summaryrefslogtreecommitdiffstats
path: root/tests/libcgrouptest.h
diff options
context:
space:
mode:
authorDhaval Giani <dhaval@linux.vnet.ibm.com>2008-07-01 13:51:52 +0000
committerDhaval Giani <dhaval@linux.vnet.ibm.com>2008-07-01 13:51:52 +0000
commit952183580cc874db99230534f7e38b75f57f3d88 (patch)
treefa55c60b047c678d091ee75df9e421e90286b205 /tests/libcgrouptest.h
parent2fd38347726e379945d5506136f7e1fe656bcde7 (diff)
downloadlibcg-952183580cc874db99230534f7e38b75f57f3d88.tar.gz
libcg-952183580cc874db99230534f7e38b75f57f3d88.tar.xz
libcg-952183580cc874db99230534f7e38b75f57f3d88.zip
From: Sudhir Kumar <skumar@linux.vnet.ibm.com>
libcgroup: libcgroup testcases for cgroup_attach_task() This patch adds testcases for libcgroup API cgroup_create_cgroup() and cgroup_delete_cgroup() testing. The APIs are called under the same but two conditions(FS_MOUNTED=0/1) and return values are checked. The cgroup is created and freed using the wrapper APIs. Testcases for FS_MOUNTED=2 have to be added. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@90 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'tests/libcgrouptest.h')
-rw-r--r--tests/libcgrouptest.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/libcgrouptest.h b/tests/libcgrouptest.h
index b35c7a9..9d3da5d 100644
--- a/tests/libcgrouptest.h
+++ b/tests/libcgrouptest.h
@@ -18,6 +18,8 @@
#ifndef __LIBCGROUPTEST_H
#define __LIBCGROUPTEST_H
+#include <errno.h>
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -25,12 +27,25 @@
#include <libcgroup.h>
+int cpu = 0, memory = 0;
+
enum cgroup_mount_t {
FS_NOT_MOUNTED,
FS_MOUNTED,
FS_MULTI_MOUNTED,
};
+enum controller_t {
+ MEMORY,
+ CPU,
+ /* Add new controllers here */
+};
+
+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);
+
static inline pid_t cgrouptest_gettid()
{
return syscall(__NR_gettid);