C Programming/POSIX Reference/sys/stat.h

 is the header in the C POSIX library for the C programming language that contains constructs that facilitate getting information about files attributes.

Member constants
The following POSIX macros are defined to check the file type using the  field:

The following flags are defined for the  field:

The set-group-ID bit  has several special uses. For a directory it indicates that BSD semantics is to be used for that directory: files created there inherit their group ID from the directory, not from the effective group ID  of the  creating  process, and directories created there will also get the   bit set. For a file that does not have the group execution bit  set, the set-group-ID bit indicates mandatory file/record locking. The sticky bit  on a directory means that a file in that directory can be renamed or deleted only by the owner of the file, by the owner of the directory, and by a privileged process.

POSIX does  not describe the ,  ,  ,  ,  ,  ,  ,  ,   bits, but instead demands the use of the macros  , etc. The  and   macros are not in POSIX.1-1996, but both are present in POSIX.1-2001; the former is from SVID 4, the latter from SUSv2.

Other Systems - Values that have been (or are) in use on various systems:

A sticky command appeared in Version 32V AT&T UNIX.

Member types
Data types defined in the  header include:

Example
A short example of  usage is:

Put the source in a file (main.c) and compile this: gcc main.c -o test

Now, to run type: ./test main.c ./test *