From: Kamalesh Babulal Date: Mon, 27 Nov 2023 14:30:14 +0000 (+0530) Subject: systemd: add function stubs for non-systemd X-Git-Tag: v3.2.0~165 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07f038769e19b9c2e190a0c5c43d10dce6b6d26e;p=thirdparty%2Flibcgroup.git systemd: add function stubs for non-systemd Add systemd function stubs for --enable-systemd=no configuration. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/src/config.c b/src/config.c index 51b9342d..65a4118e 100644 --- a/src/config.c +++ b/src/config.c @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -2284,18 +2283,28 @@ err: #else int cgroup_add_systemd_opts(const char * const config, const char * const value) { - return 1; + cgroup_err("Systemd support not compiled\n"); + return 0; } int cgroup_alloc_systemd_opts(const char * const config, const char * const value) { - return 1; + cgroup_err("Systemd support not compiled\n"); + return 0; } void cgroup_cleanup_systemd_opts(void) { } int cgroup_set_default_systemd_cgroup(void) { + cgroup_err("Systemd support not compiled\n"); + return 0; +} + +int cgroup_write_systemd_default_cgroup(const char * const slice, + const char * const scope) +{ + cgroup_err("Systemd support not compiled\n"); return 0; } #endif diff --git a/src/systemd.c b/src/systemd.c index c97d5056..d12abc76 100644 --- a/src/systemd.c +++ b/src/systemd.c @@ -6,6 +6,8 @@ */ #include + +#ifdef WITH_SYSTEMD #include #include #include @@ -422,3 +424,24 @@ err: return ret; } +#else +int cgroup_set_default_scope_opts(struct cgroup_systemd_scope_opts * const opts) +{ + cgroup_err("Systemd support not compiled\n"); + return 1; +} + +int cgroup_create_scope(const char * const scope_name, const char * const slice_name, + const struct cgroup_systemd_scope_opts * const opts) +{ + cgroup_err("Systemd support not compiled\n"); + return 1; +} + +int cgroup_create_scope2(struct cgroup *cgroup, int ignore_ownership, + const struct cgroup_systemd_scope_opts * const opts) +{ + cgroup_err("Systemd support not compiled\n"); + return 1; +} +#endif