| 3788 | } |
| 3789 | |
| 3790 | static 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 | |
| 3824 | static int |
| 3825 | __umtx_op_sem2_wake(struct thread *td, struct _umtx_op_args *uap, |
nothing calls this directly
no test coverage detected