stat(3type) | stat(3type) |
stat - file status
Standard C library (libc)
#include <sys/stat.h>
struct stat { dev_t st_dev; /* ID of device containing file */ ino_t st_ino; /* Inode number */ mode_t st_mode; /* File type and mode */ nlink_t st_nlink; /* Number of hard links */ uid_t st_uid; /* User ID of owner */ gid_t st_gid; /* Group ID of owner */ dev_t st_rdev; /* Device ID (if special file) */ off_t st_size; /* Total size, in bytes */ blksize_t st_blksize; /* Block size for filesystem I/O */ blkcnt_t st_blocks; /* Number of 512 B blocks allocated */ /* Since POSIX.1-2008, this structure supports nanosecond precision for the following timestamp fields. For the details before POSIX.1-2008, see VERSIONS. */ struct timespec st_atim; /* Time of last access */ struct timespec st_mtim; /* Time of last modification */ struct timespec st_ctim; /* Time of last status change */ #define st_atime st_atim.tv_sec /* Backward compatibility */ #define st_mtime st_mtim.tv_sec #define st_ctime st_ctim.tv_sec };
st_atim, st_mtim, st_ctim:
Since glibc 2.12: _POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700 glibc 2.19 and earlier: _BSD_SOURCE || _SVID_SOURCE
Describes information about a file.
The fields are as follows:
For further information on the above fields, see inode(7).
POSIX.1-2008.
POSIX.1-2001.
Old kernels and old standards did not support nanosecond timestamp fields. Instead, there were three timestamp fields—st_atime, st_mtime, and st_ctime—typed as time_t that recorded timestamps with one-second precision.
Since Linux 2.5.48, the stat structure supports nanosecond resolution for the three file timestamp fields. The nanosecond components of each timestamp are available via names of the form st_atim.tv_nsec, if suitable test macros are defined. Nanosecond timestamps were standardized in POSIX.1-2008, and, starting with glibc 2.12, glibc exposes the nanosecond component names if _POSIX_C_SOURCE is defined with the value 200809L or greater, or _XOPEN_SOURCE is defined with the value 700 or greater. Up to and including glibc 2.19, the definitions of the nanoseconds components are also defined if _BSD_SOURCE or _SVID_SOURCE is defined. If none of the aforementioned macros are defined, then the nanosecond values are exposed with names of the form st_atimensec.
The following header also provides this type: <ftw.h>.
stat(2), inode(7)
2023-10-31 | Linux man-pages 6.7 |