umask(2) umask(2)NAME umask - set and get file creation mask SYNOPSIS #include <sys/types.h> #include <sys/stat.h> mode_t umask(cmask) mode_t cmask; DESCRIPTION umask sets the file-mode-creation mask of the calling process 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. For the POSIX environment, the following constants for cmask are defined in <sys/stat.h>: S_IRUSR read permission, owner S_IWUSR write permission, owner S_IXUSR execute/search permission, owner S_IRGRP read permission, group S_IWGRP write permission, group S_IXGRP execute/search permission, group S_IRUSR read permission, others S_IWUSR write permission, others S_IXUSR execute/search permission, others January 1992 1
umask(2) umask(2)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. The value 022 here means that no permissions are withheld from the owner, but write permission is forbidden to the group and to others. Its complement, the mode of the file, would be 0755. The file-mode-creation mask is inherited by child processes. STATUS MESSAGES AND VALUES The previous value of the file-mode-creation mask is returned. SEE ALSO chmod1(2), creat(2), mknod(2), open(2) csh(1), ksh(1), chmod(1), mkdir(1), sh(1) in A/UX Command Reference 2 January 1992