int netbsd32___timer_settime50(struct lwp *l, const struct netbsd32___timer_settime50_args *uap, register_t *retval) { /* { syscallarg(netbsd32_timer_t) timerid; syscallarg(int) flags; syscallarg(const netbsd32_itimerspecp_t) value; syscallarg(netbsd32_itimerspecp_t) ovalue; } */ int error; struct itimerspec value, ovalue, *ovp = NULL; struct netbsd32_itimerspec its32; if ((error = copyin(SCARG_P32(uap, value), &its32, sizeof(its32))) != 0) return (error); netbsd32_to_timespec(&its32.it_interval, &value.it_interval); netbsd32_to_timespec(&its32.it_value, &value.it_value); if (SCARG_P32(uap, ovalue)) ovp = &ovalue; if ((error = dotimer_settime(SCARG(uap, timerid), &value, ovp, SCARG(uap, flags), l->l_proc)) != 0) return error; if (ovp) { netbsd32_from_timespec(&ovp->it_interval, &its32.it_interval); netbsd32_from_timespec(&ovp->it_value, &its32.it_value); return copyout(&its32, SCARG_P32(uap, ovalue), sizeof(its32)); } return 0; }
int netbsd32___mq_timedreceive50(struct lwp *l, const struct netbsd32___mq_timedreceive50_args *uap, register_t *retval) { /* { syscallarg(mqd_t) mqdes; syscallarg(netbsd32_charp) msg_ptr; syscallarg(netbsd32_size_t) msg_len; syscallarg(netbsd32_uintp) msg_prio; syscallarg(const netbsd32_timespecp_t) abs_timeout; } */ struct timespec ts, *tsp; struct netbsd32_timespec ts32; ssize_t mlen; int error; /* Get and convert time value */ if (SCARG_P32(uap, abs_timeout)) { error = copyin(SCARG_P32(uap, abs_timeout), &ts32, sizeof(ts32)); if (error) return error; netbsd32_to_timespec(&ts32, &ts); tsp = &ts; } else { tsp = NULL; } error = mq_recv1(SCARG(uap, mqdes), SCARG_P32(uap, msg_ptr), SCARG(uap, msg_len), SCARG_P32(uap, msg_prio), tsp, &mlen); if (error == 0) *retval = mlen; return error; }
int netbsd32__ksem_timedwait(struct lwp *l, const struct netbsd32__ksem_timedwait_args *uap, register_t *retval) { /* { intptr_t id; const netbsd32_timespecp_t abstime; } */ struct netbsd32_timespec ts32; struct timespec ts; intptr_t id; int error; id = SCARG(uap, id); error = copyin(SCARG_P32(uap, abstime), &ts32, sizeof(ts32)); if (error != 0) return error; netbsd32_to_timespec(&ts32, &ts); if (ts.tv_sec < 0 || ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000) return EINVAL; error = do_ksem_wait(l, id, false, &ts); if (error == EWOULDBLOCK) error = ETIMEDOUT; return error; }
int netbsd32_clock_nanosleep(struct lwp *l, const struct netbsd32_clock_nanosleep_args *uap, register_t *retval) { /* { clockid_t clock_id; int flags; syscallarg(const netbsd32_timespecp_t) rqtp; syscallarg(netbsd32_timespecp_t) rmtp; } */ struct netbsd32_timespec ts32; struct timespec rqt, rmt; int error, error1; error = copyin(SCARG_P32(uap, rqtp), &ts32, sizeof(ts32)); if (error) return (error); netbsd32_to_timespec(&ts32, &rqt); error = nanosleep1(l, SCARG(uap, clock_id), SCARG(uap, flags), &rqt, SCARG_P32(uap, rmtp) ? &rmt : NULL); if (SCARG_P32(uap, rmtp) == NULL || (error != 0 && error != EINTR)) return error; netbsd32_from_timespec(&rmt, &ts32); error1 = copyout(&ts32, SCARG_P32(uap, rmtp), sizeof(ts32)); return error1 ? error1 : error; }
int netbsd32___nanosleep50(struct lwp *l, const struct netbsd32___nanosleep50_args *uap, register_t *retval) { /* { syscallarg(const netbsd32_timespecp_t) rqtp; syscallarg(netbsd32_timespecp_t) rmtp; } */ struct netbsd32_timespec ts32; struct timespec rqt, rmt; int error, error1; error = copyin(SCARG_P32(uap, rqtp), &ts32, sizeof(ts32)); if (error) return (error); netbsd32_to_timespec(&ts32, &rqt); error = nanosleep1(l, CLOCK_MONOTONIC, 0, &rqt, SCARG_P32(uap, rmtp) ? &rmt : NULL); if (SCARG_P32(uap, rmtp) == NULL || (error != 0 && error != EINTR)) return error; netbsd32_from_timespec(&rmt, &ts32); error1 = copyout(&ts32, SCARG_P32(uap, rmtp), sizeof(ts32)); return error1 ? error1 : error; }
static int netbsd32_sigtimedwait_fetch_timeout(const void *src, void *dst, size_t size) { struct timespec *ts = dst; struct netbsd32_timespec ts32; int error; error = copyin(src, &ts32, sizeof(ts32)); if (error) return error; netbsd32_to_timespec(&ts32, ts); return 0; }
int netbsd32___clock_settime50(struct lwp *l, const struct netbsd32___clock_settime50_args *uap, register_t *retval) { /* { syscallarg(netbsd32_clockid_t) clock_id; syscallarg(const netbsd32_timespecp_t) tp; } */ struct netbsd32_timespec ts32; struct timespec ats; int error; if ((error = copyin(SCARG_P32(uap, tp), &ts32, sizeof(ts32))) != 0) return (error); netbsd32_to_timespec(&ts32, &ats); return clock_settime1(l->l_proc, SCARG(uap, clock_id), &ats, true); }
int netbsd32____lwp_park60(struct lwp *l, const struct netbsd32____lwp_park60_args *uap, register_t *retval) { /* { syscallarg(const netbsd32_clockid_t) clock_id; syscallarg(int) flags; syscallarg(const netbsd32_timespec50p) ts; syscallarg(netbsd32_lwpid_t) unpark; syscallarg(netbsd32_voidp) hint; syscallarg(netbsd32_voidp) unparkhint; } */ struct timespec ts, *tsp; struct netbsd32_timespec ts32; int error; if (SCARG_P32(uap, ts) == NULL) tsp = NULL; else { error = copyin(SCARG_P32(uap, ts), &ts32, sizeof ts32); if (error != 0) return error; netbsd32_to_timespec(&ts32, &ts); tsp = &ts; } if (SCARG(uap, unpark) != 0) { error = lwp_unpark(SCARG(uap, unpark), SCARG_P32(uap, unparkhint)); if (error != 0) return error; } return lwp_park(SCARG(uap, clock_id), SCARG(uap, flags), tsp, SCARG_P32(uap, hint)); }