[CRIU] [PATCH] syscall: don't use pr_info to print a part of string

Andrey Vagin avagin at openvz.org
Wed Aug 13 03:39:09 PDT 2014


Before:
(00.009468)     87: sysctl: <kernel/sem> = <(00.009475)     87: 2108913153 (00.009481)     87: 1252387386 (00.009486)     87: 835139248 (00.009491)     87: 320896030 (00.009496)     87: >
After:
(00.009468)     87: sysctl: <kernel/sem> = <2108913153 1252387386 835139248 320896030 >

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 sysctl.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sysctl.c b/sysctl.c
index 505127d..5d23a48 100644
--- a/sysctl.c
+++ b/sysctl.c
@@ -106,11 +106,12 @@ static int sysctl_print_##__type(int fd,				\
 				 __type *arg,				\
 				 int nr)				\
 {									\
-	int i;								\
-	pr_info("sysctl: <%s> = <", req->name);				\
+	char msg[PAGE_SIZE];						\
+	int i, off = 0;							\
 	for (i = 0; i < nr; i++)					\
-		pr_info(__fmt, arg[i]);					\
-	pr_info(">\n");							\
+		off += snprintf(msg + off, sizeof(msg) - off,		\
+				__fmt, arg[i]);				\
+	pr_info("sysctl: <%s> = <%s>\n", req->name, msg);		\
 									\
 	return 0;							\
 }
-- 
1.9.3



More information about the CRIU mailing list