diff options
Diffstat (limited to 'include/osmocom/core/select.h')
-rw-r--r-- | include/osmocom/core/select.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/osmocom/core/select.h b/include/osmocom/core/select.h index bc601982..fc148512 100644 --- a/include/osmocom/core/select.h +++ b/include/osmocom/core/select.h @@ -19,6 +19,8 @@ #define OSMO_FD_WRITE 0x0002 /*! Indicate interest in exceptions from the file descriptor */ #define OSMO_FD_EXCEPT 0x0004 +/*! Used as when_mask in osmo_fd_update_when() */ +#define OSMO_FD_MASK 0xFFFF /* legacy naming dating back to early OpenBSC / bsc_hack of 2008 */ #define BSC_FD_READ OSMO_FD_READ @@ -47,6 +49,24 @@ void osmo_fd_setup(struct osmo_fd *ofd, int fd, unsigned int when, int (*cb)(struct osmo_fd *fd, unsigned int what), void *data, unsigned int priv_nr); +void osmo_fd_update_when(struct osmo_fd *ofd, unsigned int when_mask, unsigned int when); + +static inline void osmo_fd_read_enable(struct osmo_fd *ofd) { + osmo_fd_update_when(ofd, OSMO_FD_MASK, OSMO_FD_READ); +} + +static inline void osmo_fd_read_disable(struct osmo_fd *ofd) { + osmo_fd_update_when(ofd, ~OSMO_FD_READ, 0); +} + +static inline void osmo_fd_write_enable(struct osmo_fd *ofd) { + osmo_fd_update_when(ofd, OSMO_FD_MASK, OSMO_FD_WRITE); +} + +static inline void osmo_fd_write_disable(struct osmo_fd *ofd) { + osmo_fd_update_when(ofd, ~OSMO_FD_WRITE, 0); +} + bool osmo_fd_is_registered(struct osmo_fd *fd); int osmo_fd_register(struct osmo_fd *fd); void osmo_fd_unregister(struct osmo_fd *fd); @@ -85,5 +105,8 @@ struct osmo_signalfd { struct osmo_signalfd * osmo_signalfd_setup(void *ctx, sigset_t set, osmo_signalfd_cb *cb, void *data); +void osmo_select_shutdown_request(void); +int osmo_select_shutdown_requested(void); +bool osmo_select_shutdown_done(void); /*! @} */ |