1UMASK(P) POSIX Programmer's Manual UMASK(P)
2
3
4
6 umask - set and get the file mode creation mask
7
9 #include <sys/stat.h>
10
11 mode_t umask(mode_t cmask);
12
13
15 The umask() function shall set the process' file mode creation mask to
16 cmask and return the previous value of the mask. Only the file permis‐
17 sion bits of cmask (see <sys/stat.h>) are used; the meaning of the
18 other bits is implementation-defined.
19
20 The process' file mode creation mask is used during open(), creat(),
21 mkdir(), and mkfifo() to turn off permission bits in the mode argument
22 supplied. Bit positions that are set in cmask are cleared in the mode
23 of the created file.
24
26 The file permission bits in the value returned by umask() shall be the
27 previous value of the file mode creation mask. The state of any other
28 bits in that value is unspecified, except that a subsequent call to
29 umask() with the returned value as cmask shall leave the state of the
30 mask the same as its state before the first call, including any unspec‐
31 ified use of those bits.
32
34 No errors are defined.
35
36 The following sections are informative.
37
39 None.
40
42 None.
43
45 Unsigned argument and return types for umask() were proposed. The
46 return type and the argument were both changed to mode_t.
47
48 Historical implementations have made use of additional bits in cmask
49 for their implementation-defined purposes. The addition of the text
50 that the meaning of other bits of the field is implementation-defined
51 permits these implementations to conform to this volume of
52 IEEE Std 1003.1-2001.
53
55 None.
56
58 creat() , mkdir() , mkfifo() , open() , the Base Definitions volume of
59 IEEE Std 1003.1-2001, <sys/stat.h>, <sys/types.h>
60
62 Portions of this text are reprinted and reproduced in electronic form
63 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
64 -- Portable Operating System Interface (POSIX), The Open Group Base
65 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
66 Electrical and Electronics Engineers, Inc and The Open Group. In the
67 event of any discrepancy between this version and the original IEEE and
68 The Open Group Standard, the original IEEE and The Open Group Standard
69 is the referee document. The original Standard can be obtained online
70 at http://www.opengroup.org/unix/online.html .
71
72
73
74IEEE/The Open Group 2003 UMASK(P)