summaryrefslogtreecommitdiffstats
path: root/src/libcgroup-internal.h
diff options
context:
space:
mode:
authorKen'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>2009-06-26 14:49:16 +0900
committerDhaval Giani <dhaval@linux.vnet.ibm.com>2009-06-29 16:28:38 +0530
commit404007be1a80ab2ab75f64195fb692d520df0623 (patch)
tree33ac4d08d27a91188028ba857949d306e314cbba /src/libcgroup-internal.h
parent7620ff3e067b8d77ddf321d81b4b19adc2729f6b (diff)
downloadlibcg-404007be1a80ab2ab75f64195fb692d520df0623.tar.gz
libcg-404007be1a80ab2ab75f64195fb692d520df0623.tar.xz
libcg-404007be1a80ab2ab75f64195fb692d520df0623.zip
Add cgroup_get_procname_from_procfs() for getting a process name.
Hi, Changelog of v6: ================ * Change the returning values of *_get_procname_from_proc*() to integer from charactor pointer. * Clarify the number meaning of string length in cg_get_procname_from_ ~proc_status() Changelog of v5: ================ * Rebase the patch to the latest code. Changelog of v4: ================ * Add the error handling for strdup()'s error. * Reduce strlen() calls. * Make the check code of a process name simple. Changelog of v3: ================ * Move cgroup_get_procname_from_procfs() to libcgroup-internal.h. * Fix unclear buffer of buf_cwd by memset(). * Get a real path of script file by realpath(). Changelog of v2: ================ * It is possible to handle a process, which name length is over than 16 characters, also. Description: ============ This patch adds a new function cgroup_get_procname_from_procfs() for getting a process name. This function allocates the memory for a process name, and writes the name to the memory, and returns the pointer of the memory. So a caller should free the memory if unusing it. The process name, which is wrotten by this function, depends on the specified process: If a command process) the full path of command. If a shell script process) the full path of shell script. If a kernel thread) the process name of kernel thread. Thanks Ken'ichi Ohmichi Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Diffstat (limited to 'src/libcgroup-internal.h')
-rw-r--r--src/libcgroup-internal.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libcgroup-internal.h b/src/libcgroup-internal.h
index 95ff76c..fac82a1 100644
--- a/src/libcgroup-internal.h
+++ b/src/libcgroup-internal.h
@@ -100,6 +100,7 @@ struct cgroup_tree_handle {
/* Internal API */
char *cg_build_path(char *name, char *path, char *type);
int cgroup_get_uid_gid_from_procfs(pid_t pid, uid_t *euid, gid_t *egid);
+int cgroup_get_procname_from_procfs(pid_t pid, char **procname);
int cg_mkdir_p(const char *path);