.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
+.\" and Copyright (c) 2006, Michael Kerrisk (mtk-manpages@gmx.net)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" Modified Tue Oct 22 22:39:04 1996 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified Thu May 1 06:05:54 UTC 1997 by Nicolás Lichtmaier
.\" <nick@debian.com> with Lars Wirzenius <liw@iki.fi> suggestion
-.TH UMASK 2 1998-08-09 "Linux" "Linux Programmer's Manual"
+.\" 2006-05-13, mtk, substantial rewrite of description of 'mask'
+.TH UMASK 2 2006-05-13 "Linux" "Linux Programmer's Manual"
.SH NAME
umask \- set file mode creation mask
.SH SYNOPSIS
.\" 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
+the \fImode\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 to
+.BR mkdir (2).
+
+The constants that should be used to specify
+.I mask
+are described under
+.BR stat (2).
+
+The typical default value for the process umask is
+S_IWGRP\ |\ S_IWOTH
+(octal 022).
+In the usual case where the
+.I mode
+argument to
.BR open (2)
-as 0666).
+is specified as:
+.nf
+
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWRGRP | S_IROTH | S_IWOTH
+
+.fi
+(octal 0666) when creating a new file, the permissions on the
+resulting file will be:
+.nf
+
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH
+
+.fi
+(because 0666 & ~022 = 0644; i.e., rw-r--r--).
.SH "RETURN VALUE"
This system call always succeeds and the previous value of the mask
is returned.
.SH "SEE ALSO"
.BR chmod (2),
.BR mkdir (2),
-.BR open (2)
+.BR open (2),
+.BR stat (2)