tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Make compat consistently use do_sys_fstat()
Hi,
I noticed that not all compat fstat(2) functions do use
do_sys_fstat(), some of them do still do the fd_getfile()+fd_putfile()
dance.
Ok to convert the remaining functions to do_sys_fstat() ?
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.
Index: sys/compat/common/vfs_syscalls_12.c
===================================================================
RCS file: /cvsroot/src/sys/compat/common/vfs_syscalls_12.c,v
retrieving revision 1.27
diff -u -p -r1.27 vfs_syscalls_12.c
--- sys/compat/common/vfs_syscalls_12.c 11 Jan 2009 02:45:47 -0000 1.27
+++ sys/compat/common/vfs_syscalls_12.c 25 Jan 2009 02:24:28 -0000
@@ -179,16 +179,11 @@ compat_12_sys_fstat(struct lwp *l, const
syscallarg(int) fd;
syscallarg(struct stat12 *) sb;
} */
- int fd = SCARG(uap, fd);
- struct file *fp;
struct stat ub;
struct stat12 oub;
int error;
- if ((fp = fd_getfile(fd)) == NULL)
- return (EBADF);
- error = (*fp->f_ops->fo_stat)(fp, &ub);
- fd_putfile(fd);
+ error = do_sys_fstat(SCARG(uap, fd), &ub);
if (error == 0) {
compat_12_stat_conv(&ub, &oub);
error = copyout(&oub, SCARG(uap, sb), sizeof (oub));
Index: sys/compat/common/vfs_syscalls_30.c
===================================================================
RCS file: /cvsroot/src/sys/compat/common/vfs_syscalls_30.c,v
retrieving revision 1.29
diff -u -p -r1.29 vfs_syscalls_30.c
--- sys/compat/common/vfs_syscalls_30.c 11 Jan 2009 02:45:47 -0000 1.29
+++ sys/compat/common/vfs_syscalls_30.c 25 Jan 2009 02:24:28 -0000
@@ -180,16 +180,11 @@ compat_30_sys___fstat13(struct lwp *l, c
syscallarg(int) fd;
syscallarg(struct stat13 *) sb;
} */
- int fd = SCARG(uap, fd);
- struct file *fp;
struct stat sb;
struct stat13 osb;
int error;
- if ((fp = fd_getfile(fd)) == NULL)
- return EBADF;
- error = (*fp->f_ops->fo_stat)(fp, &sb);
- fd_putfile(fd);
+ error = do_sys_fstat(SCARG(uap, fd), &sb);
if (error)
return error;
cvtstat(&osb, &sb);
Index: sys/compat/common/vfs_syscalls_43.c
===================================================================
RCS file: /cvsroot/src/sys/compat/common/vfs_syscalls_43.c,v
retrieving revision 1.48
diff -u -p -r1.48 vfs_syscalls_43.c
--- sys/compat/common/vfs_syscalls_43.c 19 Nov 2008 18:36:02 -0000 1.48
+++ sys/compat/common/vfs_syscalls_43.c 25 Jan 2009 02:24:28 -0000
@@ -206,23 +206,17 @@ compat_43_sys_fstat(struct lwp *l, const
syscallarg(int) fd;
syscallarg(struct stat43 *) sb;
} */
- int fd = SCARG(uap, fd);
- struct file *fp;
struct stat ub;
struct stat43 oub;
int error;
- if ((fp = fd_getfile(fd)) == NULL)
- return (EBADF);
- error = (*fp->f_ops->fo_stat)(fp, &ub);
- fd_putfile(fd);
+ error = do_sys_fstat(SCARG(uap, fd), &ub);
if (error == 0) {
cvtstat(&ub, &oub);
error = copyout((void *)&oub, (void *)SCARG(uap, sb),
sizeof (oub));
}
-
return (error);
}
Index: sys/compat/common/vfs_syscalls_50.c
===================================================================
RCS file: /cvsroot/src/sys/compat/common/vfs_syscalls_50.c,v
retrieving revision 1.3
diff -u -p -r1.3 vfs_syscalls_50.c
--- sys/compat/common/vfs_syscalls_50.c 11 Jan 2009 20:46:53 -0000 1.3
+++ sys/compat/common/vfs_syscalls_50.c 25 Jan 2009 02:24:28 -0000
@@ -153,18 +153,11 @@ compat_50_sys___fstat30(struct lwp *l, c
syscallarg(int) fd;
syscallarg(struct stat30 *) sb;
} */
- int fd = SCARG(uap, fd);
- struct file *fp;
struct stat sb;
struct stat30 osb;
int error;
- if ((fp = fd_getfile(fd)) == NULL)
- return EBADF;
-
- error = (*fp->f_ops->fo_stat)(fp, &sb);
- fd_putfile(fd);
-
+ error = do_sys_fstat(SCARG(uap, fd), &sb);
if (error)
return error;
cvtstat(&osb, &sb);
Index: sys/compat/netbsd32/netbsd32_compat_30.c
===================================================================
RCS file: /cvsroot/src/sys/compat/netbsd32/netbsd32_compat_30.c,v
retrieving revision 1.28
diff -u -p -r1.28 netbsd32_compat_30.c
--- sys/compat/netbsd32/netbsd32_compat_30.c 11 Jan 2009 02:45:49 -0000
1.28
+++ sys/compat/netbsd32/netbsd32_compat_30.c 25 Jan 2009 02:24:29 -0000
@@ -120,17 +120,11 @@ compat_30_netbsd32___fstat13(struct lwp
syscallarg(int) fd;
syscallarg(netbsd32_stat13p_t) sb;
} */
- int fd = SCARG(uap, fd);
- file_t *fp;
struct netbsd32_stat13 sb32;
struct stat ub;
- int error = 0;
-
- if ((fp = fd_getfile(fd)) == NULL)
- return (EBADF);
- error = (*fp->f_ops->fo_stat)(fp, &ub);
- fd_putfile(fd);
+ int error;
+ error = do_sys_fstat(SCARG(uap, fd), &ub);
if (error == 0) {
netbsd32_from___stat13(&ub, &sb32);
error = copyout(&sb32, SCARG_P32(uap, sb), sizeof(sb32));
Index: sys/compat/netbsd32/netbsd32_compat_50.c
===================================================================
RCS file: /cvsroot/src/sys/compat/netbsd32/netbsd32_compat_50.c,v
retrieving revision 1.2
diff -u -p -r1.2 netbsd32_compat_50.c
--- sys/compat/netbsd32/netbsd32_compat_50.c 11 Jan 2009 02:45:49 -0000
1.2
+++ sys/compat/netbsd32/netbsd32_compat_50.c 25 Jan 2009 02:24:29 -0000
@@ -798,16 +798,11 @@ compat_50_netbsd32___fstat30(struct lwp
syscallarg(int) fd;
syscallarg(netbsd32_stat50p_t) sb;
} */
- int fd = SCARG(uap, fd);
- file_t *fp;
struct netbsd32_stat50 sb32;
struct stat ub;
- int error = 0;
+ int error;
- if ((fp = fd_getfile(fd)) == NULL)
- return (EBADF);
- error = (*fp->f_ops->fo_stat)(fp, &ub);
- fd_putfile(fd);
+ error = do_sys_fstat(SCARG(uap, fd), &ub);
if (error == 0) {
netbsd32_from___stat50(&ub, &sb32);
error = copyout(&sb32, SCARG_P32(uap, sb), sizeof(sb32));
Index: sys/compat/netbsd32/netbsd32_fs.c
===================================================================
RCS file: /cvsroot/src/sys/compat/netbsd32/netbsd32_fs.c,v
retrieving revision 1.56
diff -u -p -r1.56 netbsd32_fs.c
--- sys/compat/netbsd32/netbsd32_fs.c 11 Jan 2009 02:45:49 -0000 1.56
+++ sys/compat/netbsd32/netbsd32_fs.c 25 Jan 2009 02:24:29 -0000
@@ -543,16 +543,11 @@ netbsd32___fstat50(struct lwp *l, const
syscallarg(int) fd;
syscallarg(netbsd32_statp_t) sb;
} */
- int fd = SCARG(uap, fd);
- file_t *fp;
struct netbsd32_stat sb32;
struct stat ub;
- int error = 0;
+ int error;
- if ((fp = fd_getfile(fd)) == NULL)
- return (EBADF);
- error = (*fp->f_ops->fo_stat)(fp, &ub);
- fd_putfile(fd);
+ error = do_sys_fstat(SCARG(uap, fd), &ub);
if (error == 0) {
netbsd32_from_stat(&ub, &sb32);
error = copyout(&sb32, SCARG_P32(uap, sb), sizeof(sb32));
Index: sys/compat/osf1/osf1_descrip.c
===================================================================
RCS file: /cvsroot/src/sys/compat/osf1/osf1_descrip.c,v
retrieving revision 1.26
diff -u -p -r1.26 osf1_descrip.c
--- sys/compat/osf1/osf1_descrip.c 21 Mar 2008 21:54:58 -0000 1.26
+++ sys/compat/osf1/osf1_descrip.c 25 Jan 2009 02:24:30 -0000
@@ -216,16 +216,11 @@ osf1_sys_fpathconf(struct lwp *l, const
int
osf1_sys_fstat(struct lwp *l, const struct osf1_sys_fstat_args *uap,
register_t *retval)
{
- file_t *fp;
struct stat ub;
struct osf1_stat oub;
int error;
- if ((fp = fd_getfile(SCARG(uap, fd))) == NULL)
- return (EBADF);
- error = (*fp->f_ops->fo_stat)(fp, &ub);
- fd_putfile(SCARG(uap, fd));
-
+ error = do_sys_fstat(SCARG(uap, fd), &ub);
osf1_cvt_stat_from_native(&ub, &oub);
if (error == 0)
error = copyout(&oub, SCARG(uap, sb), sizeof(oub));
@@ -239,16 +234,11 @@ osf1_sys_fstat(struct lwp *l, const stru
int
osf1_sys_fstat2(struct lwp *l, const struct osf1_sys_fstat2_args *uap,
register_t *retval)
{
- file_t *fp;
struct stat ub;
struct osf1_stat2 oub;
int error;
- if ((fp = fd_getfile(SCARG(uap, fd))) == NULL)
- return (EBADF);
- error = (*fp->f_ops->fo_stat)(fp, &ub);
- fd_putfile(SCARG(uap, fd));
-
+ error = do_sys_fstat(SCARG(uap, fd), &ub);
osf1_cvt_stat2_from_native(&ub, &oub);
if (error == 0)
error = copyout(&oub, SCARG(uap, sb), sizeof(oub));
Home |
Main Index |
Thread Index |
Old Index