diff options
Diffstat (limited to 'src/supervision')
-rw-r--r-- | src/supervision/deps-exe/s6-svlisten | 2 | ||||
-rw-r--r-- | src/supervision/s6-notifyoncheck.c | 33 | ||||
-rw-r--r-- | src/supervision/s6-svlisten.c | 7 |
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) |