]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
systemd: add function stubs for non-systemd
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Mon, 27 Nov 2023 14:30:14 +0000 (20:00 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 7 Dec 2023 16:21:09 +0000 (09:21 -0700)
Add systemd function stubs for --enable-systemd=no configuration.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit 07f038769e19b9c2e190a0c5c43d10dce6b6d26e)

src/config.c
src/systemd.c

index 767857841c796851ddb8c4389a5a1f44770efc4c..77ae3fe6492237f84ae66bb4692eaf271b8cf523 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <libcgroup.h>
 #include <libcgroup-internal.h>
-#include <libcgroup/systemd.h>
 
 #include <pthread.h>
 #include <assert.h>
@@ -2283,18 +2282,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
index 47e19d31e0b14ab81cffc53b10819b52288df0c6..2ca89f3dbcbbb1b24cf927865af5b25125dc466a 100644 (file)
@@ -6,6 +6,8 @@
  */
 
 #include <libcgroup-internal.h>
+
+#ifdef WITH_SYSTEMD
 #include <systemd/sd-bus.h>
 #include <libcgroup.h>
 #include <unistd.h>
@@ -346,3 +348,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