diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2016-07-18 17:10:57 +0200 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2016-07-18 17:10:57 +0200 |
| commit | 8a2de39c0558accf02f3b620c1e946d556705408 (patch) | |
| tree | 3a54e35ad87bb92497fcc704ad4776448b482cde | |
| parent | ac6c297c7bf023fd56352db6b9a102cad846673f (diff) | |
| download | man-pages-8a2de39c0558accf02f3b620c1e946d556705408.tar.gz | |
umask.2: Provide a rationale for the existence of /proc/PID/status 'Umask' field
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| -rw-r--r-- | man2/umask.2 | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/man2/umask.2 b/man2/umask.2 index ba98370244..2e3933cc07 100644 --- a/man2/umask.2 +++ b/man2/umask.2 @@ -117,10 +117,22 @@ inherits its parent's umask. The umask is left unchanged by .BR execve (2). +It is impossible to user +.BR umask () +to fetch a process's umask without at the same time changing it. +A second call to +.BR umask () +would then be needed to restore the umask. +The nonatomicity of these two steps provides the potential +for races in multithreaded programs. + Since Linux 4.7, the umask of any process can be viewed via the .I Umask field of .IR /proc/[pid]/status . +Inspecting this field in +.IR /proc/self/status +allows a process to retrieve its umask without at the same time changing it. The umask setting also affects the permissions assigned to POSIX IPC objects .RB ( mq_open (3), |
