From c538ee8d695de053dc9da8965c85997a79fb6cb2 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Mon, 27 Feb 2023 17:49:23 +0100 Subject: util: Add own prototype for __clone2() on ia64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ia64 needs to use __clone2() as clone() is not available, but glibc doesn't export the prototype. Take it from clone(2) to avoid an implicit declaration: util.c: In function ‘do_clone’: util.c:512:16: warning: implicit declaration of function ‘__clone2’ [-Wimplicit-function-declaration] 512 | return __clone2(fn, stack_area + stack_size / 2, stack_size / 2, | ^~~~~~~~ Signed-off-by: Stefano Brivio --- util.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'util.c') diff --git a/util.c b/util.c index c5ee1c0..799173f 100644 --- a/util.c +++ b/util.c @@ -495,6 +495,15 @@ int write_file(const char *path, const char *buf) return len == 0 ? 0 : -1; } +#ifdef __ia64__ +/* Needed by do_clone() below: glibc doesn't export the prototype of __clone2(), + * use the description from clone(2). + */ +int __clone2(int (*fn)(void *), void *stack_base, size_t stack_size, int flags, + void *arg, ... /* pid_t *parent_tid, struct user_desc *tls, + pid_t *child_tid */ ); +#endif + /** * do_clone() - Wrapper of __clone2() for ia64, clone() for other architectures * @fn: Entry point for child -- cgit v1.2.3