pctl Add kill command
This commit is contained in:
28
user/pctl/kill.c
Normal file
28
user/pctl/kill.c
Normal file
@ -0,0 +1,28 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <ulib.h>
|
||||
#include "kill.h"
|
||||
#include "macros.h"
|
||||
|
||||
struct {
|
||||
int32_t pid;
|
||||
} PCTL_KILL_CONFIG = {
|
||||
.pid = -1,
|
||||
};
|
||||
|
||||
static Arg ARGS[] = {
|
||||
ARG("-pid", ARG_INT, &PCTL_KILL_CONFIG.pid),
|
||||
ARG_END(),
|
||||
};
|
||||
|
||||
void pctl_kill(void) {
|
||||
int32_t ret;
|
||||
if ((ret = parse_args(SUBCMD_ARGS(), SUBCMD_ARGSLEN(), ARGS)) < 0) {
|
||||
uprintf("pctl kill: Could not parse args: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
if (PCTL_KILL_CONFIG.pid != -1) {
|
||||
processctl(PCTL_KILL_CONFIG.pid, PCTL_KILL, 0, 0, 0);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user