diff options
author | Dhaval Giani <dhaval@linux.vnet.ibm.com> | 2009-06-26 23:06:18 +0530 |
---|---|---|
committer | Dhaval Giani <dhaval@linux.vnet.ibm.com> | 2009-06-26 23:06:18 +0530 |
commit | 305fdb705e4eca50f3dc18d7cc685b547ce0ee98 (patch) | |
tree | 492943020ca7fd7d7756aaab80434571785e8eca /src/api.c | |
parent | 3c60aa98093e94985fb3fe43c03bb91a5e6b45c6 (diff) | |
download | libcg-305fdb705e4eca50f3dc18d7cc685b547ce0ee98.tar.gz libcg-305fdb705e4eca50f3dc18d7cc685b547ce0ee98.tar.xz libcg-305fdb705e4eca50f3dc18d7cc685b547ce0ee98.zip |
libcgroup: Introduce an API to get the mount point of a specific subsystem
Introduce an API which will query the mount table and return the mount point
of a specific subsystem. This is needed in the case when the user knows which
subsystem he wants the details of, which would make the use of the get_controller*
APIs cumbersome.
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Diffstat (limited to 'src/api.c')
-rw-r--r-- | src/api.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -2668,3 +2668,31 @@ int cgroup_get_uid_gid_from_procfs(pid_t pid, uid_t *euid, gid_t *egid) return 0; } +int cgroup_get_subsys_mount_point(char *controller, char **mount_point) +{ + int i; + int ret = ECGROUPNOTEXIST; + + if (!cgroup_initialized) + return ECGROUPNOTINITIALIZED; + + pthread_rwlock_rdlock(&cg_mount_table_lock); + for (i = 0; cg_mount_table[i].name[0] != '\0'; i++) { + if (strncmp(cg_mount_table[i].name, controller, FILENAME_MAX)) + continue; + + *mount_point = strdup(cg_mount_table[i].path); + + if (!*mount_point) { + last_errno = errno; + ret = ECGOTHER; + goto out_exit; + } + + ret = 0; + break; + } +out_exit: + pthread_rwlock_unlock(&cg_mount_table_lock); + return ret; +} |