]> 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 15:58:13 +0000 (08:58 -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>
src/config.c
src/systemd.c

index 51b9342d9ef1cb20c6bad06ba0244639edfc3695..65a4118e2cd689d28f30f2306be91b43adf579a8 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <libcgroup.h>
 #include <libcgroup-internal.h>
-#include <libcgroup/systemd.h>
 
 #include <pthread.h>
 #include <assert.h>
@@ -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
index c97d5056f90cdb8dcd89f8550426c2a2c4eca451..d12abc76f55787eb6f3b80eef2ff313c631200e2 100644 (file)
@@ -6,6 +6,8 @@
  */
 
 #include <libcgroup-internal.h>
+
+#ifdef WITH_SYSTEMD
 #include <systemd/sd-bus.h>
 #include <libcgroup.h>
 #include <unistd.h>
@@ -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