summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pgm_socket.cpp8
-rw-r--r--src/poll.hpp14
-rw-r--r--src/polling.hpp29
-rw-r--r--src/select.hpp20
-rw-r--r--src/signaler.hpp38
-rw-r--r--src/upoll.cpp32
6 files changed, 29 insertions, 112 deletions
diff --git a/src/pgm_socket.cpp b/src/pgm_socket.cpp
index 7726259..64d337d 100644
--- a/src/pgm_socket.cpp
+++ b/src/pgm_socket.cpp
@@ -30,14 +30,6 @@
# 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.hpp b/src/poll.hpp
index 879f4ee..2dd67f4 100644
--- a/src/poll.hpp
+++ b/src/poll.hpp
@@ -28,20 +28,6 @@
#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/polling.hpp b/src/polling.hpp
index c0b2423..1854705 100644
--- a/src/polling.hpp
+++ b/src/polling.hpp
@@ -65,4 +65,33 @@
#error No polling mechanism available!
#endif
+// Conditionally include header files that might be required to use the poll()
+// or select() functions
+
+#if defined XS_HAVE_WINDOWS // Windows-specific header files
+# include "windows.h"
+# include "winsock2.h"
+#else // Header files for Unix-like operating systems
+# if HAVE_SYS_TYPES
+# 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
+# if HAVE_POLL_H
+# include <poll.h>
+# elif HAVE_SYS_POLL_H
+# include <sys/poll.h>
+# endif
#endif
+
+#endif // __XS_POLLING_HPP_INCLUDED__
diff --git a/src/select.hpp b/src/select.hpp
index 23ca4d7..e46bd03 100644
--- a/src/select.hpp
+++ b/src/select.hpp
@@ -31,26 +31,6 @@
#include <stddef.h>
#include <vector>
-#if defined XS_HAVE_WINDOWS
-# include "winsock2.h"
-#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
-
#include "fd.hpp"
#include "thread.hpp"
#include "io_thread.hpp"
diff --git a/src/signaler.hpp b/src/signaler.hpp
index b94858f..ccb825b 100644
--- a/src/signaler.hpp
+++ b/src/signaler.hpp
@@ -24,44 +24,6 @@
#include "fd.hpp"
#include "polling.hpp"
-// On AIX, poll.h has to be included before xs.h to get consistent
-// definition of pollfd structure (AIX uses 'reqevents' and 'retnevents'
-// instead of 'events' and 'revents' and defines macros to map from POSIX-y
-// names to AIX-specific names).
-#if defined XS_USE_SYNC_POLL
-# 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"
-# 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 4d61b77..5a6bffd 100644
--- a/src/upoll.cpp
+++ b/src/upoll.cpp
@@ -28,38 +28,6 @@
#include "platform.hpp"
#include "polling.hpp"
-// On AIX platform, poll.h has to be included first to get consistent
-// definition of pollfd structure (AIX uses 'reqevents' and 'retnevents'
-// instead of 'events' and 'revents' and defines macros to map from POSIX-y
-// names to AIX-specific names).
-#if defined XS_USE_SYNC_POLL
-# 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"
-#else
-# 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_)
{
#if defined XS_USE_SYNC_POLL