rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 1 | .TH INTRO 1 |
| 2 | .SH NAME |
| 3 | intro \- introduction to Plan 9 from User Space |
| 4 | .SH DESCRIPTION |
| 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. |
| 12 | .PP |
| 13 | Plan 9 from User Space provides many of the ideas, |
| 14 | applications, and services from Plan 9 |
| 15 | on Unix-like systems. |
| 16 | It runs on |
| 17 | FreeBSD (x86), |
| 18 | Linux (x86 and PowerPC), |
| 19 | Mac OS X (PowerPC), |
| 20 | OpenBSD (x86), |
| 21 | and |
| 22 | SunOS (Sparc). |
| 23 | .SS Commands |
| 24 | Plan 9 from User Space expects its own directory tree, |
| 25 | conventionally |
| 26 | .BR /usr/local/plan9 . |
| 27 | When programs need to access files in the tree, |
| 28 | they expect the |
| 29 | .B $PLAN9 |
| 30 | environment variable |
| 31 | to contain the name of the root of the tree. |
| 32 | See |
rsc | 93aa30a | 2005-01-14 03:27:51 +0000 | [diff] [blame] | 33 | .IR install (1) |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 34 | for details about installation. |
| 35 | .PP |
| 36 | Many of the familiar Unix commands, |
| 37 | for example |
| 38 | .IR cat (1), |
| 39 | .IR ls (1), |
| 40 | and |
| 41 | .IR wc (1), |
| 42 | are present, but in their Plan 9 forms: |
| 43 | .I cat |
rsc | 1ba0524 | 2005-01-14 23:46:18 +0000 | [diff] [blame] | 44 | takes no options, |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 45 | .I ls |
| 46 | does not columnate its output when printing to a terminal, |
| 47 | and |
| 48 | .I wc |
| 49 | counts UTF characters. |
| 50 | In some cases, the differences are quite noticeable: |
| 51 | .IR grep (1) |
| 52 | and |
| 53 | .IR sed (1) |
| 54 | expect Plan 9 regular expressions |
| 55 | (see |
| 56 | .IR regexp (7)), |
| 57 | which are closest to what Unix calls extended regular expressions. |
| 58 | Because of these differences, it is not recommended to put |
| 59 | .B $PLAN9/bin |
| 60 | before the usual system |
| 61 | .B bin |
| 62 | directories in your search path. |
| 63 | Instead, put it at the end of your path and use the |
| 64 | .IR 9 (1) |
| 65 | script when you want to invoke the Plan 9 version of a |
| 66 | traditional Unix command. |
| 67 | .PP |
| 68 | Occasionally the Plan 9 programs have been |
| 69 | changed to adapt to Unix. |
| 70 | .IR Mk (1) |
| 71 | now allows mkfiles to choose their own shell, |
| 72 | and |
| 73 | .IR rc (1) |
| 74 | has a |
| 75 | .I ulimit |
| 76 | builtin and manages |
| 77 | .BR $PATH . |
| 78 | .PP |
| 79 | Many of the graphical programs from Plan 9 are present, |
| 80 | including |
| 81 | .IR sam (1) |
| 82 | and |
| 83 | .IR acme (1). |
| 84 | An X11 window manager |
| 85 | .IR rio (1) |
| 86 | mimics Plan 9's window system, with command windows |
| 87 | implemented by the external program |
| 88 | .IR 9term (1). |
| 89 | Following the style of X Windows, these programs run in new |
| 90 | windows rather than the one in which they are invoked. |
| 91 | They all take a |
| 92 | .B -W |
| 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, |
| 98 | \fRor |
| 99 | \fIxmin\fL,\fIymin\fL,\fIxmax\fL,\fIymax\fR. |
| 100 | .PP |
| 101 | The |
| 102 | .IR plumber (4) |
| 103 | helps to connect the various Plan 9 programs together, |
| 104 | and fittings like |
| 105 | .IR web (1) |
| 106 | connect it to external programs such as web browsers; |
| 107 | one can click on a URL in |
| 108 | .I acme |
| 109 | and see the page load in |
| 110 | .IR Firefox . |
| 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. |
| 116 | .PP |
| 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 |
| 120 | .IR 9pclient (3) |
| 121 | library. |
| 122 | .IR Intro (4) |
| 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. |
| 126 | The |
| 127 | .IR 9p (1) |
| 128 | client can be used in shell scripts or by hand to carry out |
| 129 | simple interactions with servers. |
rsc | 86a1a5e | 2005-07-19 17:58:26 +0000 | [diff] [blame] | 130 | .IR Netfiles (1) |
| 131 | is an experimental client for acme. |
rsc | 93aa30a | 2005-01-14 03:27:51 +0000 | [diff] [blame] | 132 | .SS External databases |
| 133 | Some programs rely on large databases that would be |
| 134 | cumbersome to include in every release. |
| 135 | Scripts are provided that download these databases separately. |
| 136 | These databases can be downloaded separately. |
| 137 | See |
| 138 | .B $PLAN9/dict/README |
| 139 | and |
| 140 | .BR $PLAN9/sky/README . |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 141 | .SS Programming |
| 142 | The shell scripts |
| 143 | .I 9c |
| 144 | and |
| 145 | .I 9l |
| 146 | (see |
| 147 | .IR 9c (1)) |
| 148 | provide a simple interface to the underlying system compiler and linker, |
| 149 | similar to the |
| 150 | .I 2c |
| 151 | and |
| 152 | .I 2l |
| 153 | families on Plan 9. |
| 154 | .I 9c |
| 155 | compiles source files, and |
| 156 | .I 9l |
| 157 | links object files into executables. |
| 158 | When using Plan 9 libraries, |
| 159 | .I 9l |
| 160 | infers the correct set of libraries from the object files, |
| 161 | so that no |
| 162 | .B -l |
| 163 | options are needed. |
| 164 | .PP |
| 165 | The only way to write multithreaded programs is to use the |
| 166 | .IR thread (3) |
| 167 | library. |
| 168 | .IR Rfork (3) |
| 169 | exists but is not as capable as on Plan 9. |
| 170 | There are many unfortunate by necessary preprocessor |
| 171 | diversions to make Plan 9 and Unix libraries coexist. |
| 172 | See |
| 173 | .IR intro (3) |
| 174 | for details. |
| 175 | .PP |
| 176 | The debuggers |
| 177 | .IR acid (1) |
| 178 | and |
| 179 | .IR db (1) |
| 180 | and the debugging library |
| 181 | .IR mach (3) |
| 182 | are works in progress. |
| 183 | They are platform-independent, so that x86 Linux core dumps |
| 184 | can be inspected on PowerPC Mac OS X machines, |
| 185 | but they are also fairly incomplete. |
| 186 | The x86 target is the most mature; initial PowerPC support |
| 187 | exists; and other targets are unimplemented. |
| 188 | The debuggers can only inspect, not manipulate, target processes. |
| 189 | Support for operating system threads and for 64-bit architectures |
| 190 | needs to be rethought. |
| 191 | On x86 Linux systems, |
| 192 | .I acid |
| 193 | and |
| 194 | .I db |
| 195 | can be relied upon to produce reasonable stack traces |
| 196 | (often in cases when GNU |
| 197 | .I gdb |
| 198 | cannot) |
| 199 | and dump data structures, |
| 200 | but that it is the extent to which they have been developed and exercised. |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 201 | .SS Porting programs |
| 202 | The vast majority of the familiar Plan 9 programs |
| 203 | have been ported, including the Unicode-aware |
| 204 | .IR troff (1). |
| 205 | .PP |
| 206 | Of the more recent additions to Plan 9, |
rsc | 26ca53e | 2005-02-14 00:37:51 +0000 | [diff] [blame] | 207 | .IR factotum (4), |
| 208 | .IR secstore (1), |
| 209 | and |
rsc | 86a1a5e | 2005-07-19 17:58:26 +0000 | [diff] [blame] | 210 | .IR secstored (1), |
| 211 | .IR vac (1), |
| 212 | .IR vacfs (4), |
rsc | fdf67c1 | 2005-01-16 23:01:55 +0000 | [diff] [blame] | 213 | and |
rsc | 86a1a5e | 2005-07-19 17:58:26 +0000 | [diff] [blame] | 214 | .IR venti (8) |
| 215 | are all ported. |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 216 | .PP |
| 217 | A backup system providing a dump file system built atop Venti |
rsc | 86a1a5e | 2005-07-19 17:58:26 +0000 | [diff] [blame] | 218 | is in progress; see |
| 219 | .IR vbackup (8). |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 220 | .SS Porting to new systems |
| 221 | Porting the tree to new operating systems or architectures |
| 222 | should be straightforward, as system-specific code has been |
| 223 | kept to a minimum. |
| 224 | The largest pieces of system-specific code are |
| 225 | .BR <u.h> , |
| 226 | which must include the right system files and |
| 227 | set up the right integer type definitions, |
| 228 | and |
| 229 | .IR libthread , |
| 230 | which must implement spin locks, operating system thread |
| 231 | creation, and context switching routines. |
| 232 | Portable implementations of these using |
| 233 | .B <pthread.h> |
| 234 | and |
| 235 | .B <ucontext.h> |
| 236 | already exist. If your system supports them, you may not |
| 237 | need to write any system specific code at all. |
| 238 | .PP |
| 239 | There are other smaller system dependencies, |
| 240 | such as the terminal handling code in |
| 241 | .IR 9term (1) |
| 242 | and the implementation of |
| 243 | .IR getcallerpc (3), |
| 244 | but these are usually simple and are not on the critical |
| 245 | path for getting the system up and running. |
rsc | 93aa30a | 2005-01-14 03:27:51 +0000 | [diff] [blame] | 246 | .SH SEE ALSO |
| 247 | The rest of this manual describes Plan 9 from User Space. |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 248 | Many of the man pages have been brought from Plan 9, |
| 249 | but they have been updated, and others have been written from scratch. |
| 250 | .PP |
| 251 | The manual pages are in a Unix style tree, with names like |
| 252 | .B $PLAN9/man/man1/cat.1 |
| 253 | instead of Plan 9's simpler |
| 254 | .BR $PLAN9/man/1/cat , |
| 255 | so that the Unix |
| 256 | .IR man (1) |
| 257 | utility can handle it. |
| 258 | Some systems, for example Debian Linux, |
| 259 | deduce the man page locations from the search path, so that |
| 260 | adding |
| 261 | .B $PLAN9/bin |
| 262 | to your path is sufficient to cause |
| 263 | .B $PLAN9/man |
| 264 | to be consulted for manual pages using the system |
| 265 | .IR man . |
| 266 | On other systems, or to look at manual pages with the |
| 267 | same name as a system page, |
| 268 | invoke the Plan 9 |
| 269 | .I man |
| 270 | directly, as in |
| 271 | .B 9 |
| 272 | .B man |
| 273 | .BR cat . |
| 274 | .PP |
| 275 | The manual sections follow the Unix numbering conventions, |
| 276 | not the Plan 9 ones. |
| 277 | .PP |
rsc | 93aa30a | 2005-01-14 03:27:51 +0000 | [diff] [blame] | 278 | .HR ../man1 "Section (1) |
| 279 | describes general publicly accessible commands. |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 280 | .PP |
rsc | 93aa30a | 2005-01-14 03:27:51 +0000 | [diff] [blame] | 281 | .HR ../man3 "Section (3) |
| 282 | describes C library functions. |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 283 | .PP |
rsc | 93aa30a | 2005-01-14 03:27:51 +0000 | [diff] [blame] | 284 | .HR ../man4 "Section (4) |
| 285 | describes user-level file servers. |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 286 | .PP |
rsc | 93aa30a | 2005-01-14 03:27:51 +0000 | [diff] [blame] | 287 | .HR ../man7 "Section (7) |
| 288 | describes file formats and protocols. |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 289 | (On Unix, section (5) is technically for file formats but |
| 290 | seems now to be used for describing specific files.) |
rsc | 86a1a5e | 2005-07-19 17:58:26 +0000 | [diff] [blame] | 291 | .PP |
| 292 | .HR ../man8 "Section (8) |
| 293 | describes commands used for system administration. |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 294 | .PP |
rsc | 93aa30a | 2005-01-14 03:27:51 +0000 | [diff] [blame] | 295 | .HR ../man9 "Section (9p) |
| 296 | describes the Plan 9 file protocol 9P. |
rsc | 01cd406 | 2005-01-14 19:43:51 +0000 | [diff] [blame] | 297 | .PP |
| 298 | These pages describe parts of the system |
| 299 | that are new or different from Plan 9 from Bell Labs: |
| 300 | .IP |
| 301 | .IR 9 (1), |
| 302 | .IR 9c (1), |
| 303 | .IR 9p (1), |
| 304 | .IR 9term (1), |
| 305 | .I acidtypes |
| 306 | in |
| 307 | .IR acid (1), |
| 308 | .IR cvs (1), |
| 309 | .IR dial (1), |
| 310 | .IR label (1), |
| 311 | the |
| 312 | .B MKSHELL |
| 313 | variable in |
| 314 | .IR mk (1), |
| 315 | .IR namespace (1), |
rsc | 3aec33f | 2005-07-18 22:41:58 +0000 | [diff] [blame] | 316 | .IR netfiles (1), |
rsc | 01cd406 | 2005-01-14 19:43:51 +0000 | [diff] [blame] | 317 | .IR page (1), |
| 318 | .IR psfonts (1), |
| 319 | .IR rio (1), |
| 320 | .IR web (1), |
| 321 | .IR wintext (1) |
| 322 | .IP |
| 323 | .IR intro (3), |
| 324 | .IR 9pclient (3), |
| 325 | the |
| 326 | .B unix |
| 327 | network in |
| 328 | .IR dial (3), |
| 329 | .IR exits (3), |
| 330 | .IR get9root (3), |
| 331 | .IR getns (3), |
| 332 | .IR notify (3), |
| 333 | .IR post9pservice (3), |
| 334 | .IR rfork (3), |
rsc | de39860 | 2005-01-23 23:19:47 +0000 | [diff] [blame] | 335 | .IR searchpath (3), |
rsc | 01cd406 | 2005-01-14 19:43:51 +0000 | [diff] [blame] | 336 | .IR sendfd (3), |
| 337 | .IR udpread (3), |
rsc | 86a1a5e | 2005-07-19 17:58:26 +0000 | [diff] [blame] | 338 | .IR venti (3), |
rsc | 01cd406 | 2005-01-14 19:43:51 +0000 | [diff] [blame] | 339 | .IR wait (3), |
| 340 | .IR wctl (3) |
| 341 | .IP |
| 342 | .IR intro (4), |
| 343 | .IR 9pserve (4), |
rsc | 86a1a5e | 2005-07-19 17:58:26 +0000 | [diff] [blame] | 344 | .IR import (4), |
| 345 | .IP |
| 346 | .IR vbackup (8) |
rsc | 01cd406 | 2005-01-14 19:43:51 +0000 | [diff] [blame] | 347 | .IP |
| 348 | .IR openfd (9p) |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 349 | .SH DIAGNOSTICS |
| 350 | In Plan 9, a program's exit status is an arbitrary text string, |
| 351 | while on Unix it is an integer. |
| 352 | Section (1) of this manual describes commands as though they |
| 353 | exit with string statuses. In fact, exiting with an empty status |
| 354 | corresponds to exiting with status 0, |
| 355 | and exiting with any non-empty string corresponds to exiting with status 1. |
| 356 | See |
| 357 | .IR exits (3). |