summaryrefslogtreecommitdiff
path: root/lib/replace/system
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-02-09 19:22:25 +0100
committerVolker Lendecke <vlendec@samba.org>2011-02-28 16:40:19 +0100
commit0fc1650e091727971b3e3017f9f06cae6cdf71bb (patch)
tree204644c18847c7eb0388a5c89fa096128899f389 /lib/replace/system
parent5e93e3e88fb4a219492c23c18067f358b54311d0 (diff)
downloadsamba-0fc1650e091727971b3e3017f9f06cae6cdf71bb.tar.gz
samba-0fc1650e091727971b3e3017f9f06cae6cdf71bb.tar.bz2
samba-0fc1650e091727971b3e3017f9f06cae6cdf71bb.zip
libreplace: poll based on select
Diffstat (limited to 'lib/replace/system')
-rw-r--r--lib/replace/system/config.m44
-rw-r--r--lib/replace/system/select.h36
2 files changed, 40 insertions, 0 deletions
diff --git a/lib/replace/system/config.m4 b/lib/replace/system/config.m4
index 04364bc3a1..b7cdf1414a 100644
--- a/lib/replace/system/config.m4
+++ b/lib/replace/system/config.m4
@@ -6,6 +6,10 @@ AC_CHECK_HEADERS(sys/acl.h acl/libacl.h sys/file.h)
# select
AC_CHECK_HEADERS(sys/select.h)
+# poll
+AC_CHECK_HEADERS(poll.h)
+AC_CHECK_FUNCS(poll,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/poll.o"])
+
# time
AC_CHECK_HEADERS(sys/time.h utime.h)
AC_HEADER_TIME
diff --git a/lib/replace/system/select.h b/lib/replace/system/select.h
index da18de0cfc..11c5390d90 100644
--- a/lib/replace/system/select.h
+++ b/lib/replace/system/select.h
@@ -38,4 +38,40 @@
#define SELECT_CAST
#endif
+#ifdef HAVE_POLL
+
+#include <poll.h>
+
+#else
+
+/* Type used for the number of file descriptors. */
+typedef unsigned long int nfds_t;
+
+/* Data structure describing a polling request. */
+struct pollfd
+{
+ int fd; /* File descriptor to poll. */
+ short int events; /* Types of events poller cares about. */
+ short int revents; /* Types of events that actually occurred. */
+};
+
+/* Event types that can be polled for. These bits may be set in `events'
+ to indicate the interesting event types; they will appear in `revents'
+ to indicate the status of the file descriptor. */
+#define POLLIN 0x001 /* There is data to read. */
+#define POLLPRI 0x002 /* There is urgent data to read. */
+#define POLLOUT 0x004 /* Writing now will not block. */
+#define POLLRDNORM 0x040 /* Normal data may be read. */
+#define POLLRDBAND 0x080 /* Priority data may be read. */
+#define POLLWRNORM 0x100 /* Writing now will not block. */
+#define POLLWRBAND 0x200 /* Priority data may be written. */
+#define POLLERR 0x008 /* Error condition. */
+#define POLLHUP 0x010 /* Hung up. */
+#define POLLNVAL 0x020 /* Invalid polling request. */
+
+/* define is in "replace.h" */
+int rep_poll(struct pollfd *fds, nfds_t nfds, int timeout);
+
+#endif
+
#endif