This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
ls doesn't call fstatat?
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin-developers at cygwin dot com
- Date: Fri, 10 Sep 2010 19:18:46 +0200
- Subject: ls doesn't call fstatat?
- Reply-to: cygwin-developers at cygwin dot com
Hi Eric,
I'm wondering a bit about this. I had expected that `ls -l' would use
fstatat if it is available, roughly like this:
dir = opendir();
while (ent = readdir(dir))
fstatat (dirfd(dir), ent->d_name, &statbuf, AT_SYMLINK_NOFOLLOW);
but while debugging I found that it uses stat/lstat. Is there any
good reason for this, like, say, it's just not supported in ls?
I'm asking since the combination of readdir/fstatat would allow to reuse
information from the last readdir call in fstatat since the file
descriptor given to fstatat would be kind of a free gift. It's much
harder to do the same with readdir/lstat.
Corinna