From 16c6ff22693a7c5419e4f36b4b8158d5dccbceec Mon Sep 17 00:00:00 2001 From: Mathias Gibbens Date: Sat, 19 Nov 2022 15:14:47 +0000 Subject: [PATCH] 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 --- src/tests/reboot.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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; -- 2.47.2