Files
systemd/src/core/scope.h
Daan De Meyer 4ea4abb651 core: Remove circular dependencies between headers
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.
2025-04-23 10:33:35 +02:00

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);