From: Mathias Gibbens Date: Sat, 19 Nov 2022 15:14:47 +0000 (+0000) Subject: tests: lxc-test-reboot: Fix build on ia64 X-Git-Tag: v6.0.0~87^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16c6ff22693a7c5419e4f36b4b8158d5dccbceec;p=thirdparty%2Flxc.git tests: lxc-test-reboot: Fix build on ia64 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 --- diff --git a/src/tests/reboot.c b/src/tests/reboot.c index 005e9863d..43250a99e 100644 --- a/src/tests/reboot.c +++ b/src/tests/reboot.c @@ -34,7 +34,13 @@ #include +/* + * 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;