From 9e8a8aa5518b04907041c66b97d49fecb657c0e0 Mon Sep 17 00:00:00 2001 From: David Xu Date: Tue, 12 Dec 2006 05:26:39 +0000 Subject: [PATCH] Correctly check failed syscall. --- lib/libthr/thread/thr_umtx.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/libthr/thread/thr_umtx.c b/lib/libthr/thread/thr_umtx.c index 9de346e216a1..0a5ee6a31113 100644 --- a/lib/libthr/thread/thr_umtx.c +++ b/lib/libthr/thread/thr_umtx.c @@ -41,7 +41,7 @@ _thr_umutex_init(struct umutex *mtx) int __thr_umutex_lock(struct umutex *mtx) { - if (_umtx_op(mtx, UMTX_OP_MUTEX_LOCK, 0, 0, 0) == 0) + if (_umtx_op(mtx, UMTX_OP_MUTEX_LOCK, 0, 0, 0) != -1) return 0; return (errno); } @@ -54,7 +54,7 @@ __thr_umutex_timedlock(struct umutex *mtx, timeout->tv_nsec <= 0))) return (ETIMEDOUT); if (_umtx_op(mtx, UMTX_OP_MUTEX_LOCK, 0, 0, - __DECONST(void *, timeout)) == 0) + __DECONST(void *, timeout)) != -1) return (0); return (errno); } @@ -62,7 +62,7 @@ __thr_umutex_timedlock(struct umutex *mtx, int __thr_umutex_unlock(struct umutex *mtx) { - if (_umtx_op(mtx, UMTX_OP_MUTEX_UNLOCK, 0, 0, 0) == 0) + if (_umtx_op(mtx, UMTX_OP_MUTEX_UNLOCK, 0, 0, 0) != -1) return (0); return (errno); } @@ -70,7 +70,7 @@ __thr_umutex_unlock(struct umutex *mtx) int __thr_umutex_trylock(struct umutex *mtx) { - if (_umtx_op(mtx, UMTX_OP_MUTEX_TRYLOCK, 0, 0, 0) == 0) + if (_umtx_op(mtx, UMTX_OP_MUTEX_TRYLOCK, 0, 0, 0) != -1) return (0); return (errno); } @@ -79,7 +79,7 @@ int __thr_umutex_set_ceiling(struct umutex *mtx, uint32_t ceiling, uint32_t *oldceiling) { - if (_umtx_op(mtx, UMTX_OP_SET_CEILING, ceiling, oldceiling, 0) == 0) + if (_umtx_op(mtx, UMTX_OP_SET_CEILING, ceiling, oldceiling, 0) != -1) return (0); return (errno); } @@ -91,7 +91,7 @@ _thr_umtx_wait(volatile umtx_t *mtx, long id, const struct timespec *timeout) timeout->tv_nsec <= 0))) return (ETIMEDOUT); if (_umtx_op(__DEVOLATILE(void *, mtx), UMTX_OP_WAIT, id, 0, - __DECONST(void*, timeout)) == 0) + __DECONST(void*, timeout)) != -1) return (0); return (errno); } @@ -100,7 +100,7 @@ int _thr_umtx_wake(volatile umtx_t *mtx, int nr_wakeup) { if (_umtx_op(__DEVOLATILE(void *, mtx), UMTX_OP_WAKE, - nr_wakeup, 0, 0) == 0) + nr_wakeup, 0, 0) != -1) return (0); return (errno); } @@ -122,7 +122,7 @@ _thr_ucond_wait(struct ucond *cv, struct umutex *m, } if (_umtx_op(cv, UMTX_OP_CV_WAIT, check_unparking ? UMTX_CHECK_UNPARKING : 0, - m, __DECONST(void*, timeout)) == 0) { + m, __DECONST(void*, timeout)) != -1) { return (0); } return (errno); @@ -133,7 +133,7 @@ _thr_ucond_signal(struct ucond *cv) { if (!cv->c_has_waiters) return (0); - if (_umtx_op(cv, UMTX_OP_CV_SIGNAL, 0, NULL, NULL) == 0) + if (_umtx_op(cv, UMTX_OP_CV_SIGNAL, 0, NULL, NULL) != -1) return (0); return (errno); } @@ -143,7 +143,7 @@ _thr_ucond_broadcast(struct ucond *cv) { if (!cv->c_has_waiters) return (0); - if (_umtx_op(cv, UMTX_OP_CV_BROADCAST, 0, NULL, NULL) == 0) + if (_umtx_op(cv, UMTX_OP_CV_BROADCAST, 0, NULL, NULL) != -1) return (0); return (errno); }