]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/core/scope.h
tree-wide: drop {} from one-line if blocks
[thirdparty/systemd.git] / src / core / scope.h
CommitLineData
6c12b52e
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3#pragma once
4
5/***
6 This file is part of systemd.
7
8 Copyright 2013 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22***/
23
24typedef struct Scope Scope;
25
6c12b52e
LP
26#include "kill.h"
27
28typedef enum ScopeState {
29 SCOPE_DEAD,
30 SCOPE_RUNNING,
a911bb9a 31 SCOPE_ABANDONED,
6c12b52e
LP
32 SCOPE_STOP_SIGTERM,
33 SCOPE_STOP_SIGKILL,
34 SCOPE_FAILED,
35 _SCOPE_STATE_MAX,
36 _SCOPE_STATE_INVALID = -1
37} ScopeState;
38
39typedef enum ScopeResult {
40 SCOPE_SUCCESS,
41 SCOPE_FAILURE_RESOURCES,
42 SCOPE_FAILURE_TIMEOUT,
43 _SCOPE_RESULT_MAX,
44 _SCOPE_RESULT_INVALID = -1
45} ScopeResult;
46
47struct Scope {
48 Unit meta;
49
50 CGroupContext cgroup_context;
51 KillContext kill_context;
52
53 ScopeState state, deserialized_state;
54 ScopeResult result;
55
56 usec_t timeout_stop_usec;
57
2d4a39e7
LP
58 char *controller;
59
718db961 60 sd_event_source *timer_event_source;
6c12b52e
LP
61};
62
63extern const UnitVTable scope_vtable;
64
a911bb9a
LP
65int scope_abandon(Scope *s);
66
6c12b52e
LP
67const char* scope_state_to_string(ScopeState i) _const_;
68ScopeState scope_state_from_string(const char *s) _pure_;
69
70const char* scope_result_to_string(ScopeResult i) _const_;
71ScopeResult scope_result_from_string(const char *s) _pure_;