shithub: riscv

Download patch

ref: 1720551fd69a86363dcaff6c36e58a9b00ee6332
parent: e0372c26e9263207fb9ede2b8d706e4f8cd24b7a
author: cinap_lenrek <[email protected]>
date: Sun Dec 18 09:56:03 EST 2022

/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)).

--- a/lib/namespace
+++ b/lib/namespace
@@ -7,7 +7,7 @@
 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
--- 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,7 +23,7 @@
 .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
@@ -30,7 +30,7 @@
 .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 @@
 .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 ,