summaryrefslogtreecommitdiff
path: root/sys/compat/linux32
diff options
context:
space:
mode:
authorad <ad@NetBSD.org>2008-03-21 21:54:58 +0000
committerad <ad@NetBSD.org>2008-03-21 21:54:58 +0000
commita9ca7a3734751f09c9dc4e1f645cd528fd403e8c (patch)
treeff26aca94a1a611e6be984fcff411406b466507f /sys/compat/linux32
parentc743ad71591a886accf44c9e93c1ff677b45a41f (diff)
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
Diffstat (limited to 'sys/compat/linux32')
-rw-r--r--sys/compat/linux32/common/linux32_stat.c10
-rw-r--r--sys/compat/linux32/common/linux32_termios.c40
2 files changed, 23 insertions, 27 deletions
diff --git a/sys/compat/linux32/common/linux32_stat.c b/sys/compat/linux32/common/linux32_stat.c
index 36cb63ea006..010705872c9 100644
--- a/sys/compat/linux32/common/linux32_stat.c
+++ b/sys/compat/linux32/common/linux32_stat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_stat.c,v 1.10 2007/12/20 23:02:58 dsl Exp $ */
+/* $NetBSD: linux32_stat.c,v 1.11 2008/03/21 21:54:58 ad Exp $ */
/*-
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_stat.c,v 1.10 2007/12/20 23:02:58 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_stat.c,v 1.11 2008/03/21 21:54:58 ad Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -120,7 +120,7 @@ linux32_sys_stat64(struct lwp *l, const struct linux32_sys_stat64_args *uap, reg
struct linux32_stat64 *st32p;
const char *path = SCARG_P32(uap, path);
- error = do_sys_stat(l, path, FOLLOW, &st);
+ error = do_sys_stat(path, FOLLOW, &st);
if (error != 0)
return error;
@@ -144,7 +144,7 @@ linux32_sys_lstat64(struct lwp *l, const struct linux32_sys_lstat64_args *uap, r
struct linux32_stat64 *st32p;
const char *path = SCARG_P32(uap, path);
- error = do_sys_stat(l, path, NOFOLLOW, &st);
+ error = do_sys_stat(path, NOFOLLOW, &st);
if (error != 0)
return error;
@@ -167,7 +167,7 @@ linux32_sys_fstat64(struct lwp *l, const struct linux32_sys_fstat64_args *uap, r
struct linux32_stat64 st32;
struct linux32_stat64 *st32p;
- error = do_sys_fstat(l, SCARG(uap, fd), &st);
+ error = do_sys_fstat(SCARG(uap, fd), &st);
if (error != 0)
return error;
diff --git a/sys/compat/linux32/common/linux32_termios.c b/sys/compat/linux32/common/linux32_termios.c
index 1d2e9b4a596..3ece7463078 100644
--- a/sys/compat/linux32/common/linux32_termios.c
+++ b/sys/compat/linux32/common/linux32_termios.c
@@ -1,7 +1,7 @@
-/* $NetBSD: linux32_termios.c,v 1.9 2007/12/20 23:02:59 dsl Exp $ */
+/* $NetBSD: linux32_termios.c,v 1.10 2008/03/21 21:54:58 ad Exp $ */
/*-
- * Copyright (c) 1995-2006 The NetBSD Foundation, Inc.
+ * Copyright (c) 1995-2006, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_termios.c,v 1.9 2007/12/20 23:02:59 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_termios.c,v 1.10 2008/03/21 21:54:58 ad Exp $");
#include "opt_compat_linux32.h"
@@ -76,8 +76,7 @@ linux32_ioctl_termios(struct lwp *l, const struct linux32_sys_ioctl_args *uap, r
syscallarg(netbsd32_u_long) com;
syscallarg(netbsd32_charp) data;
} */
- struct file *fp;
- struct filedesc *fdp;
+ file_t *fp;
u_long com;
struct linux32_termio tmplt;
struct linux32_termios tmplts;
@@ -86,26 +85,24 @@ linux32_ioctl_termios(struct lwp *l, const struct linux32_sys_ioctl_args *uap, r
struct netbsd32_ioctl_args ia;
int error;
char tioclinux;
- int (*bsdioctl)(struct file *, u_long, void *, struct lwp *);
+ int (*bsdioctl)(file_t *, u_long, void *);
- fdp = l->l_proc->p_fd;
- if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL)
+ if ((fp = fd_getfile(SCARG(uap, fd))) == NULL)
return (EBADF);
if ((fp->f_flag & (FREAD | FWRITE)) == 0) {
+ fd_putfile(SCARG(uap, fd));
error = EBADF;
goto out;
}
- FILE_USE(fp);
-
bsdioctl = fp->f_ops->fo_ioctl;
com = SCARG(uap, com);
retval[0] = 0;
switch (com) {
case LINUX32_TCGETS:
- error = (*bsdioctl)(fp, TIOCGETA, (void *)&tmpbts, l);
+ error = (*bsdioctl)(fp, TIOCGETA, &tmpbts);
if (error)
goto out;
bsd_termios_to_linux32_termios(&tmpbts, &tmplts);
@@ -118,7 +115,7 @@ linux32_ioctl_termios(struct lwp *l, const struct linux32_sys_ioctl_args *uap, r
* First fill in all fields, so that we keep the current
* values for fields that Linux doesn't know about.
*/
- error = (*bsdioctl)(fp, TIOCGETA, (void *)&tmpbts, l);
+ error = (*bsdioctl)(fp, TIOCGETA, &tmpbts);
if (error)
goto out;
if ((error = copyin(SCARG_P32(uap, data),
@@ -136,10 +133,10 @@ linux32_ioctl_termios(struct lwp *l, const struct linux32_sys_ioctl_args *uap, r
com = TIOCSETAF;
break;
}
- error = (*bsdioctl)(fp, com, (void *)&tmpbts, l);
+ error = (*bsdioctl)(fp, com, &tmpbts);
goto out;
case LINUX32_TCGETA:
- error = (*bsdioctl)(fp, TIOCGETA, (void *)&tmpbts, l);
+ error = (*bsdioctl)(fp, TIOCGETA, &tmpbts);
if (error)
goto out;
bsd_termios_to_linux32_termio(&tmpbts, &tmplt);
@@ -152,7 +149,7 @@ linux32_ioctl_termios(struct lwp *l, const struct linux32_sys_ioctl_args *uap, r
* First fill in all fields, so that we keep the current
* values for fields that Linux doesn't know about.
*/
- error = (*bsdioctl)(fp, TIOCGETA, (void *)&tmpbts, l);
+ error = (*bsdioctl)(fp, TIOCGETA, &tmpbts);
if (error)
goto out;
if ((error = copyin(SCARG_P32(uap, data),
@@ -170,7 +167,7 @@ linux32_ioctl_termios(struct lwp *l, const struct linux32_sys_ioctl_args *uap, r
com = TIOCSETAF;
break;
}
- error = (*bsdioctl)(fp, com, (void *)&tmpbts, l);
+ error = (*bsdioctl)(fp, com, &tmpbts);
goto out;
case LINUX32_TCFLSH:
switch((u_long)SCARG_P32(uap, data)) {
@@ -187,10 +184,10 @@ linux32_ioctl_termios(struct lwp *l, const struct linux32_sys_ioctl_args *uap, r
error = EINVAL;
goto out;
}
- error = (*bsdioctl)(fp, TIOCFLUSH, (void *)&idat, l);
+ error = (*bsdioctl)(fp, TIOCFLUSH, &idat);
goto out;
case LINUX32_TIOCGETD:
- error = (*bsdioctl)(fp, TIOCGETD, (void *)&idat, l);
+ error = (*bsdioctl)(fp, TIOCGETD, &idat);
if (error)
goto out;
switch (idat) {
@@ -244,7 +241,7 @@ linux32_ioctl_termios(struct lwp *l, const struct linux32_sys_ioctl_args *uap, r
error = EINVAL;
goto out;
}
- error = (*bsdioctl)(fp, TIOCSETD, (void *)&idat, l);
+ error = (*bsdioctl)(fp, TIOCSETD, &idat);
goto out;
case LINUX32_TIOCLINUX:
if ((error = copyin(SCARG_P32(uap, data),
@@ -325,7 +322,7 @@ linux32_ioctl_termios(struct lwp *l, const struct linux32_sys_ioctl_args *uap, r
{
struct ptmget ptm;
- error = (*bsdioctl)(fp, TIOCPTSNAME, &ptm, l);
+ error = (*bsdioctl)(fp, TIOCPTSNAME, &ptm);
if (error != 0)
goto out;
@@ -342,9 +339,8 @@ linux32_ioctl_termios(struct lwp *l, const struct linux32_sys_ioctl_args *uap, r
SCARG(&ia, fd) = SCARG(uap, fd);
SCARG(&ia, data) = SCARG(uap, data);
- /* XXX NJWLWP */
error = netbsd32_ioctl(curlwp, &ia, retval);
out:
- FILE_UNUSE(fp, l);
+ fdputfile(SCARG(uap, fd));
return error;
}