From 07491df186d562d0efa6a7fca2b7f8d07dbd0652 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 23 Dec 2019 13:05:25 +0000 Subject: 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. --- src/supervision/deps-exe/s6-svlisten | 2 +- src/supervision/s6-notifyoncheck.c | 33 +++++++++++++++++++++++---------- src/supervision/s6-svlisten.c | 7 ++++--- 3 files changed, 28 insertions(+), 14 deletions(-) (limited to 'src/supervision') 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 #include #include + #include #include #include @@ -15,11 +16,18 @@ #include #include #include -#include -#include -#include +#include + +#ifdef S6_USE_EXECLINE +#include #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 + #include #include #include #include #include #include -#include + +#include #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) -- cgit v1.2.3