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