s6

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

s6-ipcserver-socketbinder.html (3817B)


      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-ipcserver-socketbinder program</title>
      7     <meta name="Description" content="s6: the s6-ipcserver-socketbinder program" />
      8     <meta name="Keywords" content="s6 s6-ipcserver-socketbinder ipcserver ucspi socket bind listen" />
      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-ipcserver-socketbinder</tt> program </h1>
     20 
     21 <p>
     22 <tt>s6-ipcserver-socketbinder</tt> binds a Unix domain
     23 socket, then executes a program.
     24 </p>
     25 
     26 <h2> Interface </h2>
     27 
     28 <pre>
     29      s6-ipcserver-socketbinder [ -d | -D ] [ -b <em>backlog</em> ] [ -M | -m ] [ -a <em>perms</em> ] [ -B ] <em>path</em> <em>prog...</em>
     30 </pre>
     31 
     32 <ul>
     33  <li> s6-ipcserver-socketbinder creates a Unix domain socket
     34 and binds it to <em>path</em>. It prepares the socket to accept
     35 connections by calling
     36 <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html">listen()</a>. </li>
     37  <li> It then execs into <em>prog...</em> with the open socket
     38 as its standard input. </li>
     39 </ul>
     40 
     41 <h2> Options </h2>
     42 
     43 <ul>
     44  <li> <tt>-d</tt>&nbsp;: allow instant rebinding to the same path
     45 even if it has been used not long ago - this is the SO_REUSEADDR flag to
     46 <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html">setsockopt()</a>
     47 and is generally used with server programs. This is the default. Note that
     48 <em>path</em> will be deleted if it already exists at program start time. </li>
     49  <li> <tt>-D</tt>&nbsp;: disallow instant rebinding to the same path. </li>
     50  <li> <tt>-b&nbsp;<em>backlog</em></tt>&nbsp;: set a maximum of
     51 <em>backlog</em> backlog connections on the socket - extra
     52 connection attempts will rejected by the kernel. The default is SOMAXCONN,
     53 i.e. the maximum number allowed by the system. If <em>backlog</em>
     54 is 0, then the socket will be created, but it <strong>will not be
     55 listening</strong>. </li>
     56  <li> <tt>-M</tt>&nbsp;: the type of the socket will be SOCK_STREAM. This is
     57 the default. </li>
     58  <li> <tt>-m</tt>&nbsp;: the type of the socket will be SOCK_DGRAM. Note
     59 that by default SOCK_DGRAM sockets are not connection-mode, and <tt>listen()</tt>
     60 will fail - so you should always give the <tt>-b0</tt> option to
     61 s6-ipcserver-socketbinder along with <tt>-m</tt>. </li>
     62  <li> <tt>-a&nbsp;<em>perms</em></tt>&nbsp;: create the socket with
     63 permissions <em>perms</em>, which is an octal number from 0000 to 0777.
     64 Default is 0777, meaning everyone can connect to it. 0700 means only processes having the
     65 same uid as the s6-ipcserver-socketbinder process can connect to it. </li>
     66  <li> <tt>-B</tt>&nbsp;: the socket will be blocking. The default is nonblocking. </li>
     67 </ul>
     68 
     69 <h2> Notes </h2>
     70 
     71 <ul>
     72  <li> The socket is provided <strong>non-blocking by default</strong>. </li>
     73  <li> s6-ipcserver-socketbinder is part of a set of basic blocks used to
     74 build a flexible Unix super-server. It normally should be given a
     75 command line crafted to make it execute into
     76 <a href="s6-ipcserverd.html">s6-ipcserverd</a> to accept connections
     77 from clients, or into a program such as
     78 <a href="s6-applyuidgid.html">s6-applyuidgid</a>
     79 to drop privileges before doing so. </li>
     80  <li> The <a href="s6-ipcserver.html">s6-ipcserver</a> program does
     81 exactly this. It implements
     82 a full Unix super-server by building a command line starting with
     83 s6-ipcserver-socketbinder and ending with s6-ipcserverd followed by the
     84 application program, and executing into it. </li>
     85 </ul>
     86 
     87 </body>
     88 </html>