| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include "cgroup.h" |
| 5 |
#include "core-forward.h" |
| 6 |
#include "kill.h" |
| 7 |
#include "unit.h" |
| 8 |
|
| 9 |
typedef enum ScopeResult { |
| 10 |
SCOPE_SUCCESS, |
| 11 |
SCOPE_FAILURE_RESOURCES, |
| 12 |
SCOPE_FAILURE_TIMEOUT, |
| 13 |
SCOPE_FAILURE_OOM_KILL, |
| 14 |
_SCOPE_RESULT_MAX, |
| 15 |
_SCOPE_RESULT_INVALID = -EINVAL, |
| 16 |
} ScopeResult; |
| 17 |
|
| 18 |
typedef struct Scope { |
| 19 |
Unit meta; |
| 20 |
|
| 21 |
CGroupContext cgroup_context; |
| 22 |
KillContext kill_context; |
| 23 |
CGroupRuntime *cgroup_runtime; |
| 24 |
|
| 25 |
ScopeState state, deserialized_state; |
| 26 |
ScopeResult result; |
| 27 |
|
| 28 |
usec_t runtime_max_usec; |
| 29 |
usec_t runtime_rand_extra_usec; |
| 30 |
usec_t timeout_stop_usec; |
| 31 |
|
| 32 |
char *controller; |
| 33 |
sd_bus_track *controller_track; |
| 34 |
|
| 35 |
bool was_abandoned; |
| 36 |
|
| 37 |
sd_event_source *timer_event_source; |
| 38 |
|
| 39 |
char *user; |
| 40 |
char *group; |
| 41 |
|
| 42 |
OOMPolicy oom_policy; |
| 43 |
} Scope; |
| 44 |
|
| 45 |
extern const UnitVTable scope_vtable; |
| 46 |
|
| 47 |
int scope_abandon(Scope *s); |
| 48 |
|
| 49 |
DECLARE_STRING_TABLE_LOOKUP(scope_result, ScopeResult); |
| 50 |
|
| 51 |
DEFINE_CAST(SCOPE, Scope); |