Re: New feature

Chris Wedgwood (chris@cyphercom.com)
Fri, 26 Sep 1997 10:02:24 -0400


From: Ricky Beam <root@defiant.interpath.net>
Subject: Re: New feature
To: davem@jenolan.rutgers.edu (David S. Miller)

This is UNIX, the filesystem consists of FILES - period. What you do
with magic bits in the filesystem is your business.

Ermm... I didn't realize there was enough leeway in POSIX to allow things
like the open(2) call deleting all your files?

There used to be all manner of neat things one could do with
setting/clearing the directory bit in the inode... turn a regular file
into a directory and vice-versa. The kernel now blocks such idiot
things as accessing directories without specifying that you accessing
them as a directory: 'cat .' no longer works.

'cat'ing directories is actually damn handy. You could do this to find
deleted files and such. (I think there was a paper published about the
Internet Worm that suggests you do just this?)

Anyhow... different file system do different things. There is no requirement
to keep stale information in the directory 'files' so filesystems are free
to clear this data meaning this is of fairly limited use.

>ATIME is the access time for an inode, when you read an inode which
>happens to be a directory you are accessing it.

A clarification... if you access an inode (any inode,) the access time
is updated. stat()ing the inode accesses the inode, hence the atime is
updated for every file on the drive following 'ls -laR /'

stat'ing a file doesn't (and shouldn't IMO) update the atime, for example:

caffeine:~$ date
Fri Sep 26 09:58:41 EDT 1997
caffeine:~$ ls -l --time=atime stat-test
-rw-r--r-- 2 me users 2611 Sep 25 15:45 stat-test

caffeine:~$ strace ./a.out
execve("./a.out", ["./a.out"], [/* 25 vars */]) = 0
personality(PER_LINUX) = 0
geteuid() = 503
getuid() = 503
getgid() = 100
getegid() = 100
stat("./stat-test", {st_mode=S_IFREG|0644, st_size=2611, ...}) = 0
_exit(0) = ?

caffeine:~$ ls -l --time=atime stat-test
-rw-r--r-- 2 me users 2611 Sep 25 15:45 stat-test

caffeine:~$ date
Fri Sep 26 09:58:50 EDT 1997

caffeine:~$ uname -a
Linux caffeine 2.1.56 #24 Sat Sep 20 14:29:28 EDT 1997 i686

-Chris