/lib/namespace: add bind -c #s$srvspec /srv bind

This makes it possible to start a new namespace
using a specific service directory as the
starting point (see srv(3)).
This commit is contained in:
cinap_lenrek 2022-12-18 14:56:03 +00:00
parent e0372c26e9
commit 1720551fd6
2 changed files with 23 additions and 10 deletions

View file

@ -7,7 +7,7 @@ bind #c /dev
bind #d /fd
bind -c #e /env
bind #p /proc
bind -c #s /srv
bind -c #s$srvspec /srv
bind -q #σ /shr
bind -a #¤ /dev
bind -qa #¶ /dev

View file

@ -3,10 +3,10 @@
srv \- server registry
.SH SYNOPSIS
.nf
.B bind #s /srv
.BI "bind -c #s" $srvspec " /srv"
.BI #s/ clone
.BI #s/ n
.BI #s/ id
.BI #s/ service1
.BI #s/ service2
...
@ -23,14 +23,14 @@ to make them available to other processes.
.PP
To install a channel, create
a new file such as
.B /srv/myserv
.BI /srv/ myserv
and then write a text string (suitable for
.IR strtoul ;
see
.IR atof (2))
giving the file descriptor number of an open file.
Any process may then open
.B /srv/myserv
.BI /srv/ myserv
to acquire another reference to the open file that was registered.
.PP
An entry in
@ -47,13 +47,26 @@ Opening the
.I clone
file allocates a new service directory. Reading
.I clone
returns the id of the new directory. This new service
directory can then be accessed at
.BR /srv/id .
Directories are recursable; each new service directory
returns the
.I id
of the new directory.
This new service directory can then be accessed at
.BI /srv/ id .
Directories are recursive; each new service directory
contains its own
.I clone
file.
file and sub-directories.
Directories can be walked from the root such as
.BI #s/ id1 / id2 / id3
which makes them globally addressable.
As a convention,
.B /lib/namespace
accepts the path to the service directory from the
environment variable
.IR $srvspec ,
making it possible to start a new namespace
using a specific service directory as a
starting point.
.SH EXAMPLE
To drop one end of a pipe into
.BR /srv ,