[CRIU] [PATCH 3/4] zdtm: fix comilation for non-constant PAGE_SIZE

Konstantin Khlebnikov khlebnikov at openvz.org
Wed Sep 12 03:48:43 EDT 2012


On some systems PAGE_SIZE is declared as sysconf(_SC_PAGESIZE) in <sys/user.h>
this is non-constant expression, so it cannot be used in type declarations.

cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0   -c -o ns.o ns.c
ns.c:124:7: error: variably modified ‘stack’ at file scope

Signed-off-by: Konstantin Khlebnikov <khlebnikov at openvz.org>
---
 test/zdtm/lib/ns.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/test/zdtm/lib/ns.c b/test/zdtm/lib/ns.c
index 06ba4ce..25f5fd7 100644
--- a/test/zdtm/lib/ns.c
+++ b/test/zdtm/lib/ns.c
@@ -10,7 +10,6 @@
 #include <sys/wait.h>
 #include <sys/param.h>
 #include <sys/mman.h>
-#include <sys/user.h>
 #include <fcntl.h>
 #include <signal.h>
 #include <sched.h>
@@ -119,9 +118,11 @@ done:
 	return 0;
 }
 
+#define NS_STACK_SIZE	4096
+
 /* All arguments should be above stack, because it grows down */
 struct ns_exec_args {
-	char stack[PAGE_SIZE];
+	char stack[NS_STACK_SIZE];
 	char stack_ptr[0];
 	int argc;
 	char **argv;



More information about the CRIU mailing list