about summary refs log tree commit diff
path: root/ports
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@systemhalted.org>2014-04-29 02:48:16 -0400
committerCarlos O'Donell <carlos@systemhalted.org>2014-04-29 02:48:16 -0400
commit4e4a58f4ee45cea6f3083af8f12d3834bb999555 (patch)
tree0b0bac45f060fb4bf2cee7f31368a6f23d610ce4 /ports
parent810789aed026442f8f3ba13877d01fd5bee8720f (diff)
downloadglibc-4e4a58f4ee45cea6f3083af8f12d3834bb999555.tar.gz
glibc-4e4a58f4ee45cea6f3083af8f12d3834bb999555.tar.xz
glibc-4e4a58f4ee45cea6f3083af8f12d3834bb999555.zip
hppa: Update lowlevellock.h.
Cleanup and remove old lll_private_futex_wake macro and add
generic support for PI-aware futexes.
Diffstat (limited to 'ports')
-rw-r--r--ports/ChangeLog.hppa9
-rw-r--r--ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h52
2 files changed, 39 insertions, 22 deletions
diff --git a/ports/ChangeLog.hppa b/ports/ChangeLog.hppa
index e867a9f337..499656b7c1 100644
--- a/ports/ChangeLog.hppa
+++ b/ports/ChangeLog.hppa
@@ -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.
 
diff --git a/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h b/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h
index a428bb4b9f..bd16f77cf2 100644
--- a/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h
+++ b/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h
@@ -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)