Consistent use of st_atime, st_ctime, st_mtime, with explanatory text,

instead if atime/ctime/mtime.
This commit is contained in:
Michael Kerrisk 2005-07-19 07:15:17 +00:00
parent e360c3a9cf
commit 310b79194a
5 changed files with 38 additions and 23 deletions

View File

@ -31,6 +31,9 @@ there was a mix of x.yBSD and BSD x.y).
pid --> PID pid --> PID
id --> ID id --> ID
Consistent use of st_atime, st_ctime, st_mtime, with explanatory text,
instead if atime/ctime/mtime.
Typographical or grammatical errors have been corrected in several Typographical or grammatical errors have been corrected in several
places. places.

View File

@ -54,8 +54,11 @@ on the file descriptor of the directory is also needed.
.B fdatasync .B fdatasync
does the same as does the same as
.B fsync .B fsync
but only flushes user data, not the meta data like the mtime or atime. but only flushes user data, not the meta data like the st_atime or
st_mtime
(respectively, time of last access and
time of last modification; see
.BR stat (2)) .
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned. On error, \-1 is returned, and
.I errno .I errno
@ -98,7 +101,7 @@ POSIX.1b (formerly POSIX.4)
.SH "SEE ALSO" .SH "SEE ALSO"
.BR bdflush (2), .BR bdflush (2),
.BR open (2), .BR open (2),
.BR sync (2) .BR sync (2),
.BR mount (8), .BR mount (8),
.BR sync (8), .BR sync (8),
.BR update (8) .BR update (8)

View File

@ -194,7 +194,8 @@ to be opened.
.TP .TP
.B O_NOATIME .B O_NOATIME
(Since Linux 2.6.8) (Since Linux 2.6.8)
Do not update the file last access time when the file is Do not update the file last access time (st_atime in the inode)
when the file is
.BR read (2). .BR read (2).
This flag is intended for use by indexing or backup programs, This flag is intended for use by indexing or backup programs,
where its use can significantly reduce the amount of disk activity. where its use can significantly reduce the amount of disk activity.
@ -333,12 +334,15 @@ This is because the client performs \fBopen\fP() by checking the
permissions, but UID mapping is performed by the server upon permissions, but UID mapping is performed by the server upon
read and write requests. read and write requests.
If the file is newly created, its atime, ctime, mtime fields are set If the file is newly created, its st_atime, st_ctime, st_mtime fields
to the current time, and so are the ctime and mtime fields of the (respectively, time of last access, time of last status change, and
time of last modification; see
.BR stat (2))
are set
to the current time, and so are the st_ctime and st_mtime fields of the
parent directory. parent directory.
Otherwise, if the file is modified because of the O_TRUNC flag, Otherwise, if the file is modified because of the O_TRUNC flag,
its ctime and mtime fields are set to the current time. its st_ctime and st_mtime fields are set to the current time.
.SH ERRORS .SH ERRORS
.TP .TP
.B EACCES .B EACCES

View File

@ -116,8 +116,9 @@ SVr4, SVID, AT&T, POSIX, X/OPEN, 4.3BSD
On NFS file systems, reading small amounts of data will only update the On NFS file systems, reading small amounts of data will only update the
time stamp the first time, subsequent calls may not do so. This is caused time stamp the first time, subsequent calls may not do so. This is caused
by client side attribute caching, because most if not all NFS clients by client side attribute caching, because most if not all NFS clients
leave atime updates to the server and client side reads satisfied from the leave st_atime (last file access time)
client's cache will not cause atime updates on the server as there are no updates to the server and client side reads satisfied from the
client's cache will not cause st_atime updates on the server as there are no
server side reads. UNIX semantics can be obtained by disabling client server side reads. UNIX semantics can be obtained by disabling client
side attribute caching, but in most situations this will substantially side attribute caching, but in most situations this will substantially
increase server load and decrease performance. increase server load and decrease performance.

View File

@ -51,9 +51,9 @@ truncate, ftruncate \- truncate a file to a specified length
.BI "int ftruncate(int " fd ", off_t " length ); .BI "int ftruncate(int " fd ", off_t " length );
.SH DESCRIPTION .SH DESCRIPTION
The The
.B truncate .BR truncate ()
and and
.B ftruncate .BR ftruncate ()
functions cause the regular file named by functions cause the regular file named by
.I path .I path
or referenced by or referenced by
@ -68,14 +68,17 @@ the extended part reads as zero bytes.
.LP .LP
The file offset is not changed. The file offset is not changed.
.LP .LP
If the size changed, then the ctime and mtime fields for the file If the size changed, then the st_ctime and st_mtime fields
are updated, (respectively, time of last status change and
and set-user-ID and set-group-ID permission bits may be cleared. time of last modification; see
.BR stat (2))
for the file are updated,
and the set-user-ID and set-group-ID permission bits may be cleared.
.LP .LP
With With
.BR ftruncate , .BR ftruncate (),
the file must be open for writing; with the file must be open for writing; with
.BR truncate , .BR truncate (),
the file must be writable. the file must be writable.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned. On error, \-1 is returned, and
@ -134,7 +137,7 @@ The named file resides on a read-only file system.
The file is a pure procedure (shared text) file that is being executed. The file is a pure procedure (shared text) file that is being executed.
.PP .PP
For For
.B ftruncate .BR ftruncate ()
the same errors apply, but instead of things that can be wrong with the same errors apply, but instead of things that can be wrong with
.IR path , .IR path ,
we now have things that can be wrong with we now have things that can be wrong with
@ -163,24 +166,25 @@ POSIX 1003.1-2001 also has
as an XSI extension. as an XSI extension.
.LP .LP
SVr4 documents additional SVr4 documents additional
.B truncate .BR truncate ()
error conditions EMFILE, EMULTIHP, ENFILE, ENOLINK. SVr4 documents for error conditions EMFILE, EMULTIHP, ENFILE, ENOLINK. SVr4 documents for
.B ftruncate .BR ftruncate ()
an additional EAGAIN error condition. an additional EAGAIN error condition.
.SH NOTES .SH NOTES
The above description is for XSI-compliant systems. The above description is for XSI-compliant systems.
For non-XSI-compliant systems, the POSIX standard allows For non-XSI-compliant systems, the POSIX standard allows
two behaviours for two behaviours for
.B ftruncate .BR ftruncate ()
when when
.I length .I length
exceeds the file length exceeds the file length
(note that (note that
.B truncate .BR truncate ()
is not specified at all in such an environment): is not specified at all in such an environment):
either returning an error, or extending the file. either returning an error, or extending the file.
(Most Unices follow the XSI requirement.) (Most Unices follow the XSI requirement.)
.\" At the very least: OSF/1, Solaris 7, and FreeBSD conform, mtk, Jan 2002 .\" At the very least: OSF/1, Solaris 7, and FreeBSD conform, mtk, Jan 2002
.SH "SEE ALSO" .SH "SEE ALSO"
.BR open (2), .BR open (2),
.BR path_resolution (2) .BR path_resolution (2),
.BR stat (2)