public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Subject: [PATCH] util: Add own prototype for __clone2() on ia64
Date: Mon, 27 Feb 2023 17:50:51 +0100	[thread overview]
Message-ID: <20230227165051.292844-1-sbrivio@redhat.com> (raw)

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


             reply	other threads:[~2023-02-27 16:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27 16:50 Stefano Brivio [this message]
2023-02-27 22:39 ` [PATCH] util: Add own prototype for __clone2() on ia64 David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230227165051.292844-1-sbrivio@redhat.com \
    --to=sbrivio@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).