summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWake Liu <wakel@google.com>2025-08-07 16:09:32 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-12-07 06:08:10 +0900
commitc465773d17cea2083bb6e471629b7115442f4399 (patch)
tree5a1211c42d42acea0208d0c64e7f9f3394fb0453 /tools
parent04af23c99354bd96dd2f67283fa64e795b8c0d04 (diff)
downloadlinux-c465773d17cea2083bb6e471629b7115442f4399.tar.gz
linux-c465773d17cea2083bb6e471629b7115442f4399.tar.bz2
linux-c465773d17cea2083bb6e471629b7115442f4399.zip
selftests/net: Replace non-standard __WORDSIZE with sizeof(long) * 8
[ Upstream commit c36748e8733ef9c5f4cd1d7c4327994e5b88b8df ] The `__WORDSIZE` macro, defined in the non-standard `<bits/wordsize.h>` header, is a GNU extension and not universally available with all toolchains, such as Clang when used with musl libc. This can lead to build failures in environments where this header is missing. The intention of the code is to determine the bit width of a C `long`. Replace the non-portable `__WORDSIZE` with the standard and portable `sizeof(long) * 8` expression to achieve the same result. This change also removes the inclusion of the now-unused `<bits/wordsize.h>` header. Signed-off-by: Wake Liu <wakel@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/net/psock_tpacket.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/tools/testing/selftests/net/psock_tpacket.c b/tools/testing/selftests/net/psock_tpacket.c
index 404a2ce759ab..93092d13b3c5 100644
--- a/tools/testing/selftests/net/psock_tpacket.c
+++ b/tools/testing/selftests/net/psock_tpacket.c
@@ -33,7 +33,6 @@
#include <ctype.h>
#include <fcntl.h>
#include <unistd.h>
-#include <bits/wordsize.h>
#include <net/ethernet.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
@@ -785,7 +784,7 @@ static int test_kernel_bit_width(void)
static int test_user_bit_width(void)
{
- return __WORDSIZE;
+ return sizeof(long) * 8;
}
static const char *tpacket_str[] = {