aboutsummaryrefslogtreecommitdiff
path: root/man/man4/plumber.4
blob: c309a39c2696cfb5a8e16fd8d482145413249f8a (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
.TH PLUMBER 4
.SH NAME
plumber \- file system for interprocess messaging
.SH SYNOPSIS
.B plumber
[
.B -f
]
[
.B -p
.I plumbing
]
.SH DESCRIPTION
The
.I plumber
is a user-level file server that receives, examines, rewrites, and dispatches
.MR plumb (7)
messages between programs.
Its behavior is programmed by a
.I plumbing
file (default
.BR $HOME/lib/plumbing )
in the format of
.MR plumb (7) .
.PP
Its services are posted via
.MR 9pserve (4)
as
.BR plumb ,
and consist of two
pre-defined files,
.B plumb/send
and
.BR plumb/rules ,
and a set of output
.I ports
for dispatching messages to applications.
.PP
Programs use
.B fswrite
(see
.MR 9pclient (3) )
to deliver messages to the
.B send
file, and
.I fsread
to receive them from the corresponding port.
For example,
.MR sam (1) 's
.B plumb
menu item or the
.B B
command cause a message to be sent to
.BR plumb/send ;
.B sam
in turn reads from, by convention,
.B plumb/edit
to receive messages about files to open.
.PP
A copy of each message is sent to each client that has the corresponding port open.
If none has it open, and the rule has a
.B plumb
.B client
or
.B plumb
.B start
rule, that rule is applied.
A
.B plumb
.B client
rule causes the specified command to be run
and the message to be held for delivery when the port is opened.
A
.B plumb
.B start
rule runs the command but discards the message.
If neither
.B start
or
.B client
is specified and the port is not open,
the message is discarded and a write error is returned to the sender.
.PP
The set of output ports is determined dynamically by the
specification in the plumbing rules file: a port is created for each unique
destination of a
.B plumb
.B to
rule.
.PP
The set of rules currently active may be examined by reading the file
.BR plumb/rules ;
appending to this file adds new rules to the set, while
creating it (opening it with
.BR OTRUNC )
clears the rule set.
Thus the rule set may be edited dynamically with a traditional text editor.
However, ports are never deleted dynamically; if a new set of rules does not
include a port that was defined in earlier rules, that port will still exist (although
no new messages will be delivered there).
.PP
The
.B -f
option causes the process to run in the foreground.
.SH FILES
.TF $HOME/lib/plumbing
.TP
.B $HOME/lib/plumbing
default rules file
.TP
.B \*9/plumb
directory to search for files in
.B include
statements
.TP
.B plumb
mount name for
.MR plumber (4) .
.SH SOURCE
.B \*9/src/cmd/plumb
.SH "SEE ALSO"
.MR plumb (1) ,
.MR plumb (3) ,
.MR plumb (7)
.\" .SH BUGS
.\" .IR Plumber 's
.\" file name space is fixed, so it is difficult to plumb
.\" messages that involve files in newly mounted services.