umask(2) umask(2)
NAME
umask - set and get file mode creation mask
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
modet umask(modet cmask);
DESCRIPTION
umask() sets the process' file mode creation mask to cmask and returns
the previous value of the mask. Only the access permission bits of
cmask and the file mode creation mask are used.
The process' file mode creation mask is used during open(), creat(),
mkdir() and mkfifo() functions to turn off permission bits in the mode
argument. Bit positions that are set in cmask are cleared in the mode
of the created file.
RESULT
The file permission bits in the value returned by umask() will be the
previous value of the file creation mask. The state of any other bits
in that mask is unspecified. A subsequent call to umask() with the
return value of the first call as argument will leave the state of the
mask the same as its state before the first call, including any
unspecified use of bits.
SEE ALSO
mkdir(1), sh(1), chmod(2), creat(2), mknod(2), open(2), stat(5).
Page 1 Reliant UNIX 5.44 Printed 11/98