lkml.org 
[lkml]   [2012]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/1] procfs: expose umask in stat and status
From
On Sat, May 5, 2012 at 5:15 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> How is it useful to display numeric -ENOENT in a /proc file?

The fields in stat are looked up by index, so they should all always appear.
Sticking to a numerical value makes both this code and parsing
reasonably straightforward.

Given expected values are masks, a negative value makes a good marker.
Overall I don't see a compelling reason to avoid an errno.
They seem common in kernel outputs and benefit from some tooling
(self-promotion: [1]).

Would you have a better idea in mind?

> So sometimes "Umask:" is displayed, sometimes not...

Well, it is displayed whenever available (which sounds better to my ear).
This seemed consistent with the current practices: status already has
guards for FDSize, Groups, VmPeak, VmSize, VmLck, VmPin, VmHWM, VmRSS,
VmData, VmStk, VmExe, VmLib, VmPTE, VmSwap.

In all honesty I can't think of a realistic situation where one would
look for a umask in a task that doesn't have one.

--
Pierre

[1] https://github.com/pcarrier/stuff/blob/master/sys/errnos.c


\
 
 \ /
  Last update: 2012-05-05 07:01    [from the cache]
©2003-2011 Jasper Spaans