Hide most of the private futex functions.
Also hide part of the system properties compatibility code, since
we needed to touch that to keep it building.
I'll remove __futex_syscall4 and futex in a later patch.
Bug: 11156955
Change-Id: Ibbf42414c5bb07fb9f1c4a169922844778e4eeae
diff --git a/libc/private/bionic_futex.h b/libc/private/bionic_futex.h
index d01b859..11699ce 100644
--- a/libc/private/bionic_futex.h
+++ b/libc/private/bionic_futex.h
@@ -30,20 +30,30 @@
#include <linux/futex.h>
#include <sys/cdefs.h>
+#include <stdbool.h>
+#include <stddef.h>
__BEGIN_DECLS
-extern int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout);
-extern int __futex_wake(volatile void *ftx, int count);
+struct timespec;
-extern int __futex_syscall3(volatile void *ftx, int op, int val);
-extern int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout);
+extern int __futex_syscall4(volatile void* ftx, int op, int value, const struct timespec* timeout);
-/* Like __futex_wait/wake, but take an additional 'pshared' argument.
- * when non-0, this will use normal futexes. Otherwise, private futexes.
- */
-__LIBC_HIDDEN__ int __futex_wake_ex(volatile void* ftx, int pshared, int val);
-__LIBC_HIDDEN__ int __futex_wait_ex(volatile void* ftx, int pshared, int val, const struct timespec* timeout);
+static inline int __futex_wake(volatile void* ftx, int count) {
+ return __futex_syscall4(ftx, FUTEX_WAKE, count, NULL);
+}
+
+static inline int __futex_wake_ex(volatile void* ftx, bool shared, int count) {
+ return __futex_syscall4(ftx, shared ? FUTEX_WAKE : FUTEX_WAKE_PRIVATE, count, NULL);
+}
+
+static inline int __futex_wait(volatile void* ftx, int value, const struct timespec* timeout) {
+ return __futex_syscall4(ftx, FUTEX_WAIT, value, timeout);
+}
+
+static inline int __futex_wait_ex(volatile void* ftx, bool shared, int value, const struct timespec* timeout) {
+ return __futex_syscall4(ftx, shared ? FUTEX_WAIT : FUTEX_WAIT_PRIVATE, value, timeout);
+}
__END_DECLS