3 intro \- introduction to Plan 9 from User Space
5 Plan 9 is a distributed computing environment built
6 at Bell Labs starting in the late 1980s.
7 The system can be obtained from Bell Labs at
8 .B http://plan9.bell-labs.com/plan9
9 and runs on PCs and a variety of other platforms.
10 Plan 9 became a convenient platform for experimenting
11 with new ideas, applications, and services.
13 Plan 9 from User Space provides many of the ideas,
14 applications, and services from Plan 9
17 FreeBSD (x86, x86-64),
18 Linux (x86, x86-64, PowerPC and ARM),
19 Mac OS X (x86, x86-64, and PowerPC),
20 NetBSD (x86 and PowerPC),
21 OpenBSD (x86 and PowerPC),
22 Dragonfly BSD (x86-64),
24 SunOS (x86-64 and Sparc).
26 Plan 9 from User Space expects its own directory tree,
28 .BR /usr/local/plan9 .
29 When programs need to access files in the tree,
33 to contain the name of the root of the tree.
36 for details about installation.
38 Many of the familiar Unix commands,
44 are present, but in their Plan 9 forms:
48 does not columnate its output when printing to a terminal,
51 counts UTF characters.
52 In some cases, the differences are quite noticeable:
56 expect Plan 9 regular expressions
59 which are closest to what Unix calls extended regular expressions.
60 Because of these differences, it is not recommended to put
62 before the usual system
64 directories in your search path.
65 Instead, put it at the end of your path and use the
67 script when you want to invoke the Plan 9 version of a
68 traditional Unix command.
70 Occasionally the Plan 9 programs have been
71 changed to adapt to Unix.
73 now allows mkfiles to choose their own shell,
81 Many of the graphical programs from Plan 9 are present,
88 mimics Plan 9's window system, with command windows
89 implemented by the external program
91 Following the style of X Windows, these programs run in new
92 windows rather than the one in which they are invoked.
95 option to specify the size and placement of the new window.
96 The argument is one of
97 \fIwidth\^\^\fLx\fI\^\^height\fR,
98 \fIwidth\^\^\fLx\fI\^\^height\^\^\fL@\fI\^\^xmin\fL,\fIxmax\fR,
99 \fL'\fIxmin ymin xmax ymax\fL'\fR,
101 \fIxmin\fL,\fIymin\fL,\fIxmax\fL,\fIymax\fR.
105 helps to connect the various Plan 9 programs together,
108 connect it to external programs such as web browsers;
109 one can click on a URL in
111 and see the page load in
113 .SS User-level file servers
114 In Plan 9, user-level file servers present file trees via the Plan 9 file protocol, 9P.
115 Processes can mount arbitrary file servers and customize their own name spaces.
116 These facilities are used to connect programs. Clients interact
117 with file servers by reading and writing files.
119 This cannot be done directly on Unix.
120 Instead the servers listen for 9P connections on Unix domain sockets;
121 clients connect to these sockets and speak 9P directly using the
125 tells more of the story.
126 The effect is not as clean as on Plan 9, but it gets the job done
127 and still provides a uniform and easy-to-understand mechanism.
130 client can be used in shell scripts or by hand to carry out
131 simple interactions with servers.
133 is an experimental client for acme.
134 .SS External databases
135 Some programs rely on large databases that would be
136 cumbersome to include in every release.
137 Scripts are provided that download these databases separately.
138 These databases can be downloaded separately.
140 .B $PLAN9/dict/README
142 .BR $PLAN9/sky/README .
150 provide a simple interface to the underlying system compiler and linker,
157 compiles source files, and
159 links object files into executables.
160 When using Plan 9 libraries,
162 infers the correct set of libraries from the object files,
167 The only way to write multithreaded programs is to use the
171 exists but is not as capable as on Plan 9.
172 There are many unfortunate by necessary preprocessor
173 diversions to make Plan 9 and Unix libraries coexist.
182 and the debugging library
184 are works in progress.
185 They are platform-independent, so that x86 Linux core dumps
186 can be inspected on PowerPC Mac OS X machines,
187 but they are also fairly incomplete.
188 The x86 target is the most mature; initial PowerPC support
189 exists; and other targets are unimplemented.
190 The debuggers can only inspect, not manipulate, target processes.
191 Support for operating system threads and for 64-bit architectures
192 needs to be rethought.
193 On x86 Linux systems,
197 can be relied upon to produce reasonable stack traces
198 (often in cases when GNU
201 and dump data structures,
202 but that it is the extent to which they have been developed and exercised.
204 The vast majority of the familiar Plan 9 programs
205 have been ported, including the Unicode-aware
208 Of the more recent additions to Plan 9,
219 A backup system providing a dump file system built atop Venti
222 .SS Porting to new systems
223 Porting the tree to new operating systems or architectures
224 should be straightforward, as system-specific code has been
226 The largest pieces of system-specific code are
228 which must include the right system files and
229 set up the right integer type definitions,
232 which must implement spin locks, operating system thread
233 creation, and context switching routines.
234 Portable implementations of these using
238 already exist. If your system supports them, you may not
239 need to write any system specific code at all.
241 There are other smaller system dependencies,
242 such as the terminal handling code in
244 and the implementation of
246 but these are usually simple and are not on the critical
247 path for getting the system up and running.
249 The rest of this manual describes Plan 9 from User Space.
250 Many of the man pages have been brought from Plan 9,
251 but they have been updated, and others have been written from scratch.
253 The manual pages are in a Unix style tree, with names like
254 .B $PLAN9/man/man1/cat.1
255 instead of Plan 9's simpler
256 .BR $PLAN9/man/1/cat ,
259 utility can handle it.
260 Some systems, for example Debian Linux,
261 deduce the man page locations from the search path, so that
264 to your path is sufficient to cause
266 to be consulted for manual pages using the system
268 On other systems, or to look at manual pages with the
269 same name as a system page,
277 The manual sections follow the Unix numbering conventions,
280 .HR ../man1 "Section (1)
281 describes general publicly accessible commands.
283 .HR ../man3 "Section (3)
284 describes C library functions.
286 .HR ../man4 "Section (4)
287 describes user-level file servers.
289 .HR ../man7 "Section (7)
290 describes file formats and protocols.
291 (On Unix, section (5) is technically for file formats but
292 seems now to be used for describing specific files.)
294 .HR ../man8 "Section (8)
295 describes commands used for system administration.
297 .HR ../man9 "Section (9p)
298 describes the Plan 9 file protocol 9P.
300 These pages describe parts of the system
301 that are new or different from Plan 9 from Bell Labs:
335 .IR post9pservice (3),
352 In Plan 9, a program's exit status is an arbitrary text string,
353 while on Unix it is an integer.
354 Section (1) of this manual describes commands as though they
355 exit with string statuses. In fact, exiting with an empty status
356 corresponds to exiting with status 0,
357 and exiting with any non-empty string corresponds to exiting with status 1.