Re: New feature

Alan Modra (alan@mullet.Levels.UniSA.Edu.Au)
Wed, 24 Sep 1997 23:19:33 +0930 (CST)


> > >
> > > ls -F will access the files. check that you don't alias ls to 'ls -F'
> > >
> > Yes! `ls` is aliased to `ls -AF`. Don't know why. I just removed it from
> > .bashrc.
>
> Hmm, my man says
> -F, --classify
> Do not know why this should touch files.

I guess I should have been a little clearer. -F requires that ls
stat() every file in the directory. stat() means every file's inode
will be accessed. ie. a lot more disk accesses than just reading the
directory. Andreas Schwab has correctly pointed out that stat()
doesn't update atime for a file. Sorry for the confusion.

If file atimes are changed, that's a bug. Try the following a number
of times, giving the same file as a command line arg.

#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
while (--argc > 0)
{
struct stat buf;
if (stat(*++argv, &buf) == 0)
printf("%ld\n", buf.st_atime);
}
return 0;
}