[v3,1/4] Linux: Add FUTEX_LOCK_PI2

Message ID 20210906204740.3988273-2-adhemerval.zanella@linaro.org
State New
Headers show
Series
  • Add CLOCK_MONOTONIC support for PI mutexes
Related show

Commit Message

Florian Weimer via Libc-alpha Sept. 6, 2021, 8:47 p.m.
From: Kurt Kanzenbach <kurt@linutronix.de>


Linux v5.14.0 introduced a new futex operation called FUTEX_LOCK_PI2.

This kernel feature can be used to implement
pthread_mutex_clocklock(MONOTONIC)/PI.

Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

---
 sysdeps/unix/sysv/linux/kernel-features.h | 8 ++++++++
 1 file changed, 8 insertions(+)

-- 
2.30.2

Patch

diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 3930e14322..ffb6af196b 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -220,4 +220,12 @@ 
 # define __ASSUME_FACCESSAT2 0
 #endif
 
+/* The FUTEX_LOCK_PI2 operation was introduced across all architectures in Linux
+   5.14.  */
+#if __LINUX_KERNEL_VERSION >= 0x050e00
+# define __ASSUME_FUTEX_LOCK_PI2 1
+#else
+# define __ASSUME_FUTEX_LOCK_PI2 0
+#endif
+
 #endif /* kernel-features.h */