4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / lib / libc / sys / umask.2
CommitLineData
15715acc
KB
1.\" Copyright (c) 1980, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
542d81aa 3.\"
931b8415 4.\" %sccs.include.redist.man%
542d81aa 5.\"
15715acc 6.\" @(#)umask.2 8.1 (Berkeley) %G%
931b8415
CL
7.\"
8.Dd
9.Dt UMASK 2
10.Os BSD 4
11.Sh NAME
12.Nm umask
13.Nd set file creation mode mask
14.Sh SYNOPSIS
15.Fd #include <sys/stat.h>
16.Ft mode_t
17.Fn umask "mode_t numask"
18.Sh DESCRIPTION
19The
20.Fn umask
21routine sets the process's file mode creation mask to
22.Fa numask
23and returns the previous value of the mask. The 9 low-order
24access permission
25bits of
26.Fa numask
27are used by system calls, including
28.Xr open 2 ,
29.Xr mkdir 2 ,
30and
31.Xr mkfifo 2 ,
32to turn off corresponding bits
33requested in file mode.
ead8edf9 34(See
931b8415 35.Xr chmod 2 ) .
5a5f5b5e
KM
36This clearing allows each user to restrict the default access
37to his files.
931b8415 38.Pp
ead8edf9
KB
39The default mask value is S_IWGRP|S_IWOTH (022, write access for the
40owner only).
931b8415
CL
41Child processes inherit the mask of the calling process.
42.Sh RETURN VALUES
5a5f5b5e 43The previous value of the file mode mask is returned by the call.
931b8415
CL
44.Sh ERRORS
45The
46.Fn umask
47function is always successful.
48.Sh SEE ALSO
49.Xr chmod 2 ,
50.Xr mknod 2 ,
51.Xr open 2
52.Sh STANDARDS
53The
54.Fn umask
ead8edf9 55function call is expected to conform to IEEE Std 1003.1-1988
931b8415 56.Pq Dq Tn POSIX .