summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2022-12-18 14:56:03 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2022-12-18 14:56:03 +0000
commit1720551fd69a86363dcaff6c36e58a9b00ee6332 (patch)
tree6eacb3ea01bfc3f8dddcd0eec2086e87303fd4e6
parente0372c26e9263207fb9ede2b8d706e4f8cd24b7a (diff)
/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)).
-rw-r--r--lib/namespace2
-rw-r--r--sys/man/3/srv31
2 files changed, 23 insertions, 10 deletions
diff --git a/lib/namespace b/lib/namespace
index a02d45402..76e9659ef 100644
--- a/lib/namespace
+++ b/lib/namespace
@@ -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
diff --git a/sys/man/3/srv b/sys/man/3/srv
index b68f00887..c2185a167 100644
--- a/sys/man/3/srv
+++ b/sys/man/3/srv
@@ -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 ,