Logo address

Demo of name space encapsulation of Pegasus

目次

2006/08/28
2002/01/13

I show the name space that can be viewed by CGI.

The configulation

The following is the current contents of "/lib/namespace.httpd"

#  At this stage, namespace is alredy configured using /lib/namespace
#  We can add something to it.

#
# Here /usr/web is our webroot
# and `alice' in the commants stands for any user
#

#  In case that `/~alice' is requested,
# bind /usr/alice/web /usr/web/mnt
#  is internally executed at the beginning.

#bind -a /usr/web/bin /usr/arisawa/netlib/usr/web/bin
#bind /usr/web/bin /usr/arisawa/netlib/usr/web/bin

#
# configure our basic namespace
#

bind -a /usr/web/bin/$cputype /bin
bind -a /usr/web/bin/rc /bin

bind /sys/log/http /usr/web/sys/log/http
#bind -c /sys/log/okip /usr/web/sys/log/okip
bind /sys/lib /usr/web/sys/lib
#bind -a /sys/man /usr/arisawa/www/doc/man
bind -a /sys/man /usr/arisawa/www/doc/sys/man
bind -a /usr/arisawa/sources/plan9/sys/man /usr/arisawa/www/doc/labs/sys/man
bind -a /usr/arisawa/sources/plan9/sys/doc /usr/arisawa/www/doc/labs/sys/doc
bind -a /sys/doc /usr/arisawa/www/doc/labs/sys/doc
bind /lib /usr/web/lib
bind /bin /usr/web/bin
bind /rc/lib /usr/web/rc/lib
bind -c #e /usr/web/env
bind #c /usr/web/dev

bind /proc /usr/web/proc
bind -a #I /usr/web/net
mount -a #s/cs /usr/web/net
mount -a #s/dns /usr/web/net
bind -a #d  /usr/web/fd

#
# pipe for message board notification
#
bind /srv/pipetap /usr/web/pipefs/data

#
#  bind the contents to /usr/web/doc
#  change this line to make suitable to your environment
#
bind -a /usr/local/lib /usr/web/usr/local/lib
bind /usr/arisawa/ftp /usr/arisawa/http/doc/netlib
#bind -a /usr/local /usr/arisawa/netlib/usr/local
#bind -a /usr/web/bin /usr/arisawa/netlib/usr/web/bin
bind /usr/arisawa/netlib /usr/arisawa/www/doc/netlib
bind /usr/arisawa/sources /usr/arisawa/www/doc/sources

# for http://ar.local/ls/X
bind /usr/arisawa/http/doc /usr/arisawa/http/doc/ls
# for http://p9.local/ls/X
bind /usr/arisawa/www/doc /usr/arisawa/www/doc/ls

# In case of  `~' ,
# bind /usr/web/mnt /usr/web/doc
# is internally executed

# Let /usr/web be our webroot then
# httpd internally execute the followings:
# bind /usr/web /
# cd /
# to cut off everything not mounted below /usr/web
#

The root directory that is seen by CGI

The output of
	ls -l /
is the following.
--rw-rw-r-- M 23460 arisawa web          51 Oct 30  2004 /README
d-rwxrwxr-x M 23460 sys     sys           0 Nov 28 13:24 /bin
d-rwxr-xr-x M 23460 arisawa arisawa       0 Nov  7  2002 /bin
d-r-xr-xr-x c     0 arisawa arisawa       0 Jul 19  2021 /dev
d-rwxrwxr-x M 23460 arisawa web           0 Nov 16 15:30 /doc
d-r-xr-xr-x e     0 arisawa arisawa       0 Jul 19  2021 /env
d-rwxrwxr-x M 23460 arisawa web           0 Dec 29  2001 /etc
d-rwxr-xr-x M 23460 arisawa arisawa       0 Oct  4  2014 /etc
--rw-r----- M 23460 arisawa arisawa     870 Oct  4  2021 /fix.txt
--rw-r----- M 23460 arisawa arisawa  346216 Oct 30  2014 /index
d-rwxrwxr-x M 23460 sys     sys           0 Apr 21 17:49 /lib
d-rwxr-x--- M 23460 arisawa arisawa       0 Oct 20  2014 /log
--rw-r----- M 23460 arisawa web     1264331 Dec  7 13:59 /lsr
d-rwxrwxr-x M 23460 arisawa web           0 Dec 29  2001 /mnt
d-r-xr-xr-x p     0 arisawa arisawa       0 Jul 19  2021 /proc
d-rwxrwxr-x M 23460 arisawa web           0 May  3  2002 /rc
d-rwxrwxr-x M 23460 arisawa web           0 Mar 28  2016 /sys
d-r-xr-xr-x |     0 arisawa arisawa       0 Jul 19  2021 /tmp
d-rwxrwxr-x M 23460 arisawa web           0 May 12  2012 /usr

