Revert my previous errno hack, that is certainly an issue,

and always has been, but the system call itself returns
errno in a register so the problem is really a function of
libc, not the system call.

Discussed with : Matthew Dillion <dillon@apollo.backplane.com>
This commit is contained in:
David Xu 2005-01-18 13:53:10 +00:00
parent 6c7216df78
commit a2cc61fa6e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=140421
2 changed files with 13 additions and 7 deletions

View File

@ -756,6 +756,5 @@ _umtx_op(struct thread *td, struct _umtx_op_args *uap)
error = EINVAL;
break;
}
td->td_retval[0] = -error;
return (0);
return (error);
}

View File

@ -81,7 +81,8 @@ umtx_lock(struct umtx *umtx, long id)
{
if (atomic_cmpset_acq_ptr(&umtx->u_owner, (void *)UMTX_UNOWNED,
(void *)id) == 0)
return (- _umtx_op(umtx, UMTX_OP_LOCK, id, 0, 0));
if (_umtx_op(umtx, UMTX_OP_LOCK, id, 0, 0) == -1)
return (errno);
return (0);
}
@ -99,7 +100,8 @@ umtx_timedlock(struct umtx *umtx, long id, const struct timespec *timeout)
{
if (atomic_cmpset_acq_ptr(&umtx->u_owner, (void *)UMTX_UNOWNED,
(void *)id) == 0)
return (- _umtx_op(umtx, UMTX_OP_LOCK, id, 0, (void *)timeout));
if (_umtx_op(umtx, UMTX_OP_LOCK, id, 0, (void *)timeout) == -1)
return (errno);
return (0);
}
@ -108,21 +110,26 @@ umtx_unlock(struct umtx *umtx, long id)
{
if (atomic_cmpset_rel_ptr(&umtx->u_owner, (void *)id,
(void *)UMTX_UNOWNED) == 0)
return (- _umtx_op(umtx, UMTX_OP_UNLOCK, id, 0, 0));
if (_umtx_op(umtx, UMTX_OP_UNLOCK, id, 0, 0) == -1)
return (errno);
return (0);
}
static __inline int
umtx_wait(struct umtx *umtx, long id, const struct timespec *timeout)
{
return (- _umtx_op(umtx, UMTX_OP_WAIT, id, 0, (void *)timeout));
if (_umtx_op(umtx, UMTX_OP_WAIT, id, 0, (void *)timeout) == -1)
return (errno);
return (0);
}
/* Wake threads waiting on a user address. */
static __inline int
umtx_wake(struct umtx *umtx, int nr_wakeup)
{
return (- _umtx_op(umtx, UMTX_OP_WAKE, nr_wakeup, 0, 0));
if (_umtx_op(umtx, UMTX_OP_WAKE, nr_wakeup, 0, 0) == -1)
return (errno);
return (0);
}
#endif /* !_KERNEL */