HP-UX Reference (11i v1 05/09) - 5 Miscellaneous Topics (vol 9)

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
time_t st_mtime time of last data modification
time_t st_ctime time of last status change
a file-system-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
long st_blocks
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, and time_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 type of file
S_IFBLK block special
S_IFCHR character special
S_IFIFO FIFO special
S_IFREG regular
S_IFDIR directory
S_IFLNK symbolic link
File mode bits
S_IRWXU read, write, execute/search by owner
S_IRUSR read permission, owner
S_IWUSR write permission, owner
S_IXUSR execute/search permission, owner
S_IRWXG read, write, execute/search by group
S_IRGRP read permission, group
S_IWGRP write permission, group
S_IXGRP execute/search permission, group
S_IRWXO read, write, execute/search by others
S_IROTH read permission, others
S_IWOTH write permission, others
S_IXOTH execute/search permission, others
S_ISUID set-user-ID on execution
S_ISGID set-group-ID on execution
S_ISVTX on directories, restricted deletion flag
The bits defined by S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH,
S_IWOTH, S_IXOTH, S_ISUID, S_ISGlD and S_ISVTX are unique. S_IRWXU is the bitwise OR of
S_IRUSR, S_IWUSR, and S_IXUSR. S_IRWXG is the bitwise OR of S_IRGRP, S_IWGRP, and
S_IXGRP. S_IRWXO is the bitwise OR of S_IROTH, S_IWOTH, and S_IXOTH.
HP-UX 11i Version 1: September 2005 1 Hewlett-Packard Company Section 5357