]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix draining in ttydev_leave():
authormarcel <marcel@FreeBSD.org>
Thu, 9 Oct 2014 02:30:38 +0000 (02:30 +0000)
committermarcel <marcel@FreeBSD.org>
Thu, 9 Oct 2014 02:30:38 +0000 (02:30 +0000)
commit9baa5db0553da264dd364301af17a58824c5be3f
treeaa275958604ebf9ea083151599a862f56d8cc6bb
parent9de8ee6c0c9bd7196f7b443fe919f04089a6b67e
Fix draining in ttydev_leave():
1.  ERESTART is not only returned when the revoke count changed. It
    is also returned when a signal is received. While a change in
    the revoke count should be ignored, a signal should not.
2.  Waiting until the output queue is entirely drained can cause a
    hang when the underlying device is stuck or broken.

Have tty_drain() take care of this by telling it when we're leaving.
When leaving, tty_drain() will use a timed wait to address point 2
above and it will check the revoke count to handle point 1 above.
The timeout is set to 1 second, which is arbitrary and long enough
to expect a change in the output queue.

Discussed with: jilles@
Reported by: Yamagi Burmeister <lists@yamagi.org>
sys/kern/tty.c