summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons
diff options
context:
space:
mode:
authorbland <bland@FreeBSD.org>2008-03-20 04:10:52 +0000
committerbland <bland@FreeBSD.org>2008-03-20 04:10:52 +0000
commit5671837ad2a5c68a4b81f5f55fbf1fc19d471dd1 (patch)
tree6f1087fbc5a1e6eae7e348d68e02b0118ef3bd08 /sys/dev/syscons
parentdc8118c259b1b76ade8abac46b4845ae3bbb45c7 (diff)
downloadFreeBSD-src-5671837ad2a5c68a4b81f5f55fbf1fc19d471dd1.zip
FreeBSD-src-5671837ad2a5c68a4b81f5f55fbf1fc19d471dd1.tar.gz
Improve VT_WAITACTIVE semantics.
- Wait for requested vty activation regardless its open state. - Remove redundant console cleanup. Approved by: kib MFC after: 1 week
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r--sys/dev/syscons/syscons.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 677ab57..9fc443b 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -160,6 +160,7 @@ SYSCTL_INT(_machdep, OID_AUTO, enable_panic_key, CTLFLAG_RW, &enable_panic_key,
#define SC_CONSOLECTL 255
+#define VTY_WCHAN(sc, vty) (&SC_DEV(sc, vty))
#define VIRTUAL_TTY(sc, x) (SC_DEV((sc), (x)) != NULL ? \
SC_DEV((sc), (x))->si_tty : NULL)
#define ISTTYOPEN(tp) ((tp) && ((tp)->t_state & TS_ISOPEN))
@@ -1065,17 +1066,9 @@ scioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
i = (*(int *)data == 0) ? scp->index : (*(int *)data - 1);
if ((i < sc->first_vty) || (i >= sc->first_vty + sc->vtys))
return EINVAL;
- s = spltty();
- error = sc_clean_up(sc->cur_scp);
- splx(s);
- if (error)
- return error;
- scp = sc_get_stat(SC_DEV(sc, i));
- if (scp == NULL)
- return (ENXIO);
- if (scp == scp->sc->cur_scp)
+ if (i == sc->cur_scp->index)
return 0;
- error = tsleep(&scp->smode, PZERO | PCATCH, "waitvt", 0);
+ error = tsleep(VTY_WCHAN(sc, i), PZERO | PCATCH, "waitvt", 0);
return error;
case VT_GETACTIVE: /* get active vty # */
@@ -2335,7 +2328,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr)
* be invoked at splhigh().
*/
if (debugger == 0)
- wakeup(&sc->new_scp->smode);
+ wakeup(VTY_WCHAN(sc,next_scr));
splx(s);
DPRINTF(5, ("switch done (new == old)\n"));
return 0;
@@ -2358,7 +2351,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr)
/* wake up processes waiting for this vty */
if (debugger == 0)
- wakeup(&sc->cur_scp->smode);
+ wakeup(VTY_WCHAN(sc,next_scr));
/* wait for the controlling process to acknowledge, if necessary */
if (signal_vt_acq(sc->cur_scp)) {
@@ -2384,7 +2377,7 @@ do_switch_scr(sc_softc_t *sc, int s)
exchange_scr(sc);
s = spltty();
/* sc->cur_scp == sc->new_scp */
- wakeup(&sc->cur_scp->smode);
+ wakeup(VTY_WCHAN(sc,sc->cur_scp->index));
/* wait for the controlling process to acknowledge, if necessary */
if (!signal_vt_acq(sc->cur_scp)) {
OpenPOWER on IntegriCloud