[PATCH] tools/include/linux/types.h: add ulong typedef for musl compatibility

From: Hisam Mehboob

Date: Sun May 31 2026 - 10:53:57 EST


Building KVM selftests with musl libc fails across multiple files
(e.g. memslot_perf_test.c, cpuid_test.c) with 'ulong' undeclared.

Under glibc, <semaphore.h> includes <sys/types.h>, which exposes ulong.
Under musl, <semaphore.h> includes only <features.h>, <bits/alltypes.h>
and <fcntl.h>, and does not include <sys/types.h>. As a result, ulong is
not visible through the current selftests include chain.

include/linux/types.h already defines both ulong and ullong in its sysv
aliases block. tools/include/linux/types.h mirrors ullong but omits
ulong. Add ulong alongside ullong to close the gap.

Signed-off-by: Hisam Mehboob <hisamshar@xxxxxxxxx>
---
tools/include/linux/types.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/include/linux/types.h b/tools/include/linux/types.h
index d41f8a261bce..ccc90dd4baeb 100644
--- a/tools/include/linux/types.h
+++ b/tools/include/linux/types.h
@@ -42,6 +42,7 @@ typedef __s16 s16;
typedef __u8 u8;
typedef __s8 s8;

+typedef unsigned long ulong;
typedef unsigned long long ullong;

#ifdef __CHECKER__
--
2.51.0