From 8bbfc319248c0cbeb57edc45f26d1c972d32f505 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 23 Dec 2019 11:48:48 +0000 Subject: Add ?processor support to s6-log --- doc/s6-log.html | 5 +++++ src/daemontools-extras/s6-log.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/s6-log.html b/doc/s6-log.html index 6538017..5cc4529 100644 --- a/doc/s6-log.html +++ b/doc/s6-log.html @@ -237,6 +237,11 @@ an unpadded, unlimited status file. By default, statussize is 1001. execlineb must be found in s6-log's PATH. If processor is empty, no processor will be set for the next logdirs. By default, no processor is set. +
  • ?processor: registers +/bin/sh -c processor as a processor for the next logdirs. +It is just like the ! directive, except that the processor string +is interpreted by /bin/sh, not execlineb. It is useful +for people who have built s6 without execline support.
  • t: the logged line will be prepended with a TAI64N timestamp (and a space) before being processed by the next action diff --git a/src/daemontools-extras/s6-log.c b/src/daemontools-extras/s6-log.c index 8596879..6b2035e 100644 --- a/src/daemontools-extras/s6-log.c +++ b/src/daemontools-extras/s6-log.c @@ -304,7 +304,7 @@ static int finish (logdir_t *ldp, char const *name, char suffix) static inline void exec_processor (logdir_t *ldp) { - char const *cargv[4] = { EXECLINE_EXTBINPREFIX "execlineb", "-Pc", ldp->processor, 0 } ; + char const *cargv[4] = { ldp->flags & 4 ? "/bin/sh" : EXECLINE_EXTBINPREFIX "execlineb", ldp->flags & 4 ? "-c" : "-Pc", ldp->processor, 0 } ; int fd ; PROG = "s6-log (processor child)" ; if (chdir(ldp->dir) < 0) strerr_diefu2sys(111, "chdir to ", ldp->dir) ; @@ -714,6 +714,7 @@ static inline void script_firstpass (char const *const *argv, unsigned int *sell case 'E' : case '^' : case '!' : + case '?' : break ; case 't' : if ((*argv)[1]) goto fail ; @@ -839,6 +840,11 @@ static inline void script_secondpass (char const *const *argv, scriptelem_t *scr break ; case '!' : processor = (*argv)[1] ? *argv + 1 : 0 ; + flags &= ~4 ; + break ; + case '?' : + processor = (*argv)[1] ? *argv + 1 : 0 ; + flags |= 4 ; break ; case 't' : flags |= 1 ; -- cgit v1.3.1