The directories above are exactly same as those in /usr/web/.

The output of

	ls -l /doc
are as follows.
d-rwxrwxr-x M 23460 arisawa web            0 Aug 16  2012 /doc/9fans
d-rwxrwxr-x M 23460 arisawa web            0 Sep 11  2014 /doc/9front
d-rwxrwxr-x M 23460 arisawa web            0 Nov 17  2015 /doc/9grid
d-rwxrwxr-x M 23460 arisawa web            0 Jun 14  2016 /doc/9grid2
--rw-rw-r-- M 23460 arisawa web         2662 Feb 21  2007 /doc/9logo.jpg
--rw-rw-r-- M 23460 arisawa web       607187 Aug 26  2007 /doc/9logo.png
d-rwxrwxr-x M 23460 arisawa web            0 Nov 23  2021 /doc/9p
--rwxrwxr-x M 23460 arisawa web        38287 Jul 13  2000 /doc/FAQ
--rw-rw-r-- M 23460 arisawa web       326255 Feb 18  2003 /doc/OOP.pdf
--rw-rw-r-- M 23460 arisawa web       104610 Jul 13  2000 /doc/OOP.ps
d-rwxrwxr-x M 23460 arisawa web            0 Oct  3  2002 /doc/abab
d-rwxrwxr-x M 23460 arisawa web            0 Aug 15  2012 /doc/acme1
d-rwxrwxr-x M 23460 arisawa web            0 Oct 16  2021 /doc/admin
d-rwxrwxr-x M 23460 arisawa web            0 Aug 15  2012 /doc/aquarela
--rwxrwxr-x M 23460 arisawa web          260 May 31  2023 /doc/authers
d-rwxrwxr-x M 23460 arisawa web            0 Jan 17  2022 /doc/bar
d-rwxrwxr-x M 23460 arisawa web            0 Nov 26 13:34 /doc/blog
d-rwxrwxr-x M 23460 arisawa web            0 Nov 15  2015 /doc/boot
d-rwxrwxr-x M 23460 arisawa web            0 Aug 11  2007 /doc/cap
d-rwxrwxr-x M 23460 arisawa web            0 Mar  1  2022 /doc/certificate
d-rwxrwxr-x M 23460 arisawa web            0 Nov  5  2003 /doc/cf-c33
d-rwxrwxr-x M 23460 arisawa web            0 Oct 13  2021 /doc/cpdir
--rw-rw-r-- M 23460 arisawa web         5748 Jan 19  2013 /doc/cpu.html
--rw-rw-r-- M 23460 arisawa web         4510 Jan 19  2013 /doc/cpu.tt
--rw-rw-r-- M 23460 arisawa web         1181 Sep  1  2002 /doc/create.c
--rw-rw-r-- M 23460 arisawa web        88452 Jul 13  2000 /doc/cw.ps
d-rwxrwxr-x M 23460 arisawa web            0 Jun 11  2023 /doc/cwfs
d-rwxrwxr-x M 23460 arisawa web            0 Aug 11  2007 /doc/dir
d-rwxrwxr-x M 23460 arisawa web            0 Nov  5  2003 /doc/dossrv
d-rwxrwxr-x M 23460 arisawa web            0 Sep 27  2021 /doc/drawterm
d-rwxrwxr-x M 23460 arisawa web            0 Oct 15  2012 /doc/dumpfs
d-rwxrwxr-x M 23460 arisawa web            0 Sep  5  2007 /doc/env
d-rwxrwxr-x M 23460 arisawa web            0 Oct  3  2002 /doc/errata
d-rwxrwxr-x M 23460 arisawa web            0 Aug 15  2012 /doc/factotum
d-rwxrwxr-x M 23460 arisawa web            0 Dec 30  2004 /doc/factotum2
--rw-rw-r-- M 23460 arisawa web        11423 Aug 11  2007 /doc/features.html
--rw-rw-r-- M 23460 arisawa web        10115 Apr 17  2009 /doc/features.tt
d-rwxrwxr-x M 23460 arisawa web            0 Nov  5  2003 /doc/flavor
d-rwxrwxr-x M 23460 arisawa web            0 Jan 17  2022 /doc/foo
d-rwxrwxr-x M 23460 arisawa web            0 Aug 27  2007 /doc/fossil
d-rwxrwxr-x M 23460 arisawa web            0 Dec 28  2004 /doc/fossil1
d-rwxrwxr-x M 23460 arisawa web            0 Oct 16  2004 /doc/fossil2
d-rwxrwxr-x M 23460 arisawa web            0 Oct 15  2012 /doc/fs
--rw-rw-r-- M 23460 arisawa web         3433 Aug 15  2012 /doc/ftpd.html
--rw-rw-r-- M 23460 arisawa web         2637 Aug 15  2012 /doc/ftpd.tt
d-rwxrwxr-x M 23460 arisawa web            0 Oct  3  2021 /doc/fuse
--rw-rw-r-- M 23460 arisawa web         1841 Aug 11  2007 /doc/getting.html
--rw-rw-r-- M 23460 arisawa web         1111 Apr 17  2009 /doc/getting.tt
d-rwxrwxr-x M 23460 arisawa web            0 Feb 16  2022 /doc/golang
--rw-rw-r-- M 23460 arisawa web            0 Jul 23  2007 /doc/googlefaac76950fc1e389.html
d-rwxrwxr-x M 23460 arisawa web            0 Oct 21  2021 /doc/gr
d-rwxrwxr-x M 23460 arisawa web            0 Aug 14  2012 /doc/hardware
d-rwxrwxr-x M 23460 arisawa web            0 Aug 16  2012 /doc/httpd
d-rwxrwxr-x M 23460 arisawa web            0 Jan 26  2015 /doc/image
d-rwxrwxr-x M 23460 arisawa web            0 Aug 15  2012 /doc/import
--rw-rw-r-- M 23460 arisawa web            0 Aug 16  2012 /doc/import.html
--rw-rw-r-- M 23460 arisawa web        46638 Nov 26 13:08 /doc/index.html
--rw-rw-r-- M 23460 arisawa web        32042 Nov 26 13:08 /doc/index.tt
d-rwxrwxr-x M 23460 arisawa web            0 Oct 16  2021 /doc/install
d-rwxrwxr-x M 23460 arisawa web            0 Oct 18  2021 /doc/iwp9-2006
d-rwxrwxr-x M 23460 arisawa web            0 Mar 10  2007 /doc/javascript
--rw-r----- M 23460 arisawa web       282569 Jun  1  2016 /doc/jiskb.png
d-rwxrwxr-x M 23460 arisawa web            0 Aug 15  2012 /doc/kernel
d-rwxrwxr-x M 23460 arisawa web            0 Nov 15  2013 /doc/kirara
d-rwxrwxr-x M 23460 arisawa web            0 Jul 10  2012 /doc/kprint
d-rwxr-xr-x M 23460 arisawa web            0 Mar 31  2016 /doc/labs
d-rwxrwxr-x M 23460 arisawa web            0 Jan 26  2015 /doc/lib
d-rwxrwxr-x M 23460 arisawa web            0 Oct 19  2021 /doc/lr
d-rwxrwxr-x M 23460 arisawa web            0 Nov 16 15:30 /doc/ls
d-rwxrwxr-x M 23460 arisawa web            0 Nov 16 15:35 /doc/lua
d-rwxrwxr-x M 23460 arisawa web            0 Mar 27  2016 /doc/man-
--rw-rw-r-- M 23460 arisawa web        16429 Apr 14  2007 /doc/me.jpg
d-rwxrwxr-x M 23460 arisawa web            0 Jun 10  2009 /doc/mini-itx
d-rwxrwxr-x M 23460 arisawa web            0 Aug 15  2012 /doc/mk
d-rwxrwxr-x M 23460 arisawa web            0 Aug 16  2012 /doc/mysys
d-rwxrwxr-x M 23460 arisawa web            0 Aug 15  2012 /doc/namespace
d-rwxrwxr-x M 23460 arisawa arisawa        0 Jul 30  2023 /doc/netlib
d-rwxrwxr-x M 23460 arisawa web            0 May 13  2005 /doc/network
d-rwxrwxr-x M 23460 arisawa web            0 Dec 21  2015 /doc/nfs
d-rwxrwxr-x M 23460 arisawa web            0 Nov  7  2004 /doc/none
d-rwxrwxr-x M 23460 arisawa web            0 May 19  2007 /doc/openfd
d-rwxrwxr-x M 23460 arisawa web            0 Sep 18  2021 /doc/p9p
d-rwxrwxr-x M 23460 arisawa web            0 Feb  8  2005 /doc/papers
d-rwxrwxr-x M 23460 arisawa web            0 Oct  5  2014 /doc/pegasus
d-rwxrwxr-x M 23460 arisawa web            0 Aug 21  2006 /doc/pipe
--rw-rw-r-- M 23460 arisawa web         2822 Aug 16  2012 /doc/plan9.html
--rw-rw-r-- M 23460 arisawa web        17638 Jul 13  2000 /doc/plan9.jpg
--rw-rw-r-- M 23460 arisawa web         2011 Aug 16  2012 /doc/plan9.tt
d-rwxrwxr-x M 23460 arisawa web            0 Feb  1  2016 /doc/plisten
--rw-rw-r-- M 23460 arisawa web         3230 Apr  3  2007 /doc/problems.html
d-rwxrwxr-x M 23460 arisawa web            0 Aug 15  2012 /doc/process
d-rwxrwxr-x M 23460 arisawa web            0 Feb 18  2003 /doc/prog
--rw-rw-r-- M 23460 arisawa web        20652 Aug 16  2012 /doc/programming.html
--rw-rw-r-- M 23460 arisawa web        19504 Aug 16  2012 /doc/programming.tt
d-rwxrwxr-x M 23460 arisawa web            0 Dec 31  2021 /doc/qemu
d-rwxrwxr-x M 23460 arisawa web            0 Oct  3  2002 /doc/questions
d-rwxrwxr-x M 23460 arisawa web            0 Nov  6  2016 /doc/raspi
d-rwxrwxr-x M 23460 arisawa web            0 Aug  6  2023 /doc/rc
d-rwxrwxr-x M 23460 arisawa web            0 Sep  1  2007 /doc/reboot
d-rwxrwxr-x M 23460 arisawa web            0 Nov 29  2002 /doc/ref
d-rwxrwxr-x M 23460 arisawa web            0 Nov 23  2014 /doc/remoty3
d-rwxrwxr-x M 23460 arisawa web            0 Aug 15  2012 /doc/replica
d-rwxrwxr-x M 23460 arisawa web            0 Oct 27  2003 /doc/rio
d-rwxrwxr-x M 23460 arisawa web            0 Dec  7  2014 /doc/rit
--rw-rw-r-- M 23460 arisawa web           54 May 13  2017 /doc/robots.txt
--rw-rw-r-- M 23460 arisawa web     29048832 Dec  2  2004 /doc/robspeech.mp4
d-rwxrwxr-x M 23460 arisawa web            0 Aug 15  2012 /doc/screenshot
d-rwxrwxr-x M 23460 arisawa web            0 Nov  4  2004 /doc/secstore
d-rwxrwxr-x M 23460 arisawa web            0 Sep  6  2007 /doc/security
--rw-rw-r-- M 23460 arisawa web        14829 Apr  3  2007 /doc/security.html
--rw-rw-r-- M 23460 arisawa web          366 Jun  1  2023 /doc/sitemap.conf
--rw-rw-r-- M 23460 arisawa web       214144 Nov 26 13:10 /doc/sitemap.xml
d-rwxrwxr-x M 23460 arisawa arisawa        0 Feb  3  2016 /doc/sources
d-rwxrwxr-x M 23460 arisawa web            0 Oct 24  2004 /doc/spam
d-rwxrwxr-x M 23460 arisawa web            0 Jul 17  2005 /doc/srv
d-rwxrwxr-x M 23460 arisawa web            0 Dec 23  2004 /doc/ssh
d-rwxrwxr-x M 23460 arisawa web            0 Aug 15  2012 /doc/stepbystep
--rw-rw-r-- M 23460 arisawa web         4860 Feb 26  2016 /doc/style.css
d-rwxrwxr-x M 23460 arisawa web            0 Sep  9  2012 /doc/su
d-rwxrwxr-x M 23460 arisawa web            0 Mar 26  2016 /doc/sys
d-rwxrwxr-x M 23460 arisawa web            0 Jan 14  2005 /doc/sys-example
d-rwxrwxr-x M 23460 arisawa web            0 Aug 15  2012 /doc/system
d-rwxrwxr-x M 23460 arisawa web            0 Sep  6  2007 /doc/tapefs
--rw-rw-r-- M 23460 arisawa web        15028 Jun  9  2003 /doc/team.jpg
d-rwxrwxr-x M 23460 arisawa web            0 Dec  4  2014 /doc/trouble
d-rwxrwxr-x M 23460 arisawa web            0 Nov 16  2021 /doc/u9fs
d-rwxrwxr-x M 23460 arisawa web            0 Aug 11  2007 /doc/unix
--rw-rw-r-- M 23460 arisawa web        45373 Apr  3  2007 /doc/unix-hist.html
--rw-rw-r-- M 23460 arisawa web         1854 Apr  3  2007 /doc/unix-plan9.html
--rw-rw-r-- M 23460 arisawa web        17303 Sep  1  2007 /doc/unix.html
--rw-rw-r-- M 23460 arisawa web        11020 Apr  3  2007 /doc/using.html
d-rwxrwxr-x M 23460 arisawa web            0 Oct 16  2021 /doc/venti
--rw-rw-r-- M 23460 arisawa web        22911 Aug 11  2007 /doc/venti.html
--rw-rw-r-- M 23460 arisawa web        19882 Oct 26  2003 /doc/venti.tt
d-rwxrwxr-x M 23460 arisawa web            0 Jan 17  2016 /doc/vm
d-rwxrwxr-x M 23460 arisawa web            0 Oct 25  2004 /doc/vnc
--rw-r--r-- M 23460 arisawa web      3013256 Mar 20  2016 /doc/vol1.pdf
d-rwxrwxr-x M 23460 arisawa web            0 Oct 20  2003 /doc/vpc
d-rwxrwxr-x M 23460 arisawa web            0 Oct 27  2004 /doc/webbrowser
d-rwxrwxr-x M 23460 arisawa web            0 Sep  6  2007 /doc/webdav
d-rwxrwxr-x M 23460 arisawa web            0 Nov  7  2014 /doc/webserver
d-rwxrwxr-x M 23460 arisawa web            0 Oct 30  2004 /doc/whoami
d-r-xr-xr-x M 23460 arisawa web            0 Feb 11  2016 /doc/wiki
--rw-r--r-- M 23460 arisawa web         1949 Feb 11  2016 /doc/wiki-style.css
--rw-rw-r-- M 23460 arisawa web         5005 Apr  3  2007 /doc/window.html
--rw-r--r-- M 23460 arisawa web        23726 Nov 26  2016 /doc/x.txt
--rw-rw-r-- M 23460 arisawa web        37571 Jul 21  2013 /doc/z.gz
You might aware that these are same as the contents that you see when you brows my server "plan9.aichi-u.ac.jp".

