Subject: Re: procfs/kernfs "required"?
To: Bernd Felsche <bernie@metapro.DIALix.oz.au>
From: Bernd Felsche <bernie@metapro.metapro.DIALix.oz.au>
List: current-users
Date: 01/14/1996 18:09:34
According to Bernd Felsche:

{replying to myself; sad}

>>No, as someone else already said, just open the ctl file and read/write
>>it.  The only excuse for ioctl is code that needs to do things when
>>handed just a file descriptor, like stdio doing a TCGETA on stdout.
>>I'm not sure how to address that.

>If it's handed an fd, then surely it can grok /proc/<pid>/fd and do
>a write on a /proc/<pid>/fd/xxx/ctl, where xxx is the file descriptor.

I should have mentioned that /dev/fd is counter-intuitive in the
/procfs paradigm. However, if the latter is implemented, the former
becomes trivial.

>When you have a paradigm, you may as well pursue it to its ultimate
>stupidity :-)

>BTW: what could one do about select() or poll()? create a list of the
>appropriate /proc/<pid>/fd/xxx/{read,write,except} files to a special
>/proc/<pid>/select?  That way, you could, given permissions,
>select/poll on other, unrelated processes too.

It goes without saying that read, write etc would also apply. Thus an
inter-process pipe can be created by linking read and write "ends" of
different process' file descriptors to each other. Multiplexing can
be done by linking multiple writers to one reader.

One would also expect that mmap()ing another process' memory
(/proc/<pid>/memory/segment.<segn> would cause it to become shared.

Maybe this is getting needlessly Plan 9ish! <apologies to drm et cie.>

If all operations occur in procfs/kernfs, then that's virtually like
placing all the system calls in procfs/kernfs itself. The only
advantage is portability of system utilities which would not need
changing if the kernel's internal structure changed. One could write
"ps" as a shell script for example.

Of course, if most of the kernel interfaces are done inside the procfs,
then an alternate "procfs" can be used to give a different view of the
system. Your machine can suffer from multiple personality disorder!

-- 
Bernd Felsche {speaking for himself}
MetaPro Systems Pty Ltd, 130 Fauntleroy Avenue,
Redcliffe, Western Australia 6104
Phone: +61 9 479 3722    Fax: +61 9 479 3720