summaryrefslogtreecommitdiff
path: root/src/conn-tools/s6-tcpserver6d.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-09-11 06:24:20 +0000
committerLaurent Bercot <ska@appnovation.com>2023-09-11 06:24:20 +0000
commit16edfb1a2bd0b7fa793618b8e5953e92e253a955 (patch)
treea959f35c9141048a7058019cce8c8563d693c7fe /src/conn-tools/s6-tcpserver6d.c
parent0734bbc08aa726cc371f8c0bf5e6aadce2825245 (diff)
downloads6-networking-16edfb1a2bd0b7fa793618b8e5953e92e253a955.tar.xz
Remove s6-tcpserver?d dependency on libs6
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/conn-tools/s6-tcpserver6d.c')
-rw-r--r--src/conn-tools/s6-tcpserver6d.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/conn-tools/s6-tcpserver6d.c b/src/conn-tools/s6-tcpserver6d.c
index e3c66bd..4168d91 100644
--- a/src/conn-tools/s6-tcpserver6d.c
+++ b/src/conn-tools/s6-tcpserver6d.c
@@ -16,14 +16,13 @@
#include <skalibs/strerr.h>
#include <skalibs/fmtscan.h>
#include <skalibs/env.h>
+#include <skalibs/cspawn.h>
#include <skalibs/djbunix.h>
#include <skalibs/sig.h>
#include <skalibs/selfpipe.h>
#include <skalibs/iopause.h>
#include <skalibs/socket.h>
-#include <s6/ucspiserver.h>
-
#define ABSOLUTE_MAXCONN 16384
#define USAGE "s6-tcpserver6d [ -v verbosity ] [ -1 ] [ -c maxconn ] [ -C localmaxconn ] prog..."
@@ -230,7 +229,16 @@ static inline void new_connection (int s, char const *ip, uint16_t port, char co
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]) ;