From 5e85390c90df59b324ed6fd56102c2c800af076a Mon Sep 17 00:00:00 2001
From: Hailiang <mahailiang@uniontech.com>
Date: Mon, 10 Mar 2025 14:46:57 +0800
Subject: [PATCH] add sw_64 support

---
 ell/missing.h           | 2 ++
 profiles/network/bnep.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/ell/missing.h b/ell/missing.h
index b1ee0f1..32eb887 100644
--- a/ell/missing.h
+++ b/ell/missing.h
@@ -13,6 +13,8 @@
 #    define __NR_getrandom 318
 #  elif defined(__i386__)
 #    define __NR_getrandom 355
+#  elif defined(__sw_64__)
+#    define __NR_getrandom 511
 #  elif defined(__arm__)
 #    define __NR_getrandom 384
 # elif defined(__aarch64__)
diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
index 54b9500..49bc12f 100644
--- a/profiles/network/bnep.c
+++ b/profiles/network/bnep.c
@@ -256,7 +256,11 @@ static gboolean bnep_setup_cb(GIOChannel *chan, GIOCondition cond,
 
 	memset(&timeo, 0, sizeof(timeo));
 	timeo.tv_sec = 0;
+#if defined(__sw_64__)
+	if (setsockopt(sk, SOL_SOCKET, SO_RCVTIMEO_OLD, &timeo,
+#else
 	if (setsockopt(sk, SOL_SOCKET, SO_RCVTIMEO, &timeo,
+#endif
 							sizeof(timeo)) < 0) {
 		error("bnep: Set setsockopt failed: %s", strerror(errno));
 		goto failed;
-- 
2.20.1

