diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2025-11-04 22:23:28 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2025-11-04 22:23:28 +0000 |
| commit | 3b56d41ef579c18feafbf47d170a6ea4375beb6f (patch) | |
| tree | 87d634d029dba1f786d04df4f35b75af996c74b3 /src/helpers | |
| parent | 2ea40fd0c6b05d29edf5a3b62f4c0f1af6e8b8d8 (diff) | |
| download | s6-frontend-3b56d41ef579c18feafbf47d170a6ea4375beb6f.tar.gz | |
Lots of work done, doesn't build yet, next commit will
- alias subsystem moved to s6
- config subsystem deleted
- new helpers subsystem, with a s6-frontend-helper-kill program
- new s6f_equote function, to execline-quote an argv
- started the adaptation to the new s6-rc functions, in progress
Diffstat (limited to 'src/helpers')
| -rw-r--r-- | src/helpers/deps-exe/s6-frontend-helper-kill | 1 | ||||
| -rw-r--r-- | src/helpers/s6-frontend-helper-kill.c | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/helpers/deps-exe/s6-frontend-helper-kill b/src/helpers/deps-exe/s6-frontend-helper-kill new file mode 100644 index 0000000..e7187fe --- /dev/null +++ b/src/helpers/deps-exe/s6-frontend-helper-kill @@ -0,0 +1 @@ +-lskarnet diff --git a/src/helpers/s6-frontend-helper-kill.c b/src/helpers/s6-frontend-helper-kill.c new file mode 100644 index 0000000..c217373 --- /dev/null +++ b/src/helpers/s6-frontend-helper-kill.c @@ -0,0 +1,31 @@ +/* ISC license. */ + +#include <unistd.h> +#include <signal.h> + +#include <skalibs/types.h> +#include <skalibs/prog.h> +#include <skalibs/strerr.h> + +#define USAGE "s6-frontend-helper-kill signal pid..." +#define dieusage() strerr_dieusage(100, USAGE) + +int main (int argc, char const *const *argv) +{ + unsigned int sig ; + PROG = "s6-frontend-helper-kill" ; + if (argc-- < 3) dieusage() ; + argv++ ; + if (!uint0_scan(*argv++, &sig)) dieusage() ; + argc-- ; + + pid_t pids[argc] ; + for (unsigned int i = 0 ; i < argc ; i++) + if (!pid0_scan(argv[i], pids + i)) + strerr_dief1x(100, "pids must be numerical") ; + + for (unsigned int i = 0 ; i < argc ; i++) + kill(sig, pids[i]) ; + + _exit(0) ; +} |
