xref: /original-bsd/lib/libc/sys/umask.2 (revision c3e32dec)
1.\" Copyright (c) 1980, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)umask.2	8.1 (Berkeley) 06/04/93
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 S_IWGRP|S_IWOTH (022, write access for the
40owner only).
41Child processes inherit the mask of the calling process.
42.Sh RETURN VALUES
43The previous value of the file mode mask is returned by the call.
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
55function call is expected to conform to IEEE Std 1003.1-1988
56.Pq Dq Tn POSIX .
57