This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ls doesn't call fstatat?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]