/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_50.c,v 1.26 2021/08/15 07:57:46 christos Exp $");
/*
* Set the access and modification times given a path name; this
* version follows links.
*/
/* ARGSUSED */
int
compat_50_sys_utimes(struct lwp *l, const struct compat_50_sys_utimes_args *uap,
register_t *retval)
{
/* {
syscallarg(const char *) path;
syscallarg(const struct timeval50 *) tptr;
} */
/*
* Set the access and modification times given a file descriptor.
*/
/* ARGSUSED */
int
compat_50_sys_futimes(struct lwp *l,
const struct compat_50_sys_futimes_args *uap, register_t *retval)
{
/* {
syscallarg(int) fd;
syscallarg(const struct timeval50 *) tptr;
} */
int error;
struct file *fp;
/* fd_getvnode() will use the descriptor for us */
if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0)
return error;
error = compat_50_do_sys_utimes(l, fp->f_vnode, NULL, 0,
SCARG(uap, tptr));
fd_putfile(SCARG(uap, fd));
return error;
}
/*
* Set the access and modification times given a path name; this
* version does not follow links.
*/
int
compat_50_sys_lutimes(struct lwp *l,
const struct compat_50_sys_lutimes_args *uap, register_t *retval)
{
/* {
syscallarg(const char *) path;
syscallarg(const struct timeval50 *) tptr;
} */
int
compat_50_sys_lfs_segwait(struct lwp *l,
const struct compat_50_sys_lfs_segwait_args *uap, register_t *retval)
{
/* {
syscallarg(fsid_t *) fsidp;
syscallarg(struct timeval50 *) tv;
} */
#ifdef notyet
/* XXX need to check presence of LFS at run-time XXX */
struct timeval atv;
struct timeval50 atv50;
fsid_t fsid;
int error;
/* XXX need we be su to segwait? */
error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_LFS,
KAUTH_REQ_SYSTEM_LFS_SEGWAIT, NULL, NULL, NULL);
if (error)
return (error);
if ((error = copyin(SCARG(uap, fsidp), &fsid, sizeof(fsid_t))) != 0)
return (error);
if (SCARG(uap, tv)) {
error = copyin(SCARG(uap, tv), &atv50, sizeof(atv50));
if (error)
return (error);
timeval50_to_timeval(&atv50, &atv);
if (itimerfix(&atv))
return (EINVAL);
} else /* NULL or invalid */
atv.tv_sec = atv.tv_usec = 0;
return lfs_segwait(&fsid, &atv);
#else
return ENOSYS;
#endif
}