Messages in this thread | | | Date | Sat, 5 May 2012 06:19:46 +0200 | Subject | Re: [PATCH 1/1] procfs: expose umask in stat and status | From | Pierre Carrier <> |
| |
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
| |