Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode make sure to set O_ASYNC on stdin to enabl...



details:   https://anonhg.NetBSD.org/src/rev/1a412e04665f
branches:  trunk
changeset: 771986:1a412e04665f
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Dec 12 16:39:16 2011 +0000

description:
make sure to set O_ASYNC on stdin to enable ttycons "interrupts"

diffstat:

 sys/arch/usermode/dev/ttycons.c    |   6 ++++--
 sys/arch/usermode/include/thunk.h  |   3 ++-
 sys/arch/usermode/usermode/thunk.c |  19 +++++++++++++++++--
 3 files changed, 23 insertions(+), 5 deletions(-)

diffs (84 lines):

diff -r 03b11d3b7e61 -r 1a412e04665f sys/arch/usermode/dev/ttycons.c
--- a/sys/arch/usermode/dev/ttycons.c   Mon Dec 12 16:06:15 2011 +0000
+++ b/sys/arch/usermode/dev/ttycons.c   Mon Dec 12 16:39:16 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ttycons.c,v 1.9 2011/12/12 16:06:15 jmcneill Exp $ */
+/* $NetBSD: ttycons.c,v 1.10 2011/12/12 16:39:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttycons.c,v 1.9 2011/12/12 16:06:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttycons.c,v 1.10 2011/12/12 16:39:16 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -136,6 +136,8 @@
                panic("couldn't establish ttycons softint handler\n");
 
        thunk_signal(SIGIO, ttycons_intr);
+       if (thunk_set_stdin_sigio(true) != 0)
+               panic("couldn't enable stdin async mode");
 }
 
 void
diff -r 03b11d3b7e61 -r 1a412e04665f sys/arch/usermode/include/thunk.h
--- a/sys/arch/usermode/include/thunk.h Mon Dec 12 16:06:15 2011 +0000
+++ b/sys/arch/usermode/include/thunk.h Mon Dec 12 16:39:16 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.36 2011/12/11 22:33:49 jmcneill Exp $ */
+/* $NetBSD: thunk.h,v 1.37 2011/12/12 16:39:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -92,6 +92,7 @@
 int    thunk_tcgetattr(int, struct thunk_termios *);
 int    thunk_tcsetattr(int, int, const struct thunk_termios *);
 
+int    thunk_set_stdin_sigio(int);
 int    thunk_pollchar(void);
 int    thunk_getchar(void);
 void   thunk_putchar(int);
diff -r 03b11d3b7e61 -r 1a412e04665f sys/arch/usermode/usermode/thunk.c
--- a/sys/arch/usermode/usermode/thunk.c        Mon Dec 12 16:06:15 2011 +0000
+++ b/sys/arch/usermode/usermode/thunk.c        Mon Dec 12 16:39:16 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.41 2011/12/11 22:33:49 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.42 2011/12/12 16:39:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.41 2011/12/11 22:33:49 jmcneill Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.42 2011/12/12 16:39:16 jmcneill Exp $");
 #endif
 
 #include <sys/types.h>
@@ -321,6 +321,21 @@
 }
 
 int
+thunk_set_stdin_sigio(int onoff)
+{
+       int flags;
+
+       flags = fcntl(STDIN_FILENO, F_GETFL, 0);
+
+       if (onoff)
+               flags |= O_ASYNC;
+       else
+               flags &= ~O_ASYNC;
+
+       return fcntl(STDIN_FILENO, F_SETFL, flags);
+}
+
+int
 thunk_pollchar(void)
 {
        struct pollfd fds[1];



Home | Main Index | Thread Index | Old Index