From: "Richard W.M. Jones" <rjones@redhat.com>
To: corbet@lwn.net
Cc: akpm@linux-foundation.org, vbabka@suse.cz, mhocko@suse.com,
hughd@google.com, koct9i@gmail.com, chenhanxiao@cn.fujitsu.com,
n-horiguchi@ah.jp.nec.com, ross.zwisler@linux.intel.com,
john.stultz@linaro.org, minchan@kernel.org, jmarchan@redhat.com,
hannes@cmpxchg.org, nathans@redhat.com,
andriy.shevchenko@linux.intel.com, keescook@chromium.org,
gorcunov@openvz.org, joe@perches.com, linux@rasmusvillemoes.dk,
mingo@kernel.org, cmetcalf@ezchip.com, iago@endocode.com,
luto@kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, gorcunov@gmail.com,
fw@deneb.enyo.de, walters@verbum.org
Subject: Re: [PATCH] procfs: expose umask in /proc/<PID>/status (formerly umask2, formerly getumask)
Date: Thu, 14 Apr 2016 10:36:37 +0100 [thread overview]
Message-ID: <20160414093637.GC28599@redhat.com> (raw)
In-Reply-To: <1460626489-31932-1-git-send-email-rjones@redhat.com>
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
prev parent reply other threads:[~2016-04-14 9:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-14 9:34 [PATCH] procfs: expose umask in /proc/<PID>/status (formerly umask2, formerly getumask) Richard W.M. Jones
2016-04-14 9:34 ` [PATCH] procfs: expose umask in /proc/<PID>/status Richard W.M. Jones
2016-04-14 10:21 ` Jerome Marchand
2016-04-14 9:36 ` Richard W.M. Jones [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160414093637.GC28599@redhat.com \
--to=rjones@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=chenhanxiao@cn.fujitsu.com \
--cc=cmetcalf@ezchip.com \
--cc=corbet@lwn.net \
--cc=fw@deneb.enyo.de \
--cc=gorcunov@gmail.com \
--cc=gorcunov@openvz.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=iago@endocode.com \
--cc=jmarchan@redhat.com \
--cc=joe@perches.com \
--cc=john.stultz@linaro.org \
--cc=keescook@chromium.org \
--cc=koct9i@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=luto@kernel.org \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
--cc=mingo@kernel.org \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=nathans@redhat.com \
--cc=ross.zwisler@linux.intel.com \
--cc=vbabka@suse.cz \
--cc=walters@verbum.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.