In our previous episode, Michael Van Canneyt said:
> lgetxattr("/etc/odbc.ini", "security.selinux", 0x14de920, 255) = -1 ENODATA 
> (No data available)
> getxattr("/etc/odbc.ini", "system.posix_acl_access", 0x0, 0) = -1 EOPNOTSUPP 
> (Operation not supported)
> 
> If you want speedier operation, and have enough file information with the 
> name, you can simply do a getdents().

I wouldn't do that for two reasons:

1) getdents is not portable at the syscall level (unix systems either implement
getdirentries or getdents, not both). This is why getdents is not available
via portable calls.
2) it is very sensitive.

Basically findfirst is a opendir/readdir/closedir loop where opendir and/or 
readdir
call getdents, with a stat per file.

IOW one can avoid getdents by doing opendir/readdir/closedir, and be as
fast, AND be portable.
 
> > does the operating system keep an index somewhere ?
> 
> Normally not (at least other than the regular disc cache).

The getdents calls afaik simply returns blocks from the directory file. The
basic block level cache of the filesystem driver therefore works perfectly
for it.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to