# cython: language_level = 3str
from posix.types cimport pid_t, uid_t, gid_t, mode_t
+from libcpp cimport bool
cdef extern from "libcgroup.h":
cdef struct cgroup:
int cgroup_compare_cgroup(cgroup *cgroup_a, cgroup *cgroup_b)
int cgroup_get_procs(char *name, char *controller, pid_t **pids, int *size)
+
+ bool is_cgroup_mode_legacy()
+
+ bool is_cgroup_mode_hybrid()
+
+ bool is_cgroup_mode_unified()
+
# vim: set et ts=4 sw=4:
return pid_list
+ @staticmethod
+ def is_cgroup_mode_legacy():
+ """Check if the current setup mode is legacy (v1)
+
+ Return:
+ True if the mode is legacy, else false
+ """
+ return cgroup.is_cgroup_mode_legacy()
+
+ @staticmethod
+ def is_cgroup_mode_hybrid():
+ """Check if the current setup mode is hybrid (v1/v2)
+
+ Return:
+ True if the mode is hybrid, else false
+ """
+ return cgroup.is_cgroup_mode_hybrid()
+
+ @staticmethod
+ def is_cgroup_mode_unified():
+ """Check if the current setup mode is unified (v2)
+
+ Return:
+ True if the mode is unified, else false
+ """
+ return cgroup.is_cgroup_mode_unified()
+
def __dealloc__(self):
cgroup.cgroup_free(&self._cgp);