summaryrefslogtreecommitdiff
path: root/doc/s6-fdholder-store.html
blob: ceff6964a2d8152ab9f2035faddb3b12723c3b88 (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
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>s6: the s6-fdholder-store program</title>
    <meta name="Description" content="s6: the s6-fdholder-store program" />
    <meta name="Keywords" content="s6 s6-fdholder fd-holding fd-holder fd storage unix socket activation" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="index.html">s6</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> The <tt>s6-fdholder-store</tt> program </h1>

<p>
<tt>s6-fdholder-store</tt> connects to a
<a href="s6-fdholderd.html">fd-holding daemon</a> listening on a
Unix domain socket, and gives it a copy of one of its open file
descriptors for the daemon to hold.
</p>

<h2> Interface </h2>

<pre>
     s6-fdholder-store [ -d <em>fd</em> ] [ -T fdtimeout ] [ -t <em>timeout</em> ] <em>path</em> <em>id</em>
</pre>

<ul>
 <li> <tt>s6-fdholder-store</tt> connects to a
<a href="s6-fdholderd.html">s6-fdholderd</a> server process listening on
<em>path</em>. </li>
 <li> It attempts to pass a copy of its standard input, or of its descriptor
<em>fd</em>, to the server, with identifier <em>id</em>. </li>
</ul>

<h2> Options </h2>

<ul>
 <li> <tt>-d&nbsp;<em>fd</em></tt>&nbsp;: store descriptor number <em>fd</em>.
By default, <em>fd</em> is 0 (i.e. the program's stdin will be stored). </li>
 <li> <tt>-T&nbsp;<em>fdtimeout</em></tt>&nbsp;: the descriptor is stored with
an expiration time of <em>fdtimeout</em> milliseconds, which means the
<a href="s6-fdholderd.html">s6-fdholderd</a> daemon will close and get rid of
the descriptor after this time. By default, <em>fdtimeout</em> is 0, which
means infinite - no expiration time. </li>
 <li> <tt>-t&nbsp;<em>timeout</em></tt>&nbsp;: if the operation cannot be
processed in <em>timeout</em> milliseconds, then fail with an error message.
Communications with the server should be near-instant, so this option is
only here to protect users against programming errors (connecting to the
wrong socket, for instance). </li>
</ul>

<h2> Exit codes </h2>                                                       
                                                                            
<ul>                                                                        
 <li> 0: success. </li>                                                     
 <li> 1: the server denied the operation. The meaning of the error messages 
is explained <a href="s6-fdholder-errorcodes.html">here</a>. </li>          
 <li> 100: wrong usage. </li>                                               
 <li> 111: system call failed - this includes attempting to connect to a    
nonexistent socket, or one where no <a href="s6-fdholderd.html">s6-fdholderd</a>
daemon is listening. </li>                                                      
</ul>                                                                           
                                                                                
<h2> Usage example </h2>

<pre>
   <a href="s6-ipcserver-socketbinder.html">s6-ipcserver-socketbinder</a> /tmp/mysocket s6-fdholder-store /service/fdholderd/s MYSOCKET
</pre>

<p>
 will open a Unix domain socket, bind it to <tt>/tmp/mysocket</tt> and
listen to incoming connections, then give it to a
<a href="s6-fdholderd.html">s6-fdholderd</a> instance listening on
<tt>/service/fdholderd/s</tt>, with no expiration date, with the
"MYSOCKET" identifier. Another program will be able to retrieve the
socket later, using <a href="s6-fdholder-retrieve.html">s6-fdholder-retrieve</a>.
</p>

</body>
</html>