diff --git a/man2/stat.2 b/man2/stat.2 index 319ec8723..a762c519a 100644 --- a/man2/stat.2 +++ b/man2/stat.2 @@ -200,38 +200,77 @@ or the old together with the new .IR st_mode . -The +The fields in the +.I stat +structure are as follows: +.TP .I st_dev -field describes the device on which this file resides. +This field describes the device on which this file resides. (The .BR major (3) and .BR minor (3) macros may be useful to decompose the device ID in this field.) - -The +.TP .I st_rdev -field describes the device that this file (inode) represents. - -The +This field describes the device that this file (inode) represents. +.TP .I st_size -field gives the size of the file (if it is a regular +This field gives the size of the file (if it is a regular file or a symbolic link) in bytes. The size of a symbolic link is the length of the pathname it contains, without a terminating null byte. - -The +.TP .I st_blocks -field indicates the number of blocks allocated to the file, 512-byte units. +This field indicates the number of blocks allocated to the file, +512-byte units. (This may be smaller than .IR st_size /512 when the file has holes.) - -The +.TP .I st_blksize -field gives the "preferred" blocksize for efficient filesystem I/O. +This field gives the "preferred" blocksize for efficient filesystem I/O. (Writing to a file in smaller chunks may cause an inefficient read-modify-rewrite.) +.TP +.I st_atime +This is the file's last access timestamp. +It is changed by file accesses, for example, by +.BR execve (2), +.BR mknod (2), +.BR pipe (2), +.BR utime (2), +and +.BR read (2) +(of more than zero bytes). +Other routines, like +.BR mmap (2), +may or may not update +.IR st_atime . +.TP +.I st_mtime +This is the file's last modification timestamp. +It is changed by file modifications, for example, by +.BR mknod (2), +.BR truncate (2), +.BR utime (2), +and +.BR write (2) +(of more than zero bytes). +Moreover, +.I st_mtime +of a directory is changed by the creation or deletion of files +in that directory. +The +.I st_mtime +field is +.I not +changed for changes in owner, group, hard link count, or mode. +.TP +.I st_ctime +This is the file's last status change timestamp. +It is changed by writing or by setting inode information +(i.e., owner, group, link count, mode, etc.). .PP Not all of the Linux filesystems implement all of the time fields. Some filesystem types allow mounting in such a way that file @@ -253,45 +292,6 @@ is not updated if a file is opened with the .BR O_NOATIME flag; see .BR open (2). - -The field -.I st_atime -is changed by file accesses, for example, by -.BR execve (2), -.BR mknod (2), -.BR pipe (2), -.BR utime (2), -and -.BR read (2) -(of more than zero bytes). -Other routines, like -.BR mmap (2), -may or may not update -.IR st_atime . - -The field -.I st_mtime -is changed by file modifications, for example, by -.BR mknod (2), -.BR truncate (2), -.BR utime (2), -and -.BR write (2) -(of more than zero bytes). -Moreover, -.I st_mtime -of a directory is changed by the creation or deletion of files -in that directory. -The -.I st_mtime -field is -.I not -changed for changes in owner, group, hard link count, or mode. - -The field -.I st_ctime -is changed by writing or by setting inode information -(i.e., owner, group, link count, mode, etc.). .PP POSIX refers to the .I st_mode