Fix #12: Implement workaround for application < foo.txt

This patch implements a workaround for issue #12, i.e. when an I/O
watcher for redirected stdin is registered and causes epoll_ctl()
to return EPERM.

The workaround registers the watcher as `active = -1` and bypasses
the epoll_wait() call in the main loop until all data has been read
from stdin and the temporary -1 watcher(s) have completed.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-10-21 19:10:04 +02:00
1 parent 82a1018dd2
commit e0cebc33b1
2 files changed
+52 -4

No files matched your search

+1
View File
@@ -46,6 +46,7 @@ typedef struct {
int fd; /* For epoll() */
uint32_t errors;
LIST_HEAD(,uev) watchers;
uint32_t workaround; /* For workarounds, e.g. redirected stdin */
} uev_ctx_t;
/* Forward declare due to dependencys, don't try this at home kids. */