UMASK(2) — UNIX Programmer’s Manual
NAME
umask − set file creation mode mask
SYNOPSIS
umask(complmode)
int complmode;
DESCRIPTION
Umask sets a mask used whenever a file is created by creat(2) or mknod(2): the actual mode (see chmod(2)) of the newly-created file is the difference between the given mode and its complement; the mode and its complement should "and" (add up to) 7. Only the low-order 9 bits of the mask (the protection bits) participate. In other words, the mask shows the bits to be turned off when a new file is created.
The previous value of the mask is returned by the call. The value is initially 022, which is an octal "mask" number representing the complement of the desired mode. "022" here means that no permissions are withheld from the owner, but write permission is forbidden to group and to others. Its complement, the mode of the file, would be 755. The mask is inherited by child processes.
SEE ALSO
7th Edition