summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r--sys/kern/tty.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 9695312..1dc6af2 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -132,11 +132,11 @@ tty_drain(struct tty *tp, int leaving)
/* buffer is inaccessible */
return (0);
- while (ttyoutq_bytesused(&tp->t_outq) > 0) {
+ while (ttyoutq_bytesused(&tp->t_outq) > 0 || ttydevsw_busy(tp)) {
ttydevsw_outwakeup(tp);
/* Could be handled synchronously. */
bytesused = ttyoutq_bytesused(&tp->t_outq);
- if (bytesused == 0)
+ if (bytesused == 0 && !ttydevsw_busy(tp))
return (0);
/* Wait for data to be drained. */
@@ -955,6 +955,13 @@ ttydevsw_deffree(void *softc)
panic("Terminal device freed without a free-handler");
}
+static bool
+ttydevsw_defbusy(struct tty *tp __unused)
+{
+
+ return (FALSE);
+}
+
/*
* TTY allocation and deallocation. TTY devices can be deallocated when
* the driver doesn't use it anymore, when the TTY isn't a session's
@@ -989,6 +996,7 @@ tty_alloc_mutex(struct ttydevsw *tsw, void *sc, struct mtx *mutex)
PATCH_FUNC(mmap);
PATCH_FUNC(pktnotify);
PATCH_FUNC(free);
+ PATCH_FUNC(busy);
#undef PATCH_FUNC
tp = malloc(sizeof(struct tty), M_TTY, M_WAITOK|M_ZERO);
OpenPOWER on IntegriCloud