예제 #1
0
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;
}
예제 #2
0
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;
}
예제 #3
0
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;
}
예제 #4
0
static int
netbsd32_sigtimedwait_put_timeout(const void *src, void *dst, size_t size)
{
	const struct timespec *ts = src;
	struct netbsd32_timespec ts32;

	netbsd32_from_timespec(ts, &ts32);

	return copyout(&ts32, dst, sizeof(ts32));
}
예제 #5
0
int
netbsd32___timer_gettime50(struct lwp *l, const struct netbsd32___timer_gettime50_args *uap, register_t *retval)
{
	/* {
		syscallarg(netbsd32_timer_t) timerid;
		syscallarg(netbsd32_itimerspecp_t) value;
	} */
	int error;
	struct itimerspec its;
	struct netbsd32_itimerspec its32;

	if ((error = dotimer_gettime(SCARG(uap, timerid), l->l_proc,
	    &its)) != 0)
		return error;

	netbsd32_from_timespec(&its.it_interval, &its32.it_interval);
	netbsd32_from_timespec(&its.it_value, &its32.it_value);

	return copyout(&its32, SCARG_P32(uap, value), sizeof(its32));
}
예제 #6
0
/*
 * sysctl helper routine for netbsd32's kern.boottime node
 */
static int
netbsd32_sysctl_kern_boottime(SYSCTLFN_ARGS)
{
	struct sysctlnode node;
	struct netbsd32_timespec bt32;

	netbsd32_from_timespec(&boottime, &bt32);

	node = *rnode;
	node.sysctl_data = &bt32;
	return (sysctl_lookup(SYSCTLFN_CALL(&node)));
}
예제 #7
0
int
netbsd32___clock_gettime50(struct lwp *l, const struct netbsd32___clock_gettime50_args *uap, register_t *retval)
{
	/* {
		syscallarg(netbsd32_clockid_t) clock_id;
		syscallarg(netbsd32_timespecp_t) tp;
	} */
	int error;
	struct timespec ats;
	struct netbsd32_timespec ts32;

	error = clock_gettime1(SCARG(uap, clock_id), &ats);
	if (error != 0)
		return error;

	netbsd32_from_timespec(&ats, &ts32);
	return copyout(&ts32, SCARG_P32(uap, tp), sizeof(ts32));
}