Date: Fri, 24 Feb 2006 21:30:26 -0500 From: Chuck Swiger <cswiger@mac.com> To: lalev@uni-svishtov.bg Cc: freebsd-questions@freebsd.org Subject: Re: ls -c vs. ls -u / manpage / architecture question Message-ID: <43FFC142.5080807@mac.com> In-Reply-To: <53964.193.68.172.33.1140794542.squirrel@mail.uni-svishtov.bg> References: <53964.193.68.172.33.1140794542.squirrel@mail.uni-svishtov.bg>
next in thread | previous in thread | raw e-mail | index | archive | help
lalev@uni-svishtov.bg wrote:
[ ... ]
> I could see in the source of ls that these two options
> are opposite of each other, but being ignorant about
> the architecture of UNIX file system, i'm not positive
> that in addition to the time of last modification
> and the time of last access, there is not
> another time - "file status change time".
>
> Or is it what I suppose, that the -c option is just on by default
> and no other than these 2 times are saved in the file system
> info about the file.
There are three timestamps kept per file in Unix (see "man 2 stat"):
The time-related fields of struct stat are as follows:
st_atime Time when file data last accessed. Changed by the
mknod(2), utimes(2), read(2) and readv(2) system calls.
st_mtime Time when file data last modified. Changed by the
mkdir(2), mkfifo(2), mknod(2), utimes(2), write(2) and
writev(2) system calls.
st_ctime Time when file status was last changed (inode data modifi-
cation). Changed by the chflags(2), chmod(2), chown(2),
creat(2), link(2), mkdir(2), mkfifo(2), mknod(2),
rename(2), rmdir(2), symlink(2), truncate(2), unlink(2),
utimes(2), write(2) and writev(2) system calls.
By default, ls uses st_mtime; -c means st_ctime; -u means st_atime.
--
-Chuck
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43FFC142.5080807>
