Esempio n. 1
0
static int
fetchts(const void *u, void *s, size_t len)
{
	int error;
	struct linux_timespec lts;
	
	if ((error = copyin(u, &lts, sizeof(lts))) != 0)
		return error;

	linux_to_native_timespec(s, &lts);
	return 0;
}
Esempio n. 2
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, &lts, sizeof lts);
	if (error != 0)
		return (error);
	error = linux_to_native_timespec(&ts, &lts);
	if (error != 0)
		return (error);

	return (kern_clock_settime(nwhich, &ts));
}
Esempio n. 3
0
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);
}
Esempio n. 4
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, &lts, sizeof(lts));
	if (error)
		return (error);

	error = linux_to_native_timespec(ts, &lts);
	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);
}