]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r311954, r311996, r312077, r312080:
authorian <ian@FreeBSD.org>
Thu, 2 Mar 2017 04:23:53 +0000 (04:23 +0000)
committerian <ian@FreeBSD.org>
Thu, 2 Mar 2017 04:23:53 +0000 (04:23 +0000)
commit441c0c0ed529fc9fb17e0feb520d123e21acb7f5
tree798f99c36b3f220290c85d5b78d50866d47b5875
parenta8e4be5c56fa510af7512ec8fc2bfe5dc41ffe45
MFC r311954, r311996, r312077, r312080:

  Rework tty_drain() to poll the hardware for completion, and restore
  drain timeout handling to historical freebsd behavior.

  The primary reason for these changes is the need to have tty_drain() call
  ttydevsw_busy() at some reasonable sub-second rate, to poll hardware that
  doesn't signal an interrupt when the transmit shift register becomes empty
  (which includes virtually all USB serial hardware).  Such hardware hangs
  in a ttyout wait, because it never gets an opportunity to trigger a wakeup
  from the sleep in tty_drain() by calling ttydisc_getc() again, after
  handing the last of the buffered data to the hardware.

  Restructure the tty_drain loop so that device-busy is checked one more time
  after tty_timedwait() returns an error only if the error is EWOULDBLOCK;
  other errors cause an immediate return.  This fixes the case of the tty
  disappearing while in tty_drain().

  Check tty_gone() after allocating IO buffers.  The tty lock has to be
  dropped then reacquired due to using M_WAITOK, which opens a window in
  which the tty device can disappear.  Check for this and return ENXIO
  back up the call chain so that callers can cope.

  Correct the comments about how much buffer is allocated.
lib/libc/gen/tcsendbreak.3
share/man/man4/tty.4
sys/kern/tty.c
sys/kern/tty_inq.c
sys/kern/tty_outq.c
sys/sys/tty.h
sys/sys/ttyqueue.h