diff options
author | Harald Welte <laforge@osmocom.org> | 2020-04-17 19:20:01 +0200 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2020-04-18 21:16:12 +0200 |
commit | a70ac85f5bf0d9a7bc0eeae94d38bd680bea5ebb (patch) | |
tree | 4d67654c596a66d8bad0d1c180fc46c7a565bd3d /include/osmocom/core/select.h | |
parent | f3cc731d40c223c25c81c063d0f477b0c88ca069 (diff) |
select.c: Introduce support for signalfd
The signalfd(2) mechanism of Linux allows signals to be delivered
and processed via normal file descriptor I/O. This avoids any of the
usual problems about re-entrancy of signal processing, as signals can
be processed from the osmocom select() loop abstraction just like any
other event.
Change-Id: If8d89dd1f6989e1cd9b9367fad954d65f91ada30
Diffstat (limited to 'include/osmocom/core/select.h')
-rw-r--r-- | include/osmocom/core/select.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/osmocom/core/select.h b/include/osmocom/core/select.h index 92904e2f..bc601982 100644 --- a/include/osmocom/core/select.h +++ b/include/osmocom/core/select.h @@ -7,6 +7,7 @@ #include <osmocom/core/linuxlist.h> #include <stdbool.h> #include <time.h> +#include <signal.h> /*! \defgroup select Select loop abstraction * @{ @@ -68,4 +69,21 @@ int osmo_timerfd_schedule(struct osmo_fd *ofd, const struct timespec *first, const struct timespec *interval); int osmo_timerfd_setup(struct osmo_fd *ofd, int (*cb)(struct osmo_fd *, unsigned int), void *data); +/* signalfd integration */ +struct osmo_signalfd; +struct signalfd_siginfo; + +typedef void osmo_signalfd_cb(struct osmo_signalfd *osfd, const struct signalfd_siginfo *fdsi); + +struct osmo_signalfd { + struct osmo_fd ofd; + sigset_t sigset; + osmo_signalfd_cb *cb; + void *data; +}; + +struct osmo_signalfd * +osmo_signalfd_setup(void *ctx, sigset_t set, osmo_signalfd_cb *cb, void *data); + + /*! @} */ |