summaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
authoryamt <yamt@NetBSD.org>2004-06-03 01:53:28 +0000
committeryamt <yamt@NetBSD.org>2004-06-03 01:53:28 +0000
commit6c4915e34d13daeff19a034cdbac2d5a42c2e333 (patch)
treeee765f8febd091c0ba996bc20aae65925fec1138 /sys/compat/linux
parent387534cc0a452ed62e32f3c6eacdab3f42a6d76e (diff)
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 (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/common/linux_ioctl.c51
1 files changed, 35 insertions, 16 deletions
diff --git a/sys/compat/linux/common/linux_ioctl.c b/sys/compat/linux/common/linux_ioctl.c
index 5bc6ff6830c..19dc1061531 100644
--- a/sys/compat/linux/common/linux_ioctl.c
+++ b/sys/compat/linux/common/linux_ioctl.c
@@ -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 @@ linux_sys_ioctl(l, v, retval)
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 @@ linux_sys_ioctl(l, v, retval)
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 @@ linux_sys_ioctl(l, v, retval)
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;
}