Plan 9

Availability

Plan 9 can be downloaded for free over the web.

Why Plan 9?

Why Plan 9 indeed. Isn't Plan 9 just another Unix clone? Who cares?

First, Plan 9 presents a consistent and easy to use interface. Once you've settled in, there are very few surprises here, whereas Windows still surprises me once in a while (though, to its credit, not as much as older versions did). After I switched to Linux from Windows 3.1, I noticed all manner of inconsistent behavior in Windows 3.1 that Linux did not have. Switching to Plan 9 from Linux highlighted just as much in Linux.

One reason Plan 9 can do this is that the Plan 9 group has had the luxury of having an entire system, so problems can be fixed and features added where they belong, rather than where they can be. For example, there is no tty driver in the kernel. The window system handles the nuances of terminal input.

If Plan 9 were just a really clean Unix clone, it might be worth using, or it might not. The neat things start happening with user-level file servers and per-process namespace. Recall that in Unix, /dev/tty refers to the current window's output device, and means different things to different processes. This is a special hack enabled by the kernel for a single file. Plan 9 provides full-blown per-process namespaces. Thus, in Plan 9 /dev/cons also refers to the current window's output device, and means different things to different processes, but the window system (or telnet daemon, or ssh daemon, or whoever) arranges this, and does the same for /dev/mouse, /dev/text (the contents of the current window), etc.

Since pieces of file tree can be provided by user-level servers the kernel need not know about things like DOS's FAT file system or Linux's EXT2 file system or NFS, etc. Instead, user-level servers provide this functionality when desired. In Plan 9, even FTP is provided as a file server: you run ftpfs and the files on the server appear in /n/ftp.

We need not stop at physical file systems, though. Other file servers synthesize files that represent other resources. For example, upas/fs presents your mail box as a file tree at /mail/fs/mbox. This models the recursive structure of MIME messages especially well.

As another example, cdfs presents an audio or data CD as a file system, one file per track. If it's a writable CD, copying new files into the /mnt/cd/wa or /mnt/cd/wd directories creates new audio or data tracks. Want to fixate the CD as audio or data? Remove one of the directories.

Finally, Plan 9 fits well with a networked environment. Since files or directory trees can be imported from other machines, and all resources are files or directory trees, it's easy to share resources. Want to use a different machine's sound card? Import its /dev/audio. Want to debug processes that run on another machine? Import its /proc. Want to use a network interface on another machine? Import its /net. And so on.

Projects

If you're interested in helping with any of these, let me know.

Cross-compiling for other operating systems.
I'd like to add support to 8l to create (static) ELF binaries, for use under Linux and FreeBSD. Once we have ELF binaries, we can compile the C library, write the appropriate system call stubs, and make Linux (or FreeBSD) binaries.

At that point, most of the Plan 9 build tools (mk, 8a, 8c, 8l) as well as most of the non-system programs (cat, ls, etc.) should be trivial to move over.

(23 July 2000) I actually have 8l generating ELF binaries (without debugging info) and have Plan 9's libc ported enough that 8l, 8a, 8c, ar, and sed can work together to compile the libraries and then themselves completely under Linux. Some parts of the library (notes, error strings) still need to be fleshed out. I rely on Byron Rakitzis's rc and the Inferno mk at the moment, but would like to not need to do that.

The hard part here will be debugging. In particular, it would be prudent to format the ELF debugging section in a way that gdb understands.

Porting libmach would mean being able to use acid.

Palm Pilots.
I've got most of a Palm Pilot synchronization file system written, to make it easy to manipulate the databases on a Pilot (or even manipulate a backup copy of the databases).

We already have a Motorola 68000 compiler suite; all that's needed is loader support and some work on a C library. An editor for menus and screens and the like would also be helpful.

There's a similar suite under Linux using gcc. At the least it's a decent reference.

Ultimately I'd like to get drawterm working, although perhaps PalmVNC is good enough.

Single Unix Specification Version 2.
The Single Unix Specification Version 2 is slated to become the next ANSI/POSIX standard. Updating APE would probably make it easier to port Unix programs.

Dot-dot.
This is not Plan 9 hacking per se, but it would be interesting to fix dot-dot in Unix. There might even be enough issues involved to make it a good senior or master's thesis. I don't use Unixes enough to do it myself, but if someone were interested I'd be glad to talk through problems and lend help.

More later...

Software

These are mainly little shell scripts or programs that aren't useful enough to merit a place in a standard installation or aren't completely in keeping with the spirit of Plan 9, but which I rely on nonetheless.

Most of these shell scripts are trivially simple, to the point that you could write your own in a minute given the description. What amazes me is how useful such trivial things are, and how long I went before thinking to (or seeing someone else) package them as such. Your mileage may vary.

Some of the C programs are not useful, but make good examples.

Shell scripts

