diff options
author | Rich Felker <dalias@aerifal.cx> | 2014-08-22 23:49:54 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014-08-22 23:49:54 -0400 |
commit | b8ca9eb5301580dcf101753451eee196edceefbd (patch) | |
tree | 9602bfb40fbb328360bd024d2e416824cea63337 /src | |
parent | a6293285e930dbdb0eff47e29b513ca22537b1a2 (diff) | |
download | musl-b8ca9eb5301580dcf101753451eee196edceefbd.tar.gz musl-b8ca9eb5301580dcf101753451eee196edceefbd.tar.xz musl-b8ca9eb5301580dcf101753451eee196edceefbd.zip |
fix fallback checks for kernels without private futex support
for unknown syscall commands, the kernel produces ENOSYS, not EINVAL.
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/pthread_impl.h | 2 | ||||
-rw-r--r-- | src/thread/__timedwait.c | 2 | ||||
-rw-r--r-- | src/thread/__wait.c | 2 | ||||
-rw-r--r-- | src/thread/pthread_barrier_wait.c | 2 | ||||
-rw-r--r-- | src/thread/pthread_cond_timedwait.c | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h index 2d090f8f..4de66378 100644 --- a/src/internal/pthread_impl.h +++ b/src/internal/pthread_impl.h @@ -112,7 +112,7 @@ static inline void __wake(volatile void *addr, int cnt, int priv) { if (priv) priv = 128; if (cnt<0) cnt = INT_MAX; - __syscall(SYS_futex, addr, FUTEX_WAKE|priv, cnt) != -EINVAL || + __syscall(SYS_futex, addr, FUTEX_WAKE|priv, cnt) != -ENOSYS || __syscall(SYS_futex, addr, FUTEX_WAKE, cnt); } diff --git a/src/thread/__timedwait.c b/src/thread/__timedwait.c index 39eb9963..d6f12331 100644 --- a/src/thread/__timedwait.c +++ b/src/thread/__timedwait.c @@ -29,7 +29,7 @@ int __timedwait(volatile int *addr, int val, pthread_cleanup_push(cleanup, arg); r = -__syscall_cp(SYS_futex, addr, FUTEX_WAIT|priv, val, top); - if (r == EINVAL) r = -__syscall_cp(SYS_futex, addr, FUTEX_WAIT, val, top); + if (r == ENOSYS) r = -__syscall_cp(SYS_futex, addr, FUTEX_WAIT, val, top); if (r != EINTR && r != ETIMEDOUT) r = 0; pthread_cleanup_pop(0); diff --git a/src/thread/__wait.c b/src/thread/__wait.c index ec1e8206..3d0d9204 100644 --- a/src/thread/__wait.c +++ b/src/thread/__wait.c @@ -10,7 +10,7 @@ void __wait(volatile int *addr, volatile int *waiters, int val, int priv) } if (waiters) a_inc(waiters); while (*addr==val) { - __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val, 0) != -EINVAL + __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val, 0) != -ENOSYS || __syscall(SYS_futex, addr, FUTEX_WAIT, val, 0); } if (waiters) a_dec(waiters); diff --git a/src/thread/pthread_barrier_wait.c b/src/thread/pthread_barrier_wait.c index 6b329c95..4a964fe3 100644 --- a/src/thread/pthread_barrier_wait.c +++ b/src/thread/pthread_barrier_wait.c @@ -87,7 +87,7 @@ int pthread_barrier_wait(pthread_barrier_t *b) a_spin(); a_inc(&inst->finished); while (inst->finished == 1) - __syscall(SYS_futex,&inst->finished,FUTEX_WAIT|128,1,0) != -EINTR + __syscall(SYS_futex,&inst->finished,FUTEX_WAIT|128,1,0) != -ENOSYS || __syscall(SYS_futex,&inst->finished,FUTEX_WAIT,1,0); return PTHREAD_BARRIER_SERIAL_THREAD; } diff --git a/src/thread/pthread_cond_timedwait.c b/src/thread/pthread_cond_timedwait.c index c5cf66c3..2d192b07 100644 --- a/src/thread/pthread_cond_timedwait.c +++ b/src/thread/pthread_cond_timedwait.c @@ -52,7 +52,7 @@ static inline void unlock_requeue(volatile int *l, volatile int *r, int w) { a_store(l, 0); if (w) __wake(l, 1, 1); - else __syscall(SYS_futex, l, FUTEX_REQUEUE|128, 0, 1, r) != -EINVAL + else __syscall(SYS_futex, l, FUTEX_REQUEUE|128, 0, 1, r) != -ENOSYS || __syscall(SYS_futex, l, FUTEX_REQUEUE, 0, 1, r); } |