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