Data Types in stat.h

The stat.h header file defines several data types. The table below lists the types used to describe a file's properties.
Table 1. Data Types in stat.h
Data Type Represents
dev_t Device type.
gid_t Group ID.
ino_t Serial number.
mode_t File attributes.
nlink_t Number of links to a file.
off_t File size, in bytes.
uid_t User ID.
The stat structure contains information about a file. The table below lists the members in this structure.
Table 2. Structure Members in stat.h
Structure Data Type Contains
st_mode mode_t File attributes.
st_ino ino_t File serial number.
st_dev dev_t ID of device on which this file is stored.
st_nlink nlink_t Number of links to the file.
st_uid uid_t The file owner's user ID.
st_gid gid_t The file owner's group ID.
st_size off_t The file's size, in bytes.
st_atime time_t Time of last access to the file.
st_mtime time_t Time of the last modification to the file.
st_ctime time_t Time that the file was created.
st_blksize long Optimal block size.
st_blocks long Number of blocks allocated to the file.
The table below describes the file attributes that the facilities in stat.h recognize.
Table 3. File Modes
Mode File Property
S_IFMT File type.
S_IFIFO FIFO queue.
S_IFCHR Character special.
S_IFDIR Directory.
S_IFBLK Blocking stream.
S_IFREG Regular file.
S_IFLNK Symbolic link.
S_IFSOCK Socket.
S_IRGRP Read permission, file group class.
S_IROTH Read permission, file other class.
S_IRUSR Read permission, file owner class.
S_IRWXG Permission, file group class.
S_IRWXO Permission, file group class.
S_IRWXU Permission, file group class.
S_ISGID Set group ID on execution.
S_ISUID Set user ID on execution.
S_IWGRP Write permission, file group class.
S_IWOTH Write permission, file other class.
S_IWUSR Write permission, file owner class
S_IXGRP Execute permission, file group class
S_IXOTH Execute permission, file other class.
S_IXUSR Execute permission, file owner class.