diff options
-rw-r--r-- | doc/index.html | 2 | ||||
-rw-r--r-- | doc/s6-pause.html | 27 | ||||
-rw-r--r-- | doc/upgrade.html | 6 | ||||
-rw-r--r-- | package/deps.mak | 2 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | src/skaembutils/deps-exe/s6-pause | 1 | ||||
-rw-r--r-- | src/skaembutils/s6-pause.c | 43 |
7 files changed, 73 insertions, 10 deletions
diff --git a/doc/index.html b/doc/index.html index 6f18572..54a515c 100644 --- a/doc/index.html +++ b/doc/index.html @@ -76,7 +76,7 @@ library. </li> <ul> <li> The current released version of s6-portable-utils is -<a href="s6-portable-utils-2.0.3.0.tar.gz">2.0.3.0</a>. </li> +<a href="s6-portable-utils-2.0.4.0.tar.gz">2.0.4.0</a>. </li> <li> Alternatively, you can checkout a copy of the s6-portable-utils git repository: <pre> git clone git://git.skarnet.org/s6-portable-utils </pre> </li> </ul> diff --git a/doc/s6-pause.html b/doc/s6-pause.html index edb129f..3e0cbf8 100644 --- a/doc/s6-pause.html +++ b/doc/s6-pause.html @@ -24,16 +24,31 @@ <h2> Interface </h2> <pre> - s6-pause + s6-pause [ -t ] [ -h ] [ -a ] [ -q ] [ -b ] [ -i ] [ -p <em>signals</em> ] </pre> +<h2> Options </h2> + +<ul> + <li> <tt>-t</tt> : ignore SIGTERM </li> + <li> <tt>-h</tt> : ignore SIGHUP </li> + <li> <tt>-a</tt> : ignore SIGALRM </li> + <li> <tt>-q</tt> : ignore SIGQUIT </li> + <li> <tt>-b</tt> : ignore SIGABRT </li> + <li> <tt>-i</tt> : ignore SIGINT </li> + <li> <tt>-p <em>signals</em></tt> : ignore the signals +listed in <em>signals</em>, which must be a comma-separated list of +signal numbers. </li> +</ul> + <h2> Usage notes </h2> -<p> - s6-pause is one of the smallest possible long-lived programs. It can be -used to emulate a running service with the least possible resource -consumption. -</p> +<ul> + <li> s6-pause is one of the smallest possible long-lived programs. It uses +as few resources as the kernel will allow. </li> + <li> The options can be used to wait for a specific signal without being +killed by others. </li> +</ul> </body> </html> diff --git a/doc/upgrade.html b/doc/upgrade.html index 1b5cdbb..b3c9f87 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -17,6 +17,12 @@ <h1> What has changed in s6-portable-utils </h1> +<h2> in 2.0.4.0 </h2> + +<ul> + <li> New options in <a href="s6-pause.html">s6-pause</a>. </li> +</ul> + <h2> in 2.0.3.0 </h2> <ul> diff --git a/package/deps.mak b/package/deps.mak index d5b641d..d5de160 100644 --- a/package/deps.mak +++ b/package/deps.mak @@ -94,7 +94,7 @@ s6-nice: src/skaembutils/s6-nice.o -lskarnet s6-nuke: private EXTRA_LIBS := s6-nuke: src/skaembutils/s6-nuke.o -lskarnet s6-pause: private EXTRA_LIBS := -s6-pause: src/skaembutils/s6-pause.o +s6-pause: src/skaembutils/s6-pause.o -lskarnet s6-printenv: private EXTRA_LIBS := s6-printenv: src/skaembutils/s6-printenv.o -lskarnet s6-quote: private EXTRA_LIBS := diff --git a/package/info b/package/info index 5eb0354..e624d73 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=s6-portable-utils -version=2.0.3.0 +version=2.0.4.0 category=admin package_macro_name=S6_PORTABLE_UTILS diff --git a/src/skaembutils/deps-exe/s6-pause b/src/skaembutils/deps-exe/s6-pause index e69de29..e7187fe 100644 --- a/src/skaembutils/deps-exe/s6-pause +++ b/src/skaembutils/deps-exe/s6-pause @@ -0,0 +1 @@ +-lskarnet diff --git a/src/skaembutils/s6-pause.c b/src/skaembutils/s6-pause.c index 8eafdce..acb1f41 100644 --- a/src/skaembutils/s6-pause.c +++ b/src/skaembutils/s6-pause.c @@ -1,9 +1,50 @@ /* ISC license. */ #include <unistd.h> +#include <signal.h> +#include <skalibs/uint.h> +#include <skalibs/sgetopt.h> +#include <skalibs/strerr2.h> +#include <skalibs/sig.h> -int main () +#define USAGE "s6-pause [ -t ] [ -h ] [ -a ] [ -q ] [ -b ] [ -i ] [ -p signal,signal... ]" +#define dieusage() strerr_dieusage(100, USAGE) + +#define MAX 64 + +int main (int argc, char const *const *argv) { + PROG = "s6-pause" ; + unsigned int sigs[MAX] ; + unsigned int nsig = 0 ; + { + subgetopt_t l = SUBGETOPT_ZERO ; + for (;;) + { + register int opt = subgetopt_r(argc, argv, "thaqbip:", &l) ; + if (opt == -1) break ; + switch (opt) + { + case 't' : if (nsig >= MAX) dieusage() ; sigs[nsig++] = SIGTERM ; + case 'h' : if (nsig >= MAX) dieusage() ; sigs[nsig++] = SIGHUP ; + case 'a' : if (nsig >= MAX) dieusage() ; sigs[nsig++] = SIGALRM ; + case 'q' : if (nsig >= MAX) dieusage() ; sigs[nsig++] = SIGQUIT ; + case 'b' : if (nsig >= MAX) dieusage() ; sigs[nsig++] = SIGABRT ; + case 'i' : if (nsig >= MAX) dieusage() ; sigs[nsig++] = SIGINT ; + case 'p' : + { + unsigned int n ; + if (!uint_scanlist(sigs + nsig, MAX - nsig, l.arg, &n)) dieusage() ; + nsig += n ; + break ; + } + default : dieusage() ; + } + } + argc -= l.ind ; argv += l.ind ; + } + + while (nsig--) sig_ignore(sigs[nsig]) ; pause() ; return 0 ; } |