mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Yet another design for /proc. Or actually /kernel.
@ 2001-11-07 19:09 Erik Hensema
  2001-11-07 19:27 ` Alan Cox
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Erik Hensema @ 2001-11-07 19:09 UTC (permalink / raw)
  To: linux-kernel


Here's my go at a new design for /proc. I designed it from a userland
point of view and tried not to drown myself into details.

Design goals
============

- Backward compatibility
	The current /proc interface is coded into many applications.
	A new design must leave room for backward compatibility.
- Forward compatibility
	The new interface must be clearly defined and must not change
	in the future, unless that change is clearly indicated and it
	would cause horrible pain maintaining the current interface.
	(Note: I mean the interface to userland, kernel interfaces may
	change as much as they like)
- Parsable by applications
	Information in /proc isn't really meant for humans to read.
	Maybe programmers, but they aren't human anyway. The new /proc
	interface must be parsable by applications as easily as
	possible.
- Readable by humans
	When there's no compelling need to obscure information, don't.
- As simple as possible
	Don't bloat the interface with all kinds of fancy decorations.
	Let's leave that to userspace.


>From these goals I come to the following design:

Design
======

- Multiple values per file when needed
	A file is a two dimensional array: it has lines and every line
	can consist of multiple fields.
	A good example of this is the current /proc/mounts.
	This can be parsed very easily in all languages.
	No need for single-value files, that's oversimplification.
- No headers, no pretty formatting
	Headers are nice to humans, but applications tend to dislike
	them. Same goes for formatting.
	An example of this is in /proc/partitions or -- horrors --
	/proc/meminfo.
- ASCII values
	ASCII is the only format which can be read by humans, shell
	scripts, perl, C and the rest of the world.
- Maybe we should move out of /proc
	Since this design must leave room for backwards compatibility
	we must assume the current /proc stays around for a while. I
	propose we create a new kernelfs which is to be mounted at
	/kernel.
- Mandatory documentation
	Each and every value must be documented. This documentation
	may be very, very basic, but it must clearly define the entry
	and its intention. This is forward compatibility.


As an example, this is how I would organize the info currently in
/proc/meminfo (any boy, that file is UGLY!):

Every value is in bytes. Rounding to kbytes or mbytes should be done
in userspace.

New		Current entry in /proc/meminfo
--------------- -----------------------------------
mem/total	MemTotal
mem/free	MemFree
mem/shared	MemShared
mem/buffers	Buffers
mem/cached	Cached
mem/active	Active
mem/inactive	Inactive

mem/high/total	HighTotal
mem/high/free	HighFree

mem/low/total	LowTotal
mem/low/free	LowFree

mem/swap/total	SwapTotal
mem/swap/free	SwapFree
mem/swap/cached	SwapCached
mem/swap/files	(current /proc/swaps)
-- 
Erik Hensema (erik@hensema.net)
I'm on the list, no need to Cc: me, though I appreciate one if your
mailer doesn't support the References header.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-11-08  2:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-07 19:09 Yet another design for /proc. Or actually /kernel Erik Hensema
2001-11-07 19:27 ` Alan Cox
2001-11-08  0:54   ` /proc discussions Tim Jansen
2001-11-08  2:23     ` Alexander Viro
2001-11-07 19:42 ` Yet another design for /proc. Or actually /kernel Daniel R. Warner
2001-11-07 22:35   ` Allen Campbell
2001-11-07 20:58 ` H. Peter Anvin
2001-11-07 21:19   ` Justin A
2001-11-07 23:44 ` Rusty Russell
2001-11-08  0:35 ` Stephen Satchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®