diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2022-08-20 14:13:22 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2022-08-20 14:13:22 +0000 |
commit | 6920ddc814d709bc60c162c1fef794b108940e95 (patch) | |
tree | 5c99a8e79983b95467833c7e32557efb6a148654 /src | |
parent | 28f5b4e7a5cce43198269f26583e66a232a976b5 (diff) | |
download | s6-6920ddc814d709bc60c162c1fef794b108940e95.tar.gz s6-6920ddc814d709bc60c162c1fef794b108940e95.tar.xz s6-6920ddc814d709bc60c162c1fef794b108940e95.zip |
Pass service name as an argument to the service script
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/supervision/s6-supervise.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c index 60ba85c..881d29a 100644 --- a/src/supervision/s6-supervise.c +++ b/src/supervision/s6-supervise.c @@ -62,6 +62,7 @@ static state_t state = DOWN ; static int flagdying = 0 ; static int cont = 1 ; static int notifyfd = -1 ; +static char const *servicename = 0 ; static inline void settimeout (int secs) { @@ -305,7 +306,7 @@ static void trystart (void) } else if (!pid) { - char const *cargv[2] = { "run", 0 } ; + char const *cargv[3] = { "run", servicename, 0 } ; ((char *)PROG)[strlen(PROG)] = ' ' ; selfpipe_finish() ; if (notifyp[0] >= 0) close(notifyp[0]) ; @@ -455,7 +456,7 @@ static int uplastup_z (void) { char fmt0[UINT_FMT] ; char fmt1[UINT_FMT] ; - char *cargv[4] = { "finish", fmt0, fmt1, 0 } ; + char *cargv[5] = { "finish", fmt0, fmt1, servicename, 0 } ; selfpipe_finish() ; fmt0[uint_fmt(fmt0, WIFSIGNALED(status.wstat) ? 256 : WEXITSTATUS(status.wstat))] = 0 ; fmt1[uint_fmt(fmt1, WTERMSIG(status.wstat))] = 0 ; @@ -765,6 +766,7 @@ int main (int argc, char const *const *argv) PROG = "s6-supervise" ; if (argc < 2) strerr_dieusage(100, USAGE) ; if (chdir(argv[1]) < 0) strerr_diefu2sys(111, "chdir to ", argv[1]) ; + servicename = argv[1] ; { size_t proglen = strlen(PROG) ; size_t namelen = strlen(argv[1]) ; |