> I was wondering if it would be possible to start dossrv in a new
> namespace, built from scratch, so I've been playing a bit with rfork
> (the rc builtin).
> However, when I do a 'rfork N', my namespace is empty after that (of
> course), but I'm not sure how to get it populated again? Since /bin is
> gone, I'm can't do much beside using rc's builtins, of which 'exit'
> seems to be the most useful at that point...
Rob wrote the script below, called "namespace", years ago.
It is essentially a script version of newns.
You could do
9fs boot
namespace /n/boot dossrv
if you really wanted to, but that seems like overkill to me.
Just FYI, you are mucking around in one of the
least satisfactory parts of the system: dossrv, 9660srv, etc.
The fact that they interpret the mount spec as a file name
in their own name space means that if you already have
dossrv running in one window and do
import othermachine /dev/sdC0
mount /srv/dos /n/other /dev/sdC0/dos
dossrv doesn't see othermachine's disks. So in general
you wouldn't want dossrv itself to clear its name space,
and it is debatable whether 9fat, c:, etc. should.
Dossrv is one of those programs that it's best just to use
and not think too much about.
Russ
#!/bin/rc
rfork en
# adapted from /lib/namespace
if(~ $#* 0 || ! test -x $1/$cputype/bin/bind) {
echo 'usage: namespace /n/foo' >[1=2]
echo ' /n/foo/$cputype/bin/bind must exist' >[1=2]
exit usage
}
root = $1
echo setting up $root
fn bind{
/$cputype/bin/bind $*
}
# root
bind $root /
bind -b '#/' /
# kernel devices
bind '#c' /dev
bind '#d' /fd
bind -c '#e' /env
bind '#p' /proc
bind -c '#s' /srv
bind -a '#S' /dev
# standard bin
bind /$cputype/bin /bin
bind -a /rc/bin /bin
ramfs
cd
prompt=(`{basename $root}^'=; ' ' ')
fn cd
if(~ $#* 1)
exec rc -i
if not{
shift
exec $*
}