diff options
author | Marius Strobl <marius@FreeBSD.org> | 2016-01-19 23:34:27 +0000 |
---|---|---|
committer | Marius Strobl <marius@FreeBSD.org> | 2016-01-19 23:34:27 +0000 |
commit | 9750d9e5b6f011a99da26a6f1e57c65545d26473 (patch) | |
tree | 317f9c0bd52607efdfd2f6c62f25b5b2aa3842e2 /sys/sys | |
parent | eb2ad8724bbaa87ab9a264562075d28e5428e9c2 (diff) | |
download | src-9750d9e5b6f011a99da26a6f1e57c65545d26473.tar.gz src-9750d9e5b6f011a99da26a6f1e57c65545d26473.zip |
Fix tty_drain() and, thus, TIOCDRAIN of the current tty(4) incarnation
to actually wait until the TX FIFOs of UARTs have be drained before
returning. This is done by bringing the equivalent of the TS_BUSY flag
found in the previous implementation back in an ABI-preserving way.
Reported and tested by: Patrick Powell
Most likely, drivers for USB-serial-adapters likewise incorporating
TX FIFOs as well as other terminal devices that buffer output in some
form should also provide implementations of tsw_busy.
MFC after: 3 days
Notes
Notes:
svn path=/head/; revision=294362
Diffstat (limited to 'sys/sys')
-rw-r--r-- | sys/sys/ttydevsw.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/sys/ttydevsw.h b/sys/sys/ttydevsw.h index 748ae0bee8e1..ae70613523a1 100644 --- a/sys/sys/ttydevsw.h +++ b/sys/sys/ttydevsw.h @@ -54,6 +54,7 @@ typedef int tsw_mmap_t(struct tty *tp, vm_ooffset_t offset, vm_paddr_t * paddr, int nprot, vm_memattr_t *memattr); typedef void tsw_pktnotify_t(struct tty *tp, char event); typedef void tsw_free_t(void *softc); +typedef bool tsw_busy_t(struct tty *tp); struct ttydevsw { unsigned int tsw_flags; /* Default TTY flags. */ @@ -74,7 +75,9 @@ struct ttydevsw { tsw_free_t *tsw_free; /* Destructor. */ - void *tsw_spare[4]; /* For future use. */ + tsw_busy_t *tsw_busy; /* Draining output. */ + + void *tsw_spare[3]; /* For future use. */ }; static __inline int @@ -181,4 +184,13 @@ ttydevsw_free(struct tty *tp) tp->t_devsw->tsw_free(tty_softc(tp)); } +static __inline bool +ttydevsw_busy(struct tty *tp) +{ + + MPASS(tty_gone(tp)); + + return (tp->t_devsw->tsw_busy(tp)); +} + #endif /* !_SYS_TTYDEVSW_H_ */ |