[H-GEN] chestnut

Jason Parker-Burlingham jasonp at uq.net.au
Thu Mar 27 22:01:03 EST 2003


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

David Seikel <won_fang at yahoo.com.au> writes:

> Tony Nugent <tony at linuxworks.com.au> wrote: 
> > One issue to consider: "oldest file" -- by creation time, last
> > modify time, or last access date?
> This one has been asked a few times.  Unless I am mistaken , files cannot
> be modified or accessed before they are created, so oldest by creation time
> is the obvious answer.

$ man 2 stat # what creation time?
[...]
DESCRIPTION
       These functions return information about the specified file.
       You do not need any access rights to the file to get this
       information but you need search rights to all directories named
       in the path leading to the file.
[...]
       They all return a stat structure, which contains the following fields:

         struct stat {
             dev_t         st_dev;      /* device */
             ino_t         st_ino;      /* inode */
             mode_t        st_mode;     /* protection */
             nlink_t       st_nlink;    /* number of hard links */
             uid_t         st_uid;      /* user ID of owner */
             gid_t         st_gid;      /* group ID of owner */
             dev_t         st_rdev;     /* device type (if inode device) */
             off_t         st_size;     /* total size, in bytes */
             blksize_t     st_blksize;  /* blocksize for filesystem I/O */
             blkcnt_t      st_blocks;   /* number of blocks allocated */
             time_t        st_atime;    /* time of last access */
             time_t        st_mtime;    /* time of last modification */
             time_t        st_ctime;    /* time of last change */
         };
[...]
       The field st_atime is changed by file accesses, e.g.  by
       execve(2), mknod(2), pipe(2), utime(2) and read(2) (of more
       than zero bytes). Other routines, like mmap(2), may or may not
       update st_atime.

       The field st_mtime is changed by file modifications, e.g. by
       mknod(2), truncate(2), utime(2) and write(2) (of more than zero
       bytes).  Moreover, st_mtime of a directory is changed by the
       creation or deletion of files in that directory.  The st_mtime
       field is not changed for changes in owner, group, hard link
       count, or mode.

       The field st_ctime is changed by writing or by setting inode
       information (i.e., owner, group, link count, mode, etc.).
-- 
uck Wa!

--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list