.\" <nick@debian.com> with Lars Wirzenius <liw@iki.fi> suggestion
.TH UMASK 2 1998-08-09 "Linux" "Linux Programmer's Manual"
.SH NAME
-umask \- set file creation mask
+umask \- set file mode creation mask
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.sp
.BI "mode_t umask(mode_t " mask );
.SH DESCRIPTION
-.B umask
-sets the umask to
+.BR umask ()
+sets the calling process's file mode creation mask (umask) to
.I mask
& 0777.
The umask is used by
-.BR open (2)
-to set initial file permissions on a newly-created file.
+.BR open (2),
+.BR mkdir (2),
+and other system calls that create files
+.\" e.g., mkfifo(), creat(), mknod(), sem_open(), mq_open(), shm_open()
+.\" but NOT the System V IPC *get() calls
+to modify the permissions placed on newly created files or directories.
Specifically, permissions in the umask are turned off from
the \fBmode\fR argument to
.BR open (2)
+and
+.BR mkdir (2)
(so, for example, the common umask default value of 022 results in new
files being created with permissions 0666 & ~022 = 0644 = rw-r--r--
-in the usual case where the \fBmode\fR is specified as 0666).
+in the usual case where the \fBmode\fR is specified to
+.BR open (2)
+as 0666).
.SH "RETURN VALUE"
This system call always succeeds and the previous value of the mask
is returned.
.SH "CONFORMING TO"
SVr4, SVID, POSIX, X/OPEN, BSD 4.3
.SH "SEE ALSO"
-.BR creat (2),
+.BR chmod (2),
+.BR mkdir (2),
.BR open (2)