libcgroup
Loading...
Searching...
No Matches
systemd.h
1/* SPDX-License-Identifier: LGPL-2.1-only */
2#ifndef _LIBCGROUP_SYSTEMD_H
3#define _LIBCGROUP_SYSTEMD_H
4
5#ifndef _LIBCGROUP_H_INSIDE
6#error "Only <libcgroup.h> should be included directly."
7#endif
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13enum cgroup_systemd_mode_t {
14 CGROUP_SYSTEMD_MODE_FAIL = 0,
15 CGROUP_SYSTEMD_MODE_REPLACE,
16 CGROUP_SYSTEMD_MODE_ISOLATE,
17 CGROUP_SYSTEMD_MODE_IGNORE_DEPS,
18 CGROUP_SYSTEMD_MODE_IGNORE_REQS,
19
20 CGROUP_SYSTEMD_MODE_CNT,
21 CGROUP_SYSTEMD_MODE_DFLT = CGROUP_SYSTEMD_MODE_REPLACE
22};
23
31 enum cgroup_systemd_mode_t mode;
33 pid_t pid;
34};
35
36/*
37 * cgroup systemd settings
38 */
40 char slice_name[FILENAME_MAX];
41 char scope_name[FILENAME_MAX];
42 int setdefault;
43 pid_t pid;
44 struct cgroup_systemd_opts *next;
45};
46
54int cgroup_set_default_scope_opts(struct cgroup_systemd_scope_opts * const opts);
55
65int cgroup_create_scope(const char * const scope_name, const char * const slice_name,
66 const struct cgroup_systemd_scope_opts * const opts);
67
80int cgroup_create_scope2(struct cgroup *cgrp, int ignore_ownership,
81 const struct cgroup_systemd_scope_opts * const opts);
82
92int cgroup_set_default_systemd_cgroup(void);
93
105int cgroup_alloc_systemd_opts(const char * const conf, const char * const value);
106
117int cgroup_add_systemd_opts(const char * const conf, const char * const value);
118
122void cgroup_cleanup_systemd_opts(void);
123
124/*
125 * Write the specified slice and scope to the libcgroup systemd run file. This
126 * slice and scope will then be used as the default cgroup root. Subsequent
127 * libcgroup commands, cgget, etc., will utilize this slice and scope when
128 * constructing the libcgroup path
129 *
130 * @param slice systemd slice name, e.g. libcgroup.slice
131 * @param scope systemd scope name, e.g. database.scope
132 */
133int cgroup_write_systemd_default_cgroup(const char * const slice,
134 const char * const scope);
135
136/*
137 * Return true if systemd support is compiled into the libcgroup library
138 */
139bool cgroup_is_systemd_enabled(void);
140
141#ifdef __cplusplus
142} /* extern "C" */
143#endif
144
145#endif /* _LIBCGROUP_SYSTEMD_H */
Definition systemd.h:39
Definition systemd.h:27
pid_t pid
Definition systemd.h:33
enum cgroup_systemd_mode_t mode
Definition systemd.h:31
int delegated
Definition systemd.h:29
Definition libcgroup-internal.h:121