diff options
author | Kenny Levinsen <kl@kl.wtf> | 2020-09-18 15:06:29 +0200 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2020-09-22 01:01:46 +0200 |
commit | 6747c5f3f8d677bd553699710c1b99f5ae98f309 (patch) | |
tree | 2ee6bc79688a508455591614a8ee3dae7414dd48 /include | |
parent | fb5743971c731794758acd44bb08975b3ef15f2e (diff) | |
download | seatd-6747c5f3f8d677bd553699710c1b99f5ae98f309.tar.xz |
poller: Raise signals through self-pipe
Signal handling relied on poll(2) being interrupted by signals, followed
by a check for signal handlers flagging a signal as received. This only
allowed signals that were received during poll(2) to be handled
correctly.
Implement the usual self-pipe implementation, where signal handlers
write an arbitrary byte to a polled file descriptor to ensure proper
level-triggered signal handling.
Diffstat (limited to 'include')
-rw-r--r-- | include/poller.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/poller.h b/include/poller.h index f30bbda..63733e2 100644 --- a/include/poller.h +++ b/include/poller.h @@ -71,10 +71,11 @@ struct poller { struct linked_list signals; struct linked_list fds; + int signal_fds[2]; struct pollfd *pollfds; size_t pollfds_len; size_t fd_event_sources; - bool pollfds_dirty; + bool dirty; }; /** @@ -96,7 +97,7 @@ struct poll_impl { * Initializes the poller. The poller must be torn down with poller_finish when * it is no longer needed. */ -void poller_init(struct poller *poller); +int poller_init(struct poller *poller); /** * De-initializes the poller. This destroys all remaining event sources and |