From 216ef3fa583b751c3f76f8812f947fe3b61c58d9 Mon Sep 17 00:00:00 2001 From: Dhaval Giani Date: Fri, 9 Jan 2009 16:26:15 +0000 Subject: libcgrouptest:attach exclusive pid support in test_cgroup_attach_task() function From: Sudhir Kumar The function test_attach_task_pid() was attaching the process calling the function to a group and did not have support to take any pid for attaching it to a group. This patch does that. Signed-off-by: Sudhir Kumar Acked-by: Dhaval Giani Signed-off-by: Dhaval Giani git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@310 4f4bb910-9a46-0410-90c8-c897d4f1cd53 --- tests/test_functions.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'tests/test_functions.c') diff --git a/tests/test_functions.c b/tests/test_functions.c index fc64934..4b8bcbb 100644 --- a/tests/test_functions.c +++ b/tests/test_functions.c @@ -66,13 +66,17 @@ void test_cgroup_init(int retcode, int i) * @param k the message enum number to print the useful message */ void test_cgroup_attach_task(int retcode, struct cgroup *cgrp, - const char *group1, const char *group2, int k, int i) + const char *group1, const char *group2, pid_t pid, int k, int i) { int retval; char tasksfile[FILENAME_MAX], tasksfile2[FILENAME_MAX]; /* Check, In case some error is expected due to a negative scenario */ if (retcode) { - retval = cgroup_attach_task(cgrp); + if (pid) + retval = cgroup_attach_task_pid(cgrp, pid); + else + retval = cgroup_attach_task(cgrp); + if (retval == retcode) message(i, PASS, "attach_task()", retval, info[k]); else @@ -82,7 +86,11 @@ void test_cgroup_attach_task(int retcode, struct cgroup *cgrp, } /* Now there is no error and it is a genuine call */ - retval = cgroup_attach_task(cgrp); + if (pid) + retval = cgroup_attach_task_pid(cgrp, pid); + else + retval = cgroup_attach_task(cgrp); + /* API returned success, so perform check */ if (retval == 0) { build_path(tasksfile, mountpoint, -- cgit