copyediting for Usenix manuals
[unix-history] / usr / src / lib / libc / sys / umask.2
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" %sccs.include.redist.man%
.\"
.\" @(#)umask.2 8.1 (Berkeley) %G%
.\"
.Dd
.Dt UMASK 2
.Os BSD 4
.Sh NAME
.Nm umask
.Nd set file creation mode mask
.Sh SYNOPSIS
.Fd #include <sys/stat.h>
.Ft mode_t
.Fn umask "mode_t numask"
.Sh DESCRIPTION
The
.Fn umask
routine sets the process's file mode creation mask to
.Fa numask
and returns the previous value of the mask. The 9 low-order
access permission
bits of
.Fa numask
are used by system calls, including
.Xr open 2 ,
.Xr mkdir 2 ,
and
.Xr mkfifo 2 ,
to turn off corresponding bits
requested in file mode.
(See
.Xr chmod 2 ) .
This clearing allows each user to restrict the default access
to his files.
.Pp
The default mask value is S_IWGRP|S_IWOTH (022, write access for the
owner only).
Child processes inherit the mask of the calling process.
.Sh RETURN VALUES
The previous value of the file mode mask is returned by the call.
.Sh ERRORS
The
.Fn umask
function is always successful.
.Sh SEE ALSO
.Xr chmod 2 ,
.Xr mknod 2 ,
.Xr open 2
.Sh STANDARDS
The
.Fn umask
function call is expected to conform to IEEE Std 1003.1-1988
.Pq Dq Tn POSIX .