]> git.proxmox.com Git - mirror_lxc.git/commitdiff
tests: lxc-test-reboot: Fix build on ia64
authorMathias Gibbens <gibmat@debian.org>
Sat, 19 Nov 2022 15:14:47 +0000 (15:14 +0000)
committerMathias Gibbens <gibmat@debian.org>
Sat, 19 Nov 2022 15:14:47 +0000 (15:14 +0000)
Add the prototype for __clone2(...) that is used on ia64, and adjust the
code to use it via macro tests.

Verified that the code compiles properly on Debian's ia64 porterbox
(yttrium), but was unable to actually run as lxc-test-reboot requires
root privileges.

Signed-off-by: Mathias Gibbens <gibmat@debian.org>
src/tests/reboot.c

index 005e9863d1d7d4132b33ccf6f35acb1e4ebd11b8..43250a99e90f3ff7a7596f016fa0c1b72eb3a79b 100644 (file)
 
 #include <linux/reboot.h>
 
+/*
+ * glibc clone(2) wrapper function prototypes as defined in that manpage. Most
+ * architectures use clone(...), but ia64 uses __clone2(...).
+ */
 int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ...);
+int __clone2(int (*fn)(void *), void *stack_base, size_t stack_size, \
+               int flags, void *arg, ...);
 
 static int do_reboot(void *arg)
 {
@@ -53,7 +59,12 @@ static int test_reboot(int cmd, int sig)
        int status;
        pid_t ret;
 
+#if defined(__ia64__)
+       ret = __clone2(do_reboot, stack, stack_size, \
+                       CLONE_NEWPID | SIGCHLD, &cmd);
+#else
        ret = clone(do_reboot, stack, CLONE_NEWPID | SIGCHLD, &cmd);
+#endif
        if (ret < 0) {
                printf("failed to clone: %s\n", strerror(errno));
                return -1;