Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/linux/common linux_sys_ioctl: map EPASSTHROUGH to...
details: https://anonhg.NetBSD.org/src/rev/55a72006750b
branches: trunk
changeset: 567152:55a72006750b
user: yamt <yamt%NetBSD.org@localhost>
date: Thu Jun 03 01:53:28 2004 +0000
description:
linux_sys_ioctl: map EPASSTHROUGH to EINVAL as sys_ioctl does.
otherwise, linux_syscall() returns garbage, at least on i386.
(it returns native_to_linux_errno[EPASSTHROUGH] where EPASSTHROUGH == -4.)
i choose EINVAL rather than ENOTTY, because linux's pipe returns it
and i think that it's a common case.
diffstat:
sys/compat/linux/common/linux_ioctl.c | 51 ++++++++++++++++++++++++----------
1 files changed, 35 insertions(+), 16 deletions(-)
diffs (102 lines):
diff -r 184c2cd766dc -r 55a72006750b sys/compat/linux/common/linux_ioctl.c
--- a/sys/compat/linux/common/linux_ioctl.c Thu Jun 03 00:31:28 2004 +0000
+++ b/sys/compat/linux/common/linux_ioctl.c Thu Jun 03 01:53:28 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.39 2004/06/03 01:53:28 yamt 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.39 2004/06/03 01:53:28 yamt 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