Re: [1/1][PATCH] nproc v2: netlink access to /proc information

From: Roger Luethi
Date: Tue Sep 14 2004 - 03:32:59 EST


On Tue, 14 Sep 2004 17:47:52 +1000, Greg Ungerer wrote:
> Yeah, the !CONFIG_MMU code behind this is probably a little stale.
> The thinking has mostly been to keep things as much the same as
> possible, even if the fields didn't have a sensible meaning in
> non-mmu space.

With nproc, tool authors won't need to write any special-casing code
for non-MMU. All they need to handle is the possibility that a field
they ask for does not exist. (Of course it doesn't hurt if they know
how to deal with non-MMU specific fields if any exist)

> >On Tue, Sep 14, 2004 at 07:59:46AM +0200, Roger Luethi wrote:
> >
> >>>I agree with you that those specific fields should be offered for
> >>>!CONFIG_MMU. However, if for some reason they cannot carry a value
> >>>that fits the field description, they should not be offered at all. The
> >>>ambiguity of having 0 mean either "0" or "this field is not available"
> >>>is bad. Trying to read a specific field _can_ fail, and applications
> >>>had better handle that case (it's still trivial compared to having to
> >>>parse different /proc file layouts depending on the configuration).
>
> In at least one case this is true now, as you mention for the
> VmXxx fields. But looking at these now I think we could actually
> implement most of them in a sensible way for the no-mmu case.
> Size, Exe, Lib, Stk, etc all apply with their conventional
> meanings.

It seems we all agree on that.

What I'd object to is offering fields like Size, Exe, etc. and filling
them with values that are wrong (e.g. returning always 0 for Exe). In
such a case, the field is simply not offered and asking for it an
error.

That's not a problem we can solve for tool authors: Allowing them to
distinguish between N/A and 0 is a property of the interface, and using
that interface means knowing how to deal with that distinction.

Roger
-
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/