This source file includes following definitions.
- kill_context_init
- kill_context_dump
#include <string.h>
#include "kill.h"
#include "util.h"
void kill_context_init(KillContext *c) {
assert(c);
c->kill_signal = SIGTERM;
c->send_sigkill = true;
c->send_sighup = false;
}
void kill_context_dump(KillContext *c, FILE *f, const char *prefix) {
assert(c);
if (!prefix)
prefix = "";
fprintf(f,
"%sKillMode: %s\n"
"%sKillSignal: SIG%s\n"
"%sSendSIGKILL: %s\n"
"%sSendSIGHUP: %s\n",
prefix, kill_mode_to_string(c->kill_mode),
prefix, signal_to_string(c->kill_signal),
prefix, yes_no(c->send_sigkill),
prefix, yes_no(c->send_sighup));
}
static const char* const kill_mode_table[_KILL_MODE_MAX] = {
[KILL_CONTROL_GROUP] = "control-group",
[KILL_PROCESS] = "process",
[KILL_MIXED] = "mixed",
[KILL_NONE] = "none"
};
DEFINE_STRING_TABLE_LOOKUP(kill_mode, KillMode);
static const char* const kill_who_table[_KILL_WHO_MAX] = {
[KILL_MAIN] = "main",
[KILL_CONTROL] = "control",
[KILL_ALL] = "all"
};
DEFINE_STRING_TABLE_LOOKUP(kill_who, KillWho);