The output above are also same as /usr/arisawa/www/doc.

URI rewrite rule file

Request from clients to server are essentially a request for sending files.
HTTP/1.1 server has a mechanism to redirect request URI to another URI. Then Pegasus uses "/sys/lib/httpd.rewrite". The following is the current contents of the file.

# syntax: prefix replacement
# parsed by splitting into fields separated by spaces and tabs.
# Anything following a # is ignored.
#
# prefix is a literal string match which is applied to each
# file prefix of each url. The most specific, ie longest
# pattern wins,  and is applied once (no rescanning).
# Leave off trailing slash if pattern is a directory.
#
# If replacemant is a url, a "Permanently moved" message is returned.
#
# An example of a local redirect
#/netlib/c++/idioms/index.html.Z /netlib/c++/idioms/index.html
#/sys/man /man/man.html;
#/magic/man2html /man/man.html;
#
#
# Home page for virtual host. don't foreget IP of plan9
http://ar */usr/arisawa/http
http://ar1 */usr/arisawa/http
http://ar.nyx.link */usr/arisawa/http
https://ar.nyx.link */usr/arisawa/http
http://p9 */usr/arisawa/www
http://p91 */usr/arisawa/www
http://p9.nyx.link */usr/arisawa/www
https://p9.nyx.link */usr/arisawa/www
http://semi */usr/semi/www
http://semi.nyx.link */usr/semi/www
http://me */usr/nyx/me
http://me.nyx.link */usr/nyx/me
https://me.nyx.link */usr/nyx/me
http://nowar */usr/nyx/nowar
http://nowar.nyx.link */usr/nyx/nowar
https://nowar.nyx.link */usr/nyx/nowar
http://nhkthinktokai */usr/nyx/nhk
http://nhkthinktokai.nyx.link */usr/nyx/nhk
https://nhkthinktokai.nyx.link */usr/nyx/nhk
http://detect */usr/sho/www
http://detect.nyx.link */usr/sho/www
https://detect.nyx.link */usr/sho/www

# Redirection to another site
#/~carol http://plan9.bell-labs.com
/ */usr/arisawa/http


see this script the tt format