diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2015-01-15 20:51:39 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2015-01-15 20:51:39 +0000 |
commit | ebfd0ba17e0d4b220725018d16e294e8e22a1745 (patch) | |
tree | 4b29683050ce9e8f24f1920f1be38b2f837ef5ad /src/conn-tools/s6-ipcserver-socketbinder.c | |
parent | 20c7d8e1b328155145ce9e8648435e127b60c208 (diff) | |
download | s6-networking-ebfd0ba17e0d4b220725018d16e294e8e22a1745.tar.xz |
Move Unix domain socket and access control stuff to s6.
Move seekablepipe to s6-portable-utils.
Version: 2.0.1.0, release candidate
Diffstat (limited to 'src/conn-tools/s6-ipcserver-socketbinder.c')
-rw-r--r-- | src/conn-tools/s6-ipcserver-socketbinder.c | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/conn-tools/s6-ipcserver-socketbinder.c b/src/conn-tools/s6-ipcserver-socketbinder.c deleted file mode 100644 index b5a32f3..0000000 --- a/src/conn-tools/s6-ipcserver-socketbinder.c +++ /dev/null @@ -1,49 +0,0 @@ -/* ISC license. */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <skalibs/uint.h> -#include <skalibs/sgetopt.h> -#include <skalibs/strerr2.h> -#include <skalibs/djbunix.h> -#include <skalibs/webipc.h> - -#define USAGE "s6-ipcserver-socketbinder [ -d | -D ] [ -b backlog ] path prog..." -#define dieusage() strerr_dieusage(100, USAGE) - -int main (int argc, char const *const *argv, char const *const *envp) -{ - unsigned int backlog = 20 ; - int flagreuse = 1 ; - PROG = "s6-ipcserver-socketbinder" ; - { - subgetopt_t l = SUBGETOPT_ZERO ; - for (;;) - { - register int opt = subgetopt_r(argc, argv, "Ddb:", &l) ; - if (opt == -1) break ; - switch (opt) - { - case 'D' : flagreuse = 0 ; break ; - case 'd' : flagreuse = 1 ; break ; - case 'b' : if (!uint0_scan(l.arg, &backlog)) dieusage() ; break ; - default : dieusage() ; - } - } - argc -= l.ind ; argv += l.ind ; - } - if (argc < 2) dieusage() ; - close(0) ; - if (ipc_stream()) strerr_diefu1sys(111, "create socket") ; - { - mode_t m = umask(0) ; - if ((flagreuse ? ipc_bind_reuse(0, argv[0]) : ipc_bind(0, argv[0])) < 0) - strerr_diefu2sys(111, "bind to ", argv[0]) ; - umask(m) ; - } - if (ipc_listen(0, backlog) < 0) strerr_diefu2sys(111, "listen to ", argv[0]) ; - - pathexec_run(argv[1], argv + 1, envp) ; - strerr_dieexec(111, argv[1]) ; -} |