srv – server registry
bind #s /srv
device provides a one-level directory holding
already-open channels to services.
is a bulletin board on which processes may post open file descriptors
to make them available to other processes.
To install a channel, create
a new file such as
and then write a text string (suitable for
giving the file descriptor number of an open file.
Any process may then open
to acquire another reference to the open file that was registered.
An entry in
holds a reference to the associated file even if no process has the
file open. Removing the file from
releases that reference.
It is an error to write more than one number into a server file,
or to create a file with a name that is already being used.
To drop one end of a pipe into
that is, to create a named pipe:
int fd, p;
fd = create("/srv/namedpipe", OWRITE, 0666);
fprint(fd, "%d", p);
At this point, any process may open and read
to receive the
string. Data written to
can be received by executing
read(p, buf, sizeof buf);
in the above process.