summaryrefslogtreecommitdiff
path: root/src/supervision
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2019-12-23 13:05:25 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2019-12-23 13:05:25 +0000
commit07491df186d562d0efa6a7fca2b7f8d07dbd0652 (patch)
treed66a8709a82b4c621c5f21a7f346362e8a243a3f /src/supervision
parent8bbfc319248c0cbeb57edc45f26d1c972d32f505 (diff)
downloads6-07491df186d562d0efa6a7fca2b7f8d07dbd0652.tar.xz
Make execline dependency optional
This includes: - adding a configure option to disable execline support - duplicating el_semicolon() and el_getstrict() into the s6 library when execline is disabled at build time, making a compat shim and using it where needed (s6-svlisten, s6-ftrig-listen) - Creating alternatives for execlineb script spawning: * s6-log: '?' directive (done in the previous commit) * s6-notifyoncheck: require hardcoding the check in ./data/check * s6-ipcserver-access: no support for exec files, add a warning - Updating the relevant parts of the doc --enable-execline will remain the default, and whiners can choke on their tears.
Diffstat (limited to 'src/supervision')
-rw-r--r--src/supervision/deps-exe/s6-svlisten2
-rw-r--r--src/supervision/s6-notifyoncheck.c33
-rw-r--r--src/supervision/s6-svlisten.c7
3 files changed, 28 insertions, 14 deletions
diff --git a/src/supervision/deps-exe/s6-svlisten b/src/supervision/deps-exe/s6-svlisten
index fd153b3..a7bbbfa 100644
--- a/src/supervision/deps-exe/s6-svlisten
+++ b/src/supervision/deps-exe/s6-svlisten
@@ -1,7 +1,7 @@
s6_svlisten_signal_handler.o
s6_svlisten_loop.o
${LIBS6}
--lexecline
+${LIBEXECLINE}
-lskarnet
${SOCKET_LIB}
${SYSCLOCK_LIB}
diff --git a/src/supervision/s6-notifyoncheck.c b/src/supervision/s6-notifyoncheck.c
index c8a0e19..b1ef96b 100644
--- a/src/supervision/s6-notifyoncheck.c
+++ b/src/supervision/s6-notifyoncheck.c
@@ -6,6 +6,7 @@
#include <fcntl.h>
#include <limits.h>
#include <sys/wait.h>
+
#include <skalibs/types.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/bytestr.h>
@@ -15,11 +16,18 @@
#include <skalibs/djbunix.h>
#include <skalibs/selfpipe.h>
#include <skalibs/iopause.h>
-#include <execline/config.h>
-#include <s6/s6-supervise.h>
-#include <s6/ftrigr.h>
+#include <s6/s6.h>
+
+#ifdef S6_USE_EXECLINE
+#include <execline/config.h>
#define USAGE "s6-notifyoncheck [ -d ] [ -3 fd ] [ -s initialsleep ] [ -T globaltimeout ] [ -t localtimeout ] [ -w waitingtime ] [ -n tries ] [ -c \"checkprog...\" ] prog..."
+#define OPTIONS "d3:s:T:t:w:n:c:"
+#else
+#define USAGE "s6-notifyoncheck [ -d ] [ -3 fd ] [ -s initialsleep ] [ -T globaltimeout ] [ -t localtimeout ] [ -w waitingtime ] [ -n tries ] prog..."
+#define OPTIONS "d3:s:T:t:w:n:"
+#endif
+
#define dieusage() strerr_dieusage(100, USAGE)
@@ -70,13 +78,14 @@ static int handle_event (ftrigr_t *a, uint16_t id, pid_t pid)
return 0 ;
}
-
int main (int argc, char const *const *argv, char const *const *envp)
{
ftrigr_t a = FTRIGR_ZERO ;
iopause_fd x[2] = { { .events = IOPAUSE_READ }, { .events = IOPAUSE_READ } } ;
- char const *childargv[4] = { EXECLINE_EXTBINPREFIX "execlineb", "-Pc", 0, 0 } ;
+ char const *childargv[4] = { "./data/check", 0, 0, 0 } ;
+#ifdef S6_USE_EXECLINE
char const *checkprog = 0 ;
+#endif
unsigned int fd ;
int df = 0 ;
int autodetect = 1 ;
@@ -91,7 +100,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
unsigned int initialsleep = 10, globaltimeout = 0, localtimeout = 0, waitingtime = 1000 ;
for (;;)
{
- int opt = subgetopt_r(argc, argv, "d3:s:T:t:w:n:c:", &l) ;
+ int opt = subgetopt_r(argc, argv, OPTIONS, &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -102,7 +111,9 @@ int main (int argc, char const *const *argv, char const *const *envp)
case 't' : if (!uint0_scan(l.arg, &localtimeout)) dieusage() ; break ;
case 'w' : if (!uint0_scan(l.arg, &waitingtime)) dieusage() ; break ;
case 'n' : if (!uint0_scan(l.arg, &tries)) dieusage() ; break ;
+#ifdef S6_USE_EXECLINE
case 'c' : checkprog = l.arg ; break ;
+#endif
default : dieusage() ;
}
}
@@ -124,12 +135,14 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (r < 0) strerr_diefu1sys(111, "sanity-check current service directory") ;
if (!r) strerr_dief1x(100, "s6-supervise not running.") ;
}
- if (checkprog) childargv[2] = checkprog ;
- else
+#ifdef S6_USE_EXECLINE
+ if (checkprog)
{
- childargv[0] = "./data/check" ;
- childargv[1] = 0 ;
+ childargv[0] = EXECLINE_EXTBINPREFIX "execlineb" ;
+ childargv[1] = "-Pc" ;
+ childargv[2] = checkprog ;
}
+#endif
if (autodetect)
{
diff --git a/src/supervision/s6-svlisten.c b/src/supervision/s6-svlisten.c
index c8af1f4..1364b44 100644
--- a/src/supervision/s6-svlisten.c
+++ b/src/supervision/s6-svlisten.c
@@ -1,13 +1,15 @@
/* ISC license. */
#include <stdint.h>
+
#include <skalibs/sgetopt.h>
#include <skalibs/types.h>
#include <skalibs/bitarray.h>
#include <skalibs/tai.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
-#include <execline/execline.h>
+
+#include <s6/compat.h>
#include "s6-svlisten.h"
#define USAGE "s6-svlisten [ -U | -u | -d | -D | -r | -R ] [ -a | -o ] [ -t timeout ] servicedir... \"\" prog..."
@@ -46,8 +48,7 @@ int main (int argc, char const **argv, char const *const *envp)
if (t) tain_from_millisecs(&tto, t) ; else tto = tain_infinite_relative ;
}
if (argc < 3) dieusage() ;
-
- argc1 = el_semicolon(argv) ;
+ argc1 = s6_el_semicolon(argv) ;
if (!argc1 || argc == argc1 + 1) dieusage() ;
if (argc1 >= argc) strerr_dief1x(100, "unterminated servicedir block") ;
if (wantrestart && or)