summaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
authormatthias <matthias@NetBSD.org>2008-07-04 10:13:52 +0000
committermatthias <matthias@NetBSD.org>2008-07-04 10:13:52 +0000
commit1b4ed9ea4e00dee1e52a6f4d38eee56121618c55 (patch)
tree80043dd5c0bfa795e8f642083a30d8a546db5af6 /sys/compat/linux
parent7453f200da3e33ea5573cfe22de6427a63897894 (diff)
make LINUX_TCSBRK work. The code is mostly copied from
sys/compat/ibcs2/ibcs2_ioctl.c.
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/common/linux_termios.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/sys/compat/linux/common/linux_termios.c b/sys/compat/linux/common/linux_termios.c
index 371a0582be8..650c4b9d510 100644
--- a/sys/compat/linux/common/linux_termios.c
+++ b/sys/compat/linux/common/linux_termios.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_termios.c,v 1.35 2008/04/28 20:23:44 martin Exp $ */
+/* $NetBSD: linux_termios.c,v 1.36 2008/07/04 10:13:52 matthias Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_termios.c,v 1.35 2008/04/28 20:23:44 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_termios.c,v 1.36 2008/07/04 10:13:52 matthias Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ptm.h"
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_termios.c,v 1.35 2008/04/28 20:23:44 martin Ex
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/termios.h>
+#include <sys/kernel.h>
#include <sys/syscallargs.h>
@@ -296,7 +297,20 @@ linux_ioctl_termios(struct lwp *l, const struct linux_sys_ioctl_args *uap, regis
SCARG(&ia, com) = TIOCNOTTY;
break;
case LINUX_TCSBRK:
- SCARG(&ia, com) = SCARG(uap, data) ? TIOCDRAIN : TIOCSBRK;
+ idat = (u_long)SCARG(uap, data);
+ if (idat != 0)
+ SCARG(&ia, com) = TIOCDRAIN;
+ else {
+ if ((error = (*bsdioctl)(fp, TIOCSBRK, NULL)) != 0)
+ goto out;
+ error = tsleep(&idat, PZERO | PCATCH, "linux_tcsbrk", hz / 4);
+ if (error == EINTR || error == ERESTART) {
+ (void)(*bsdioctl)(fp, TIOCCBRK, NULL);
+ error = EINTR;
+ } else
+ error = (*bsdioctl)(fp, TIOCCBRK, NULL);
+ goto out;
+ }
break;
case LINUX_TIOCMGET:
SCARG(&ia, com) = TIOCMGET;