Subject: Re: bin/560: ls -i returns incorrect inodes on symlinks and root dirs
To: I can teach you how to fish... <greywolf@autodesk.com>
From: Ken Hornstein <kenh@entropic.com>
List: netbsd-bugs
Date: 11/08/1994 15:59:38
> * huh?  ls(1) only does a stat when you ask for info that
> * requires it (such as -s, or -i or -l, etc).  i just tested
> * it with ktrace and there was only one fstat() call and no
> * stat() calls.  this has always been the case as far as i'm
> * aware.
>
>"ls -i" never *used* to do a stat()/lstat() call.

On SunOS 4.1.1:

% trace ls -i .cshrc

open ("/usr/lib/ld.so", 0, 037004066000) = 3
[shared library initialization stuff deleted]
getuid () = 81
gettimeofday (0xf7fff4e0, 0) = 0
ioctl (1, 0x40125401, 0xf7fff4d4) = 0
ioctl (1, 0x40067408, 0xf7fff548) = 0
ioctl (1, 0x40087468, 0x6840) = 0
getpagesize () = 8192
brk (0x9210) = 0
brk (0xb210) = 0
lstat (".cshrc", 0xf7fff4a8) = 0
^^^^^
ioctl (1, 0x40125401, 0xf7ffe954) = 0
write (1, " 51103 .cshrc\n", 14) =  51103 .cshrc
14
close (0) = 0
close (1) = 0
close (2) = 0
exit (0) = ?

Now, SunOS may do this differently, but how else would you get the inode
number?

--Ken