From: Earl Chew <echew@ixiacom.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Andrew Morton <akpm@linux-foundation.org>,
Eric Paris <eparis@redhat.com>,
"Serge E. Hallyn" <serge.hallyn@canonical.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
<adobriyan@gmail.com>
Subject: Re: [PATCH] Support single byte reads from integers published in procfs by kernel/sysctl.c
Date: Mon, 23 Jan 2012 07:49:20 -0800 [thread overview]
Message-ID: <4F1D8180.9030509@ixiacom.com> (raw)
In-Reply-To: <m1fwf6pjal.fsf@fess.ebiederm.org>
On 23/01/2012 6:47 AM, Eric W. Biederman wrote:
> The difference between strings and integers is that with strings
> single byte reads/writes actually make sense.
>
> Single decimal digits reads don't make much sense at all for integers.
>
> Is there any compelling reason to support this complete idiocy from user
> space programs?
Eric,
[ I also note that the patch allows multiple short reads (not necessarily
just a single byte at a time) from these entries in procfs. ]
I think there is a reasonable userspace expectation that entities
that present themselves as text files to produce results that are
consistent with the userspace model of a text file.
For a more concrete example, consider the following BusyBox ash(1) code:
read X < /proc/sys/kernel/threads-max
Y=$(cat /proc/sys/kernel/threads-max)
read A < /proc/sys/kernel/core_pattern
B=$(cat /proc/sys/kernel/core_pattern)
The fact that these yield different results is surprising given that
the user sees these as text files.
I think it is worthwhile asking the opposite question,
" Is there any compelling reason for the kernel to require userspace
programs to access /proc/sys/kernel/threads-max any differently
from, say, /etc/fstab ? "
If the answer is in the affirmative, then it requires some layer in
the userspace program (presumably the IO layer) to make some
special accommodation for some entries in /proc.
As can be seen in the case of BusyBox, this approach might be difficult
to swallow in something as generic as ash(1), so it is left to the user to
puzzle out why read fails, but cat works -- but only sometimes.
Earl
next prev parent reply other threads:[~2012-01-23 15:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-22 18:46 [PATCH] Support single byte reads from integers published in procfs by kernel/sysctl.c Earl Chew
2012-01-23 14:47 ` Eric W. Biederman
2012-01-23 15:49 ` Earl Chew [this message]
2012-01-23 16:35 ` Eric W. Biederman
2012-01-23 16:43 ` Eric W. Biederman
2012-01-23 16:47 ` Earl Chew
2012-01-24 22:50 ` Andrew Morton
2012-01-25 6:28 ` Eric W. Biederman
2012-01-25 15:27 ` Earl Chew
2012-01-29 22:56 ` Earl Chew
2012-01-30 0:15 ` Eric W. Biederman
2012-01-30 1:13 ` Earl Chew
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=4F1D8180.9030509@ixiacom.com \
--to=echew@ixiacom.com \
--cc=a.p.zijlstra@chello.nl \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=eparis@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=serge.hallyn@canonical.com \
/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.