diff mbox series

[meta-filesystems,10/26] xfstests: fix musl build (linux/types.h, RWH_WRITE_LIFE_NOT_SET)

Message ID 20260929225723.1046705-10-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-oe,01/26] canvenient: include <sys/time.h> for struct timeval on musl | expand

Commit Message

Khem Raj Sept. 29, 2026, 10:57 p.m. UTC
fs-monitor.c uses __s32/__u32 without <linux/types.h>, and rw_hint.c
uses RWH_WRITE_LIFE_NOT_SET which musl's headers don't define. Add the
missing include and a guarded fallback define.

AI-Generated: Uses Claude Code

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 ...nclude-linux-types.h-for-__s32-__u32.patch | 24 +++++++++++++++
 ...lback-define-for-RWH_WRITE_LIFE_NOT_.patch | 29 +++++++++++++++++++
 .../xfstests/xfstests_2026.06.21.bb           |  2 ++
 3 files changed, 55 insertions(+)
 create mode 100644 meta-filesystems/recipes-utils/xfstests/xfstests/0003-fs-monitor-include-linux-types.h-for-__s32-__u32.patch
 create mode 100644 meta-filesystems/recipes-utils/xfstests/xfstests/0004-rw_hint-add-fallback-define-for-RWH_WRITE_LIFE_NOT_.patch
diff mbox series

Patch

diff --git a/meta-filesystems/recipes-utils/xfstests/xfstests/0003-fs-monitor-include-linux-types.h-for-__s32-__u32.patch b/meta-filesystems/recipes-utils/xfstests/xfstests/0003-fs-monitor-include-linux-types.h-for-__s32-__u32.patch
new file mode 100644
index 0000000000..74b1d42f57
--- /dev/null
+++ b/meta-filesystems/recipes-utils/xfstests/xfstests/0003-fs-monitor-include-linux-types.h-for-__s32-__u32.patch
@@ -0,0 +1,24 @@ 
+From: Khem Raj <khem.raj@oss.qualcomm.com>
+Date: Tue, 29 Sep 2026 02:03:26 +0000
+Subject: [PATCH] fs-monitor: include linux/types.h for __s32/__u32
+
+The local fallback definition of "struct fanotify_event_info_error"
+(used when the libc's <sys/fanotify.h> predates FAN_FS_ERROR) uses the
+kernel-style __s32/__u32 typedefs. glibc's headers happen to pull
+these in transitively via other system headers, but musl does not, so
+building against musl fails with "unknown type name '__s32'/'__u32'"
+unless <linux/types.h> is included directly.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
+---
+--- a/src/fs-monitor.c
++++ b/src/fs-monitor.c
+@@ -12,6 +12,7 @@
+ #include <sys/fanotify.h>
+ #include <sys/types.h>
+ #include <unistd.h>
++#include <linux/types.h>
+
+ #ifndef FAN_FS_ERROR
+ #define FAN_FS_ERROR		0x00008000
diff --git a/meta-filesystems/recipes-utils/xfstests/xfstests/0004-rw_hint-add-fallback-define-for-RWH_WRITE_LIFE_NOT_.patch b/meta-filesystems/recipes-utils/xfstests/xfstests/0004-rw_hint-add-fallback-define-for-RWH_WRITE_LIFE_NOT_.patch
new file mode 100644
index 0000000000..a69dd6811b
--- /dev/null
+++ b/meta-filesystems/recipes-utils/xfstests/xfstests/0004-rw_hint-add-fallback-define-for-RWH_WRITE_LIFE_NOT_.patch
@@ -0,0 +1,29 @@ 
+From: Khem Raj <khem.raj@oss.qualcomm.com>
+Date: Tue, 29 Sep 2026 02:03:26 +0000
+Subject: [PATCH] rw_hint: add fallback define for RWH_WRITE_LIFE_NOT_SET
+
+The musl <fcntl.h> shipped in this toolchain mistakenly names the
+"not set" write-hint constant RWF_WRITE_LIFE_NOT_SET instead of the
+kernel uapi's RWH_WRITE_LIFE_NOT_SET (the other RWH_WRITE_LIFE_*
+values are spelled correctly), while glibc's <bits/fcntl-linux.h>
+defines RWH_WRITE_LIFE_NOT_SET as expected. Guard a local fallback
+definition so the test builds against either libc, without needing to
+pull in <linux/fcntl.h> and risk clashing with musl's own F_*_RW_HINT
+macro values.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
+---
+--- a/src/rw_hint.c
++++ b/src/rw_hint.c
+@@ -7,6 +7,10 @@
+ #include <string.h>
+ #include <fcntl.h>
+
++#ifndef RWH_WRITE_LIFE_NOT_SET
++#define RWH_WRITE_LIFE_NOT_SET	0
++#endif
++
+ int main(int argc, char **argv)
+ {
+ 	uint64_t hint = -1;
diff --git a/meta-filesystems/recipes-utils/xfstests/xfstests_2026.06.21.bb b/meta-filesystems/recipes-utils/xfstests/xfstests_2026.06.21.bb
index ad1ceea463..f6f246332e 100644
--- a/meta-filesystems/recipes-utils/xfstests/xfstests_2026.06.21.bb
+++ b/meta-filesystems/recipes-utils/xfstests/xfstests_2026.06.21.bb
@@ -13,6 +13,8 @@  SRC_URI = "git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git;branch=master;ta
            file://0002-Add-missing-STATX_ATTR_-defines-from-musl-sys-stat.h.patch \
            file://0001-bstat-use-uint32_t-instead-of-__uint32_t-to-fix-buil.patch \
            file://0001-locktest-do-not-tie-struct-delegation-to-the-F_GETDE.patch \
+           file://0003-fs-monitor-include-linux-types.h-for-__s32-__u32.patch \
+           file://0004-rw_hint-add-fallback-define-for-RWH_WRITE_LIFE_NOT_.patch \
            "