stat.5 (2010 09)
s
stat(5) stat(5)
NAME
stat: stat.h - data returned by the stat() function
SYNOPSIS
#include <sys/stat.h>
DESCRIPTION
The <sys/stat.h> header defines the structure of the data returned by the functions
fstat(),
lstat(), and stat(). The structure
stat contains at least the following members:
dev_t st_dev ID of device containing file
ino_t st_ino file serial number
mode_t st_mode mode of file (see below)
nlink_t st_nlink number of links to the file
uid_t st_uid user ID of file
gid_t st_gid group ID of file
dev_t st_rdev device ID (if file is character or block special)
off_t st_size file size in bytes (if file is a regular file)
time_t st_atime time of last access
int st_natime Reserved, DO NOT USE; field may change.
time_t st_mtime time of last data modification
int st_nmtime Reserved, DO NOT USE; field may change.
time_t st_ctime time of last status change
int st_nctime Reserved, DO NOT USE; field may change.
a filesystem-specific preferred I/O block size
for this object. In some filesystem types, this
may vary from file to file
long st_blksize
number of blocks of a filesystem-specific size
allocated for this object
blkcnt_t st_blocks
type of filesystem this file is in; see
vfsmount (2)
short st_fstype
real device number of device containing the
inode for this file
dev_t st_realdev
File serial number and device ID taken together uniquely identify the file within the system. The
dev_t,
ino_t, mode_t, nlink_t, uid_t, gid_t, off_t, time_t and blkcnt_t types are defined as
described in <sys/types.h>. Times are given in seconds since the Epoch.
The following symbolic names for the values of
st_mode are also defined:
File type
S_IFMT 0170000 type of file
S_IFSOCK 0140000 socket
S_IFLNK 0120000 symbolic link
S_IFNWK 0110000 network special
S_IFREG 0100000 regular (ordinary)
S_IFBLK 0060000 block special
S_IFDIR 0040000 directory
S_IFCHR 0020000 character special
S_IFIFO 0010000 FIFO special (named pipe)
File mode bits: miscellaneous
S_CDF 0004000 directory is a context-dependent file
S_ISUID 0004000 set user id on execution
S_ISGID 0002000 set group id on execution
S_ENFMT 0002000 set file-locking mode to enforced
S_ISVTX 0001000 set sticky bit on a directory file
File mode bits: permissions
S_IRWXU 0000700 owner’s file access permission bits
S_IRUSR 0000400 read access permission for owner
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1