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
18 Linux (x86 and PowerPC),
24 Plan 9 from User Space expects its own directory tree,
26 .BR /usr/local/plan9 .
27 When programs need to access files in the tree,
31 to contain the name of the root of the tree.
34 for details about installation.
36 Many of the familiar Unix commands,
42 are present, but in their Plan 9 forms:
46 does not columnate its output when printing to a terminal,
49 counts UTF characters.
50 In some cases, the differences are quite noticeable:
54 expect Plan 9 regular expressions
57 which are closest to what Unix calls extended regular expressions.
58 Because of these differences, it is not recommended to put
60 before the usual system
62 directories in your search path.
63 Instead, put it at the end of your path and use the
65 script when you want to invoke the Plan 9 version of a
66 traditional Unix command.
68 Occasionally the Plan 9 programs have been
69 changed to adapt to Unix.
71 now allows mkfiles to choose their own shell,
79 Many of the graphical programs from Plan 9 are present,
86 mimics Plan 9's window system, with command windows
87 implemented by the external program
89 Following the style of X Windows, these programs run in new
90 windows rather than the one in which they are invoked.
93 option to specify the size and placement of the new window.
94 The argument is one of
95 \fIwidth\^\^\fLx\fI\^\^height\fR,
96 \fIwidth\^\^\fLx\fI\^\^height\^\^\fL@\fI\^\^xmin\fL,\fIxmax\fR,
97 \fL'\fIxmin ymin xmax ymax\fL'\fR,
99 \fIxmin\fL,\fIymin\fL,\fIxmax\fL,\fIymax\fR.
103 helps to connect the various Plan 9 programs together,
106 connect it to external programs such as web browsers;
107 one can click on a URL in
109 and see the page load in
111 .SS User-level file servers
112 In Plan 9, user-level file servers present file trees via the Plan 9 file protocol, 9P.
113 Processes can mount arbitrary file servers and customize their own name spaces.
114 These facilities are used to connect programs. Clients interact
115 with file servers by reading and writing files.
117 This cannot be done directly on Unix.
118 Instead the servers listen for 9P connections on Unix domain sockets;
119 clients connect to these sockets and speak 9P directly using the
123 tells more of the story.
124 The effect is not as clean as on Plan 9, but it gets the job done
125 and still provides a uniform and easy-to-understand mechanism.
128 client can be used in shell scripts or by hand to carry out
129 simple interactions with servers.
130 .SS External databases
131 Some programs rely on large databases that would be
132 cumbersome to include in every release.
133 Scripts are provided that download these databases separately.
134 These databases can be downloaded separately.
136 .B $PLAN9/dict/README
138 .BR $PLAN9/sky/README .
146 provide a simple interface to the underlying system compiler and linker,
153 compiles source files, and
155 links object files into executables.
156 When using Plan 9 libraries,
158 infers the correct set of libraries from the object files,
163 The only way to write multithreaded programs is to use the
167 exists but is not as capable as on Plan 9.
168 There are many unfortunate by necessary preprocessor
169 diversions to make Plan 9 and Unix libraries coexist.
178 and the debugging library
180 are works in progress.
181 They are platform-independent, so that x86 Linux core dumps
182 can be inspected on PowerPC Mac OS X machines,
183 but they are also fairly incomplete.
184 The x86 target is the most mature; initial PowerPC support
185 exists; and other targets are unimplemented.
186 The debuggers can only inspect, not manipulate, target processes.
187 Support for operating system threads and for 64-bit architectures
188 needs to be rethought.
189 On x86 Linux systems,
193 can be relied upon to produce reasonable stack traces
194 (often in cases when GNU
197 and dump data structures,
198 but that it is the extent to which they have been developed and exercised.
200 The vast majority of the familiar Plan 9 programs
201 have been ported, including the Unicode-aware
204 Of the more recent additions to Plan 9,
207 client has been ported, though
219 A backup system providing a dump file system built atop Venti
221 .SS Porting to new systems
222 Porting the tree to new operating systems or architectures
223 should be straightforward, as system-specific code has been
225 The largest pieces of system-specific code are
227 which must include the right system files and
228 set up the right integer type definitions,
231 which must implement spin locks, operating system thread
232 creation, and context switching routines.
233 Portable implementations of these using
237 already exist. If your system supports them, you may not
238 need to write any system specific code at all.
240 There are other smaller system dependencies,
241 such as the terminal handling code in
243 and the implementation of
245 but these are usually simple and are not on the critical
246 path for getting the system up and running.
248 The rest of this manual describes Plan 9 from User Space.
249 Many of the man pages have been brought from Plan 9,
250 but they have been updated, and others have been written from scratch.
252 The manual pages are in a Unix style tree, with names like
253 .B $PLAN9/man/man1/cat.1
254 instead of Plan 9's simpler
255 .BR $PLAN9/man/1/cat ,
258 utility can handle it.
259 Some systems, for example Debian Linux,
260 deduce the man page locations from the search path, so that
263 to your path is sufficient to cause
265 to be consulted for manual pages using the system
267 On other systems, or to look at manual pages with the
268 same name as a system page,
276 The manual sections follow the Unix numbering conventions,
279 .HR ../man1 "Section (1)
280 describes general publicly accessible commands.
282 .HR ../man3 "Section (3)
283 describes C library functions.
285 .HR ../man4 "Section (4)
286 describes user-level file servers.
288 .HR ../man7 "Section (7)
289 describes file formats and protocols.
290 (On Unix, section (5) is technically for file formats but
291 seems now to be used for describing specific files.)
293 .\" Section (8) describes commands used for system administration.
295 .HR ../man9 "Section (9p)
296 describes the Plan 9 file protocol 9P.
298 These pages describe parts of the system
299 that are new or different from Plan 9 from Bell Labs:
332 .IR post9pservice (3),
346 In Plan 9, a program's exit status is an arbitrary text string,
347 while on Unix it is an integer.
348 Section (1) of this manual describes commands as though they
349 exit with string statuses. In fact, exiting with an empty status
350 corresponds to exiting with status 0,
351 and exiting with any non-empty string corresponds to exiting with status 1.