diff options
author | Karol Lewandowski <k.lewandowsk@samsung.com> | 2013-10-28 16:09:04 +0100 |
---|---|---|
committer | Maciej Wereski <m.wereski@partner.samsung.com> | 2014-05-08 13:26:50 +0200 |
commit | b71536bf1619ccfa1ac1c140c8bd253c5cb30079 (patch) | |
tree | 4a6b035b27d5d5c9512f893dc588529a3d22c278 | |
parent | 7083c774fc988c183eed453ee33bd5df006726bd (diff) | |
download | kdbus-bus-b71536bf1619ccfa1ac1c140c8bd253c5cb30079.tar.gz kdbus-bus-b71536bf1619ccfa1ac1c140c8bd253c5cb30079.tar.bz2 kdbus-bus-b71536bf1619ccfa1ac1c140c8bd253c5cb30079.zip |
Bring task_cgroup_path_from_hierarchy() back for pre-3.11 compatiblity
This commit partially reverts ea2b8c798cd34149fa13010d24 ("message.c:
task_cgroup_path_from_hierarchy is now in 3.11-rc1, so remove it from
here").
We still require it for pre-3.11 kernels that Tizen is shipping.
Change-Id: I05568c5d8d473bb5257d3aa64f8a84b03e6da117
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
-rw-r--r-- | message.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/message.c b/message.c index f0d071dc971..eac5678793c 100644 --- a/message.c +++ b/message.c @@ -23,6 +23,8 @@ #include <linux/slab.h> #include <linux/uaccess.h> +#include <linux/version.h> + #include "bus.h" #include "connection.h" #include "endpoint.h" @@ -326,3 +328,45 @@ exit_free: 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 |