]>
Commit | Line | Data |
---|---|---|
14228c0d MB |
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 | ||
14228c0d MB |
26 | #include "kill.h" |
27 | ||
28 | typedef enum ScopeState { | |
29 | SCOPE_DEAD, | |
30 | SCOPE_RUNNING, | |
60f067b4 | 31 | SCOPE_ABANDONED, |
14228c0d MB |
32 | SCOPE_STOP_SIGTERM, |
33 | SCOPE_STOP_SIGKILL, | |
34 | SCOPE_FAILED, | |
35 | _SCOPE_STATE_MAX, | |
36 | _SCOPE_STATE_INVALID = -1 | |
37 | } ScopeState; | |
38 | ||
39 | typedef 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 | ||
47 | struct 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 | ||
60f067b4 | 58 | char *controller; |
14228c0d | 59 | |
60f067b4 | 60 | sd_event_source *timer_event_source; |
14228c0d MB |
61 | }; |
62 | ||
63 | extern const UnitVTable scope_vtable; | |
64 | ||
60f067b4 JS |
65 | int scope_abandon(Scope *s); |
66 | ||
14228c0d MB |
67 | const char* scope_state_to_string(ScopeState i) _const_; |
68 | ScopeState scope_state_from_string(const char *s) _pure_; | |
69 | ||
70 | const char* scope_result_to_string(ScopeResult i) _const_; | |
71 | ScopeResult scope_result_from_string(const char *s) _pure_; |