summaryrefslogtreecommitdiff
path: root/src/conn-tools/s6-tcpserver4d.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conn-tools/s6-tcpserver4d.c')
-rw-r--r--src/conn-tools/s6-tcpserver4d.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/conn-tools/s6-tcpserver4d.c b/src/conn-tools/s6-tcpserver4d.c
index 8dd6614..5982816 100644
--- a/src/conn-tools/s6-tcpserver4d.c
+++ b/src/conn-tools/s6-tcpserver4d.c
@@ -19,6 +19,7 @@
#include <skalibs/fmtscan.h>
#include <skalibs/diuint32.h>
#include <skalibs/env.h>
+#include <skalibs/cspawn.h>
#include <skalibs/djbunix.h>
#include <skalibs/sig.h>
#include <skalibs/selfpipe.h>
@@ -27,8 +28,6 @@
#include <skalibs/genset.h>
#include <skalibs/avltreen.h>
-#include <s6/ucspiserver.h>
-
#define ABSOLUTE_MAXCONN 16384
#define USAGE "s6-tcpserver4d [ -v verbosity ] [ -1 ] [ -c maxconn ] [ -C localmaxconn ] prog..."
@@ -257,7 +256,16 @@ static inline void new_connection (int s, uint32_t ip, uint16_t port, char const
memcpy(fmt + m, "TCPCONNNUM=", 11) ; m += 11 ;
m += uint_fmt(fmt + m, num) ; fmt[m++] = 0 ;
- pid = s6_ucspiserver_spawn(s, argv, envp, envlen, fmt, m, 4) ;
+ {
+ cspawn_fileaction fa[2] =
+ {
+ [0] = { .type = CSPAWN_FA_MOVE, .x = { .fd2 = { [0] = 0, [1] = s } } },
+ [1] = { .type = CSPAWN_FA_COPY, .x = { .fd2 = { [0] = 1, [1] = 0 } } }
+ } ;
+ char const *newenvp[envlen + 5] ;
+ env_mergen(newenvp, envlen + 5, envp, envlen, fmt, m, 4) ;
+ pid = cspawn(argv[0], argv, newenvp, CSPAWN_FLAGS_SELFPIPE_FINISH, fa, 2) ;
+ }
if (!pid)
{
if (verbosity) strerr_warnwu2sys("spawn ", argv[0]) ;