summaryrefslogtreecommitdiffhomepage
path: root/src/mypoll.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mypoll.h')
-rw-r--r--src/mypoll.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/mypoll.h b/src/mypoll.h
new file mode 100644
index 0000000..8736015
--- /dev/null
+++ b/src/mypoll.h
@@ -0,0 +1,31 @@
+#ifndef MYPOLL_H
+#define MYPOLL_H
+
+#include "config.h"
+
+#ifdef HAVE_POLL_H
+#define SELECT_OR_POLL "poll"
+
+#include <poll.h>
+typedef struct pollfd pollfd_struct;
+
+#define MYPOLL_READ POLLIN
+#define MYPOLL_WRITE POLLOUT
+
+#else
+
+#define SELECT_OR_POLL "select"
+#include <sys/select.h>
+typedef struct mypollfd {
+ int fd;
+ short events;
+ short revents;
+} pollfd_struct;
+
+#define MYPOLL_READ (1<<1)
+#define MYPOLL_WRITE (1<<2)
+#endif
+
+int mypoll(pollfd_struct* fds, int nfds, int timeout);
+
+#endif