static int fetchts(const void *u, void *s, size_t len) { int error; struct linux_timespec lts; if ((error = copyin(u, <s, sizeof(lts))) != 0) return error; linux_to_native_timespec(s, <s); return 0; }
int sys_linux_clock_settime(struct linux_clock_settime_args *args) { struct timespec ts; struct l_timespec lts; int error; clockid_t nwhich = 0; /* XXX: GCC */ error = linux_to_native_clockid(&nwhich, args->which); if (error != 0) return (error); error = copyin(args->tp, <s, sizeof lts); if (error != 0) return (error); error = linux_to_native_timespec(&ts, <s); if (error != 0) return (error); return (kern_clock_settime(nwhich, &ts)); }
int sys_linux_clock_nanosleep(struct linux_clock_nanosleep_args *args) { struct timespec *rmtp; struct l_timespec lrqts, lrmts; struct timespec rqts, rmts; int error; if (args->flags != 0) return (EINVAL); /* XXX deal with TIMER_ABSTIME */ if (args->which != LINUX_CLOCK_REALTIME) return (EINVAL); error = copyin(args->rqtp, &lrqts, sizeof lrqts); if (error != 0) return (error); if (args->rmtp != NULL) rmtp = &rmts; else rmtp = NULL; error = linux_to_native_timespec(&rqts, &lrqts); if (error != 0) return (error); error = nanosleep1(&rqts, rmtp); if (error != 0) return (error); if (args->rmtp != NULL) { native_to_linux_timespec(&lrmts, rmtp); error = copyout(&lrmts, args->rmtp, sizeof lrmts ); if (error != 0) return (error); } return (0); }
static int futex_copyin_timeout(int op, struct l_timespec *luts, int clockrt, struct timespec *ts) { struct l_timespec lts; struct timespec kts; int error; error = copyin(luts, <s, sizeof(lts)); if (error) return (error); error = linux_to_native_timespec(ts, <s); if (error) return (error); if (clockrt) { nanotime(&kts); timespecsub(ts, &kts); } else if (op == LINUX_FUTEX_WAIT_BITSET) { nanouptime(&kts); timespecsub(ts, &kts); } return (error); }