mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 16:37:19 +09:00
Currently there are various circular dependencies between headers in core/. Let's get rid of these by making judicious use of forward declarations and moving includes into implementation files instead of having them in header files. Getting rid of circular header includes simplifies the code and makes various clang based tooling such as iwyu work much better on our code. The most important change is getting rid of the manager.h include in unit.h which is possible thanks to the previous commits. We also move the OOMPolicy and StatusType enums to unit.h to remove the need for other unit headers to include manager.h to get access to these enums.
52 lines
1.1 KiB
C
52 lines
1.1 KiB
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
#pragma once
|
|
|
|
#include "cgroup.h"
|
|
#include "kill.h"
|
|
#include "unit.h"
|
|
|
|
typedef enum ScopeResult {
|
|
SCOPE_SUCCESS,
|
|
SCOPE_FAILURE_RESOURCES,
|
|
SCOPE_FAILURE_TIMEOUT,
|
|
SCOPE_FAILURE_OOM_KILL,
|
|
_SCOPE_RESULT_MAX,
|
|
_SCOPE_RESULT_INVALID = -EINVAL,
|
|
} ScopeResult;
|
|
|
|
typedef struct Scope {
|
|
Unit meta;
|
|
|
|
CGroupContext cgroup_context;
|
|
KillContext kill_context;
|
|
CGroupRuntime *cgroup_runtime;
|
|
|
|
ScopeState state, deserialized_state;
|
|
ScopeResult result;
|
|
|
|
usec_t runtime_max_usec;
|
|
usec_t runtime_rand_extra_usec;
|
|
usec_t timeout_stop_usec;
|
|
|
|
char *controller;
|
|
sd_bus_track *controller_track;
|
|
|
|
bool was_abandoned;
|
|
|
|
sd_event_source *timer_event_source;
|
|
|
|
char *user;
|
|
char *group;
|
|
|
|
OOMPolicy oom_policy;
|
|
} Scope;
|
|
|
|
extern const UnitVTable scope_vtable;
|
|
|
|
int scope_abandon(Scope *s);
|
|
|
|
const char* scope_result_to_string(ScopeResult i) _const_;
|
|
ScopeResult scope_result_from_string(const char *s) _pure_;
|
|
|
|
DEFINE_CAST(SCOPE, Scope);
|