コード例 #1
0
int
sys_linux_clock_gettime(struct linux_clock_gettime_args *args)
{
	struct l_timespec lts;
	int error;
	clockid_t nwhich = 0;	/* XXX: GCC */
	struct timespec tp;

	error = linux_to_native_clockid(&nwhich, args->which);
	if (error != 0)
		return (error);
	error = kern_clock_gettime(nwhich, &tp);
	if (error != 0)
		return (error);
	native_to_linux_timespec(&lts, &tp);

	return (copyout(&lts, args->tp, sizeof lts));
}
コード例 #2
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);
}
コード例 #3
0
ファイル: linux_time.c プロジェクト: alenichev/openbsd-kernel
int
linux_sys_clock_gettime(struct proc *p, void *v, register_t *retval)
{
	struct linux_sys_clock_gettime_args *uap = v;

	clockid_t clockid = 0;

	struct timespec tp;
	struct l_timespec ltp;

	int error;

	error = linux_to_native_clockid(&clockid, SCARG(uap, which));
	if (error != 0)
		return error;

	error = clock_gettime(p, clockid, &tp);
	if (error != 0)
		return error;

	native_to_linux_timespec(&ltp, &tp);

	return (copyout(&ltp, SCARG(uap, tp), sizeof ltp));
}