Blob


1 <head>
2 <title>intro(4) - Plan 9 from User Space</title>
3 <meta content="text/html; charset=utf-8" http-equiv=Content-Type>
4 </head>
5 <body bgcolor=#ffffff>
6 <table border=0 cellpadding=0 cellspacing=0 width=100%>
7 <tr height=10><td>
8 <tr><td width=20><td>
9 <tr><td width=20><td><b>INTRO(4)</b><td align=right><b>INTRO(4)</b>
10 <tr><td width=20><td colspan=2>
11 <br>
12 <p><font size=+1><b>NAME </b></font><br>
14 <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
16 intro &ndash; introduction to file servers<br>
18 </table>
19 <p><font size=+1><b>DESCRIPTION </b></font><br>
21 <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
23 A Plan 9 <i>file server</i> provides a file tree to processes. This section
24 of the manual describes servers that can be mounted in a name
25 space to give a file-like interface to interesting services. A
26 file server may be a provider of a conventional file system, with
27 files maintained on permanent storage, or it may also be a process
28 that synthesizes files in some manner.
29 <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
31 In Plan 9, the kernel mount device <i>mnt</i>(3) acts as a client to
32 the 9P servers mounted in the current name space, translating
33 system calls such as <a href="../man2/open.html"><i>open</i>(2)</a> into 9P transactions such as <i>open</i>(9p).
34 The kernel also multiplexes the potentially many processes onto
35 a single 9P conversation with each server. Finally, the kernel
36 provides each process with its own private <i>name space</i> which it
37 can customize at will. Modern Unix systems do not provide these
38 niceties, so the Unix port of these Plan 9 file servers provides
39 them via other means.
40 <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
42 On Unix, 9P clients do not access servers via the traditional
43 file system call interface. Only the Unix name space can be accessed
44 that way. Instead, 9P clients use the <a href="../man3/9pclient.html"><i>9pclient</i>(3)</a> library to connect
45 and interact directly with particular 9P servers. The <a href="../man1/9p.html"><i>9p</i>(1)</a> command-line
46 client is useful for interactive use and in shell
47 scripts.
48 <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
50 To preserve the fa&ccedil;ade of a single 9P conversation with each server,
51 9P servers invoke <a href="../man4/9pserve.html"><i>9pserve</i>(4)</a>, typically via <a href="../man3/post9pservice.html"><i>post9pservice</i>(3)</a>.
52 <i>9pserve</i> announces a 9P service at a particular network address
53 and multiplexes the clients that connect to that address onto
54 a single 9P conversation with the server.
55 <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
57 Each ported program operates in a pseudo-name space that determines
58 which 9P servers it is using. The name space of a ported program
59 is represented by a directory containing Unix domain sockets,
60 one for each 9P server. The directory defaults to <tt><font size=+1>/tmp/ns.$USER.$DISPLAY</font></tt>,
61 meaning that all programs in an X
62 Windows login session share a single name space. Setting the <tt><font size=+1>$NAMESPACE</font></tt>
63 environment variable overrides this default. The <a href="../man1/namespace.html"><i>namespace</i>(1)</a>
64 command prints the current name space directory.
65 <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
67 Occasionally it is useful to be able to connect the input or output
68 of a standard Unix program to a file served by a 9P server. The
69 new <i>openfd</i>(9p) 9P transaction, which depends on file descriptor
70 passing, provides a sufficient workaround in many cases. <i>9pserve</i>&#8217;s
71 implementation of <i>openfd</i> (see also <i>fsopenfd</i> in
72 <a href="../man3/9pclient.html"><i>9pclient</i>(3)</a>) returns the read or write end of a pipe; a helper
73 process transfers data between the other end of the pipe and the
74 9P server. Note that since the data is being transferred via a
75 pipe, 9P read and write errors cannot be passed on to the Unix
76 program. The Unix program sees only end-of-file or a closed pipe.
78 </table>
80 <td width=20>
81 <tr height=20><td>
82 </table>
83 <!-- TRAILER -->
84 <table border=0 cellpadding=0 cellspacing=0 width=100%>
85 <tr height=15><td width=10><td><td width=10>
86 <tr><td><td>
87 <center>
88 <a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
89 </center>
90 </table>
91 <!-- TRAILER -->
92 </body></html>