m68k: add support for PI futexes
[platform/upstream/glibc.git] / ports / sysdeps / unix / sysv / linux / m68k / nptl / lowlevellock.h
index fed152a..3a25477 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2013 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
 
@@ -38,6 +38,8 @@
 #define FUTEX_TRYLOCK_PI       8
 #define FUTEX_WAIT_BITSET      9
 #define FUTEX_WAKE_BITSET      10
+#define FUTEX_WAIT_REQEUE_PI   11
+#define FUTEX_CMP_REQEUE_PI    12
 #define FUTEX_PRIVATE_FLAG     128
 #define FUTEX_CLOCK_REALTIME   256
 
     __ret;                                                                   \
   })
 
+#define lll_futex_timed_wait_bitset(futexp, val, timespec, clockbit, private) \
+  ({                                                                         \
+    INTERNAL_SYSCALL_DECL (__err);                                           \
+    long int __ret;                                                          \
+    int __op = FUTEX_WAIT_BITSET | clockbit;                                 \
+    __ret = INTERNAL_SYSCALL (futex, __err, 6, (long) (futexp),                      \
+                             __lll_private_flag (__op, private),             \
+                             (val), (timespec), NULL /* Unused.  */,         \
+                             FUTEX_BITSET_MATCH_ANY);                        \
+    __ret;                                                                   \
+  })
+
 #define lll_futex_wake(futexp, nr, private) \
   ({                                                                         \
     INTERNAL_SYSCALL_DECL (__err);                                           \
     INTERNAL_SYSCALL_ERROR_P (__ret, __err);                                 \
   })
 
+/* Priority Inheritance support.  */
+#define lll_futex_wait_requeue_pi(futexp, val, mutex, private) \
+  lll_futex_timed_wait_requeue_pi (futexp, val, NULL, 0, mutex, private)
+
+#define lll_futex_timed_wait_requeue_pi(futexp, val, timespec, clockbit,      \
+                                       mutex, private)                       \
+  ({                                                                         \
+    INTERNAL_SYSCALL_DECL (__err);                                           \
+    long int __ret;                                                          \
+    int __op = FUTEX_WAIT_REQUEUE_PI | clockbit;                             \
+                                                                             \
+    __ret = INTERNAL_SYSCALL (futex, __err, 5, (futexp),                     \
+                             __lll_private_flag (__op, private),             \
+                             (val), (timespec), mutex);                      \
+    __ret;                                                                   \
+  })
+
+#define lll_futex_cmp_requeue_pi(futexp, nr_wake, nr_move, mutex, val, priv)  \
+  ({                                                                         \
+    INTERNAL_SYSCALL_DECL (__err);                                           \
+    long int __ret;                                                          \
+    __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp),                     \
+                             __lll_private_flag (FUTEX_CMP_REQUEUE_PI, priv),\
+                             (nr_wake), (nr_move), (mutex), (val));          \
+    INTERNAL_SYSCALL_ERROR_P (__ret, __err);                                 \
+  })
+
 #define lll_trylock(lock)                              \
   atomic_compare_and_exchange_val_acq (&(lock), 1, 0)
 
@@ -254,7 +295,7 @@ extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *,
     1  -  taken by one user
    >1  -  taken by more users */
 
-/* The kernel notifies a process which uses CLONE_CLEARTID via futex
+/* The kernel notifies a process which uses CLONE_CHILD_CLEARTID via futex
    wakeup when the clone terminates.  The memory location contains the
    thread ID while the clone is running and is reset to zero
    afterwards. */