[1248] in Athena Bugs

home help back first fref pref prev next nref lref last post

Re: updating mod time of files

daemon@ATHENA.MIT.EDU (John T Kohl)
Wed Oct 26 09:04:05 1988

Date: Wed, 26 Oct 88 09:03:46 EDT
From: John T Kohl <jtkohl@ATHENA.MIT.EDU>
To: geer@ATHENA.MIT.EDU, bugs@ATHENA.MIT.EDU
In-Reply-To: bugs:[1246]
The stat(2) man page has this to say about the various timestamps on
files:

     st_atime    Time when file data was last read or modified.
                 Changed by the following system calls: mknod(2),
                 utimes(2), read(2), and write(2).  For reasons
                 of efficiency, st_atime is not set when a direc-
                 tory is searched, although this would be more
                 logical.

     st_mtime    Time when data was last modified.  It is not set
                 by changes of owner, group, link count, or mode.
                 Changed by the following system calls: mknod(2),
                 utimes(2), write(2).

     st_ctime    Time when file status was last changed.  It is
                 set both both by writing and changing the i-
                 node.  Changed by the following system calls:
                 chmod(2) chown(2), link(2), mknod(2), rename(2),
                 unlink(2), utimes(2), write(2).


So we see that open(2) does NOT change the atime, mtime or ctime fields;
you must read(2) or write(2) or play games to get times to change.
cat >> foo; ^D does not write to the file, therefore the mod time
doesn't change.

John

home help back first fref pref prev next nref lref last post