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

Question about inodes returned by stat() and readdir()


All,

  As far as I can tell, it appears that the inode number
returned by calling stat() on a directory differs from
the inode number returned by calling readdir() for the
same directory:

    [stat]
    path         : /tmp
    path->st_ino : 1772102

    [opendir]
    parent       : /
    child        : tmp
    child->d_ino : 635407883

  (In case this is pilot error on my part, I've attached the
source used to generate the above results.)

  In trying to figure out if this is by design or not, I came
across the following:

  "The inode number for a file is calculated by hashing its full
   Win32 path. The inode number generated by the stat call always
   matches the one returned in d_ino of the dirent structure."
   <http://www.cygwin.com/cygwin-ug-net/highlights.html>

  On the other hand, in Cygwin's sys/dirent.h, there is the
following comment attached to the dirent d_ino member:

    ino_t d_ino; /* Just for compatibility, it's junk */

  What's the expected behvaior in this case - should readdir()
return the same inode as stat()?  Looking at the cygwin1.dll
source, it looks like the intent is to return the same inode
number from readdir().

-Samrobb

Attachment: check_tmp_inode.c
Description: check_tmp_inode.c


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