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