umask — set and get file creation mask
mode_t umask(mode_t cmask);
sets the process's file mode creation mask to
and returns the previous value of the mask.
Only the file access permission bits of the masks are used.
The bits set in
specify which permission bits to turn off in the mode of the created file,
and should be specified using the symbolic values defined in
The following creates a file named
in the current directory with permissions
so that the file can be written only by its owner,
and can be read or executed only by the owner
or processes with group permission,
even though group write permission
and all permissions for others are passed in to
fildes = creat("path", S_IRWXU|S_IRWXG|S_IRWXO);
The previous value of the file mode creation mask is returned.
umask(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1