stat (system call)

It is among the few original Unix system calls to change, with Version 4's addition of group permissions and larger file size.

Since the 2008 version of the standard, these fields were renamed to st_atim, st_mtim and st_ctim, respectively, of type struct timespec, since this structure provides a higher resolution time unit.

[7] The behavior behind the relatime mount option offers sufficient performance for most purposes and should not break any significant applications, as it has been extensively discussed.

[9] Current versions of the Linux kernel support four mount options, which can be specified in fstab: Current versions of Linux, macOS, Solaris, FreeBSD, and NetBSD support a noatime mount option in /etc/fstab, which causes the atime field never to be updated.

Turning off atime updating breaks POSIX compliance, and some applications, such as mbox-driven "new mail" notifications,[10] and some file usage watching utilities, notably tmpwatch.

It allows POSIX-style atime updates to be performed in-memory and flushed to disk together with some non-time-related I/O operations on the same file; atime updates are also flushed to disk when some of the sync system calls are executed, or before the file's in-memory inode is evicted from the filesystem cache.

The ctime timestamp was added in the file system restructuring that occurred with Version 7 Unix, and has always referred to inode change time.

Instead, when utime() is used, or for any other change to the inode other than an update to atime caused by accessing the file, the ctime value is set to the current time.

stat command line