diff --git a/include/proto/fd.h b/include/proto/fd.h index 5885d0cc9c..fcf026e2ea 100644 --- a/include/proto/fd.h +++ b/include/proto/fd.h @@ -409,6 +409,22 @@ static inline void fd_insert(int fd, unsigned long thread_mask) HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock); } +/* These are replacements for FD_SET, FD_CLR, FD_ISSET, working on uints */ +static inline void hap_fd_set(int fd, unsigned int *evts) +{ + evts[fd / (8*sizeof(*evts))] |= 1U << (fd & (8*sizeof(*evts) - 1)); +} + +static inline void hap_fd_clr(int fd, unsigned int *evts) +{ + evts[fd / (8*sizeof(*evts))] &= ~(1U << (fd & (8*sizeof(*evts) - 1))); +} + +static inline unsigned int hap_fd_isset(int fd, unsigned int *evts) +{ + return evts[fd / (8*sizeof(*evts))] & (1U << (fd & (8*sizeof(*evts) - 1))); +} + #endif /* _PROTO_FD_H */ diff --git a/src/ev_poll.c b/src/ev_poll.c index 715314cda9..b8ef537943 100644 --- a/src/ev_poll.c +++ b/src/ev_poll.c @@ -39,16 +39,6 @@ static unsigned int *fd_evts[2]; static THREAD_LOCAL int nbfd = 0; static THREAD_LOCAL struct pollfd *poll_events = NULL; -static inline void hap_fd_set(int fd, unsigned int *evts) -{ - evts[fd / (8*sizeof(*evts))] |= 1U << (fd & (8*sizeof(*evts) - 1)); -} - -static inline void hap_fd_clr(int fd, unsigned int *evts) -{ - evts[fd / (8*sizeof(*evts))] &= ~(1U << (fd & (8*sizeof(*evts) - 1))); -} - REGPRM1 static void __fd_clo(int fd) { HA_SPIN_LOCK(POLL_LOCK, &poll_lock);