Subject: Re: proc(4): updating for LWP
To: Andrew Brown <atatat@atatdot.net>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 03/28/2003 09:58:32
On Fri, 28 Mar 2003, Andrew Brown wrote:

> >So? What's wrong with mounting file systems? It's not like we're talking
> >about ones that really get in the way; nothing else sits on either /kern
> >or /proc. And file systems provide a much cleaner name space to get at a
> >lot of things.
>
> i know that some people are opposed to /proc (and /kern).  personally,
> i like them, but if we're going to have to depend on them being
> around, doesn't it have to stop being an "option" in kernel config
> files?

Yes, we probably would.

Actually something I'd like us to do at some point is copy how Linux does
modules. While there are lots of messy things in Linux, I must say I like
how booting new kernels and keeping kernel modules around works. Note this
is getting quite tangential to /proc. :-)

And by "modules" I mean more than just LKMs. Compiling something in as a
module is where you compile in enough code that the kernel thinks it has
FOO (procfs or kernfs in this case), but when you go to use it, it has the
module loaded on the fly.

For a file system, this would be a bit of code that would hook the file
system into the VFS structures, and would answer a mount command. When it
gets asked to mount a file system, it makes a call to the module loader to
load the real file system, inits it, then calls it to do the mount.

> >What would disappear/move, other than the register stuff that now doesn't
> >make sense?
>
> % uname -sr
> NetBSD 1.6Q
> % ls -al /proc/$$
> total 2396
> dr-xr-xr-x  2 andrew  staff     512 Mar 28 12:40 ./
> dr-xr-xr-x  1 root    wheel     512 Mar 28 12:40 ../
> -r--r--r--  1 andrew  staff       0 Mar 28 12:40 cmdline
> --w-------  1 andrew  staff       0 Mar 28 12:40 ctl
> dr-xr-xr-x  2 andrew  staff     512 Mar 28 12:40 fd/
> -r-xr-xr-x  1 root    wheel  289492 Sep 18  2002 file*
> -rw-------  1 andrew  staff     108 Mar 28 12:40 fpregs
> -r--r--r--  1 andrew  staff       0 Mar 28 12:40 map
> -r--r--r--  1 andrew  staff       0 Mar 28 12:40 maps
> -rw-------  1 andrew  staff  921600 Mar 28 12:40 mem
> --w-------  1 andrew  staff       0 Mar 28 12:40 note
> --w-------  1 andrew  staff       0 Mar 28 12:40 notepg
> -rw-------  1 andrew  staff      64 Mar 28 12:40 regs
> -r--r--r--  1 andrew  staff       0 Mar 28 12:40 status
> -rw-------  1 andrew  staff     512 Mar 28 12:40 xmmregs
>
> % uname -sr
> SunOS 5.8
> % ls -al /proc/$$
> total 4687
> dr-x--x--x   5 andrew   staff        736 Mar 28 12:40 ./
> dr-xr-xr-x  23 root     root       25536 Mar 28 12:41 ../
> -rw-------   1 andrew   staff    2351104 Mar 28 12:40 as
> -r--------   1 andrew   staff        152 Mar 28 12:40 auxv
> -r--------   1 andrew   staff         32 Mar 28 12:40 cred
> --w-------   1 andrew   staff          0 Mar 28 12:40 ctl
> lr-x------   1 andrew   staff          0 Mar 28 12:40 cwd -> /
> dr-x------   2 andrew   staff        528 Mar 28 12:40 fd/
> -r--r--r--   1 andrew   staff        120 Mar 28 12:40 lpsinfo
> -r--------   1 andrew   staff        912 Mar 28 12:40 lstatus
> -r--r--r--   1 andrew   staff        536 Mar 28 12:40 lusage
> dr-xr-xr-x   3 andrew   staff         48 Mar 28 12:40 lwp/
> -r--------   1 andrew   staff       2208 Mar 28 12:40 map
> dr-x------   2 andrew   staff        544 Mar 28 12:40 object/
> -r--------   1 andrew   staff       2896 Mar 28 12:40 pagedata
> -r--r--r--   1 andrew   staff        336 Mar 28 12:40 psinfo
> -r--------   1 andrew   staff       2208 Mar 28 12:40 rmap
> lr-x------   1 andrew   staff          0 Mar 28 12:40 root -> /
> -r--------   1 andrew   staff       1440 Mar 28 12:40 sigact
> -r--------   1 andrew   staff       1232 Mar 28 12:40 status
> -r--r--r--   1 andrew   staff        256 Mar 28 12:40 usage
> -r--------   1 andrew   staff          0 Mar 28 12:40 watch
> -r--------   1 andrew   staff       3496 Mar 28 12:40 xmap
>
> the "cmdline" file is gone, the "map" file is totally different (the
> solaris one is binary data), the "maps" file is gone, the "mem" file
> is gone, the "note" and "notepg" files are gone, and so on.

Ok, then let's leave them. Let's add the stuff from Solaris that makes
sense, but I think leaving what we have now is fine to the extent it
doesn't conflict.

Take care,

Bill