1UMASK(3P) POSIX Programmer's Manual UMASK(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 umask — set and get the file mode creation mask
13
15 #include <sys/stat.h>
16
17 mode_t umask(mode_t cmask);
18
20 The umask() function shall set the file mode creation mask of the
21 process to cmask and return the previous value of the mask. Only the
22 file permission bits of cmask (see <sys/stat.h>) are used; the meaning
23 of the other bits is implementation-defined.
24
25 The file mode creation mask of the process is used to turn off permis‐
26 sion bits in the mode argument supplied during calls to the following
27 functions:
28
29 * open(), openat(), creat(), mkdir(), mkdirat(), mkfifo(), and mkfi‐
30 foat()
31
32 * mknod(), mknodat()
33
34 * mq_open()
35
36 * sem_open()
37
38 Bit positions that are set in cmask are cleared in the mode of the cre‐
39 ated file.
40
42 The file permission bits in the value returned by umask() shall be the
43 previous value of the file mode creation mask. The state of any other
44 bits in that value is unspecified, except that a subsequent call to
45 umask() with the returned value as cmask shall leave the state of the
46 mask the same as its state before the first call, including any unspec‐
47 ified use of those bits.
48
50 No errors are defined.
51
52 The following sections are informative.
53
55 None.
56
58 None.
59
61 Unsigned argument and return types for umask() were proposed. The
62 return type and the argument were both changed to mode_t.
63
64 Historical implementations have made use of additional bits in cmask
65 for their implementation-defined purposes. The addition of the text
66 that the meaning of other bits of the field is implementation-defined
67 permits these implementations to conform to this volume of
68 POSIX.1‐2017.
69
71 None.
72
74 creat(), exec, mkdir(), mkfifo(), mknod(), mq_open(), open(),
75 sem_open()
76
77 The Base Definitions volume of POSIX.1‐2017, <sys_stat.h>,
78 <sys_types.h>
79
81 Portions of this text are reprinted and reproduced in electronic form
82 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
83 table Operating System Interface (POSIX), The Open Group Base Specifi‐
84 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
85 Electrical and Electronics Engineers, Inc and The Open Group. In the
86 event of any discrepancy between this version and the original IEEE and
87 The Open Group Standard, the original IEEE and The Open Group Standard
88 is the referee document. The original Standard can be obtained online
89 at http://www.opengroup.org/unix/online.html .
90
91 Any typographical or formatting errors that appear in this page are
92 most likely to have been introduced during the conversion of the source
93 files to man page format. To report such errors, see https://www.ker‐
94 nel.org/doc/man-pages/reporting_bugs.html .
95
96
97
98IEEE/The Open Group 2017 UMASK(3P)