xref: /original-bsd/lib/libc/sys/umask.2 (revision 95a66346)
1.\" Copyright (c) 1980, 1991 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)umask.2	6.2 (Berkeley) 03/10/91
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.
34(see
35.Xr chmod 2 ) .
36This clearing allows each user to restrict the default access
37to his files.
38.Pp
39The default mask value is 022 (write access for owner only).
40Child processes inherit the mask of the calling process.
41.Sh RETURN VALUES
42The previous value of the file mode mask is returned by the call.
43.Sh ERRORS
44The
45.Fn umask
46function is always successful.
47.Sh SEE ALSO
48.Xr chmod 2 ,
49.Xr mknod 2 ,
50.Xr open 2
51.Sh STANDARDS
52The
53.Fn umask
54function call is expected to
55conform to IEEE Std 1003.1-1988
56.Pq Dq Tn POSIX .
57