From: Tom Hromatka Date: Thu, 7 Dec 2023 04:20:13 +0000 (+0000) Subject: python: Introduce is_systemd_enabled() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2a4c703895f1de5cbe5bbc928413fa452464a75a;p=thirdparty%2Flibcgroup.git python: Introduce is_systemd_enabled() 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 (cherry picked from commit 45a36684facb8dcc75803ddcf09976730254a5f7) --- diff --git a/src/python/cgroup.pxd.m4 b/src/python/cgroup.pxd.m4 index e591876a..29ace69a 100644 --- a/src/python/cgroup.pxd.m4 +++ b/src/python/cgroup.pxd.m4 @@ -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: diff --git a/src/python/libcgroup.pyx.m4 b/src/python/libcgroup.pyx.m4 index 2f32fd90..6b5da587 100644 --- a/src/python/libcgroup.pyx.m4 +++ b/src/python/libcgroup.pyx.m4 @@ -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)