aboutsummaryrefslogtreecommitdiff
path: root/man/man4/intro.html
blob: ec2409c0726863877bb32814d6d72d47d955a8c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<head>
<title>intro(4) - Plan 9 from User Space</title>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
</head>
<body bgcolor=#ffffff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=10><td>
<tr><td width=20><td>
<tr><td width=20><td><b>INTRO(4)</b><td align=right><b>INTRO(4)</b>
<tr><td width=20><td colspan=2>
    <br>
<p><font size=+1><b>NAME     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    intro &ndash; introduction to file servers<br>
    
</table>
<p><font size=+1><b>DESCRIPTION     </b></font><br>

<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>

    A Plan 9 <i>file server</i> provides a file tree to processes. This section
    of the manual describes servers that can be mounted in a name
    space to give a file-like interface to interesting services. A
    file server may be a provider of a conventional file system, with
    files maintained on permanent storage, or it may also be a process
    that synthesizes files in some manner. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    In Plan 9, the kernel mount device <i>mnt</i>(3) acts as a client to
    the 9P servers mounted in the current name space, translating
    system calls such as <a href="../man2/open.html"><i>open</i>(2)</a> into 9P transactions such as <i>open</i>(9p).
    The kernel also multiplexes the potentially many processes onto
    a single 9P conversation with each server. Finally, the kernel
    provides each process with its own private <i>name space</i> which it
    can customize at will. Modern Unix systems do not provide these
    niceties, so the Unix port of these Plan 9 file servers provides
    them via other means. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    On Unix, 9P clients do not access servers via the traditional
    file system call interface. Only the Unix name space can be accessed
    that way. Instead, 9P clients use the <a href="../man3/9pclient.html"><i>9pclient</i>(3)</a> library to connect
    and interact directly with particular 9P servers. The <a href="../man1/9p.html"><i>9p</i>(1)</a> command-line
    client is useful for interactive use and in shell
    scripts. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    To preserve the fa&ccedil;ade of a single 9P conversation with each server,
    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>.
    <i>9pserve</i> announces a 9P service at a particular network address
    and multiplexes the clients that connect to that address onto
    a single 9P conversation with the server. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    Each ported program operates in a pseudo-name space that determines
    which 9P servers it is using. The name space of a ported program
    is represented by a directory containing Unix domain sockets,
    one for each 9P server. The directory defaults to <tt><font size=+1>/tmp/ns.$USER.$DISPLAY</font></tt>,
    meaning that all programs in an X
    Windows login session share a single name space. Setting the <tt><font size=+1>$NAMESPACE</font></tt>
    environment variable overrides this default. The <a href="../man1/namespace.html"><i>namespace</i>(1)</a>
    command prints the current name space directory. 
    <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
    
    Occasionally it is useful to be able to connect the input or output
    of a standard Unix program to a file served by a 9P server. The
    new <i>openfd</i>(9p) 9P transaction, which depends on file descriptor
    passing, provides a sufficient workaround in many cases. <i>9pserve</i>&#8217;s
    implementation of <i>openfd</i> (see also <i>fsopenfd</i> in
    <a href="../man3/9pclient.html"><i>9pclient</i>(3)</a>) returns the read or write end of a pipe; a helper
    process transfers data between the other end of the pipe and the
    9P server. Note that since the data is being transferred via a
    pipe, 9P read and write errors cannot be passed on to the Unix
    program. The Unix program sees only end-of-file or a closed pipe.
    
</table>

<td width=20>
<tr height=20><td>
</table>
<!-- TRAILER -->
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=15><td width=10><td><td width=10>
<tr><td><td>
<center>
<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
</center>
</table>
<!-- TRAILER -->
</body></html>