Re: [PATCH 1/1] procfs: expose umask in stat and status

From: Pierre Carrier
Date: Sat May 05 2012 - 00:20:12 EST


On Sat, May 5, 2012 at 5:15 AM, Cong Wang <xiyou.wangcong@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/