Blame


1 058b0118 2005-01-03 devnull .TH INTRO 4
2 058b0118 2005-01-03 devnull .SH NAME
3 058b0118 2005-01-03 devnull intro \- introduction to file servers
4 058b0118 2005-01-03 devnull .SH DESCRIPTION
5 058b0118 2005-01-03 devnull A Plan 9
6 058b0118 2005-01-03 devnull .I "file server"
7 058b0118 2005-01-03 devnull provides a file tree to processes.
8 058b0118 2005-01-03 devnull This section of the manual describes servers that can be
9 058b0118 2005-01-03 devnull mounted in a name space to give a file-like interface to interesting services.
10 058b0118 2005-01-03 devnull A file server may be a provider of a conventional file system,
11 058b0118 2005-01-03 devnull with files maintained on permanent storage,
12 058b0118 2005-01-03 devnull or it may also be a process that synthesizes files in some manner.
13 058b0118 2005-01-03 devnull .PP
14 058b0118 2005-01-03 devnull In Plan 9, the kernel mount device
15 058b0118 2005-01-03 devnull \fImnt\fR(3)
16 058b0118 2005-01-03 devnull acts as a client to the 9P servers mounted in the current name space,
17 058b0118 2005-01-03 devnull translating system calls such as
18 d32deab1 2020-08-16 rsc .MR open (2)
19 058b0118 2005-01-03 devnull into 9P transactions such as
20 058b0118 2005-01-03 devnull .IR open (9p).
21 058b0118 2005-01-03 devnull The kernel also multiplexes the potentially many processes onto a single 9P conversation
22 058b0118 2005-01-03 devnull with each server.
23 058b0118 2005-01-03 devnull Finally, the kernel provides each process with its own private
24 058b0118 2005-01-03 devnull .I name space
25 058b0118 2005-01-03 devnull which it can customize at will.
26 058b0118 2005-01-03 devnull Modern Unix systems do not provide these niceties, so
27 058b0118 2005-01-03 devnull the Unix port of these Plan 9 file servers provides them via other means.
28 058b0118 2005-01-03 devnull .PP
29 058b0118 2005-01-03 devnull On Unix, 9P clients do not access servers via the traditional
30 058b0118 2005-01-03 devnull file system call interface. Only the Unix name space can be accessed
31 058b0118 2005-01-03 devnull that way.
32 058b0118 2005-01-03 devnull Instead, 9P clients use the
33 d32deab1 2020-08-16 rsc .MR 9pclient (3)
34 058b0118 2005-01-03 devnull library to connect and interact directly with particular 9P servers.
35 058b0118 2005-01-03 devnull The
36 d32deab1 2020-08-16 rsc .MR 9p (1)
37 058b0118 2005-01-03 devnull command-line client is useful for interactive use and in shell scripts.
38 058b0118 2005-01-03 devnull .PP
39 058b0118 2005-01-03 devnull To preserve the façade of a single 9P conversation with each server,
40 058b0118 2005-01-03 devnull 9P servers invoke
41 d32deab1 2020-08-16 rsc .MR 9pserve (4) ,
42 058b0118 2005-01-03 devnull typically via
43 d32deab1 2020-08-16 rsc .MR post9pservice (3) .
44 058b0118 2005-01-03 devnull .I 9pserve
45 058b0118 2005-01-03 devnull announces a 9P service at a particular
46 058b0118 2005-01-03 devnull network address and multiplexes the clients that connect to
47 058b0118 2005-01-03 devnull that address onto a single 9P conversation with the server.
48 058b0118 2005-01-03 devnull .PP
49 058b0118 2005-01-03 devnull Each ported program operates in a pseudo-name space
50 058b0118 2005-01-03 devnull that determines which 9P servers it is using.
51 058b0118 2005-01-03 devnull The name space of a ported program is represented by a
52 058b0118 2005-01-03 devnull directory containing Unix domain sockets, one for each 9P server.
53 058b0118 2005-01-03 devnull The directory defaults to
54 058b0118 2005-01-03 devnull .BR /tmp/ns.$USER.$DISPLAY ,
55 058b0118 2005-01-03 devnull meaning that all programs in an X Windows login session
56 058b0118 2005-01-03 devnull share a single name space.
57 058b0118 2005-01-03 devnull Setting the
58 058b0118 2005-01-03 devnull .B $NAMESPACE
59 058b0118 2005-01-03 devnull environment variable overrides this default.
60 058b0118 2005-01-03 devnull The
61 d32deab1 2020-08-16 rsc .MR namespace (1)
62 058b0118 2005-01-03 devnull command prints the current name space directory.
63 058b0118 2005-01-03 devnull .PP
64 058b0118 2005-01-03 devnull Occasionally it is useful to be able to connect the input or output
65 058b0118 2005-01-03 devnull of a standard Unix program to a file served by a 9P server.
66 058b0118 2005-01-03 devnull The new
67 058b0118 2005-01-03 devnull .IR openfd (9p)
68 058b0118 2005-01-03 devnull 9P transaction, which depends on file descriptor passing,
69 058b0118 2005-01-03 devnull provides a sufficient workaround in many cases.
70 058b0118 2005-01-03 devnull .IR 9pserve 's
71 058b0118 2005-01-03 devnull implementation of
72 058b0118 2005-01-03 devnull .I openfd
73 058b0118 2005-01-03 devnull (see also
74 058b0118 2005-01-03 devnull .I fsopenfd
75 058b0118 2005-01-03 devnull in
76 d32deab1 2020-08-16 rsc .MR 9pclient (3) )
77 058b0118 2005-01-03 devnull returns the read or write end of a pipe;
78 058b0118 2005-01-03 devnull a helper process transfers data between the other end of the pipe
79 058b0118 2005-01-03 devnull and the 9P server.
80 058b0118 2005-01-03 devnull Note that since the data is being transferred via a pipe,
81 058b0118 2005-01-03 devnull 9P read and write errors cannot be passed on to the Unix program.
82 058b0118 2005-01-03 devnull The Unix program sees only end-of-file or a closed pipe.