Some of the shell scripts may get damaged downloading in Netscape or IE (they contain tab characters and carriage returns that really need to stay how they are). Scripts.tar.gz contains all the scripts.
'chk: Grep for lines with unmatched single quotes (as bedevil my own rc scripts). Note that because of rc's quoting conventions, it must be invoked as something like ''''chk.
Clean: Intended to be executed under acme, Clean deletes all clean windows matching a regular expression pattern (default .), except +Errors, Mail, and win windows.
hbold, hitalic, hcom, hlink, htrow: Pipe text through these in acme or sam, to bolden it, italicize it, comment it out, turn it into a hyperlink, or put it in a table row by itself. If hlink is given no argument, it uses the passed text as the link. (I think I picked the concept up from a wily manual or user.)
long: Expand tabs to 8 characters, and then print any lines longer than 80 characters. Useful before printing code.
q: Prefix a string to each line of its input. Useful for inserting % or // comments in the editors. The default string is a single tab, so that with no arguments it functions as Acme's ind. Because it uses sed, the last line must include a newline or it will disappear.
g, def: G, due to Rob Pike, does grep -n for a pattern in the named files, by default *.[ch]. The output is suitable for plumbing; it's not uncommon for most of my source windows to have g foo in the tag line, waiting to be executed.

Def uses g to find the prototype of a function in a header file in the current directory or in the standard locations. It is especially useful with Acme's 2-1 chord.

", "": " reprints the command lines beginning with its arguments; by default it reprints the last command line. They are printed in chronological order, oldest first. "" executes the most recent command found by ". (Originally lifted from Tom Killian; improvements by Rob Pike.)
d2h, h2d: Decimal to hexadecimal and back. Simple, but I use them every day.
mu: Audio volume control. mu what num sets what to num but prints the old setting. The default arguments are audio 0, so that mu mutes the sound card but prints a command that can be sent to unmute it.
rlogin: Just to show that you can do it in a shell script. Con -r and ssh are much better.
uptime: Print how long a system has been running.
phoneca: Watch the tfone call log for unanswered calls and send mail about them.
tar: This is horribly not Plan 9-like, but I really like the GNU tar's z option, which causes it to read and produce gzipped tar files rather than tar files. This script is a front end for the real tar.
tt: Send a ^t^t foo sequence in a con session. Ctl-\, !tt r, for instance. (Picked up from David Hogan)
watchfd: Present a bar graph of where a process is in processing a (usually large) file. watchfd proc prints the things that process (which may be a name or number) has open and could be watched. watchfd pid fd [title] actually puts up the graph. Only useful when the total size can be gleaned from ls -l on the open file. Needs bargraph.c below.
df: Display free disk space on local kfs file systems.
fromdos, todos, nocr, crlf: Fromdos and todos remove or add carriage-returns from the ends of the lines in the named files. They edit the files in place. Nocr and crlf are their filter equivalents, which behave like cat except for the removal or addition of carriage returns.

C programs

localcron.c: A cron that runs in the background locally as whoever started it, running jobs in /cron/you/cron that have a system name of local. This is useful if you use a standalone terminal rather than a full-blown network with authentication server (the latter is to be preferred, of course!).
Tfone is an interface to the (now discontinued) AT&T Computer Telephone 8130. If you have one and want to use tfone, let me know and I'll mail it to you (I like to keep track of who has copies).
tab.c: Change spaces in a text file to tabs or vice versa (-u). Useful when interacting with editors (both humans and programs) that don't know the difference.
utftex.c: Change UTF sequences into equivalent TeX sequences, or vice versa (-u). The unicode.sty style file in the Plan 9 LaTeX provides better functionality, but this lets you interact with people who can't read UTF.
mixer.c: Volume control. Button 1 scrolls the various controls, button 2 changes left and right together, button 3 changes left (top) or right (bottom). Not the best user interface, but it's enough that I haven't been inspired to fix it.
bargraph.c: The silly bar graph you saw when installing Plan 9: takes numbers from standard input and displays the appropriate bars. For those who can't be without their download graphs, hget -v -o output url | bargraph. Also see watchfd above.
rot13fs.c: A 9P filter that ``encrypts'' your file system traffic. srvfs foo / then rot13fs /srv/foo /n/a:. Inspired by a similar idea in a French introduction to Plan 9.
acd.tar.gz: An Acme CD player. It's based very very loosely on cdplay below. The code is a nice demonstration of message-based concurrent programming using the thread library and how much Acme does for you. See the enclosed README for usage.
xword.tar.gz: A crossword player, which uses its own text file format to store the crosswords. A converter from the popular Across Lite format to the text file format is included (it's named acrosslite). Button 1 selects a clue or word/square to fill in. Button 2 toggles whether you are sure of the contents of a particular square. Button 3 brings up a menu from which you can save your work or quit. The code is a demonstration of how painful text layout is.
cdplay.tar.gz: A minimal graphical CD player that queries the CDDB to get track information. It's based on a CD player someone in Australia wrote, called vcd, for the second edition.
click.c: A minimal graphical program: puts dots where you click the mouse. Written mainly to test mouse event buffering.

Software Ports

I have ported a number of Unix software packages to Plan 9.

Norman Ramsey's noweb. [noweb.9gz]
CVS 1.10.8 (just the client, for lack of RCS). [cvs.9gz]
Moscow ML 2.0. [mosml.9gz]

Other People's Ports

This isn't exactly a Plan 9 program, but it's related, and it's a wonderful hack. Kenji Arisawa figured out how to write Plan 9's netkey (which facilitates DES-based challenge-response authentication) by just using the Unix <crypt.h> functions. Source code is here.

As far as Plan 9 goes, Charles Forsyth has a rather complete list of what the Plan 9 user community has put together. In particular, he has a nice list of netkey implementations for other operating systems.


Why don't cannibals eat clowns? Because they taste funny.