android_device_lenovo_karate/libshims/private/bionic_futex.h
LuK1337 ef5e484d7b land: Add libc hax for camera
* See : https://review.lineageos.org/#/c/1170/

Change-Id: I040c3023f81322140d153cb14be9578457777ac2
2017-06-27 19:27:41 +02:00

14 lines
607 B
C

static inline __always_inline int __futex(volatile void* ftx, int op, int value, const struct timespec* timeout) {
// Our generated syscall assembler sets errno, but our callers (pthread functions) don't want to.
int saved_errno = errno;
int result = syscall(__NR_futex, ftx, op, value, timeout);
if (__predict_false(result == -1)) {
result = -errno;
errno = saved_errno;
}
return result;
}
static inline int __futex_wait_ex(volatile void* ftx, bool shared, int value, const struct timespec* timeout) {
return __futex(ftx, shared ? FUTEX_WAIT : FUTEX_WAIT_PRIVATE, value, timeout);
}