umask(2) CLIX umask(2)
NAME
umask - Sets and gets the value of the file mode creation mask
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <sys/types.h>
#include <sys/stat.h>
mode_t umask(
mode_t cmask );
PARAMETERS
cmask Specifies the value of the file mode creation mask.
DESCRIPTION
The umask() function sets the file mode creation mask of the process to
the value of cmask and returns the previous value of the mask. The cmask
parameter is constructed by a logical OR of the file permission bits
defined in the <sys/stat.h> header file.
Whenever a file is created (by the open(), mkdir(), mknod(), or mkfifo()
function), all file permission bits set in the file mode creation mask are
cleared in the mode of the created file. This clearing allows users to
restrict the default access to their files.
EXAMPLES
To prevent users other than the owner from writing any files created by
the current process:
(void)umask(S_IWGRP | S_IWOTH);
RETURN VALUES
Upon successful completion, the previous value of the file mode creation
mask is returned.
ERRORS
This function never sets errno.
RELATED INFORMATION
2/94 - Intergraph Corporation 1
umask(2) CLIX umask(2)
Commands: sh(1), umask(1)
Functions: chmod(2), mknod(2), open(2), stat(2)
2 Intergraph Corporation - 2/94