Names vs. fds -- it's a floor wax *and* a dessert topping

Barry Margolin barmar at think.uucp
Wed Oct 17 11:55:19 AEST 1990


Submitted-by: barmar at think.uucp (Barry Margolin)

In article <13642 at cs.utexas.edu> chip at tct.uucp (Chip Salzenberg) writes:
>According to brnstnd at kramden.acf.nyu.edu (Dan Bernstein):
>>3. A unified namespace has not been tested on a large scale in the
>>real world, and hence is an inappropriate object of standardization
>>at this time.
>"Advancement by invented standards" is an oxymoron, true.  Given that
>POSIX seems to be intent on inventing *something*, though, I push for
>a unified namespace.  Several people have described work with Unix (or
>Unix-like) systems that keep everything in one namespace.  And surely
>Plan 9 counts as "prior art."

Multics also has a unified namespace, although I suspect its interface
would not be considered acceptable by most Unix folks (when users interface
to it, the result looks a bit JCLish).

Rather than forcing everything into the file system hierarchy, Multics's
generalized I/O system is based on dynamically linking to the procedure
that knows how to open a particular type of I/O device.  The Multics
equivalent to open() takes a character string, called an "attach
description" that looks like a command line.  The first token in the string
is transformed into the name of a subroutine, the dynamic linker is invoked
to load the subroutine, and the remaining arguments are collected into an
array of character strings that are passed as the argument list.  For
instance, to open a file the call would look something like:

	fd = attach ("file /foo/bar/baz");

I've translated from Multics and PL/I style to Unix and C.  The Multics
version also has an additional argument, to specify a label for the file
descriptor, as there are commands to list and manipulate the attachments of
the current process (note that on Multics the entire login session is a
single process).

As another example, to attach to a TCP stream, the rsh command might do:

	fd = attach ("tcp think.com -port shell -privileged_local_port");

On Multics, there's a separate open() that is used after attach() (and,
correspondingly, separate close() and detach()).  Attach() says what device
(physical, as in a tape drive, or virtual, as in a file) you're attaching
to, while open specifies how you're using it at any particular time (input
vs output, file name on a labeled tape, etc.).  In the case of devices such
as tape drives, this distinction allows keeping a tape drive reserved to
the process while opening and closing individual files.

The user interface to this is the "io" command, with syntax like:

	io attach stdin file /foo/bar/baz
	io open stdin -input

To fit this into Unix, you'd have to make a variant of > and < that is
follwed by an attach description rather than a filename.  Actually, you
could just use pipes, e.g.

	io attach stdout tape -drive 0 | dd ... | io attach stdin tcp ...
--
Barry Margolin, Thinking Machines Corp.

barmar at think.com
{uunet,harvard}!think!barmar


Volume-Number: Volume 21, Number 206



More information about the Comp.std.unix mailing list