]> git.proxmox.com Git - systemd.git/blob - src/core/kill.h
Merge tag 'upstream/229'
[systemd.git] / src / core / kill.h
1 #pragma once
2
3 /***
4 This file is part of systemd.
5
6 Copyright 2012 Lennart Poettering
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 typedef struct KillContext KillContext;
23
24 #include <stdbool.h>
25 #include <stdio.h>
26
27 #include "macro.h"
28
29 typedef enum KillMode {
30 /* The kill mode is a property of a unit. */
31 KILL_CONTROL_GROUP = 0,
32 KILL_PROCESS,
33 KILL_MIXED,
34 KILL_NONE,
35 _KILL_MODE_MAX,
36 _KILL_MODE_INVALID = -1
37 } KillMode;
38
39 struct KillContext {
40 KillMode kill_mode;
41 int kill_signal;
42 bool send_sigkill;
43 bool send_sighup;
44 };
45
46 typedef enum KillWho {
47 /* Kill who is a property of an operation */
48 KILL_MAIN,
49 KILL_CONTROL,
50 KILL_ALL,
51 KILL_MAIN_FAIL,
52 KILL_CONTROL_FAIL,
53 KILL_ALL_FAIL,
54 _KILL_WHO_MAX,
55 _KILL_WHO_INVALID = -1
56 } KillWho;
57
58 void kill_context_init(KillContext *c);
59 void kill_context_dump(KillContext *c, FILE *f, const char *prefix);
60
61 const char *kill_mode_to_string(KillMode k) _const_;
62 KillMode kill_mode_from_string(const char *s) _pure_;
63
64 const char *kill_who_to_string(KillWho k) _const_;
65 KillWho kill_who_from_string(const char *s) _pure_;