STAT.H(7,F) AIX Technical Reference STAT.H(7,F)
-------------------------------------------------------------------------------
stat.h
PURPOSE
Defines the data structure returned by the statx, fstatx, stat, fstat,
fullstat, ffullstat, and lstat system calls.
SYNOPSIS
#include <sys/stat.h>
DESCRIPTION
The statx and fstatx system calls obtain information about a file. These
system calls return a data structure defined by the <sys/stat.h> include file.
struct stat
{
/* Beginning of stat structure replica ... */
dev_t st_dev; /* Global file system (gfs) */
/* number of the file system */
/* containing a directory */
/* entry for this file. File */
/* index+gfs number uniquely */
/* identifies the file within */
/* the system. */
ino_t st_ino; /* File index number (inode no.)*/
mode_t st_mode; /* File mode; see below */
nlink_t st_nlink; /* Number of links */
u_short_t st_spare0; /* Reserved */
uid_t st_uid; /* User ID of the file's owner */
gid_t st_gid; /* Group ID of the file's group */
dev_t st_rdev; /* ID of device */
/* This entry is defined only */
/* for character or block */
/* special files. */
off_t st_size; /* File size in bytes */
Processed November 7, 1990 STAT.H(7,F) 1
STAT.H(7,F) AIX Technical Reference STAT.H(7,F)
/* Times are seconds since 00:00:00 GMT, Jan. 1, 1970 */
time_t st_atime; /* Time of last access */
u_long_t st_spare1;
time_t st_mtime; /* Time data last modified */
u_long_t st_spare2;
time_t st_ctime; /* Time file status last changed */
u_long_t st_spare3;
u_long_t st_blksize; /* Size of block in file */
u_long_t st_blocks; /* Number of blocks in file */
u_long_t st_gen; /* Inode generation number */
u_long_t st_type; /* Vnode type */
# define VNON 0
# define VBAD 1
# define VREG 2
# define VDIR 3
# define VHDIR 4
# define VBLK 5
# define VCHR 6
# define VLNK 7
# define VSOCK 8
# define VFIFO 9
# define VMPC 10
u_long_t st_vfs; /* vfs id */
u_long_t st_flag; /* flag word */
# define FS_NOFLAG 0x00 /* clear flag */
# define FS_MOUNT 0x01 /* this file is the root of a */
/* file system or is mounted */
/* over */
# define FS_REMOTE 0x02 /* file is remote */
# define FS_VMP FS_MOUNT
/* The following fields are used by TCF */
u_long_t st_cmtcnt; /* gfs commit sequence number */
fstore_t st_fstore; /* file-replication storage */
/* attribute */
long st_version; /* version number of file */
siteno_t st_css; /* current synchronization site */
siteno_t st_ss; /* current storage site (fstat) */
siteno_t st_rdevsite; /* rdev site (devices only) */
short st_spare4;
Processed November 7, 1990 STAT.H(7,F) 2
STAT.H(7,F) AIX Technical Reference STAT.H(7,F)
/* ... end of old stat structure replica ... */
# define STATSIZE \
(((int)(char*)&(((struct stat *)0)->st_spare4))+(sizeof(short)))
/*
* the stat() compatibility interface does not
* return any of the following fields.
*/
/* ... beginning of fullstat structure, used by DS ... */
long st_nid; /* Node id */
uid_t st_uid_raw; /* The file's untranslated uid */
gid_t st_gid_raw; /* The file's untranslated gid */
u_long_t st_uid_rev_tag; /* uid translation tag */
u_long_t st_gid_rev_tag; /* gid translation tag */
#define IDTAG_CALLER 1 /* definitions for _rev_tag */
#define IDTAG_OTHER 2 /* fields */
#define IDTAG_SOMEONE 3
#define IDTAG_NO_ONE 4
/* ... End of fullstat structure replica */
# define FULLSTATSIZE \
(((int)(char*)&(((struct stat *)0)->st_gid_rev_tag))+sizeof(u_long_t))
}
/*
* Defines for statx cmd argument
*/
#define STX_LINK 0x0001 /* do not traverse final symbolic */
/* link (lstat) */
#define STX_MOUNT 0x0002 /* If a mount point return status */
/* of mounted-over directory */
#define STX_HIDDEN 0x0004 /* do not traverse final hidden */
/* directory */
#define STX_TRANS 0x0000 /* Normal uid/gid translation */
#define STX_TRANS_NONE 0x0008 /* No uid/gid translation */
#define STX_TRANS_OTHER 0x0010 /* Biased uid/gid translation */
Processed November 7, 1990 STAT.H(7,F) 3
STAT.H(7,F) AIX Technical Reference STAT.H(7,F)
/*
* Defines for file types in st_mode
*/
#define S_IFMT 0x3000F000 /* type of file */
#define S_IFDIR 0x00004000 /* directory */
#define S_ISDIR(m) (((m) & (S_IFMT)) == (S_IFDIR))
#define S_IFCHR 0x00002000 /* character special */
#define S_ISCHR(m) (((m) & (S_IFMT)) == (S_IFCHR))
#define S_IFBLK 0x00006000 /* block special */
#define S_ISBLK(m) (((m) & (S_IFMT)) == (S_IFBLK))
#define S_IFREG 0x00008000 /* regular */
#define S_ISREG(m) (((m) & (S_IFMT)) == (S_IFREG))
#define S_IFIFO 0x00001000 /* fifo (named pipe) */
#define S_ISFIFO(m) (((m) & (S_IFMT)) == (S_IFIFO))
#define S_IFLNK 0x0000a000 /* symbolic link (lstat only) */
#define S_ISLNK(m) (((m) & (S_IFMT)) == (S_IFLNK))
#define S_IFSOCK 0x0000c000 /* socket */
#define S_ISOCK(m) (((m) & (S_IFMT)) == (S_IFSOCK))
/*
* file attributes in st_mode
*/
#define S_ISUID 0x00000800 /* set user id on execution */
#define S_ISGID 0x00000400 /* set group id on execution */
#define S_IMPX 0x00000200 /* multiplexed device */
#define S_ISVTX 0x00000200 /* save swapped text even after */
/* use */
#define S_IHIDDEN 0x08000000 /* hidden directory */
#define S_ENFMT S_ISGID /* record locking enforcement */
/* flag */
#define S_IFMPX (S_IFCHR | S_IMPX) /* mode for multiplexed file */
#define S_ISMPX(m) (((m) & (S_IFMT | S_IMPX)) == (S_IFMPX))
#define S_ISHIDDEN(m) (((m) & (S_IFMT | S_IHIDDEN)) == \
(S_IFDIR | S_IHIDDEN))
Processed November 7, 1990 STAT.H(7,F) 4
STAT.H(7,F) AIX Technical Reference STAT.H(7,F)
/*
* file permissions in st_mode
*/
#define S_IRWXU 00700 /* (0x01C0) owner read,write,execute */
/* permission */
#define S_IREAD 00400 /* (0x0100) owner read permission */
#define S_IRUSR 00400 /* (0x0100) read permission, owner */
#define S_IWRITE 00200 /* (0x0080) owner write permission */
#define S_IWUSR 00200 /* (0x0080) owner write permission */
#define S_IEXEC 00100 /* (0x0040) owner execute/search permission */
#define S_IXUSR 00100 /* (0x0040) owner execute/search permission */
#define S_IRWXG 00070 /* (0x0038) group read,write,execute */
/* permission */
#define S_IRGRP 00040 /* (0x0020) group read permission */
#define S_IWGRP 00020 /* (0x0010) group write permission */
#define S_IXGRP 00010 /* (0x0008) group execute/search permission */
#define S_IRWXO 00007 /* (0x0007) other read,write,execute */
/* permission */
#define S_IROTH 00004 /* (0x0004) other read permission */
#define S_IWOTH 00002 /* (0x0002) other write permission */
#define S_IXOTH 00001 /* (0x0001) other execute/search permission */
The meanings of the stat structure fields are:
st_dev The gfs number of the file system containing a directory entry for
this file. The file index together with the gfs number uniquely
identifies the file within the system.
st_ino The index (inode number) of this file in this file system. A file is
uniquely identified by specifying the file system on which it resides
and its inode number in this file system.
st_mode The file mode. The values of this field are described above.
st_nlink The number of hard links to the file. See "link."
st_size The end-of-file mark. For a regular file or directory, st_size
specifies the length of the file in bytes; for a FIFO or pipe, it
specifies the number of unread bytes. For a device, st_size is
undefined.
st_rdev The ID of the device. This field is defined only for block or
character special files.
st_atime The time when file data was last accessed.
st_mtime The time when data was last modified.
st_ctime The time when file status was last changed.
Processed November 7, 1990 STAT.H(7,F) 5
STAT.H(7,F) AIX Technical Reference STAT.H(7,F)
st_blksize
The size, in bytes, of each block of the file.
st_blocks The number of blocks used to represent the file on permanent storage.
This includes indirect blocks.
st_gen The generation number of this inode.
st_type The type of the vnode for this object. This is one of the following
values:
VNON An unallocated object; this should not occur
VBAD An unknown type of object
VREG regular file
VDIR directory
VHDIR hidden directory
VBLK block device
VCHR character device
VLNK symbolic link
VSOCK socket
VFIFO FIFO
VMPC multiplexed character device
st_vfs Virtual file system ID.
st_flag A flag indicating whether the file or directory is a mount point. A
value of FS_MOUNT indicates that it is a mount point.
st_uid The file owner ID.
st_gid The file group ID.
FILE
/usr/include/sys/stat.h
RELATED INFORMATION
In this book: "statx, fstatx, stat, fstat, fullstat, ffullstat, lstat" and
"types.h."
Processed November 7, 1990 STAT.H(7,F) 6