]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hppa: Update lowlevellock.h.
authorCarlos O'Donell <carlos@systemhalted.org>
Tue, 29 Apr 2014 06:48:16 +0000 (02:48 -0400)
committerCarlos O'Donell <carlos@systemhalted.org>
Tue, 29 Apr 2014 06:48:16 +0000 (02:48 -0400)
Cleanup and remove old lll_private_futex_wake macro and add
generic support for PI-aware futexes.

ports/ChangeLog.hppa
ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h

index e867a9f337805397b6eee51df993f3cc9cbb7c38..499656b7c15a12d5e9076716db6cc9bcfb3a5857 100644 (file)
@@ -1,5 +1,14 @@
 2014-04-29  Carlos O'Donell  <carlos@systemhalted.org>
 
+       * sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h
+       (FUTEX_WAIT_REQUEUE_PI): Define.
+       (FUTEX_CMP_REQUEUE_PI): Define.
+       [__ASSUME_PRIVATE_FUTEX] (lll_private_futex_wake): Remove.
+       [!__ASSUME_PRIVATE_FUTEX] (lll_private_futex_wake): Remove.
+       (lll_futex_wait_requeue_pi): New macro.
+       (lll_futex_timed_wait_requeue_pi): New macro.
+       (lll_futex_cmp_requeue_pi): New macro.
+
        * sysdeps/hppa/nptl/tls.h (THREAD_GSCOPE_RESET_FLAG): Use
        lll_futex_wake.
 
index a428bb4b9f4709428de7b07e0aa791b37563c4f9..bd16f77cf2caa223e5ec974eae5193d6ef226842 100644 (file)
@@ -42,6 +42,8 @@
 #define FUTEX_TRYLOCK_PI       8
 #define FUTEX_WAIT_BITSET      9
 #define FUTEX_WAKE_BITSET      10
+#define FUTEX_WAIT_REQUEUE_PI  11
+#define FUTEX_CMP_REQUEUE_PI   12
 #define FUTEX_PRIVATE_FLAG     128
 #define FUTEX_CLOCK_REALTIME   256
 
@@ -119,19 +121,7 @@ typedef int lll_lock_t;
                              (val), (timespec));                             \
     __ret;                                                                   \
   })
-
-# define lll_private_futex_wake(futexp, nr) \
-  ({                                                                         \
-    INTERNAL_SYSCALL_DECL (__err);                                           \
-    long int __ret;                                                          \
-    __ret = INTERNAL_SYSCALL (futex, __err, 4,                               \
-                             (futexp), FUTEX_WAKE | FUTEX_PRIVATE_FLAG,      \
-                             (nr), 0);                                       \
-    __ret;                                                                   \
-  })
-
 #else
-
 # define lll_private_futex_timed_wait(futexp, val, timespec) \
   ({                                                                         \
     INTERNAL_SYSCALL_DECL (__err);                                           \
@@ -141,16 +131,6 @@ typedef int lll_lock_t;
                              (futexp), __op, (val), (timespec));             \
     __ret;                                                                   \
   })
-
-# define lll_private_futex_wake(futexp, nr) \
-  ({                                                                         \
-    INTERNAL_SYSCALL_DECL (__err);                                           \
-    long int __ret, __op;                                                    \
-    __op = FUTEX_WAKE | THREAD_GETMEM (THREAD_SELF, header.private_futex);    \
-    __ret = INTERNAL_SYSCALL (futex, __err, 4,                               \
-                             (futexp), __op, (nr), 0);                       \
-    __ret;                                                                   \
-  })
 #endif
 
 /* Returns non-zero if error happened, zero if success.  */
@@ -185,6 +165,34 @@ typedef int lll_lock_t;
     __ret;                                                                \
   })
 
+/* 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);                      \
+    INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __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);                                 \
+  })
+
 static inline int
 __attribute__ ((always_inline))
 __lll_robust_trylock (int *futex, int id)