Module Name:    src
Committed By:   matt
Date:           Fri Jan  7 02:27:43 UTC 2011

Modified Files:
        src/sys/dev [matt-nb5-pq3]: cons.c

Log Message:
Add critpollhooks.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.65.32.1 src/sys/dev/cons.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/cons.c
diff -u src/sys/dev/cons.c:1.65 src/sys/dev/cons.c:1.65.32.1
--- src/sys/dev/cons.c:1.65	Thu Jan 24 17:32:52 2008
+++ src/sys/dev/cons.c	Fri Jan  7 02:27:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cons.c,v 1.65 2008/01/24 17:32:52 ad Exp $	*/
+/*	$NetBSD: cons.c,v 1.65.32.1 2011/01/07 02:27:42 matt Exp $	*/
 
 /*
  * Copyright (c) 1990, 1993
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.65 2008/01/24 17:32:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.65.32.1 2011/01/07 02:27:42 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -279,7 +279,15 @@
 {
 	if (cn_tab == NULL)
 		return (0);
-	return ((*cn_tab->cn_getc)(cn_tab->cn_dev));
+	int s = splserial();
+	for (;;) {
+		const int rv = (*cn_tab->cn_getc)(cn_tab->cn_dev);
+		if (rv >= 0) {
+			splx(s);
+			return rv;
+		}
+		docritpollhooks();
+	}
 }
 
 int
@@ -337,8 +345,10 @@
 
 	if (c) {
 		(*cn_tab->cn_putc)(cn_tab->cn_dev, c);
-		if (c == '\n')
+		if (c == '\n') {
+			docritpollhooks();
 			(*cn_tab->cn_putc)(cn_tab->cn_dev, '\r');
+		}
 	}
 }
 

Reply via email to