HP-UX Reference (11i v2 04/09) - 5 Miscellaneous Topics (vol 9)
s
stat(5) stat(5)
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
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.
Implementations may OR other implementation-dependent bits into
S_IRWXU, S_IRWXG, and
S_IRWXO, but they will not overlap any of the other bits defined in this document. The file permission
bits are defined to be those corresponding to the bitwise inclusive OR of
S_IRWXU, S_IRWXG, and
S_IRWXO.
The following macros will test whether a file is of the specified type. The value m supplied to the macros
is the value of
st_mode from a stat structure. The macro evaluates to a non-zero value if the test is
true, 0 if the test is false.
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 pipe or 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
The following are declared as functions and may also be defined as macros:
int chmod(const char *path , mode_t mode);
int lstat(const char *path , struct stat *buf);
int mkdir(const char *path , mode_t mode);
int mkfifo(const char *path , mode_t mode);
int mknod(const char *path , mode_t mode, dev_t dev);
int stat(const char *path , struct stat *buf);
mode_t umask(mode_t cmask);
Application Usage
Use of the macros is recommended for determining the type of a file.
WARNINGS
For 32-bit applications,
st_ino will be truncated to its least significant 32-bits for file systems that use
64-bit values.
SEE ALSO
chmod(2), chown(2), link(2), mkdir(2), mkfifo(3C), mknod(2), stat(2), symlink(2), umask(2), utime(2),
types(5).
STANDARDS CONFORMANCE
<sys/stat.h>: AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1
HP-UX 11i Version 2: September 2004 − 2 − Hewlett-Packard Company Section 5−−343