conf: add 'tweak.pty-prefetch-buffer-size-kb' setting

This controls the size of the buffers used by the PTY reader
thread. The default is 512KB, for now.
This commit is contained in:
Daniel Eklöf 2020-06-19 17:15:55 +02:00
parent 984d008250
commit 1b06486c98
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 19 additions and 11 deletions

View file

@ -317,12 +317,6 @@ ptmx_reader_thread(void *_term)
amount = term->ptmx_read_buffer.size - len;
}
/* TODO */
if (amount == 0) {
LOG_ERR("PTY read buffer full");
abort();
}
ssize_t count = read(term->ptmx, &buf[len], amount);
if (count < 0) {
LOG_ERRNO("failed to read from PTY");
@ -904,10 +898,10 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
.ptmx_read_buffer = {
.event_fd = ptmx_event_fd,
.idx = 0,
.size = 4 * 1024 * 1024,
.size = conf->tweak.pty_prefetch_size,
.buf = {
{.data = malloc(4 * 1024 * 1024), .len = 0},
{.data = malloc(4 * 1024 * 1024), .len = 0},
{.data = malloc(conf->tweak.pty_prefetch_size), .len = 0},
{.data = malloc(conf->tweak.pty_prefetch_size), .len = 0},
},
},
.ptmx_buffer = tll_init(),