umask(2) umask(2)
NAME
umask - set and get file creation mask
SYNOPSIS
int umask (cmask)
int cmask;
DESCRIPTION
umask sets the process's file mode creation mask to cmask
and returns the previous value of the mask. Only the low-
order 9 bits of cmask and the file mode creation mask are
used.
The file mode creation mask is used whenever a file is
created by creat(2), mknod(2) or open(2). The actual mode
(see chmod(2)) of the newly-created file is the difference
between the given mode and cmask. In other words, cmask
shows the bits to be turned off when a new file is created.
The previous value of cmask 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 file
mode creation mask is inherited by child processes.
RETURN VALUE
The previous value of the file mode creation mask is
returned.
SEE ALSO
mkdir(1), sh(1), chmod(2), creat(2), mknod(2), open(2).
Page 1 (last mod. 1/14/87)