summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/pgm_socket.cpp16
-rw-r--r--src/poll.cpp4
-rw-r--r--src/poll.hpp16
-rw-r--r--src/select.cpp12
-rw-r--r--src/select.hpp23
-rw-r--r--src/signaler.hpp43
-rw-r--r--src/upoll.cpp26
8 files changed, 99 insertions, 43 deletions
diff --git a/configure.ac b/configure.ac
index 0d8b404..339cc37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -200,6 +200,7 @@ AC_CHECK_HEADERS([ \
string.h \
sys/socket.h \
sys/time.h \
+ sys/types.h \
time.h \
unistd.h \
limits.h
@@ -359,7 +360,6 @@ AS_IF([test "x$libxs_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"], [
AC_TYPE_SSIZE_T
])
-AC_HEADER_TIME
AC_TYPE_UINT32_T
AC_C_VOLATILE
diff --git a/src/pgm_socket.cpp b/src/pgm_socket.cpp
index 1c214a8..7747fe0 100644
--- a/src/pgm_socket.cpp
+++ b/src/pgm_socket.cpp
@@ -26,10 +26,18 @@
#ifdef XS_HAVE_WINDOWS
#include "windows.hpp"
-#endif
-
-#ifdef XS_HAVE_LINUX
-#include <poll.h>
+#else
+# if HAVE_SYS_TYPES
+# include <sys/types.h>
+# endif
+# if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# endif
+# if HAVE_POLL_H
+# include <poll.h>
+# elif HAVE_SYS_POLL_H
+# include <sys/poll.h>
+# endif
#endif
#include <stdlib.h>
diff --git a/src/poll.cpp b/src/poll.cpp
index 9f901fc..048de97 100644
--- a/src/poll.cpp
+++ b/src/poll.cpp
@@ -23,12 +23,8 @@
#if defined XS_USE_ASYNC_POLL
-#include <sys/types.h>
-#include <sys/time.h>
-#include <poll.h>
#include <algorithm>
-#include "poll.hpp"
#include "err.hpp"
#include "config.hpp"
diff --git a/src/poll.hpp b/src/poll.hpp
index c192a77..879f4ee 100644
--- a/src/poll.hpp
+++ b/src/poll.hpp
@@ -26,8 +26,22 @@
#if defined XS_USE_ASYNC_POLL
-#include <poll.h>
#include <stddef.h>
+
+#if HAVE_SYS_TYPES
+# include <sys/types.h>
+#endif
+
+#if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+
+#if HAVE_POLL_H
+# include <poll.h>
+#elif HAVE_SYS_POLL_H
+# include <sys/poll.h>
+#endif
+
#include <vector>
#include "fd.hpp"
diff --git a/src/select.cpp b/src/select.cpp
index 72346a4..1e3a7c4 100644
--- a/src/select.cpp
+++ b/src/select.cpp
@@ -24,17 +24,9 @@
#if defined XS_USE_ASYNC_SELECT
#include "platform.hpp"
+
#if defined XS_HAVE_WINDOWS
-#include "windows.hpp"
-#elif defined XS_HAVE_HPUX
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#elif defined XS_HAVE_OPENVMS
-#include <sys/types.h>
-#include <sys/time.h>
-#else
-#include <sys/select.h>
+# include "windows.hpp"
#endif
#include <string.h>
diff --git a/src/select.hpp b/src/select.hpp
index df188eb..23ca4d7 100644
--- a/src/select.hpp
+++ b/src/select.hpp
@@ -31,13 +31,24 @@
#include <stddef.h>
#include <vector>
-#ifdef XS_HAVE_WINDOWS
-#include "winsock2.h"
-#elif defined XS_HAVE_OPENVMS
-#include <sys/types.h>
-#include <sys/time.h>
+#if defined XS_HAVE_WINDOWS
+# include "winsock2.h"
#else
-#include <sys/select.h>
+# if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+# endif
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# endif
+# if HAVE_TIME_H
+# include <time.h>
+# endif
+# if HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+# if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# endif
#endif
#include "fd.hpp"
diff --git a/src/signaler.hpp b/src/signaler.hpp
index a47763f..b94858f 100644
--- a/src/signaler.hpp
+++ b/src/signaler.hpp
@@ -29,20 +29,37 @@
// instead of 'events' and 'revents' and defines macros to map from POSIX-y
// names to AIX-specific names).
#if defined XS_USE_SYNC_POLL
-#include <poll.h>
+# if HAVE_SYS_TYPES
+# include <sys/types.h>
+# endif
+# if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# endif
+# if HAVE_POLL_H
+# include <poll.h>
+# elif HAVE_SYS_POLL_H
+# include <sys/poll.h>
+# endif
#elif defined XS_USE_SYNC_SELECT
-#if defined XS_HAVE_WINDOWS
-#include "windows.hpp"
-#elif defined XS_HAVE_HPUX
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#elif defined XS_HAVE_OPENVMS
-#include <sys/types.h>
-#include <sys/time.h>
-#else
-#include <sys/select.h>
-#endif
+# if defined XS_HAVE_WINDOWS
+# include "windows.hpp"
+# else
+# if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+# endif
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# endif
+# if HAVE_TIME_H
+# include <time.h>
+# endif
+# if HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+# if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# endif
+# endif
#endif
namespace xs
diff --git a/src/upoll.cpp b/src/upoll.cpp
index 089a6a5..4d61b77 100644
--- a/src/upoll.cpp
+++ b/src/upoll.cpp
@@ -33,13 +33,31 @@
// instead of 'events' and 'revents' and defines macros to map from POSIX-y
// names to AIX-specific names).
#if defined XS_USE_SYNC_POLL
-#include <poll.h>
+# if HAVE_SYS_TYPES
+# include <sys/types.h>
+# endif
+# if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# endif
+# if HAVE_POLL_H
+# include <poll.h>
+# elif HAVE_SYS_POLL_H
+# include <sys/poll.h>
+# endif
#endif
#if defined XS_HAVE_WINDOWS
-#include "windows.hpp"
+# include "windows.hpp"
#else
-#include <unistd.h>
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# endif
+# if HAVE_TIME_H
+# include <time.h>
+# endif
+# if HAVE_UNISTD_H
+# include <unistd.h>
+# endif
#endif
int xs::upoll (xs_pollitem_t *items_, int nitems_, int timeout_)
@@ -227,7 +245,7 @@ int xs::upoll (xs_pollitem_t *items_, int nitems_, int timeout_)
// Ensure we do not attempt to select () on more than FD_SETSIZE
// file descriptors.
- xs_assert (nitems_ <= FD_SETSIZE);
+ xs_assert (nitems_ <= (int)FD_SETSIZE);
fd_set pollset_in;
FD_ZERO (&pollset_in);