]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
libcgroup test: Change dbg to cgroup_dbg
authorDhaval Giani <dhaval@linux.vnet.ibm.com>
Fri, 27 Feb 2009 20:25:36 +0000 (20:25 +0000)
committerDhaval Giani <dhaval@linux.vnet.ibm.com>
Fri, 27 Feb 2009 20:25:36 +0000 (20:25 +0000)
Since cgroup_dbg is defined on the basis of CGROUP_DBG, we get
libcgrouptest.h and libcg_ba.cpp to include config.h and change
dbg to cgroup_dbg.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@354 4f4bb910-9a46-0410-90c8-c897d4f1cd53

tests/libcg_ba.cpp
tests/libcgrouptest.h
tests/libcgrouptest01.c

index 6d402b6552e9f777c2143abfeef8942b8eb097fb..c9994d67833e1faffa40e7c25375dc06085cc850 100644 (file)
@@ -25,6 +25,14 @@ using namespace std;
 #include <stdlib.h>
 #include <string.h>
 
+#include "../config.h"
+
+#ifdef CGROUP_DBG
+#define cgroup_dbg(p...)       printf(p...)
+#else
+#define cgroup_dbg(p...)       do {} while (0)
+#endif
+
 namespace cgtest {
 
 class cg {
@@ -83,7 +91,7 @@ struct cgroup *cg::makenode(const string &name, const string &task_uid,
                return NULL;
        cgid = grp->gr_gid;
 
-       dbg("tuid %d, tgid %d, cuid %d, cgid %d\n", tuid, tgid, cuid, cgid);
+       cgroup_dbg("tuid %d, tgid %d, cuid %d, cgid %d\n", tuid, tgid, cuid, cgid);
 
        cgroup_name = (char *) malloc(name.length());
        strncpy(cgroup_name, name.c_str(), name.length() + 1);
index a0f82d637538fa071a4e0c5d581d82e6b3231071..3c04b6afc1d212f1367cc15dc6ddf6c4aa8d9bd2 100644 (file)
@@ -28,6 +28,7 @@
 #include <sys/types.h>
 
 #include <libcgroup.h>
+#include "../config.h"
 
 #define SIZE 100       /* Max size of a message to be printed */
 #define NUM_MSGS 20    /* Number of such messsages */
@@ -146,4 +147,10 @@ void build_path(char *target, char *mountpoint,
                                 const char *group, const char *file);
 pid_t cgrouptest_gettid();
 
+#ifdef CGROUP_DEBUG
+#define cgroup_dbg(p...)       printf(p...)
+#else
+#define cgroup_dbg(p...)       do {} while (0);
+#endif
+
 #endif
index d489d9cbae125d01e4b8796df6e69602c2e525b8..acc229af5d118b36e719520e5d6af0159b047eb0 100644 (file)
@@ -54,18 +54,19 @@ int main(int argc, char *argv[])
                exit(1);
        }
        fs_mounted = atoi(argv[1]);
-       dbg("C:DBG: fs_mounted as recieved from script=%d\n", fs_mounted);
+       cgroup_dbg("C:DBG: fs_mounted as recieved from script=%d\n",
+                                                               fs_mounted);
        /* All possible controller will be element of an enum */
        if (fs_mounted) {
                ctl1 = atoi(argv[2]);
                ctl2 = atoi(argv[3]);
                strncpy(mountpoint, argv[4], sizeof(mountpoint));
-               dbg("C:DBG: mountpoint1 as recieved from script=%s\n",
+               cgroup_dbg("C:DBG: mountpoint1 as recieved from script=%s\n",
                                                                 mountpoint);
                if (fs_mounted == FS_MULTI_MOUNTED) {
                        strncpy(mountpoint2, argv[5], sizeof(mountpoint2));
-                       dbg("C:DBG: mountpoint2 as recieved from script=%s\n",
-                                                                mountpoint2);
+                       cgroup_dbg("C:DBG: mountpoint2 as recieved from "
+                                       "script=%s\n", mountpoint2);
                }
 
        }