From bd92446184fe692e0ceda700945c588ae56cc6cd Mon Sep 17 00:00:00 2001 From: rofl0r Date: Tue, 15 Sep 2020 20:01:01 +0100 Subject: use poll() where available --- src/mypoll.c | 14 ++++++++++---- src/mypoll.h | 11 +++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mypoll.c b/src/mypoll.c index 0e06805..495e2c3 100644 --- a/src/mypoll.c +++ b/src/mypoll.c @@ -1,8 +1,14 @@ #include "mypoll.h" -#define MYPOLL_READ (1<<1) -#define MYPOLL_WRITE (1<<2) - +#ifdef HAVE_POLL_H +int mypoll(pollfd_struct* fds, int nfds, int timeout) { + int i, ret; + for(i=0; i +#include "config.h" #ifdef HAVE_POLL_H + #include typedef struct pollfd pollfd_struct; + +#define MYPOLL_READ POLLIN +#define MYPOLL_WRITE POLLOUT + #else + +#include typedef struct mypollfd { int fd; short events; short revents; } pollfd_struct; -#endif #define MYPOLL_READ (1<<1) #define MYPOLL_WRITE (1<<2) +#endif int mypoll(pollfd_struct* fds, int nfds, int timeout); -- cgit v1.2.3