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