pty: optimize read loop

System Internals / systemd - David Herrmann [gmail.com] - 3 October 2014 08:57 UTC

As it turns out, I can actually send data to the pty faster than the terminal can read. Therefore, make sure we read as much data as possible but bail out early enough to not cause starvation.

Kernel TTY buffers are 4k, so reduce the overall buffer size, but read more than once if possible (up to 8 times sounds reasonable).

48fed5c pty: optimize read loop
src/shared/pty.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Upstream: github.com


  • Share