Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(2)

chown(2)

link(2)

mkdir(2)

mkfifo(2)

mknod(2)

stat(2)

symlink(2)

umask(2)

utime(2)

types(5)

stat(5)

NAME

stat.h − file-specific information

SYNOPSIS

#include <sys/stat.h>

DESCRIPTION

The <sys/stat.h> header defines the structure of the data returned by the functions stat(), fstat(), and lstat().

The contents of the stat structure include the following members:

dev_tst_dev; /* ID of device containing a */
/* directory entry for this file */

ino_tst_ino; /* Inode number */

ushortst_fstype; /* Type of filesystem this file  */
/* is in; see vfsmount(2)*/

ushortst_mode; /* File mode; see mknod(2)*/

shortst_nlink; /* Number of links */

uid_tst_uid; /* User ID of file owner */

gid_tst_gid; /* Group ID of file group */

dev_tst_rdev; /* Device ID; this entry defined */
/* only for char or blk spec files */

cnode_tst_cnode;
/* Cnode ID of machine */
/* where the inode lives */

dev_tst_realdev; /* Real device number of device */

/* containing the inode for this file */

off_tst_size; /* File size (bytes) */

time_tst_atime; /* Time of last access */

time_tst_mtime; /* Last modification time */

time_tst_ctime; /* Last file status change time */

/* measured in seconds since */

/* 00:00:00 UTC, Jan 1, 1970 */

The following symbolic names for the values of the st_mode field are defined as indicated:

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:

File miscellaneous mode bits:

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 save swapped text even after use

File permission mode bits:

S_IRWXU 0000700 owner’s file access permission bits
S_IRUSR 0000400 read access permission for owner
S_IWUSR 0000200 write access permission for owner
S_IXUSR 0000100 execute/search access permission for owner
S_IRWXG 0000070 group’s file access permission bits
S_IRGRP 0000040 read access permission for group
S_IWGRP 0000020 write access permission for group
S_IXGRP 0000010 execute/search access permission for group
S_IRWXO 0000007 others’ access permission bits
S_IROTH 0000004 read access permission for others
S_IWOTH 0000002 write access permission for others
S_IXOTH 0000001 execute/search access permission for others

Obsolete names for file permission mode bits:

S_IREAD 0000400 read access permission for owner
S_IWRITE 0000200 write access permission for owner
S_IEXEC 0000100 execute/search access permission for owner

File type test macros:

S_ISBLK(m) test for a block special file
S_ISCDF(m) test for a context-dependent file
S_ISCHR(m) test for a character special file
S_ISDIR(m) test for a directory
S_ISFIFO(m) test for a FIFO special file
S_ISLNK(m) test for a symbolic link
S_ISNWK(m) test for a network special
S_ISREG(m) test for a regular file
S_ISSOCK(m) test for a socket

SEE ALSO

chmod(2), chown(2), link(2), mkdir(2), mkfifo(2), mknod(2), stat(2), symlink(2), umask(2), utime(2), types(5). 

STANDARDS CONFORMANCE

<sys/stat.h>: AES, SVID2, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

Hewlett-Packard Company  —  HP-UX Release 9.0: August 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026