From: hedrick@geneva.rutgers.edu (Charles Hedrick) Subject: Re: Nonstandard /proc? (Re: /proc directory, dosemu, and boot questions) Date: 31 Jul 1993 18:24:35 GMT
everettm@merlin.think.com (Mark J. Everett) writes:
>SVR4 procfs has just one file per process in /proc which basically
>provides access to the process' memory image. Other control is
>provided by ioctl()s. Is there some reason, other than NIH (Not Invented
>Here) that a new 'procfs' was used instead of re-implementing the
>SVR4 version? IMHO, it seems like we've locked ourselves out of
>potential future software, because the original wasn't followed.
>Or has procfs also been changed? Its been a few years ...
If you look at top or ps for SVr4, you'll see that using /proc
involves you in system-specific struct declarations, which are not
even exactly the same for different versions of SVr4. Although Linux
might be able to provide a compatibility-mode /proc of some sort for
use with SVr4 emulation, it's unlikely that any real Linux ps or other
program would really want to use the SVr4 struct declarations. So I
don't think doing /proc the same way as SVr4 would buy you much. Note
that SVr4's /proc is not part of the "mainstream Unix" that Linux
normally tries to implement. Linux normally tries to implement POSIX,
plus other features that are present in enough Unix implementations
that portable code is likely to use them. /proc is a definite
SVr4'ism.
What Linus has done with /proc is in my opinion far more interesting
than SVr4. He's using it as an general window into the kernel, so that
software that needs kernel status doesn't have to real /dev/kmem, and
doesn't have to be modified as new information is added. Thus it's
used only only by ps and top, but by the network code and other
software. Because the actual kernel structures are different than in
BSD or System 5, the software that uses /proc would not be portable
from other systems in any case. /proc just makes it easier to do
Linux versions.
Making information about a process a directory makes it easier to add
information without causing problems to old software. Using text
where possible allows human beings to look at the data, makes it
possible to write status programs as small shell or perl scripts, and
makes it easier to add new information without causing problems. In
general, the Linux /proc implementation is very much in the spirit of
the original Unix design, unlike many of the frobs that have been
added to Unix in the last few years.