Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-2-0]: src/sys/compat/linux/common Pullup rev 1.39 (requested by m...



details:   https://anonhg.NetBSD.org/src/rev/8e7a94d70d2a
branches:  netbsd-2-0
changeset: 562777:8e7a94d70d2a
user:      jmc <jmc%NetBSD.org@localhost>
date:      Fri Oct 08 03:21:21 2004 +0000

description:
Pullup rev 1.39 (requested by manu in ticket #904)

linux_sys_ioctl: map EPASSTHROUGH to EINVAL as sys_ioctl does.
otherwise, linux_syscall() returns garbage, at least on i386.

diffstat:

 sys/compat/linux/common/linux_ioctl.c |  51 ++++++++++++++++++++++++----------
 1 files changed, 35 insertions(+), 16 deletions(-)

diffs (102 lines):

diff -r 2dadd79252d2 -r 8e7a94d70d2a sys/compat/linux/common/linux_ioctl.c
--- a/sys/compat/linux/common/linux_ioctl.c     Fri Oct 08 03:19:35 2004 +0000
+++ b/sys/compat/linux/common/linux_ioctl.c     Fri Oct 08 03:21:21 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_ioctl.c,v 1.38 2003/06/29 22:29:30 fvdl Exp $    */
+/*     $NetBSD: linux_ioctl.c,v 1.38.4.1 2004/10/08 03:21:21 jmc Exp $ */
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ioctl.c,v 1.38 2003/06/29 22:29:30 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ioctl.c,v 1.38.4.1 2004/10/08 03:21:21 jmc Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "sequencer.h"
@@ -88,21 +88,28 @@
                syscallarg(caddr_t) data;
        } */ *uap = v;
        struct proc *p = l->l_proc;
+       int error;
 
        switch (LINUX_IOCGROUP(SCARG(uap, com))) {
        case 'M':
-               return oss_ioctl_mixer(p, LINUX_TO_OSS(v), retval);
+               error = oss_ioctl_mixer(p, LINUX_TO_OSS(v), retval);
+               break;
        case 'Q':
-               return oss_ioctl_sequencer(p, LINUX_TO_OSS(v), retval);
+               error = oss_ioctl_sequencer(p, LINUX_TO_OSS(v), retval);
+               break;
        case 'P':
-               return oss_ioctl_audio(p, LINUX_TO_OSS(v), retval);
+               error = oss_ioctl_audio(p, LINUX_TO_OSS(v), retval);
+               break;
        case 'r': /* VFAT ioctls; not yet supported */
-               return ENOSYS;
+               error = ENOSYS;
+               break;
        case 'S':
-               return linux_ioctl_cdrom(p, uap, retval);
+               error = linux_ioctl_cdrom(p, uap, retval);
+               break;
        case 't':
        case 'f':
-               return linux_ioctl_termios(p, uap, retval);
+               error = linux_ioctl_termios(p, uap, retval);
+               break;
        case 'T':
        {
 #if NSEQUENCER > 0
@@ -117,7 +124,6 @@
                struct filedesc *fdp;
                struct vnode *vp;
                struct vattr va;
-               int error;
                extern const struct cdevsw sequencer_cdevsw;
 
                fdp = p->p_fd;
@@ -136,20 +142,33 @@
                        error = linux_ioctl_termios(p, uap, retval);
                }
                FILE_UNUSE(fp, p);
-               return error;
 #else
-               return linux_ioctl_termios(p, uap, retval);
+               error = linux_ioctl_termios(p, uap, retval);
 #endif
        }
+               break;
        case 0x89:
-               return linux_ioctl_socket(p, uap, retval);
+               error = linux_ioctl_socket(p, uap, retval);
+               break;
        case 0x03:
-               return linux_ioctl_hdio(p, uap, retval);
+               error = linux_ioctl_hdio(p, uap, retval);
+               break;
        case 0x02:
-               return linux_ioctl_fdio(p, uap, retval);
+               error = linux_ioctl_fdio(p, uap, retval);
+               break;
        case 0x12:
-               return linux_ioctl_blkio(p, uap, retval);
+               error = linux_ioctl_blkio(p, uap, retval);
+               break;
        default:
-               return linux_machdepioctl(p, uap, retval);
+               error = linux_machdepioctl(p, uap, retval);
+               break;
        }
+       if (error == EPASSTHROUGH) {
+               /*
+                * linux returns EINVAL or ENOTTY for not supported ioctls.
+                */ 
+               error = EINVAL;
+       }
+
+       return error;
 }



Home | Main Index | Thread Index | Old Index