Re: PROPOSAL: dot-proc interface [was: /proc stuff]

From: Alex Bligh - linux-kernel (linux-kernel@alex.org.uk)
Date: Sun Nov 04 2001 - 14:24:36 EST


--On Sunday, 04 November, 2001 8:04 PM +0100 Jakob Østergaard
<jakob@unthought.net> wrote:

> I'm a little scared when our VFS guy claims he never heard of excellent
> programmers using scanf in a way that led to parse errors.

I'd be far more scared if Al claimed he'd never heard of excellent
programmers reading binary formats, compatible between multiple
code revisions both forward and backwards, endian-ness etc., which
had never lead to parse errors of the binary structure.

If you feel it's too hard to write use scanf(), use sh, awk, perl
etc. which all have their own implementations that appear to have
served UNIX quite well for a long while.

Constructive suggestions:

1. use a textual format, make minimal
   changes from current (duplicate new stuff where necessary),
   but ensure each /proc interface has something which spits
   out a format line (header line or whatever, perhaps an
   interface version number). This at least
   means that userspace tools can check this against known
   previous formats, and don't have to be clairvoyant to
   tell what future kernels have the same /proc interfaces.

2. Flag those entries which are sysctl mirrors as such
   (perhaps in each /proc directory /proc/foo/bar/, a
   /proc/foo/bar/ctl with them all in). Duplicate for the
   time being rather than move. Make reading them (at
   least those in the ctl directory) have a comment line
   starting with a '#' at the top describing the format
   (integer, boolean, string, whatever), what it does.
   Ignore comment lines on write.

3. Try and rearrange all the /proc entries this way, which
   means sysctl can be implemented by a straight ASCII
   write - nice and easy to parse files. Accept that some
   /proc reads (especially) are going to be hard.

--
Alex Bligh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Nov 07 2001 - 21:00:23 EST