diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2025-06-06 13:48:20 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska@appnovation.com> | 2025-06-06 13:48:20 +0000 |
| commit | 3f75ffee7c0c7d6b70cf305d60435ac862ea9ab5 (patch) | |
| tree | 45d86cdc414e6534305d2b723666c1291d74b940 /src/s6/process.c | |
| parent | 73988ba1cfa375582c86302116192fb8ec567f48 (diff) | |
| download | s6-frontend-3f75ffee7c0c7d6b70cf305d60435ac862ea9ab5.tar.gz | |
Implement "s6 process"
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/s6/process.c')
| -rw-r--r-- | src/s6/process.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/s6/process.c b/src/s6/process.c new file mode 100644 index 0000000..bd14c67 --- /dev/null +++ b/src/s6/process.c @@ -0,0 +1,33 @@ +/* ISC license. */ + +#include <skalibs/posixplz.h> +#include <skalibs/strerr.h> +#include <skalibs/cspawn.h> +#include <skalibs/djbunix.h> +#include <s6/config.h> + +#include "s6-internal.h" + +#define USAGE "s6 process [ process options ] subcommand [ subcommand options ] services... Type \"s6 process help\" for details." +#define dieusage() strerr_dieusage(100, USAGE) + +static struct command_s const process_commands[] = +{ + { .s = "help", .f = &process_help }, + { .s = "kill", .f = &process_kill }, + { .s = "restart", .f = &process_restart }, + { .s = "start", .f = &process_start }, + { .s = "status", .f = &process_status }, + { .s = "stop", .f = &process_stop }, +} ; + +int process (char const *const *argv) +{ + struct command_s *cmd ; + + PROG = "s6 process" ; + if (!*argv) dieusage() ; + cmd = BSEARCH(struct command_s, *argv, process_commands) ; + if (!cmd) dieusage() ; + return (*cmd->f)(++argv) ; +} |
