summaryrefslogtreecommitdiffstats
path: root/man2/umask.2
diff options
context:
space:
mode:
Diffstat (limited to 'man2/umask.2')
-rw-r--r--man2/umask.230
1 files changed, 15 insertions, 15 deletions
diff --git a/man2/umask.2 b/man2/umask.2
index c920b55..bfea2e6 100644
--- a/man2/umask.2
+++ b/man2/umask.2
@@ -11,7 +11,7 @@
.\" <nick@debian.com> with Lars Wirzenius <liw@iki.fi> suggestion
.\" 2006-05-13, mtk, substantial rewrite of description of 'mask'
.\" 2008-01-09, mtk, a few rewrites and additions.
-.TH umask 2 2023-03-30 "Linux man-pages 6.05.01"
+.TH umask 2 2023-10-31 "Linux man-pages 6.7"
.SH NAME
umask \- set file mode creation mask
.SH LIBRARY
@@ -20,7 +20,7 @@ Standard C library
.SH SYNOPSIS
.nf
.B #include <sys/stat.h>
-.PP
+.P
.BI "mode_t umask(mode_t " mask );
.fi
.SH DESCRIPTION
@@ -30,7 +30,7 @@ sets the calling process's file mode creation mask (umask) to
& 0777 (i.e., only the file permission bits of
.I mask
are used), and returns the previous value of the mask.
-.PP
+.P
The umask is used by
.BR open (2),
.BR mkdir (2),
@@ -45,7 +45,7 @@ argument to
.BR open (2)
and
.BR mkdir (2).
-.PP
+.P
Alternatively, if the parent directory has a default ACL (see
.BR acl (5)),
the umask is ignored, the default ACL is inherited,
@@ -54,23 +54,23 @@ and permission bits absent in the
.I mode
argument are turned off.
For example, the following default ACL is equivalent to a umask of 022:
-.PP
+.P
.in +4n
.EX
u::rwx,g::r-x,o::r-x
.EE
.in
-.PP
+.P
Combining the effect of this default ACL with a
.I mode
argument of 0666 (rw-rw-rw-), the resulting file permissions would be 0644
(rw-r--r--).
-.PP
+.P
The constants that should be used to specify
.I mask
are described in
.BR inode (7).
-.PP
+.P
The typical default value for the process umask is
.BR S_IWGRP " | " S_IWOTH
(octal 022).
@@ -79,22 +79,22 @@ In the usual case where the
argument to
.BR open (2)
is specified as:
-.PP
+.P
.in +4n
.EX
.BR S_IRUSR " | " S_IWUSR " | " S_IRGRP " | " S_IWGRP " | " S_IROTH " | " S_IWOTH
.EE
.in
-.PP
+.P
(octal 0666) when creating a new file, the permissions on the
resulting file will be:
-.PP
+.P
.in +4n
.EX
.BR S_IRUSR " | " S_IWUSR " | " S_IRGRP " | " S_IROTH
.EE
.in
-.PP
+.P
(because 0666 & \[ti]022 = 0644; i.e. rw\-r\-\-r\-\-).
.SH RETURN VALUE
This system call always succeeds and the previous value of the mask
@@ -109,7 +109,7 @@ A child process created via
inherits its parent's umask.
The umask is left unchanged by
.BR execve (2).
-.PP
+.P
It is impossible to use
.BR umask ()
to fetch a process's umask without at the same time changing it.
@@ -118,7 +118,7 @@ A second call to
would then be needed to restore the umask.
The nonatomicity of these two steps provides the potential
for races in multithreaded programs.
-.PP
+.P
Since Linux 4.7, the umask of any process can be viewed via the
.I Umask
field of
@@ -126,7 +126,7 @@ field of
Inspecting this field in
.I /proc/self/status
allows a process to retrieve its umask without at the same time changing it.
-.PP
+.P
The umask setting also affects the permissions assigned to POSIX IPC objects
.RB ( mq_open (3),
.BR sem_open (3),