commit dd4afee4a8ea8c44126c44b31c6f1a36582d0964
parent fddebb529fb620a9e038340fc554ec2e543802be
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Wed, 9 Dec 2020 18:27:43 +0000
Get rid of webipc.h
Diffstat:
7 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/src/conn-tools/s6-ipcclient.c b/src/conn-tools/s6-ipcclient.c
@@ -5,7 +5,7 @@
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
-#include <skalibs/webipc.h>
+#include <skalibs/socket.h>
#include <skalibs/exec.h>
#define USAGE "s6-ipcclient [ -q | -Q | -v ] [ -p bindpath ] [ -l localname ] path prog..."
diff --git a/src/conn-tools/s6-ipcserver-access.c b/src/conn-tools/s6-ipcserver-access.c
@@ -11,7 +11,7 @@
#include <skalibs/sgetopt.h>
#include <skalibs/cdb.h>
#include <skalibs/djbunix.h>
-#include <skalibs/webipc.h>
+#include <skalibs/socket.h>
#include <skalibs/exec.h>
#include <s6/config.h>
diff --git a/src/conn-tools/s6-ipcserver-socketbinder.c b/src/conn-tools/s6-ipcserver-socketbinder.c
@@ -1,14 +1,15 @@
/* ISC license. */
+#include <skalibs/nonposix.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <unistd.h>
+#include <fcntl.h>
#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
-#include <skalibs/djbunix.h>
-#include <skalibs/webipc.h>
+#include <skalibs/socket.h>
#include <skalibs/exec.h>
#define USAGE "s6-ipcserver-socketbinder [ -d | -D ] [ -b backlog ] [ -M | -m ] [ -a perms ] [ -B ] path prog..."
@@ -19,7 +20,7 @@ int main (int argc, char const *const *argv)
unsigned int backlog = SOMAXCONN ;
int flagreuse = 1 ;
int flagdgram = 0 ;
- int flagblocking = 0 ;
+ unsigned int flags = O_NONBLOCK ;
unsigned int perms = 0777 ;
PROG = "s6-ipcserver-socketbinder" ;
{
@@ -34,7 +35,7 @@ int main (int argc, char const *const *argv)
case 'd' : flagreuse = 1 ; break ;
case 'M' : flagdgram = 0 ; break ;
case 'm' : flagdgram = 1 ; break ;
- case 'B' : flagblocking = 1 ; break ;
+ case 'B' : flags = 0 ; break ;
case 'b' : if (!uint0_scan(l.arg, &backlog)) dieusage() ; break ;
case 'a' : if (!uint0_oscan(l.arg, &perms)) dieusage() ; break ;
default : dieusage() ;
@@ -44,7 +45,7 @@ int main (int argc, char const *const *argv)
}
if (argc < 2) dieusage() ;
close(0) ;
- if (flagdgram ? ipc_datagram_internal(flagblocking ? 0 : DJBUNIX_FLAG_NB) : ipc_stream_internal(flagblocking ? 0 : DJBUNIX_FLAG_NB))
+ if (flagdgram ? ipc_datagram_internal(flags) : ipc_stream_internal(flags))
strerr_diefu1sys(111, "create socket") ;
{
diff --git a/src/conn-tools/s6-ipcserverd.c b/src/conn-tools/s6-ipcserverd.c
@@ -19,7 +19,7 @@
#include <skalibs/sig.h>
#include <skalibs/selfpipe.h>
#include <skalibs/iopause.h>
-#include <skalibs/webipc.h>
+#include <skalibs/socket.h>
#include <skalibs/exec.h>
#define USAGE "s6-ipcserverd [ -v verbosity ] [ -1 ] [ -P | -p ] [ -c maxconn ] [ -C localmaxconn ] prog..."
diff --git a/src/fdholder/s6-fdholderd.c b/src/fdholder/s6-fdholderd.c
@@ -27,11 +27,12 @@
#include <skalibs/selfpipe.h>
#include <skalibs/cdb.h>
#include <skalibs/getpeereid.h>
-#include <skalibs/webipc.h>
+#include <skalibs/socket.h>
#include <skalibs/genset.h>
#include <skalibs/avltreen.h>
#include <skalibs/unixmessage.h>
#include <skalibs/unixconnection.h>
+
#include <s6/accessrules.h>
#include <s6/s6-fdholder.h>
diff --git a/src/libs6/s6_fdholder_start.c b/src/libs6/s6_fdholder_start.c
@@ -1,8 +1,8 @@
/* ISC license. */
#include <skalibs/djbunix.h>
-#include <skalibs/webipc.h>
-#include <skalibs/unixconnection.h>
+#include <skalibs/socket.h>
+
#include <s6/s6-fdholder.h>
int s6_fdholder_start (s6_fdholder_t *a, char const *path, tain_t const *deadline, tain_t *stamp)
diff --git a/src/libs6/s6_supervise_link.c b/src/libs6/s6_supervise_link.c
@@ -68,9 +68,9 @@ int s6_supervise_link (char const *scdir, char const *const *servicedirs, size_t
}
{
+ stralloc lnames = STRALLOC_ZERO ;
ftrigr_t a = FTRIGR_ZERO ;
stralloc rpsa = STRALLOC_ZERO ;
- stralloc lnames = STRALLOC_ZERO ;
gid_t gid = options & 2 ? -1 : getegid() ;
size_t scdirlen = strlen(scdir) ;
size_t prefixlen = strlen(prefix) ;
@@ -91,13 +91,14 @@ int s6_supervise_link (char const *scdir, char const *const *servicedirs, size_t
char *p ;
size_t len = strlen(servicedirs[i]) ;
memcpy(fn, servicedirs[i], len) ;
- memcpy(fn + len, S6_SUPERVISE_EVENTDIR, sizeof(S6_SUPERVISE_EVENTDIR)) ;
+ fn[len] = '/' ;
+ memcpy(fn + len + 1, S6_SUPERVISE_EVENTDIR, sizeof(S6_SUPERVISE_EVENTDIR)) ;
if (!ftrigw_fifodir_make(fn, gid, options & 1)) goto err ;
ids[m] = ftrigr_subscribe(&a, fn, "s", 0, deadline, stamp) ;
if (!ids[m++]) goto err ;
if (bitarray_peek(logged, i))
{
- memcpy(fn + len, "/log/", 5) ;
+ memcpy(fn + len + 1, "log/", 4) ;
memcpy(fn + len + 5, S6_SUPERVISE_EVENTDIR, sizeof(S6_SUPERVISE_EVENTDIR)) ;
if (!ftrigw_fifodir_make(fn, gid, options & 1)) goto err ;
ids[m] = ftrigr_subscribe(&a, fn, "s", 0, deadline, stamp) ;