s6

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

s6-fdholder-store.html (3822B)


      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-fdholder-store program</title>
      7     <meta name="Description" content="s6: the s6-fdholder-store program" />
      8     <meta name="Keywords" content="s6 s6-fdholder fd-holding fd-holder fd storage unix socket activation" />
      9     <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
     10   </head>
     11 <body>
     12 
     13 <p>
     14 <a href="index.html">s6</a><br />
     15 <a href="//skarnet.org/software/">Software</a><br />
     16 <a href="//skarnet.org/">skarnet.org</a>
     17 </p>
     18 
     19 <h1> The <tt>s6-fdholder-store</tt> program </h1>
     20 
     21 <p>
     22 <tt>s6-fdholder-store</tt> connects to a
     23 <a href="s6-fdholderd.html">fd-holding daemon</a> listening on a
     24 Unix domain socket, and gives it a copy of one of its open file
     25 descriptors for the daemon to hold.
     26 </p>
     27 
     28 <h2> Interface </h2>
     29 
     30 <pre>
     31      s6-fdholder-store [ -d <em>fd</em> ] [ -T fdtimeout ] [ -t <em>timeout</em> ] <em>path</em> <em>id</em>
     32 </pre>
     33 
     34 <ul>
     35  <li> <tt>s6-fdholder-store</tt> connects to a
     36 <a href="s6-fdholderd.html">s6-fdholderd</a> server process listening on
     37 <em>path</em>. </li>
     38  <li> It attempts to pass a copy of its standard input, or of its descriptor
     39 <em>fd</em>, to the server, with identifier <em>id</em>. </li>
     40 </ul>
     41 
     42 <h2> Options </h2>
     43 
     44 <ul>
     45  <li> <tt>-d&nbsp;<em>fd</em></tt>&nbsp;: store descriptor number <em>fd</em>.
     46 By default, <em>fd</em> is 0 (i.e. the program's stdin will be stored). </li>
     47  <li> <tt>-T&nbsp;<em>fdtimeout</em></tt>&nbsp;: the descriptor is stored with
     48 an expiration time of <em>fdtimeout</em> milliseconds, which means the
     49 <a href="s6-fdholderd.html">s6-fdholderd</a> daemon will close and get rid of
     50 the descriptor after this time. By default, <em>fdtimeout</em> is 0, which
     51 means infinite - no expiration time. </li>
     52  <li> <tt>-t&nbsp;<em>timeout</em></tt>&nbsp;: if the operation cannot be
     53 processed in <em>timeout</em> milliseconds, then fail with an error message.
     54 Communications with the server should be near-instant, so this option is
     55 only here to protect users against programming errors (connecting to the
     56 wrong socket, for instance). </li>
     57 </ul>
     58 
     59 <h2> Exit codes </h2>                                                       
     60                                                                             
     61 <ul>                                                                        
     62  <li> 0: success. </li>                                                     
     63  <li> 1: the server denied the operation. The meaning of the error messages 
     64 is explained <a href="s6-fdholder-errorcodes.html">here</a>. </li>          
     65  <li> 100: wrong usage. </li>                                               
     66  <li> 111: system call failed - this includes attempting to connect to a    
     67 nonexistent socket, or one where no <a href="s6-fdholderd.html">s6-fdholderd</a>
     68 daemon is listening. </li>                                                      
     69 </ul>                                                                           
     70                                                                                 
     71 <h2> Usage example </h2>
     72 
     73 <pre>
     74    <a href="s6-ipcserver-socketbinder.html">s6-ipcserver-socketbinder</a> /tmp/mysocket s6-fdholder-store /service/fdholderd/s MYSOCKET
     75 </pre>
     76 
     77 <p>
     78  will open a Unix domain socket, bind it to <tt>/tmp/mysocket</tt> and
     79 listen to incoming connections, then give it to a
     80 <a href="s6-fdholderd.html">s6-fdholderd</a> instance listening on
     81 <tt>/service/fdholderd/s</tt>, with no expiration date, with the
     82 "MYSOCKET" identifier. Another program will be able to retrieve the
     83 socket later, using <a href="s6-fdholder-retrieve.html">s6-fdholder-retrieve</a>.
     84 </p>
     85 
     86 </body>
     87 </html>