This is the mail archive of the cygwin 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]

Re: New platform independent problem

> You could have a flag that, if set, will instruct readdir to do the
> expensive processing.  Applications that need the real inode will set
> that flag.

And then we would have to change applications to call this nonstandard
entry point at the beginning of their program to set the flag.  As long
as we are editing programs, we might as well teach them to respect
a sentinel of -1 without having to resort to adding a nonstandard
entry point.

> > POSIX permits implementations to not have d_ino.  In other words, when it
> > comes to dirent.h, cygwin is fully POSIX-compliant to not have a d_ino
> > member, and applications had better not assume that d_ino exists.
> That may be so, but I don't think I've seen packages that check
> whether d_ino exist in their configury.  They assume it does, AFAICS.

Most GNU packages DO check - coreutils, findutils, bash, tar, etc.  And
since POSIX makes it optional, ALL portable programs SHOULD check
for the existance of d_ino.  I was actually surprised that emacs does not.

> > > It's bad mantra for an application to use a symbol that starts with
> > > "__", since those symbols are reserved for the library implementation.
> > 
> > My understanding is that leading __ is reserved for the IMPLEMENTATION in
> > general, not just the library implementation; cygwin is part of the
> > implementation.
> I was responding to a suggestion to use __deprecated_d_ino in the
> Emacs code.  Emacs is certainly _not_ a part of implementation.

Correct.  But that wouldn't help you anyways - if you are using the
version of cygwin's dirent.h that spells it __deprecated_d_ino,
then you are also using the version of cygwin's version.h that
informs the cygwin1.dll to fill that entry with 0 rather than the hash.
In other words, cygwin is smart enough to know whether your
application was compiled with d_ino existance, and does not even
bother creating a non-zero __deprecated_d_ino.

> > What platforms use d_ino==0 to mean an empty entry, rather than an entry
> > where st_ino must be checked?
> I see it in Emacs, Corinna shows another example from rcp and scp.

And after further research, I have found that coreutils is inconsistent;
backupfile.c does it one way (0 means skip the entry, but don't care
if d_ino matches st_ino) while pwd.c does it another way (0 means
fall back to stat, so that result always matches st_ino, and skip
entry if stat also failed).  So now is the time to pick the behavior
that is easiest to turn into a reasonable coding standard across
all GNU platforms (and probably to add a gnulib module that
does the d_ino magic for you).

Eric Blake

Unsubscribe info:
Problem reports:

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