From f00c5fdac6e395859cf4971e5b7fa778f24336cc Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 3 Nov 2019 01:03:52 +0100 Subject: term: asynchronous writes to slave Make ptmx non-blocking. Then, when writing data to the slave would have blocked, use the FDM to asynchronously write the remaining data. This is done by enabling EPOLLOUT on ptmx, and enqueueing all outgoing data. The FDM handler will go through the enqueued data, and once all of it has been written, we turn off EPOLLOUT again (thus switching back to synchronous writes) --- terminal.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'terminal.h') diff --git a/terminal.h b/terminal.h index 22eff5a9..0ed83877 100644 --- a/terminal.h +++ b/terminal.h @@ -145,6 +145,12 @@ enum mouse_reporting { enum cursor_style { CURSOR_BLOCK, CURSOR_UNDERLINE, CURSOR_BAR }; +struct ptmx_buffer { + void *data; + size_t len; + size_t idx; +}; + struct terminal { struct fdm *fdm; @@ -152,6 +158,8 @@ struct terminal { int ptmx; bool quit; + tll(struct ptmx_buffer) ptmx_buffer; + enum cursor_keys cursor_keys_mode; enum keypad_keys keypad_keys_mode; bool reverse; -- cgit v1.3