[comp.unix.questions] stat

ted@nih-csl.UUCP (ted persky) (12/13/89)

Here's a strange occurrence that's happening on several
of our machines here.  When I issue a stat() call on
any directory which happens to be a mount point for
a partition (as indicated by 'df'), the inode number
that comes back is '2', which is identical to the
inode of the root directory.  'ls -di' indicates the
same thing.  Why doesn't it give you the actual inode
of the directory?  For instance, a stat() of /usr will
return '2' for the inode.  Issuing an 'ls -il /' gives
you the actual inode number of /usr, which is what I want
stat() to do.

Sincerely,

Ted Persky

P.S. E-mail would be appreciated.  This is kind of urgent.
-- 
	Ted Persky			phone: (301) 496-2963
	Building 12A, Room 2031		uucp: uunet!nih-csl!ted
	National Institutes of Health	Internet: ted@alw.nih.gov
	Bethesda, MD 20892

gwyn@smoke.BRL.MIL (Doug Gwyn) (12/14/89)

In article <1279@nih-csl.UUCP> ted@nih-csl.UUCP (ted persky) writes:
>When I issue a stat() call on any directory which happens to be a mount
>point for a partition (as indicated by 'df'), the inode number that comes
>back is '2', which is identical to the inode of the root directory.

That's what you're supposed to see; it's part of the semantics of mounting.

>Issuing an 'ls -il /' gives you the actual inode number of /usr, which is
>what I want stat() to do.

That's too bad.  "ls" merely reports the inumber stored in its directory
entry, and that is not altered when a filesystem is mounted on the inode.

>P.S. E-mail would be appreciated.  This is kind of urgent.

It can't be TOO urgent since UNIX has always worked like that.