]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
python: Introduce is_systemd_enabled()
authorTom Hromatka <tom.hromatka@oracle.com>
Thu, 7 Dec 2023 04:20:13 +0000 (04:20 +0000)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 7 Dec 2023 15:58:13 +0000 (08:58 -0700)
Add python interface for systemd C function cgroup_is_systemd_enabled(),
that return true if the --enable-systemd was set or false.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/python/cgroup.pxd.m4
src/python/libcgroup.pyx.m4

index e591876a94a0c7eadce922aa581f6a9a6013eb52..29ace69aec2670b843917b8564b6b0a0478f694b 100644 (file)
@@ -130,4 +130,7 @@ cdef extern from "libcgroup.h":
     int cgroup_change_cgroup_path(const char *dest, pid_t pid, const char * const controllers[])
 
     void cgroup_set_default_logger(int log_level)
+
+    bool cgroup_is_systemd_enabled()
+
 # vim: set et ts=4 sw=4:
index 2f32fd90881b3a414f7e2c86f88a992c8abc1d87..6b5da587331f1d58492de8f5906f4b05f8841392 100644 (file)
@@ -815,6 +815,13 @@ cdef class Cgroup:
         """
         cgroup.cgroup_set_default_logger(log_level)
 
+    @staticmethod
+    def is_systemd_enabled():
+        """Returns true if libcgroup is compiled with systemd support
+        """
+
+        return cgroup.cgroup_is_systemd_enabled()
+
     def __dealloc__(self):
         cgroup.cgroup_free(&self._cgp)