blob: 4d5c80c14bad201371a5ec3054769d9760757377 (
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
|
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="dark light" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en" />
<title>s6: the s6-ftrigrd program</title>
<meta name="Description" content="s6: the s6-ftrigrd program" />
<meta name="Keywords" content="s6 command s6-ftrigrd program internal libexec fifodir regexp subscribe notification listener" />
<!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
</head>
<body>
<p>
<a href="index.html">libs6</a><br />
<a href="../">s6</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>
<h1> The s6-ftrigrd internal program </h1>
<p>
s6-ftrigrd is a helper program that manages a set of subscriptions to fifodirs as well
as regular expressions on events. It takes orders from its client program that controls
it via the <a href="ftrigr.html">ftrigr library</a>, and notifies it when desired
events happen.
</p>
<h2> Interface </h2>
<p>
s6-ftrigrd is not meant to be called directly. When the client calls
<tt>ftrigr_start()</tt> or <tt>ftrigr_startf()</tt>, it spawns an instance of
s6-ftrigrd as a child. s6-ftrigrd's stdin is a pipe reading from the client; its
stdout is a pipe writing to the client; its stderr is the same as the client's; and
there's an additional pipe from s6-ftrigrd to the client, used for asynchronous
notifications.
</p>
<p> When the client uses <tt>ftrigr_end()</tt>, or closes s6-ftrigrd's stdin in
any way, s6-ftrigrd exits 0.
</p>
<p>
s6-ftrigrd handles the grunt work of creating fifos in a
<a href="../fifodir.html">fifodir</a> for a subscriber. It also wakes up on every
event, and compares the chain of events it received on a given fifodir with the
client-provided regexp. If the chain of events matches the regexp, it notifies
the client.
</p>
<h2> Notes </h2>
<p>
The connection management between the client and s6-ftrigrd is entirely done
by the <em>sassclient</em> library from skalibs.
</p>
<p>
s6-ftrigrd is entirely asynchronous. It stores unread notifications into heap
memory; it can grow in size if there are a lot of events and the client fails
to read them. To avoid uncontrolled growth, make sure your client calls
<tt>ftrigr_update()</tt> as soon as <tt>ftrigr_fd()</tt> becomes readable.
</p>
<p>
The number of concurrent subscriptions that an s6-ftrigrd instance can handle is
only limited by RAM and open file descriptors. It is likely that the latter is the
bottleneck: s6-ftrigrd uses two file descriptors per fifodir. With a default
limit of 1024 open file descriptors per process, it means that s6-ftrigrd can
handle around 500 concurrent fifodirs, which is reasonable for most systems, but
make sure to increase the open files resource limit before starting an ftrigr
session if you need more.
</p>
</body>
</html>
|