Module Name:    src
Committed By:   mrg
Date:           Sun Sep 16 23:18:55 UTC 2018

Modified Files:
        src/sys/ddb: db_command.c db_output.c
        src/sys/kern: subr_userconf.c

Log Message:
call cnpollc(1) and cnpollc(0) around cngetc().

(christos has a good idea to add a function that does all 3,
and we should switch all the callers in this sequence to use
it (and fix the MD ones missing it still).  not all can, as
eg, line-grabbing functions can use cngetsn(), which only
calls cnpollc() twice.)


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/ddb/db_command.c
cvs rdiff -u -r1.33 -r1.34 src/sys/ddb/db_output.c
cvs rdiff -u -r1.26 -r1.27 src/sys/kern/subr_userconf.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/ddb/db_command.c
diff -u src/sys/ddb/db_command.c:1.158 src/sys/ddb/db_command.c:1.159
--- src/sys/ddb/db_command.c:1.158	Sat Sep 15 08:48:18 2018
+++ src/sys/ddb/db_command.c	Sun Sep 16 23:18:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_command.c,v 1.158 2018/09/15 08:48:18 mrg Exp $	*/
+/*	$NetBSD: db_command.c,v 1.159 2018/09/16 23:18:55 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.158 2018/09/15 08:48:18 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.159 2018/09/16 23:18:55 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -90,10 +90,10 @@ __KERNEL_RCSID(0, "$NetBSD: db_command.c
 #include <sys/module.h>
 #include <sys/kernhist.h>
 #include <sys/socketvar.h>
-
-/*include queue macros*/
 #include <sys/queue.h>
 
+#include <dev/cons.h>
+
 #include <ddb/ddb.h>
 
 #include <uvm/uvm_extern.h>
@@ -542,7 +542,10 @@ db_unregister_tbl(uint8_t type,const str
 	return ENOENT;
 }
 
-/* This function is called from machine trap code. */
+/*
+ * This function is called via db_trap() or directly from
+ * machine trap code.
+ */
 void
 db_command_loop(void)
 {
@@ -579,7 +582,9 @@ db_command_loop(void)
 		if (db_print_position() != 0)
 			db_printf("\n");
 		db_output_line = 0;
+		cnpollc(1);
 		(void) db_read_line();
+		cnpollc(0);
 		db_command(&db_last_command);
 	}
 

Index: src/sys/ddb/db_output.c
diff -u src/sys/ddb/db_output.c:1.33 src/sys/ddb/db_output.c:1.34
--- src/sys/ddb/db_output.c:1.33	Sat Sep  1 01:13:51 2012
+++ src/sys/ddb/db_output.c	Sun Sep 16 23:18:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_output.c,v 1.33 2012/09/01 01:13:51 matt Exp $	*/
+/*	$NetBSD: db_output.c,v 1.34 2018/09/16 23:18:55 mrg Exp $	*/
 
 /*
  * Mach Operating System
@@ -35,7 +35,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_output.c,v 1.33 2012/09/01 01:13:51 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_output.c,v 1.34 2018/09/16 23:18:55 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -111,7 +111,7 @@ db_more(void)
 
 	for (p = "--db_more--"; *p; p++)
 		cnputc(*p);
-	switch(cngetc()) {
+	switch (cngetc()) {
 	case ' ':
 		db_output_line = 0;
 		break;

Index: src/sys/kern/subr_userconf.c
diff -u src/sys/kern/subr_userconf.c:1.26 src/sys/kern/subr_userconf.c:1.27
--- src/sys/kern/subr_userconf.c:1.26	Mon Dec 23 15:34:16 2013
+++ src/sys/kern/subr_userconf.c	Sun Sep 16 23:18:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_userconf.c,v 1.26 2013/12/23 15:34:16 skrll Exp $	*/
+/*	$NetBSD: subr_userconf.c,v 1.27 2018/09/16 23:18:55 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 Mats O Jansson <m...@stacken.kth.se>
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_userconf.c,v 1.26 2013/12/23 15:34:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_userconf.c,v 1.27 2018/09/16 23:18:55 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -103,7 +103,9 @@ userconf_more(void)
 	if (userconf_cnt != -1) {
 		if (userconf_cnt == userconf_lines) {
 			printf("-- more --");
+			cnpollc(1);
 			c = cngetc();
+			cnpollc(0);
 			userconf_cnt = 0;
 			printf("\r            \r");
 		}
@@ -391,7 +393,9 @@ userconf_change(int devno)
 
 		while (c != 'y' && c != 'Y' && c != 'n' && c != 'N') {
 			printf("change (y/n) ?");
+			cnpollc(1);
 			c = cngetc();
+			cnpollc(0);
 			printf("\n");
 		}
 

Reply via email to