summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhaval Giani <dhaval@linux.vnet.ibm.com>2008-09-05 18:47:57 +0000
committerDhaval Giani <dhaval@linux.vnet.ibm.com>2008-09-05 18:47:57 +0000
commiteb6cf0c1d25837f4816e0a253a46118bfb05baef (patch)
tree263f50b0525d7d2820029aa675534bbf085230a4
parentf1abecc154b7be8741c8f53c6045b987391417e2 (diff)
downloadlibcg-eb6cf0c1d25837f4816e0a253a46118bfb05baef.tar.gz
libcg-eb6cf0c1d25837f4816e0a253a46118bfb05baef.tar.xz
libcg-eb6cf0c1d25837f4816e0a253a46118bfb05baef.zip
libcgroup: Change variables to *printf/*scanf to use inttypes.h
Instead of using %lu and so on, use the inttype.h macro to define types. Will ensure compatibility across platforms. Please review more closely. Tested by compiling with and without -m32 on a 64 bit system. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@176 4f4bb910-9a46-0410-90c8-c897d4f1cd53
-rw-r--r--wrapper.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/wrapper.c b/wrapper.c
index 24a641d..c75552b 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -145,7 +145,7 @@ int cgroup_add_value_int64(struct cgroup_controller *controller,
strncpy(cntl_value->name, name,
sizeof(cntl_value->name));
ret = snprintf(cntl_value->value,
- sizeof(cntl_value->value), "%ld", value);
+ sizeof(cntl_value->value), "%" PRId64, value);
if (ret >= sizeof(cntl_value->value))
return ECGINVAL;
@@ -178,8 +178,8 @@ int cgroup_add_value_uint64(struct cgroup_controller *controller,
return ECGCONTROLLERCREATEFAILED;
strncpy(cntl_value->name, name, sizeof(cntl_value->name));
- ret = snprintf(cntl_value->value, sizeof(cntl_value->value), "%lu",
- value);
+ ret = snprintf(cntl_value->value, sizeof(cntl_value->value),
+ "%" PRIu64, value);
if (ret >= sizeof(cntl_value->value))
return ECGINVAL;
@@ -381,7 +381,7 @@ int cgroup_get_value_int64(struct cgroup_controller *controller,
if (!strcmp(val->name, name)) {
- if (sscanf(val->value, "%ld", value) != 1)
+ if (sscanf(val->value, "%" SCNd64, value) != 1)
return ECGINVAL;
return 0;
@@ -402,7 +402,7 @@ int cgroup_set_value_int64(struct cgroup_controller *controller,
if (!strcmp(val->name, name)) {
ret = snprintf(val->value,
- sizeof(val->value), "%lu", value);
+ sizeof(val->value), "%" PRId64, value);
if (ret >= sizeof(val->value) || ret < 0)
return ECGINVAL;
@@ -423,7 +423,7 @@ int cgroup_get_value_uint64(struct cgroup_controller *controller,
struct control_value *val = controller->values[i];
if (!strcmp(val->name, name)) {
- if (sscanf(val->value, "%lu", value) != 1)
+ if (sscanf(val->value, "%" SCNu64, value) != 1)
return ECGINVAL;
return 0;
@@ -444,7 +444,7 @@ int cgroup_set_value_uint64(struct cgroup_controller *controller,
if (!strcmp(val->name, name)) {
ret = snprintf(val->value,
- sizeof(val->value), "%lu", value);
+ sizeof(val->value), "%" PRIu64, value);
if (ret >= sizeof(val->value) || ret < 0)
return ECGINVAL;