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 | |
parent | 2fa0acdd248c006270010196ad02e530d8ab09ea (diff) | |
download | s6-linux-init-ca8d2c96ea09cb33ff6fef33c0314c24fc6a026a.tar.xz |
Make it work with the new s6. Add s6-linux-init-nuke.
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | doc/index.html | 3 | ||||
-rw-r--r-- | doc/s6-linux-init-nuke.html | 51 | ||||
-rw-r--r-- | doc/upgrade.html | 3 | ||||
-rw-r--r-- | package/deps.mak | 3 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | package/modes | 1 | ||||
-rw-r--r-- | package/targets.mak | 1 | ||||
-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 |
13 files changed, 79 insertions, 9 deletions
@@ -1,9 +1,10 @@ Changelog for s6-linux-init. -In 1.0.5.2 +In 1.0.6.0 ---------- - Bugfixes. + - New internal binary: s6-linux-init-nuke, to remove dependency on kill In 1.0.5.1 diff --git a/doc/index.html b/doc/index.html index 81e7749..0f62a6b 100644 --- a/doc/index.html +++ b/doc/index.html @@ -115,7 +115,7 @@ all the other packages against the <em>static</em> version of libskarnet. <ul> <li> The current released version of s6-linux-init is -<a href="s6-linux-init-1.0.5.2.tar.gz">1.0.5.2</a>. </li> +<a href="s6-linux-init-1.0.6.0.tar.gz">1.0.6.0</a>. </li> <li> Alternatively, you can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6-linux-init/">s6-linux-init git repository</a>: @@ -168,6 +168,7 @@ permanent error (such as a misuse). <li><a href="s6-linux-init-telinit.html">The <tt>s6-linux-init-telinit</tt> program</a></li> <li><a href="s6-linux-init-logouthookd.html">The <tt>s6-linux-init-logouthookd</tt> program</a></li> <li><a href="s6-linux-init-echo.html">The <tt>s6-linux-init-echo</tt> program</a></li> +<li><a href="s6-linux-init-nuke.html">The <tt>s6-linux-init-nuke</tt> program</a></li> <li><a href="s6-linux-init-umountall.html">The <tt>s6-linux-init-umountall</tt> program</a></li> </ul> diff --git a/doc/s6-linux-init-nuke.html b/doc/s6-linux-init-nuke.html new file mode 100644 index 0000000..4cd3c0d --- /dev/null +++ b/doc/s6-linux-init-nuke.html @@ -0,0 +1,51 @@ +<html> + <head> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <meta http-equiv="Content-Language" content="en" /> + <title>s6-linux-init: the s6-linux-init-nuke program</title> + <meta name="Description" content="s6-linux-init: the s6-linux-init-nuke program" /> + <meta name="Keywords" content="s6-linux-init command s6-linux-init-nuke nuke kill killall process shutdown" /> + <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> --> + </head> +<body> + +<p> +<a href="index.html">s6-linux-init</a><br /> +<a href="//skarnet.org/software/">Software</a><br /> +<a href="//skarnet.org/">skarnet.org</a> +</p> + +<h1> The <tt>s6-linux-init-nuke</tt> program </h1> + +<p> + s6-linux-init-nuke kills alls processes immediately. +</p> + +<h2> Interface </h2> + +<pre> + s6-linux-init-nuke +</pre> + +<p> + s6-linux-init-nuke sends a SIGKILL to every process on the system. +(Process 1 will be unaffected.) +</p> + +<p> + Do not try this at home. +</p> + +<h2> Notes </h2> + +<ul> + <li> This program only exists so the s6-linux-init package can be +self-contained and avoid relying on the existence of an external +<tt>kill</tt> program. It is only run in the very improbable case +that <a href="//skarnet.org/software/s6/s6-svscan.html">s6-svscan</a> +crashes, in a container situation. </li> +</ul> + +</body> +</html> diff --git a/doc/upgrade.html b/doc/upgrade.html index afa96fb..6ae4bd8 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,7 +18,7 @@ <h1> What has changed in s6-linux-init </h1> -<h2> in 1.0.5.2 </h2> +<h2> in 1.0.6.0 </h2> <ul> <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> @@ -31,6 +31,7 @@ dependency bumped to 2.10.0.0. </li> optional dependency bumped to 0.0.2.3. </li> <li> <a href="//skarnet.org/software/utmps/">utmps</a> optional dependency bumped to 0.0.3.3. </li> + <li> New binary: <a href="s6-linux-init-nuke.html">s6-linux-init-nuke</a>. </li> </ul> <h2> in 1.0.5.1 </h2> diff --git a/package/deps.mak b/package/deps.mak index e5408fa..4c0aa04 100644 --- a/package/deps.mak +++ b/package/deps.mak @@ -10,6 +10,7 @@ src/init/s6-linux-init.o src/init/s6-linux-init.lo: src/init/s6-linux-init.c src src/lib/s6_linux_init_logouthook.o src/lib/s6_linux_init_logouthook.lo: src/lib/s6_linux_init_logouthook.c src/include-local/initctl.h src/include/s6-linux-init/s6-linux-init.h src/misc/s6-linux-init-echo.o src/misc/s6-linux-init-echo.lo: src/misc/s6-linux-init-echo.c src/misc/s6-linux-init-logouthookd.o src/misc/s6-linux-init-logouthookd.lo: src/misc/s6-linux-init-logouthookd.c +src/misc/s6-linux-init-nuke.o src/misc/s6-linux-init-nuke.lo: src/misc/s6-linux-init-nuke.c src/misc/s6-linux-init-umountall.o src/misc/s6-linux-init-umountall.lo: src/misc/s6-linux-init-umountall.c src/include/s6-linux-init/config.h src/shutdown/hpr_confirm_hostname.o src/shutdown/hpr_confirm_hostname.lo: src/shutdown/hpr_confirm_hostname.c src/shutdown/hpr.h src/shutdown/hpr_shutdown.o src/shutdown/hpr_shutdown.lo: src/shutdown/hpr_shutdown.c src/shutdown/hpr.h @@ -35,6 +36,8 @@ s6-linux-init-echo: EXTRA_LIBS := -lskarnet s6-linux-init-echo: src/misc/s6-linux-init-echo.o s6-linux-init-logouthookd: EXTRA_LIBS := -lskarnet ${SYSCLOCK_LIB} ${SOCKET_LIB} s6-linux-init-logouthookd: src/misc/s6-linux-init-logouthookd.o ${LIBUTMPS} +s6-linux-init-nuke: EXTRA_LIBS := +s6-linux-init-nuke: src/misc/s6-linux-init-nuke.o s6-linux-init-umountall: EXTRA_LIBS := -lskarnet s6-linux-init-umountall: src/misc/s6-linux-init-umountall.o ifeq ($(strip $(STATIC_LIBS_ARE_PIC)),) diff --git a/package/info b/package/info index 14c665a..9e1d6d1 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=s6-linux-init -version=1.0.5.2 +version=1.0.6.0 category=admin package_macro_name=S6_LINUX_INIT diff --git a/package/modes b/package/modes index f2c9b24..0cc7f74 100644 --- a/package/modes +++ b/package/modes @@ -5,5 +5,6 @@ s6-linux-init-shutdownd 0744 s6-linux-init-telinit 0744 s6-linux-init-logouthookd 0744 s6-linux-init-echo 0755 +s6-linux-init-nuke 0744 s6-linux-init-umountall 0744 s6-linux-init-maker 0744 diff --git a/package/targets.mak b/package/targets.mak index 412e9e3..04d940f 100644 --- a/package/targets.mak +++ b/package/targets.mak @@ -6,6 +6,7 @@ s6-linux-init-shutdownd \ s6-linux-init-telinit \ s6-linux-init-logouthookd \ s6-linux-init-echo \ +s6-linux-init-nuke \ s6-linux-init-umountall \ s6-linux-init-maker 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") ; |