* [PATCH] util: Add own prototype for __clone2() on ia64
@ 2023-02-27 16:50 Stefano Brivio
2023-02-27 22:39 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Stefano Brivio @ 2023-02-27 16:50 UTC (permalink / raw)
To: passt-dev
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 <sbrivio@redhat.com>
---
util.c | 9 +++++++++
1 file changed, 9 insertions(+)
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
--
@@ -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
--
2.39.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] util: Add own prototype for __clone2() on ia64
2023-02-27 16:50 [PATCH] util: Add own prototype for __clone2() on ia64 Stefano Brivio
@ 2023-02-27 22:39 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2023-02-27 22:39 UTC (permalink / raw)
To: Stefano Brivio; +Cc: passt-dev
[-- Attachment #1: Type: text/plain, Size: 1584 bytes --]
On Mon, Feb 27, 2023 at 05:50:51PM +0100, Stefano Brivio wrote:
> 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 <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> util.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> 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
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-27 22:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 16:50 [PATCH] util: Add own prototype for __clone2() on ia64 Stefano Brivio
2023-02-27 22:39 ` David Gibson
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).