예제 #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
linux_sys_clock_getres(struct proc *p, void *v, register_t *retval)
{
	struct linux_sys_clock_getres_args *uap = v;
	struct sys_clock_getres_args cgr;

	int error;

	if (SCARG(uap, tp) == NULL)
	  	return 0;

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

	SCARG(&cgr, tp) = (struct timespec *)SCARG(uap, tp);
	return sys_clock_getres(p, &cgr, retval);
}
예제 #3
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));
}
예제 #4
0
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));
}