[lxc-devel] [PATCH 2/2] Fix for ia64: Use __clone2 for ia64 in lxc/start.c

Dennis Schridde devurandom at gmx.net
Mon Mar 18 14:55:12 UTC 2013


---
 src/lxc/start.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/lxc/start.c b/src/lxc/start.c
index 3fdfa04..106c8e8 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -135,6 +135,11 @@ int signalfd(int fd, const sigset_t *mask, int flags)
 #include "lxcseccomp.h"
 #include "caps.h"
 
+#ifdef __ia64__
+extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
+                     size_t __child_stack_size, int __flags, void *__arg, ...);
+#endif
+
 lxc_log_define(lxc_start, lxc);
 
 static int match_fd(int fd)
@@ -564,7 +569,7 @@ static int must_drop_cap_sys_boot(void)
 	FILE *f = fopen("/proc/sys/kernel/ctrl-alt-del", "r");
 	int ret, cmd, v;
         long stack_size = 4096;
-        void *stack = alloca(stack_size) + stack_size;
+        void *stack = alloca(stack_size);
         int status;
         pid_t pid;
 
@@ -581,7 +586,11 @@ static int must_drop_cap_sys_boot(void)
 	}
 	cmd = v ? LINUX_REBOOT_CMD_CAD_ON : LINUX_REBOOT_CMD_CAD_OFF;
 
-        pid = clone(container_reboot_supported, stack, CLONE_NEWPID | SIGCHLD, &cmd);
+#ifdef __ia64__
+        pid = __clone2(container_reboot_supported, stack, stack_size, CLONE_NEWPID | SIGCHLD, &cmd);
+#else
+        pid = clone(container_reboot_supported, stack + stack_size, CLONE_NEWPID | SIGCHLD, &cmd);
+#endif
         if (pid < 0) {
                 SYSERROR("failed to clone\n");
                 return -1;
-- 
1.8.1.5





More information about the lxc-devel mailing list