Subject: Re: bin/560: ls -i returns incorrect inodes on symlinks and root dirs
To: None <greywolf@autodesk.com, kenh@entropic.com>
From: Christopher Hooper <cdh@mtu.edu>
List: netbsd-bugs
Date: 11/08/1994 19:33:07
Ken Hornstein wrote:
> % trace ls -i .cshrc
>
> Now, SunOS may do this differently, but how else would you get the inode
> number?

The inode number is stored in the directory entry.
How else would you get the inode from the directory entry?

> lstat (".cshrc", 0xf7fff4a8) = 0

When you explicitly provide the filenames for ls, it
will stat each one for you.  I have no idea why this
is done (other than maybe code cleanliness) because
it is not needed for that particular output of ls.

If you look about 19 lines above the lstat call, you
will see a getdents call.  One item contained in the
dirent structure is the file inode number.

-Chris Hooper
 cdh@mtu.edu