From fd13e9f6d4f315018fc88258ba965c32e12601da Mon Sep 17 00:00:00 2001 From: Dhaval Giani Date: Tue, 1 Jul 2008 14:05:09 +0000 Subject: From: Sudhir Kumar libcgroup: put common code in a function This patch puts the common code for creating cgroup structure into a function struct cgroup *new_cgroup(). The function uses few global variables which are changed before the function call and takes few variables as arguments. Signed-off-by: Sudhir Kumar Signed-off-by: Dhaval Giani git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@93 4f4bb910-9a46-0410-90c8-c897d4f1cd53 --- tests/libcgrouptest.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tests/libcgrouptest.h') diff --git a/tests/libcgrouptest.h b/tests/libcgrouptest.h index 55c94df..1efc4b8 100644 --- a/tests/libcgrouptest.h +++ b/tests/libcgrouptest.h @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -53,12 +54,19 @@ u_int64_t val_uint64; bool val_bool; /* Doubt: size of following string. is'nt this wrong ?*/ char val_string[FILENAME_MAX]; /* string value of control parameter */ +uid_t control_uid; +gid_t control_gid; +uid_t tasks_uid; +gid_t tasks_gid; +static int i; void get_controllers(char *name, int *exist); static int group_exist(char *path_group); static int set_controller(int controller, char *controller_name, - char *control_file, char *control_val, char *value); + char *control_file); static int group_modified(char *path_control_file, int value_type); +struct cgroup *new_cgroup(char *group, char *controller_name, + char *control_file, int value_type); static inline pid_t cgrouptest_gettid() { -- cgit