s6

Mirror/fork of https://skarnet.org/software/s6/
git clone https://ccx.te2000.cz/git/s6
Log | Files | Refs | README | LICENSE

s6-ftrigrd.html (3040B)


      1 <html>
      2   <head>
      3     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      4     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      5     <meta http-equiv="Content-Language" content="en" />
      6     <title>s6: the s6-ftrigrd program</title>
      7     <meta name="Description" content="s6: the s6-ftrigrd program" />
      8     <meta name="Keywords" content="s6 command s6-ftrigrd program internal libexec fifodir regexp subscribe notification listener" />
      9     <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
     10   </head>
     11 <body>
     12 
     13 <p>
     14 <a href="index.html">libs6</a><br />
     15 <a href="../">s6</a><br />
     16 <a href="//skarnet.org/software/">Software</a><br />
     17 <a href="//skarnet.org/">skarnet.org</a>
     18 </p>
     19 
     20 <h1> The s6-ftrigrd program </h1>
     21 
     22 <p>
     23 s6-ftrigrd is a helper program that manages a set of subscriptions to fifodirs as well
     24 as regular expressions on events. It takes orders from its client program that controls
     25 it via the <a href="ftrigr.html">ftrigr library</a>, and notifies it when desired
     26 events happen.
     27 </p>
     28 
     29 <h2> Interface </h2>
     30 
     31 <p>
     32  s6-ftrigrd is not meant to be called directly.
     33 </p>
     34 
     35 <ul>
     36  <li> If the client program uses <tt>ftrigr_startf()</tt>, it spawns an instance of
     37 s6-ftrigrd as a child. s6-ftrigrd's stdin is a pipe reading from the client; its
     38 stdout is a pipe writing to the client; its stderr is the same as the client's; and
     39 there's an additional pipe from s6-ftrigrd to the client, used for asynchronous
     40 notifications. </li>
     41  <li> If the client program uses <tt>ftrigr_start()</tt>, then it tries to connect
     42 to a Unix domain socket. An ftrigrd <a href="../localservice.html">local service</a> should be listening to that
     43 socket, i.e. a Unix domain super-server such as
     44 <a href="s6-ipcserver.html">s6-ipcserver</a>
     45 spawning an s6-ftrigrd program on every connection. Then an s6-ftrigrd instance is created
     46 for the client. </li>
     47  <li> When the client uses <tt>ftrigr_end()</tt>, or closes s6-ftrigrd's stdin in
     48 any way, s6-ftrigrd exits 0. </li>
     49 </ul>
     50 
     51 <p>
     52  s6-ftrigrd handles the grunt work of creating fifos in a
     53 <a href="../fifodir.html">fifodir</a> for a subscriber. It also wakes up on every
     54 event, and compares the chain of events it received on a given fifodir with the
     55 client-provided regexp. If the chain of events matches the regexp, it notifies
     56 the client.
     57 </p>
     58 
     59 <h2> Notes </h2>
     60 
     61 <p>
     62  The connection management between the client and s6-ftrigrd is entirely done
     63 by the <em>textclient</em> library from skalibs.
     64 </p>
     65 
     66 <p>
     67  s6-ftrigrd is entirely asynchronous. It stores unread notifications into heap
     68 memory; it can grow in size if there are a lot of events and the client fails
     69 to read them. To avoid uncontrolled growth, make sure your client calls
     70 <tt>ftrigr_update()</tt> as soon as <tt>ftrigr_fd()</tt> becomes readable.
     71 </p>
     72 
     73 <p>
     74  An s6-ftrigrd instance can only handle up to FTRIGRD_MAX (defined in <tt>s6/ftrigr.h</tt>)
     75 subscriptions at once. By default, this number is 1000, which is more than enough for
     76 any reasonable system.
     77 </p>
     78 
     79 </body>
     80 </html>