Beispiel #1
0
int
osf1_sys_utimes(struct lwp *l, const struct osf1_sys_utimes_args *uap, register_t *retval)
{
	struct osf1_timeval otv;
	struct timeval tv[2], *tvp;
	int error;

	if (SCARG(uap, tptr) == NULL)
		tvp = NULL;
	else {
		/* get the OSF/1 timeval argument */
		error = copyin(SCARG(uap, tptr), &otv, sizeof otv);
		if (error != 0)
			return error;

		/* fill in and copy out the NetBSD timeval */
		tv[0].tv_sec = otv.tv_sec;
		tv[0].tv_usec = otv.tv_usec;
		/* Set access and modified to the same time */
		tv[1].tv_sec = otv.tv_sec;
		tv[1].tv_usec = otv.tv_usec;
		tvp = tv;
	}

	return do_sys_utimes(l, NULL, SCARG(uap, path), FOLLOW,
			    tvp, UIO_SYSSPACE);
}
int
compat_50_netbsd32_futimes(struct lwp *l,
    const struct compat_50_netbsd32_futimes_args *uap, register_t *retval)
{
	/* {
		syscallarg(int) fd;
		syscallarg(const netbsd32_timeval50p_t) tptr;
	} */
	int error;
	file_t *fp;
	struct timeval tv[2], *tvp;

	error = get_utimes32(SCARG_P32(uap, tptr), tv, &tvp);
	if (error != 0)
		return error;

	/* fd_getvnode() will use the descriptor for us */
	if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0)
		return error;

	error = do_sys_utimes(l, fp->f_data, NULL, 0, tvp, UIO_SYSSPACE);

	fd_putfile(SCARG(uap, fd));
	return error;
}
int
compat_50_netbsd32_lutimes(struct lwp *l,
    const struct compat_50_netbsd32_lutimes_args *uap, register_t *retval)
{
	/* {
		syscallarg(const netbsd32_charp) path;
		syscallarg(const netbsd32_timeval50p_t) tptr;
	} */
	int error;
	struct timeval tv[2], *tvp;

	error = get_utimes32(SCARG_P32(uap, tptr), tv, &tvp);
	if (error != 0)
		return error;

	return do_sys_utimes(l, NULL, SCARG_P32(uap, path), NOFOLLOW,
	    tvp, UIO_SYSSPACE);
}
Beispiel #4
0
int
svr4_sys_utime(struct lwp *l, const struct svr4_sys_utime_args *uap, register_t *retval)
{
	struct svr4_utimbuf ub;
	struct timeval tbuf[2], *tvp;
	int error;

	if (SCARG(uap, ubuf) != NULL) {
		if ((error = copyin(SCARG(uap, ubuf), &ub, sizeof(ub))) != 0)
			return error;
		tbuf[0].tv_sec = ub.actime;
		tbuf[0].tv_usec = 0;
		tbuf[1].tv_sec = ub.modtime;
		tbuf[1].tv_usec = 0;
		tvp = tbuf;
	} else
		tvp = NULL;

	return do_sys_utimes(l, NULL, SCARG(uap, path), FOLLOW,
			    tvp, UIO_SYSSPACE);
}