]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/core/kill.h
tree-wide: drop license boilerplate
[thirdparty/systemd.git] / src / core / kill.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 This file is part of systemd.
6
7 Copyright 2012 Lennart Poettering
8 ***/
9
10 typedef struct KillContext KillContext;
11
12 #include <stdbool.h>
13 #include <stdio.h>
14
15 #include "macro.h"
16
17 typedef enum KillMode {
18 /* The kill mode is a property of a unit. */
19 KILL_CONTROL_GROUP = 0,
20 KILL_PROCESS,
21 KILL_MIXED,
22 KILL_NONE,
23 _KILL_MODE_MAX,
24 _KILL_MODE_INVALID = -1
25 } KillMode;
26
27 struct KillContext {
28 KillMode kill_mode;
29 int kill_signal;
30 bool send_sigkill;
31 bool send_sighup;
32 };
33
34 typedef enum KillWho {
35 /* Kill who is a property of an operation */
36 KILL_MAIN,
37 KILL_CONTROL,
38 KILL_ALL,
39 KILL_MAIN_FAIL,
40 KILL_CONTROL_FAIL,
41 KILL_ALL_FAIL,
42 _KILL_WHO_MAX,
43 _KILL_WHO_INVALID = -1
44 } KillWho;
45
46 void kill_context_init(KillContext *c);
47 void kill_context_dump(KillContext *c, FILE *f, const char *prefix);
48
49 const char *kill_mode_to_string(KillMode k) _const_;
50 KillMode kill_mode_from_string(const char *s) _pure_;
51
52 const char *kill_who_to_string(KillWho k) _const_;
53 KillWho kill_who_from_string(const char *s) _pure_;