Add support to the python bindings to list cgroup mount points.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
int cgroup_cgxset(const cgroup * const cg, cg_version_t version,
bint ignore_unmappable)
+ int cgroup_list_mount_points(const cg_version_t cgrp_version,
+ char ***mount_paths)
+
# vim: set et ts=4 sw=4:
if ret != 0:
raise RuntimeError("Failed to create cgroup: {}".format(ret))
+ def cgroup_list_mount_points(self, version):
+ """List cgroup mount points of the specified version
+
+ Arguments:
+ version - It specifies the cgroup version
+
+ Description:
+ Parse the /proc/mounts and list the cgroup mount points matching the
+ version
+ """
+ cdef char **a
+
+ mount_points = []
+ ret = cgroup.cgroup_list_mount_points(version, &a)
+ if ret is not 0:
+ raise RuntimeError("cgroup_list_mount_points failed: {}".format(ret));
+
+ i = 0
+ while a[i]:
+ mount_points.append(<str>(a[i]).decode("utf-8"))
+ i = i + 1
+ return mount_points
+
def __dealloc__(self):
cgroup.cgroup_free(&self._cgp);