]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/core/kill.h
Merge pull request #2495 from heftig/master
[thirdparty/systemd.git] / src / core / kill.h
CommitLineData
4819ff03
LP
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
22typedef struct KillContext KillContext;
23
24#include <stdbool.h>
25#include <stdio.h>
26
44a6b1b6
ZJS
27#include "macro.h"
28
4819ff03 29typedef enum KillMode {
c74f17d9 30 /* The kill mode is a property of a unit. */
4819ff03
LP
31 KILL_CONTROL_GROUP = 0,
32 KILL_PROCESS,
58ea275a 33 KILL_MIXED,
4819ff03
LP
34 KILL_NONE,
35 _KILL_MODE_MAX,
36 _KILL_MODE_INVALID = -1
37} KillMode;
38
39struct KillContext {
40 KillMode kill_mode;
41 int kill_signal;
42 bool send_sigkill;
82659fd7 43 bool send_sighup;
4819ff03
LP
44};
45
46typedef enum KillWho {
c74f17d9 47 /* Kill who is a property of an operation */
4819ff03
LP
48 KILL_MAIN,
49 KILL_CONTROL,
50 KILL_ALL,
ac5e3a50
JS
51 KILL_MAIN_FAIL,
52 KILL_CONTROL_FAIL,
53 KILL_ALL_FAIL,
4819ff03
LP
54 _KILL_WHO_MAX,
55 _KILL_WHO_INVALID = -1
56} KillWho;
57
58void kill_context_init(KillContext *c);
59void kill_context_dump(KillContext *c, FILE *f, const char *prefix);
60
44a6b1b6
ZJS
61const char *kill_mode_to_string(KillMode k) _const_;
62KillMode kill_mode_from_string(const char *s) _pure_;
4819ff03 63
44a6b1b6
ZJS
64const char *kill_who_to_string(KillWho k) _const_;
65KillWho kill_who_from_string(const char *s) _pure_;