Flag constants for POSIX mode_t:

These are detailed in POSIX stat docs


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.
  • S_IFSOCK: Socket

File modes:

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_ISGID, [XSI] [Option Start] and S_ISVTX [Option End] shall be unique.

S_IRWXU is the bitwise-inclusive OR of S_IRUSR, S_IWUSR, and S_IXUSR.

S_IRWXG is the bitwise-inclusive OR of S_IRGRP, S_IWGRP, and S_IXGRP.

S_IRWXO is the bitwise-inclusive OR of S_IROTH, S_IWOTH, and S_IXOTH.

See also