stat(2): clarify which syscalls modify file timestamps

The list of syscalls that modify st_atim, st_mtim, and st_ctim was quite out
of date and probably not accurate to begin with.  Update it, and make it
clear that the list is open-ended.

Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D18410
This commit is contained in:
asomers 2018-12-05 17:28:40 +00:00
parent a74ba1d431
commit 1d5dbbadec

View File

@ -28,7 +28,7 @@
.\" @(#)stat.2 8.4 (Berkeley) 5/1/95 .\" @(#)stat.2 8.4 (Berkeley) 5/1/95
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd November 11, 2018 .Dd December 5, 2018
.Dt STAT 2 .Dt STAT 2
.Os .Os
.Sh NAME .Sh NAME
@ -193,45 +193,53 @@ are:
.Bl -tag -width ".Va st_birthtim" .Bl -tag -width ".Va st_birthtim"
.It Va st_atim .It Va st_atim
Time when file data was last accessed. Time when file data was last accessed.
Changed by the Changed implicitly by syscalls such as
.Xr mknod 2 ,
.Xr utimes 2 ,
.Xr read 2 .Xr read 2
and and
.Xr readv 2 .Xr readv 2 ,
system calls. and explicitly by
.Xr utimes 2 .
.It Va st_mtim .It Va st_mtim
Time when file data was last modified. Time when file data was last modified.
Changed by the Changed implicitly by syscalls such as
.Xr mkdir 2 , .Xr truncate 2 ,
.Xr mkfifo 2 , .Xr write 2 ,
.Xr mknod 2 ,
.Xr utimes 2 ,
.Xr write 2
and and
.Xr writev 2 .Xr writev 2 ,
system calls. and explicitly by
.Xr utimes 2 .
Also, any syscall which modifies directory content changes the
.Va st_mtim
for the affected directory.
For instance,
.Xr creat 2 ,
.Xr mkdir 2 ,
.Xr rename 2 ,
.Xr link 2 ,
and
.Xr unlink 2 .
.It Va st_ctim .It Va st_ctim
Time when file status was last changed (inode data modification). Time when file status was last changed (inode data modification).
Changed by the Changed implicitly by any syscall that affects file metadata, including
.Va st_mtim ,
such as
.Xr chflags 2 , .Xr chflags 2 ,
.Xr chmod 2 , .Xr chmod 2 ,
.Xr chown 2 , .Xr chown 2 ,
.Xr creat 2 ,
.Xr link 2 ,
.Xr mkdir 2 ,
.Xr mkfifo 2 ,
.Xr mknod 2 ,
.Xr rename 2 ,
.Xr rmdir 2 ,
.Xr symlink 2 ,
.Xr truncate 2 , .Xr truncate 2 ,
.Xr unlink 2 ,
.Xr utimes 2 , .Xr utimes 2 ,
.Xr write 2
and and
.Xr writev 2 .Xr write 2 .
system calls. Also, any syscall which modifies directory content changes the
.Va st_ctim
for the affected directory.
For instance,
.Xr creat 2 ,
.Xr mkdir 2 ,
.Xr rename 2 ,
.Xr link 2 ,
and
.Xr unlink 2 .
.It Va st_birthtim .It Va st_birthtim
Time when the inode was created. Time when the inode was created.
.El .El