diff --git a/sys/compat/common/vfs_syscalls_30.c b/sys/compat/common/vfs_syscalls_30.c index 28cc3469191f..555bf9c325b1 100644 --- a/sys/compat/common/vfs_syscalls_30.c +++ b/sys/compat/common/vfs_syscalls_30.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls_30.c,v 1.7 2006/03/01 12:38:12 yamt Exp $ */ +/* $NetBSD: vfs_syscalls_30.c,v 1.8 2006/05/04 17:48:57 christos Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.7 2006/03/01 12:38:12 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.8 2006/05/04 17:48:57 christos Exp $"); #include #include @@ -146,6 +146,46 @@ compat_30_sys___lstat13(struct lwp *l, void *v, register_t *retval) return error; } +/* ARGSUSED */ +int +compat_30_sys_fhstat(struct lwp *l, void *v, register_t *retval) +{ + struct compat_30_sys_fhstat_args /* { + syscallarg(const fhandle_t *) fhp; + syscallarg(struct stat13 *) sb; + } */ *uap = v; + struct proc *p = l->l_proc; + struct stat sb; + struct stat13 osb; + int error; + fhandle_t fh; + struct mount *mp; + struct vnode *vp; + + /* + * Must be super user + */ + if ((error = suser(p->p_ucred, &p->p_acflag))) + 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 (mp->mnt_op->vfs_fhtovp == NULL) + return EOPNOTSUPP; + if ((error = VFS_FHTOVP(mp, &fh.fh_fid, &vp))) + return (error); + error = vn_stat(vp, &sb, l); + vput(vp); + if (error) + return (error); + cvtstat(&osb, &sb); + error = copyout(&osb, SCARG(uap, sb), sizeof(sb)); + return (error); +} + /* * Return status information about a file descriptor. */ diff --git a/sys/compat/freebsd/syscalls.master b/sys/compat/freebsd/syscalls.master index c769b03d5062..c655e5e92bbe 100644 --- a/sys/compat/freebsd/syscalls.master +++ b/sys/compat/freebsd/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.50 2005/12/11 12:20:02 christos Exp $ + $NetBSD: syscalls.master,v 1.51 2006/05/04 17:48:56 christos Exp $ ; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -538,9 +538,9 @@ 276 NOARGS { int sys_lutimes(const char *path, \ const struct timeval *tptr); } 277 NOARGS { int sys___msync13(void *addr, size_t len, int flags); } -278 NOARGS { int compat_30_sys___stat13(const char *path, struct stat30 *ub); } -279 NOARGS { int compat_30_sys___fstat13(int fd, struct stat30 *sb); } -280 NOARGS { int compat_30_sys___lstat13(const char *path, struct stat30 *ub);} +278 NOARGS { int compat_30_sys___stat13(const char *path, struct stat13 *ub); } +279 NOARGS { int compat_30_sys___fstat13(int fd, struct stat13 *sb); } +280 NOARGS { int compat_30_sys___lstat13(const char *path, struct stat13 *ub);} 281 UNIMPL 282 UNIMPL 283 UNIMPL @@ -560,8 +560,8 @@ 297 NOARGS { int compat_20_sys_fhstatfs(const fhandle_t *fhp, \ struct statfs12 *buf); } 298 NOARGS { int sys_fhopen(const fhandle_t *fhp, int flags); } -299 NOARGS { int sys_fhstat(const fhandle_t *fhp, \ - struct stat *sb); } +299 NOARGS { int compat_30_sys_fhstat(const fhandle_t *fhp, \ + struct stat13 *sb); } ; syscall numbers for FreeBSD 300 UNIMPL modnext 301 UNIMPL modstat diff --git a/sys/compat/pecoff/syscalls.master b/sys/compat/pecoff/syscalls.master index 2f05fb3ce09f..faa994abb36f 100644 --- a/sys/compat/pecoff/syscalls.master +++ b/sys/compat/pecoff/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.16 2006/02/26 17:12:44 kent Exp $ + $NetBSD: syscalls.master,v 1.17 2006/05/04 17:48:56 christos Exp $ ; based on NetBSD: syscalls.master,v 1.150 2005/11/29 22:52:02 yamt Exp ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -643,8 +643,12 @@ 296 NOARGS { int sys___getcwd(char *bufp, size_t length); } 297 NOARGS { int sys_fchroot(int fd); } 298 NOARGS { int sys_fhopen(const fhandle_t *fhp, int flags); } -299 NOARGS { int sys_fhstat(const fhandle_t *fhp, \ - struct stat *sb); } +#ifdef COMPAT_30 +299 NOARGS { int compat_30_sys_fhstat(const fhandle_t *fhp, \ + struct stat13 *sb); } +#else +299 EXCL compat_30_sys_fhstat +#endif #ifdef COMPAT_20 300 NOARGS { int compat_20_sys_fhstatfs(const fhandle_t *fhp, \ struct statfs12 *buf); } @@ -821,3 +825,5 @@ 390 NOARGS { int sys___getdents30(int fd, char *buf, size_t count); } 391 NOARGS { int sys_posix_fadvise(int fd, off_t offset, \ off_t len, int advice); } +392 NOARGS { int sys___fhstat30(const fhandle_t *fhp, \ + struct stat *sb); } diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 802b5e2c84d1..6f56b0630c08 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.151 2006/02/24 19:20:20 drochner Exp $ + $NetBSD: syscalls.master,v 1.152 2006/05/04 17:48:56 christos Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -571,9 +571,9 @@ 276 STD { int sys_lutimes(const char *path, \ const struct timeval *tptr); } 277 STD { int sys___msync13(void *addr, size_t len, int flags); } -278 COMPAT_30 { int sys___stat13(const char *path, struct stat30 *ub); } -279 COMPAT_30 { int sys___fstat13(int fd, struct stat30 *sb); } -280 COMPAT_30 { int sys___lstat13(const char *path, struct stat30 *ub); } +278 COMPAT_30 { int sys___stat13(const char *path, struct stat13 *ub); } +279 COMPAT_30 { int sys___fstat13(int fd, struct stat13 *sb); } +280 COMPAT_30 { int sys___lstat13(const char *path, struct stat13 *ub); } 281 STD { int sys___sigaltstack14( \ const struct sigaltstack *nss, \ struct sigaltstack *oss); } @@ -610,8 +610,8 @@ 296 STD { int sys___getcwd(char *bufp, size_t length); } 297 STD { int sys_fchroot(int fd); } 298 STD { int sys_fhopen(const fhandle_t *fhp, int flags); } -299 STD { int sys_fhstat(const fhandle_t *fhp, \ - struct stat *sb); } +299 COMPAT_30 { int sys_fhstat(const fhandle_t *fhp, \ + struct stat13 *sb); } 300 COMPAT_20 { int sys_fhstatfs(const fhandle_t *fhp, \ struct statfs12 *buf); } #if defined(SYSVSEM) || !defined(_KERNEL) @@ -784,3 +784,5 @@ 390 STD { int sys___getdents30(int fd, char *buf, size_t count); } 391 STD { int sys_posix_fadvise(int fd, off_t offset, \ off_t len, int advice); } +392 STD { int sys___fhstat30(const fhandle_t *fhp, \ + struct stat *sb); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 39ebbcfa76a5..e48b24d3ed4d 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.239 2006/03/27 20:20:45 martin Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.240 2006/05/04 17:48:56 christos Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.239 2006/03/27 20:20:45 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.240 2006/05/04 17:48:56 christos Exp $"); #include "opt_compat_netbsd.h" #include "opt_compat_43.h" @@ -1372,9 +1372,9 @@ bad: /* ARGSUSED */ int -sys_fhstat(struct lwp *l, void *v, register_t *retval) +sys___fhstat30(struct lwp *l, void *v, register_t *retval) { - struct sys_fhstat_args /* { + struct sys___fhstat30_args /* { syscallarg(const fhandle_t *) fhp; syscallarg(struct stat *) sb; } */ *uap = v;