#include <linux/slab.h>
#include <linux/uaccess.h>
+#include <linux/version.h>
+
#include "bus.h"
#include "connection.h"
#include "endpoint.h"
kdbus_kmsg_free(m);
return ret;
}
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
+/*
+ * FIXME: dirty and unsafe version of:
+ * http://git.kernel.org/cgit/linux/kernel/git/tj/cgroup.git/commit/?h=review-task_cgroup_path_from_hierarchy
+ * remove it when the above is upstream.
+ */
+int task_cgroup_path_from_hierarchy(struct task_struct *task, int hierarchy_id,
+ char *buf, size_t buflen)
+{
+ struct cg_cgroup_link {
+ struct list_head cgrp_link_list;
+ struct cgroup *cgrp;
+ struct list_head cg_link_list;
+ struct css_set *cg;
+ };
+
+ struct cgroupfs_root {
+ struct super_block *sb;
+ unsigned long subsys_mask;
+ int hierarchy_id;
+ };
+
+ struct cg_cgroup_link *link;
+ int ret = -ENOENT;
+
+// cgroup_lock();
+ list_for_each_entry(link, ¤t->cgroups->cg_links, cg_link_list) {
+ struct cgroup *cg = link->cgrp;
+ struct cgroupfs_root *root = (struct cgroupfs_root *)cg->root;
+
+ if (root->hierarchy_id != hierarchy_id)
+ continue;
+
+ ret = cgroup_path(cg, buf, buflen);
+ break;
+ }
+// cgroup_unlock();
+
+ return ret;
+}
+#endif