summaryrefslogtreecommitdiffhomepage
path: root/src/mypoll.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mypoll.c')
-rw-r--r--src/mypoll.c14
1 files changed, 10 insertions, 4 deletions
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<nfds; ++i) if(!fds[i].events) fds[i].fd=~fds[i].fd;
+ ret = poll(fds, nfds, timeout <= 0 ? timeout : timeout*1000);
+ for(i=0; i<nfds; ++i) if(!fds[i].events) fds[i].fd=~fds[i].fd;
+ return ret;
+}
+#else
int mypoll(pollfd_struct* fds, int nfds, int timeout) {
fd_set rset, wset, *r=0, *w=0;
int i, ret, maxfd=-1;
@@ -39,4 +45,4 @@ int mypoll(pollfd_struct* fds, int nfds, int timeout) {
}
return ret;
}
-
+#endif