git: a68d5a66258e - main - Revert "kern: console: make /dev/console backing console more predictable"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 Jan 2024 16:13:39 UTC
The branch main has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=a68d5a66258e953ef6ccdbdd82e89572a3cc04f9
commit a68d5a66258e953ef6ccdbdd82e89572a3cc04f9
Author: Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2024-01-05 16:13:06 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-01-05 16:13:06 +0000
Revert "kern: console: make /dev/console backing console more predictable"
This accidentally snuck into a different branch, and has not been
reviewed for sanity yet..
This reverts commit 8ec6d7be2e27622b8b9e192b4da9ce88a4118636.
---
sys/kern/kern_cons.c | 24 +++++-------------------
1 file changed, 5 insertions(+), 19 deletions(-)
diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c
index d4a858cb12fd..462cd0c45758 100644
--- a/sys/kern/kern_cons.c
+++ b/sys/kern/kern_cons.c
@@ -239,31 +239,15 @@ cnremove(struct consdev *cn)
{
struct cn_device *cnd;
int i;
- bool primary = true;
STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) {
- if (cnd->cnd_cn != cn) {
- primary = false;
+ if (cnd->cnd_cn != cn)
continue;
- }
-
+ if (STAILQ_FIRST(&cn_devlist) == cnd)
+ ttyconsdev_select(NULL);
STAILQ_REMOVE(&cn_devlist, cnd, cn_device, cnd_next);
cnd->cnd_cn = NULL;
- /*
- * We only need to select a new console if we've removed all
- * consoles or if we're removing the primary console.
- */
- if (primary) {
- struct cn_device *next;
-
- next = STAILQ_FIRST(&cn_devlist);
- if (next == NULL)
- ttyconsdev_select(NULL);
- else
- ttyconsdev_select(next->cnd_cn->cn_name);
- }
-
/* Remove this device from available mask. */
for (i = 0; i < CNDEVTAB_SIZE; i++)
if (cnd == &cn_devtab[i]) {
@@ -372,6 +356,8 @@ sysctl_kern_console(SYSCTL_HANDLER_ARGS)
error = 0;
} else {
error = cnadd(cp);
+ if (error == 0)
+ cnselect(cp);
}
break;
}