On Thu, 4 Jul 2002, Terry Lambert wrote:
[major snippage, much useful to think about here ...]
> > However, ls seems to call lstat in the same order that the files are in
> > the directory, and a normal clock approach to directories would yield
> > exactly the same result. Further, in the cases that the user did not want
> > a -l, we would avoid adding many potentially useless names to the name
> > cache and reducing its performance.
>
> This is because the sort occurs first. An unsorted "ls" (which is
> available -- see the man page) doesn't have this issue.
I don't want to start a flame war, but a truss of ls -l shows the
following:
getdirentries(0x5,0x809d000,0x1000,0x80990b4) = 4096 (0x1000)
lstat(".gnome",0x809c248) = 0 (0x0)
lstat(".mc",0x809c348) = 0 (0x0)
lstat(".xinitrc",0x809c44c) = 0 (0x0)
lstat("750B.pdf",0x809c54c) = 0 (0x0)
lstat("Mail",0x809c648) = 0 (0x0)
lstat("nsmail",0x809c748) = 0 (0x0)
lstat(".cshrc",0x809c848) = 0 (0x0)
lstat(".ssh",0x809c948) = 0 (0x0)
lstat(".gnome_private",0x809ca50) = 0 (0x0)
lstat(".xchat",0x809cb48) = 0 (0x0)
lstat(".exmh",0x809cc48) = 0 (0x0)
lstat(".ICEauthority",0x809cd50) = 0 (0x0)
lstat(".netrc",0x809ce48) = 0 (0x0)
This is the same order that 'ls -fal' produced.
This suggests that the ls is doing an unsorted lookup of the info, and
then sorting. That is the way I would have done it as well.
Regards
-----
Richard Sharpe, [EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED]
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message