From: "Russ Cox" <rsc@swtch.com>
To: 9fans@9fans.net
Subject: Re: [9fans] 'stuck' windows.
Date: Sun, 22 Jun 2008 10:22:36 -0400 [thread overview]
Message-ID: <20080622142021.A7DB31E8C1C@holo.morphisms.net> (raw)
In-Reply-To: <ba0d3bc70806220558k7616de29we539ffbecfdac90f@mail.gmail.com>
> 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 $*
}
next prev parent reply other threads:[~2008-06-22 14:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-21 18:21 Sander van Dijk
2008-06-21 21:39 ` erik quanstrom
2008-06-22 7:36 ` Sander van Dijk
2008-06-21 23:48 ` Pietro Gagliardi
2008-06-22 0:44 ` Russ Cox
2008-06-22 0:50 ` Russ Cox
2008-06-22 7:45 ` Sander van Dijk
2008-06-22 11:47 ` erik quanstrom
2008-06-22 11:59 ` erik quanstrom
2008-06-22 11:50 ` Russ Cox
2008-06-22 12:58 ` Sander van Dijk
2008-06-22 14:22 ` Russ Cox [this message]
2008-06-23 14:50 ` Dave Eckhardt
2008-06-24 8:53 ` Sander van Dijk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080622142021.A7DB31E8C1C@holo.morphisms.net \
--to=rsc@swtch.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).