Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1378637 > unrolled thread

Re: [PATCH] procfs: expose umask in /proc/<PID>/status (formerly umask2, formerly getumask)

Started by"Richard W.M. Jones" <rjones@redhat.com>
First post2016-04-14 11:40 +0200
Last post2016-04-14 11:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] procfs: expose umask in /proc/<PID>/status (formerly  umask2, formerly getumask) "Richard W.M. Jones" <rjones@redhat.com> - 2016-04-14 11:40 +0200

#1378637 — Re: [PATCH] procfs: expose umask in /proc/<PID>/status (formerly umask2, formerly getumask)

From"Richard W.M. Jones" <rjones@redhat.com>
Date2016-04-14 11:40 +0200
SubjectRe: [PATCH] procfs: expose umask in /proc/<PID>/status (formerly umask2, formerly getumask)
Message-ID<rnLUJ-83r-5@gated-at.bofh.it>
On Thu, Apr 14, 2016 at 10:34:48AM +0100, Richard W.M. Jones wrote:
> It's not possible to read the process umask without also modifying it,
> which is what umask(2) does.  A library cannot read umask safely,
> especially if the main program might be multithreaded.
> 
> Add a new status line ("Umask") in /proc/<PID>/status.  It contains
> the file mode creation mask (umask) in octal.  It is only shown for
> tasks which have task->fs.
> 
> For the library this allows me to read the umask from
> /proc/self/status.
> 
> This patch is adapted from one originally written by Pierre Carrier:
> https://lkml.org/lkml/2012/5/4/451

Sorry, I meant to add an example of what this looks like:

$ grep Umask /proc/1/status 
Umask:	  022
$ grep Umask /proc/2/status 
Umask:	  022
$ grep Umask /proc/self/status 
Umask:	  022
$ umask 002
$ grep Umask /proc/self/status 
Umask:	  02

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web