From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Jules Maselbas <jmaselbas@zdiv.net>,
Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 3/3] sandbox: os: tap: make it compile with musl
Date: Tue, 25 Mar 2025 13:47:40 +0100 [thread overview]
Message-ID: <20250325124740.4035964-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250325124740.4035964-1-a.fatoum@pengutronix.de>
musl not ship a definition of IFF_TAP. As this is ABI set in stone,
let's just duplicate the constant we need and use them as fallback, when
<linux/if_tun.h> is missing.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/sandbox/os/tap.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/sandbox/os/tap.c b/arch/sandbox/os/tap.c
index 83b97ffd49c7..fbb20f2fa80f 100644
--- a/arch/sandbox/os/tap.c
+++ b/arch/sandbox/os/tap.c
@@ -21,10 +21,20 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
-#include <linux/if.h>
-#include <linux/if_tun.h>
+#include <net/if.h>
#include <string.h>
+#ifdef __has_include
+# if !__has_include(<linux/if_tun.h>)
+# define IFF_TAP 0x0002
+# define IFF_NO_PI 0x1000
+# define TUNSETIFF _IOW('T', 202, int)
+# endif
+#endif
+#ifndef IFF_TAP
+# include <linux/if_tun.h>
+#endif
+
int tap_alloc(const char *dev)
{
struct ifreq ifr;
--
2.39.5
next prev parent reply other threads:[~2025-03-25 13:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-25 12:47 [PATCH master 0/3] sandbox: enable building under musl Ahmad Fatoum
2025-03-25 12:47 ` [PATCH master 1/3] sandbox: use POSIX header instead of Linux one Ahmad Fatoum
2025-03-25 12:47 ` [PATCH master 2/3] sandbox: don't build tap support code without CONFIG_DRIVER_NET_TAP Ahmad Fatoum
2025-03-25 12:47 ` Ahmad Fatoum [this message]
2025-03-27 8:13 ` [PATCH master 0/3] sandbox: enable building under musl Sascha Hauer
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=20250325124740.4035964-4-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=jmaselbas@zdiv.net \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox