X-Spam-Check-By: sourceware.org Message-ID: <2e59e6970601210645s2fb9137cq50578ef6cd118326@mail.gmail.com> Date: Sat, 21 Jan 2006 08:45:52 -0600 From: * * To: cygwin AT cygwin DOT com Subject: Re: question on d_ino semantics In-Reply-To: <43D0F45A.9060408@byu.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline References: <43D0F45A DOT 9060408 AT byu DOT net> X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k0LEk0W7028787 On 1/20/06, Eric Blake wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > There are currently two competing uses of d_ino semantics in coreutils: > > lib/backupfile.c assumes that if d_ino is ever 0, (captured by the macro > REAL_DIR_ENTRY, which is always non-zero on platforms without d_ino), that > readdir() returned an invalid entry and no attempt to dereference that > name should be attempted. > > src/pwd.c assumes that if d_ino is ever 0, (captured by the macro D_INO, > which is hardcoded to 0 on platforms without d_ino), that an lstat() > should be attempted and the entry skipped if the stat failed, otherwise > use st_ino. > > Cygwin currently has no d_ino member, because it is prohibitively > expensive to provide it on WinNT and Win2K machines (the only way to make > d_ino match st_ino on those two platforms is to perform the equivalent of > a stat during readdir, but this penalizes the many apps which do not > follow readdir with stat). But it is relatively trivial to provide d_ino In any other language.... this would be fairly easy. Make d_ino a postponed call / functor that calls stat if and only if it is read. Even with C++ this is possible. Is there any way for Cygwin to change d_ino into some type of function call which can perform the processing *on access*. Of course, this would be totally incompatible with anything that tries to take the address of d_ino or write to it, but from the discussion, that seems to be 0% of callers. > that matches st_ino on Win9x and WinXP machines. If cygwin were to > provide a sentinel value for d_ino in cases where making d_ino match > st_ino is too expensive, would it be better to make the sentinel be 0 (in > which case, pwd.c still works but backupfile.c would need to be taught to > do the lstat before giving up on the entry), or would it be better to make > the sentinel be -1 (in which case backupfile.c would still work, as it > does not care what the value of d_ino is so long as it is not 0; but pwd.c > would need to be taught that -1 also implies that lstat must be used to > get the real st_ino)? > > Which other Unix platforms use 0 as the sentinel for a non-existent entry > returned by readdir()? Does anyone know of a standard that describes > whether d_ino being 0 has special meaning? POSIX only states that d_ino > is an optional member (but required in XSI implementations), without any > details as to whether d_ino must be non-zero. > > - -- > Life is short - so eat dessert first! > > Eric Blake ebb9 AT byu DOT net > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.1 (Cygwin) > Comment: Public key at home.comcast.net/~ericblake/eblake.gpg > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > iD8DBQFD0PRZ84KuGfSFAYARAtx4AKC01vVf9eYLnSKSApZFJ8PYhEMGeACfRauv > /KMFpDyxM2/CBT1vL+iKr/o= > =3N63 > -----END PGP SIGNATURE----- > > -- > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple > Problem reports: http://cygwin.com/problems.html > Documentation: http://cygwin.com/docs.html > FAQ: http://cygwin.com/faq/ > > -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/