linux-user: Guard local FUTEX_CMD_MASK definition
PATCH v2 1/1 linux-user: Guard local FUTEX_CMD_MASK definition
Building linux-user on a host with Linux 7.2 kernel headers fails with a macro redefinition error for FUTEX_CMD_MASK. The kernel commit 3ca9595d9fb6 ("futex: Add support for unlocking robust futexes") expanded the mask to include the new FUTEX_ROBUST_UNLOCK and FUTEX_ROBUST_LIST32 flags, which conflicts with QEMU's local definition.
Add a #ifndef guard so the host definition takes precedence when available. The local fallback is kept for older kernel headers (pre-2.6.29) that lack FUTEX_CMD_MASK or define a mask without FUTEX_CLOCK_REALTIME.
--- linux-user/syscall_defs.h | 2 ++ 1 file changed, 2 insertions(+)
linux-user/syscall_defs.h +2 -0
@@ -2593,7 +2593,9 @@ struct target_drm_i915_getparam {#define FUTEX_PRIVATE_FLAG 128#define FUTEX_CLOCK_REALTIME 256 +#ifndef FUTEX_CMD_MASK #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) +#endif #if defined(TARGET_X86_64 )#define TARGET_EPOLL_PACKED QEMU_PACKED
Signature · 1 line
2.55.0
Quoted 12 lines · Cédric Le Goater
Building linux-user on a host with Linux 7.2 kernel headers fails with a macro redefinition error for
FUTEX_CMD_MASK. The kernel commit3ca9595d9fb6("futex: Add support for unlocking robust futexes") expanded the mask to include the newFUTEX_ROBUST_UNLOCKandFUTEX_ROBUST_LIST32flags, which conflicts with QEMU's local definition.Add a #ifndef guard so the host definition takes precedence when available. The local fallback is kept for older kernel headers (pre-2.6.29) that lack
FUTEX_CMD_MASKor define a mask withoutFUTEX_CLOCK_REALTIME.
Quoted 4 lines
Signed-off-by Cédric Le Goater <[email protected]>--- linux-user/syscall_defs.h | 2 ++ 1 file changed, 2 insertions(+)
Quoted 12 lines · Cédric Le Goater
Building linux-user on a host with Linux 7.2 kernel headers fails with a macro redefinition error for
FUTEX_CMD_MASK. The kernel commit3ca9595d9fb6("futex: Add support for unlocking robust futexes") expanded the mask to include the newFUTEX_ROBUST_UNLOCKandFUTEX_ROBUST_LIST32flags, which conflicts with QEMU's local definition.Add a #ifndef guard so the host definition takes precedence when available. The local fallback is kept for older kernel headers (pre-2.6.29) that lack
FUTEX_CMD_MASKor define a mask withoutFUTEX_CLOCK_REALTIME.
Quoted 5 lines
Signed-off-by Cédric Le Goater <[email protected]>--- linux-user/syscall_defs.h | 2 ++ 1 file changed, 2 insertions(+)
Quoted 22 lines · Cédric Le Goater
Building linux-user on a host with Linux 7.2 kernel headers fails with a macro redefinition error for
FUTEX_CMD_MASK. The kernel commit3ca9595d9fb6("futex: Add support for unlocking robust futexes") expanded the mask to include the newFUTEX_ROBUST_UNLOCKandFUTEX_ROBUST_LIST32flags, which conflicts with QEMU's local definition.Add a #ifndef guard so the host definition takes precedence when available. The local fallback is kept for older kernel headers (pre-2.6.29) that lack
FUTEX_CMD_MASKor define a mask withoutFUTEX_CLOCK_REALTIME.Signed-off-by Cédric Le Goater <[email protected]>--- linux-user/syscall_defs.h | 2 ++ 1 file changed, 2 insertions(+)linux-user/syscall_defs.h +0
-0
linux-user/syscall_defs.h struct target_drm_i915_getparam { · line 2596
Quoted 4 lines
linux-user/syscall_defs.h +1
-0@@ -2593,7 +2593,9 @@ struct target_drm_i915_getparam {#define FUTEX_PRIVATE_FLAG 128#define FUTEX_CLOCK_REALTIME 256 +#ifndef FUTEX_CMD_MASK
It would be nice to have /* since linux 2.6.29 */ here.
But I wonder - if we really should care about such old kernels? Quite a few qemu-user internals require more recent host kernel. I guess it wont even compile with 3.x kernel headers :) (this is why a comment like this is useful).
Thanks,
/mjt
Quoted 4 lines · Michael Tokarev
Quoted 2 lines
#define FUTEX_CLOCK_REALTIME 256
+#ifndefFUTEX_CMD_MASKIt would be nice to have /* since linux 2.6.29 */ here.
(I can follow-up with such comment later, fwiw).
/mjt