MCPcopy Create free account
hub / github.com/F-Stack/f-stack / __umtx_op_sem2_wait

Function __umtx_op_sem2_wait

freebsd/kern/kern_umtx.c:3790–3822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3788}
3789
3790static int
3791__umtx_op_sem2_wait(struct thread *td, struct _umtx_op_args *uap,
3792 const struct umtx_copyops *ops)
3793{
3794 struct _umtx_time *tm_p, timeout;
3795 size_t uasize;
3796 int error;
3797
3798 /* Allow a null timespec (wait forever). */
3799 if (uap->uaddr2 == NULL) {
3800 uasize = 0;
3801 tm_p = NULL;
3802 } else {
3803 uasize = (size_t)uap->uaddr1;
3804 error = ops->copyin_umtx_time(uap->uaddr2, uasize, &timeout);
3805 if (error != 0)
3806 return (error);
3807 tm_p = &timeout;
3808 }
3809 error = do_sem2_wait(td, uap->obj, tm_p);
3810 if (error == EINTR && uap->uaddr2 != NULL &&
3811 (timeout._flags & UMTX_ABSTIME) == 0 &&
3812 uasize >= ops->umtx_time_sz + ops->timespec_sz) {
3813 error = ops->copyout_timeout(
3814 (void *)((uintptr_t)uap->uaddr2 + ops->umtx_time_sz),
3815 uasize - ops->umtx_time_sz, &timeout._timeout);
3816 if (error == 0) {
3817 error = EINTR;
3818 }
3819 }
3820
3821 return (error);
3822}
3823
3824static int
3825__umtx_op_sem2_wake(struct thread *td, struct _umtx_op_args *uap,

Callers

nothing calls this directly

Calls 1

do_sem2_waitFunction · 0.85

Tested by

no test coverage detected