COHERENT manpages
This page displays the COHERENT manpage for stat.h [Definitions and declarations used to obtain file status].
List of available manpages
Index
stat.h -- Header File
Definitions and declarations used to obtain file status
#include <sys/stat.h>
stat.h is a header file that declares the structure stat plus constants
used by the routines that manipulate files, directories, and named pipes.
It holds the prototypes for the routines chmod(), fstat(), mkdir(), stat(),
and umask().
The following summarizes the structure stat:
struct stat {
dev_t st_dev; /* Device */
ino_t st_ino; /* Inode number */
mode_t st_mode; /* Mode */
nlink_t st_nlink; /* Link count */
uid_t st_uid; /* User id */
gid_t st_gid; /* Group id */
dev_t st_rdev; /* Real device; NB, this is non-POSIX */
off_t st_size; /* Size */
time_t st_atime; /* Access time */
time_t st_mtime; /* Modify time */
time_t st_ctime; /* Change time */
};
st_dev and st_ino together form a unique description of the file. The
former is the device on which the file and its i-node reside, whereas the
latter is the index number of the file. st_mode gives the permission bits,
as outlined below. st_nlink gives the number of links to the file. st_uid
and st_gid, respectively given the user id and group id of the owner.
st_rdev, valid only for special files, holds the major and minor numbers
for the file. st_size gives the size of the file, in bytes. For a pipe,
the size is the number of bytes waiting to be read from the pipe.
Three entries for each file give the last occurrences of various events in
the file's history. st_atime gives time the file was last read or written
to. st_mtime gives the time of the last modification, write for files,
create or delete entry for directories. st_ctime gives the last change to
the attributes, not including times and size.
The following manifest constants define file types:
S_IFMT Type
S_IFDIR Directory
S_IFCHR Character-special file
S_IFPIP Pipe
S_IFIFO Pipe
S_IFBLK Block-special file
S_IFREG Regular file
The following manifest constants define file modes:
S_IREAD Read permission, owner
S_IWRITE Write permission, owner
S_IEXEC Execute/search permission, owner
S_IRWXU RWX permission, owner
S_IRUSR Read permission, owner
S_IWUSR Write permission, owner
S_IXUSR Execute/search permission, owner
S_IRWXG RWX permission, group
S_IRGRP Read permission, group
S_IWGRP Write permission, group
S_IXGRP Execute/search permission, group
S_IRWXO RWX permission, other
S_IROTH Read permission, other
S_IWOTH Write permission, other
S_IXOTH Execute/search permission, other
See Also
chmod(),
fstat(),
header file,
stat()
POSIX Standard, §5.6.1