summaryrefslogtreecommitdiff
path: root/sys/compat/common
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-07-14 18:00:49 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-07-14 18:00:49 +0000
commitbd13dba8bfe854209f11a54bdc103802ad9d2305 (patch)
treeaf9380c0209482dbbd933dbcfb711defb136095e /sys/compat/common
parentb65a201c4f524ae94b1e9d9611abf7555cf6422c (diff)
fhstat(2) uses struct stat too and so needs replacing as well.
OK miod@
Diffstat (limited to 'sys/compat/common')
-rw-r--r--sys/compat/common/vfs_syscalls_35.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/sys/compat/common/vfs_syscalls_35.c b/sys/compat/common/vfs_syscalls_35.c
index e9e6c62cbf1..60a751db655 100644
--- a/sys/compat/common/vfs_syscalls_35.c
+++ b/sys/compat/common/vfs_syscalls_35.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls_35.c,v 1.1 2004/07/13 21:04:29 millert Exp $ */
+/* $OpenBSD: vfs_syscalls_35.c,v 1.2 2004/07/14 18:00:48 millert Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -165,3 +165,40 @@ compat_35_sys_fstat(struct proc *p, void *v, register_t *retval)
sizeof (oub));
return (error);
}
+
+/* ARGSUSED */
+int
+compat_35_sys_fhstat(struct proc *p, void *v, register_t *retval)
+{
+ struct sys_fhstat_args /* {
+ syscallarg(const fhandle_t *) fhp;
+ syscallarg(struct stat35 *) sb;
+ } */ *uap = v;
+ struct stat ub;
+ struct stat35 oub;
+ int error;
+ fhandle_t fh;
+ struct mount *mp;
+ struct vnode *vp;
+
+ /*
+ * Must be super user
+ */
+ if ((error = suser(p, 0)))
+ return (error);
+
+ if ((error = copyin(SCARG(uap, fhp), &fh, sizeof(fhandle_t))) != 0)
+ return (error);
+
+ if ((mp = vfs_getvfs(&fh.fh_fsid)) == NULL)
+ return (ESTALE);
+ if ((error = VFS_FHTOVP(mp, &fh.fh_fid, &vp)))
+ return (error);
+ error = vn_stat(vp, &ub, p);
+ vput(vp);
+ if (error)
+ return (error);
+ cvtstat(&ub, &oub);
+ error = copyout(&oub, SCARG(uap, sb), sizeof(oub));
+ return (error);
+}