diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-12-09 18:19:21 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-12-09 18:19:21 +0000 |
commit | ca8d2c96ea09cb33ff6fef33c0314c24fc6a026a (patch) | |
tree | 08cfbbbb0c7dc84154dea30e86fe2adc582d1d45 /src | |
parent | 2fa0acdd248c006270010196ad02e530d8ab09ea (diff) | |
download | s6-linux-init-ca8d2c96ea09cb33ff6fef33c0314c24fc6a026a.tar.xz |
Make it work with the new s6. Add s6-linux-init-nuke.
Diffstat (limited to 'src')
-rw-r--r-- | src/init/s6-linux-init-maker.c | 7 | ||||
-rw-r--r-- | src/lib/s6_linux_init_logouthook.c | 2 | ||||
-rw-r--r-- | src/misc/deps-exe/s6-linux-init-nuke | 0 | ||||
-rw-r--r-- | src/misc/s6-linux-init-nuke.c | 8 | ||||
-rw-r--r-- | src/shutdown/s6-linux-init-shutdownd.c | 4 |
5 files changed, 16 insertions, 5 deletions
diff --git a/src/init/s6-linux-init-maker.c b/src/init/s6-linux-init-maker.c index 1e6de62..7c315a6 100644 --- a/src/init/s6-linux-init-maker.c +++ b/src/init/s6-linux-init-maker.c @@ -120,7 +120,8 @@ static int container_crash_script (buffer *b, char const *data) EXECLINE_EXTBINPREFIX "foreground\n{\n " EXECLINE_EXTBINPREFIX "fdmove -c 1 2\n " S6_LINUX_INIT_EXTBINPREFIX "s6-linux-init-echo -- \"s6-svscan crashed. Killing everything and exiting.\"\n}\n" - EXECLINE_EXTBINPREFIX "foreground { kill -9 -1 }\n" + EXECLINE_EXTBINPREFIX "foreground { " + S6_LINUX_INIT_EXTBINPREFIX "s6-linux-init-nuke }\n" EXECLINE_EXTBINPREFIX "wait { }\n" S6_LINUX_INIT_EXTBINPREFIX "s6-linux-init-hpr -fnp\n") >= 0 ; } @@ -134,6 +135,9 @@ static int container_exit_script (buffer *b, char const *data) EXECLINE_EXTBINPREFIX "multisubstitute\n{\n" " importas -uD0 -- EXITCODE exitcode\n " " importas -uDh -- HALTCODE haltcode\n}\n" + EXECLINE_EXTBINPREFIX "fdclose 1\n" + EXECLINE_EXTBINPREFIX "fdclose 2\n" + EXECLINE_EXTBINPREFIX "wait { }\n" EXECLINE_EXTBINPREFIX "ifelse -X { test $HALTCODE = r } { " S6_LINUX_INIT_EXTBINPREFIX "s6-linux-init-hpr -fnr }\n" EXECLINE_EXTBINPREFIX "ifelse -X { test $HALTCODE = p } { " @@ -547,7 +551,6 @@ static inline void make_image (char const *base) auto_dir(base, "run-image/" SCANDIR, 0, 0, 0755) ; auto_dir(base, "run-image/" SCANDIR "/.s6-svscan", 0, 0, 0755) ; auto_script(base, "run-image/" SCANDIR "/.s6-svscan/SIGTERM", &put_shebang_options, 0) ; - auto_script(base, "run-image/" SCANDIR "/.s6-svscan/SIGHUP", &put_shebang_options, 0) ; auto_script(base, "run-image/" SCANDIR "/.s6-svscan/SIGQUIT", &put_shebang_options, 0) ; auto_script(base, "run-image/" SCANDIR "/.s6-svscan/SIGINT", &sig_script, "-r") ; auto_script(base, "run-image/" SCANDIR "/.s6-svscan/SIGUSR1", &sig_script, "-p") ; diff --git a/src/lib/s6_linux_init_logouthook.c b/src/lib/s6_linux_init_logouthook.c index 810f29b..cc6b11a 100644 --- a/src/lib/s6_linux_init_logouthook.c +++ b/src/lib/s6_linux_init_logouthook.c @@ -1,7 +1,7 @@ /* ISC license. */ #include <skalibs/djbunix.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> #include <s6-linux-init/s6-linux-init.h> #include "initctl.h" diff --git a/src/misc/deps-exe/s6-linux-init-nuke b/src/misc/deps-exe/s6-linux-init-nuke new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/misc/deps-exe/s6-linux-init-nuke diff --git a/src/misc/s6-linux-init-nuke.c b/src/misc/s6-linux-init-nuke.c new file mode 100644 index 0000000..93326e5 --- /dev/null +++ b/src/misc/s6-linux-init-nuke.c @@ -0,0 +1,8 @@ +/* ISC license. */ + +#include <signal.h> + +int main (void) +{ + return kill(-1, SIGKILL) < 0 ; +} diff --git a/src/shutdown/s6-linux-init-shutdownd.c b/src/shutdown/s6-linux-init-shutdownd.c index b646b5c..edf5adb 100644 --- a/src/shutdown/s6-linux-init-shutdownd.c +++ b/src/shutdown/s6-linux-init-shutdownd.c @@ -178,11 +178,11 @@ static inline void prepare_stage4 (char const *basedir, char what) if (buffer_puts(&b, "#!" EXECLINE_SHEBANGPREFIX "execlineb -P\n\n" EXECLINE_EXTBINPREFIX "foreground { " - S6_EXTBINPREFIX "s6-svc -Ox -- . }\n" + S6_EXTBINPREFIX "s6-svc -x -- . }\n" EXECLINE_EXTBINPREFIX "background\n{\n ") < 0 || (!nologger && buffer_puts(&b, EXECLINE_EXTBINPREFIX "foreground { " - S6_EXTBINPREFIX "s6-svc -Xh -- " SCANPREFIX LOGGER_SERVICEDIR " }\n ") < 0) + S6_EXTBINPREFIX "s6-svc -xc -- " SCANPREFIX LOGGER_SERVICEDIR " }\n ") < 0) || buffer_puts(&b, S6_EXTBINPREFIX "s6-svscanctl -b -- " SCANDIRFULL "\n}\n") < 0) strerr_diefu2sys(111, "write to ", STAGE4_FILE ".new") ; |