]>
Commit | Line | Data |
---|---|---|
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 | ||
24 | typedef struct Scope Scope; | |
25 | ||
26 | #include "unit.h" | |
27 | #include "kill.h" | |
28 | ||
29 | typedef enum ScopeState { | |
30 | SCOPE_DEAD, | |
31 | SCOPE_RUNNING, | |
a911bb9a | 32 | SCOPE_ABANDONED, |
6c12b52e LP |
33 | SCOPE_STOP_SIGTERM, |
34 | SCOPE_STOP_SIGKILL, | |
35 | SCOPE_FAILED, | |
36 | _SCOPE_STATE_MAX, | |
37 | _SCOPE_STATE_INVALID = -1 | |
38 | } ScopeState; | |
39 | ||
40 | typedef enum ScopeResult { | |
41 | SCOPE_SUCCESS, | |
42 | SCOPE_FAILURE_RESOURCES, | |
43 | SCOPE_FAILURE_TIMEOUT, | |
44 | _SCOPE_RESULT_MAX, | |
45 | _SCOPE_RESULT_INVALID = -1 | |
46 | } ScopeResult; | |
47 | ||
48 | struct Scope { | |
49 | Unit meta; | |
50 | ||
51 | CGroupContext cgroup_context; | |
52 | KillContext kill_context; | |
53 | ||
54 | ScopeState state, deserialized_state; | |
55 | ScopeResult result; | |
56 | ||
57 | usec_t timeout_stop_usec; | |
58 | ||
2d4a39e7 LP |
59 | char *controller; |
60 | ||
718db961 | 61 | sd_event_source *timer_event_source; |
6c12b52e LP |
62 | }; |
63 | ||
64 | extern const UnitVTable scope_vtable; | |
65 | ||
a911bb9a LP |
66 | int scope_abandon(Scope *s); |
67 | ||
6c12b52e LP |
68 | const char* scope_state_to_string(ScopeState i) _const_; |
69 | ScopeState scope_state_from_string(const char *s) _pure_; | |
70 | ||
71 | const char* scope_result_to_string(ScopeResult i) _const_; | |
72 | ScopeResult scope_result_from_string(const char *s) _pure_; |