00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef APR_ARCH_POLL_PRIVATE_H
00018 #define APR_ARCH_POLL_PRIVATE_H
00019
00020 #include "apr.h"
00021 #include "apr_poll.h"
00022 #include "apr_time.h"
00023 #include "apr_portable.h"
00024 #include "apr_arch_networkio.h"
00025 #include "apr_arch_file_io.h"
00026
00027 #if HAVE_POLL_H
00028 #include <poll.h>
00029 #endif
00030
00031 #if HAVE_SYS_POLL_H
00032 #include <sys/poll.h>
00033 #endif
00034
00035 #ifdef HAVE_PORT_CREATE
00036 #include <port.h>
00037 #include <sys/port_impl.h>
00038 #endif
00039
00040 #ifdef HAVE_KQUEUE
00041 #include <sys/types.h>
00042 #include <sys/event.h>
00043 #include <sys/time.h>
00044 #endif
00045
00046 #ifdef HAVE_EPOLL
00047 #include <sys/epoll.h>
00048 #endif
00049
00050 #ifdef NETWARE
00051 #define HAS_SOCKETS(dt) (dt == APR_POLL_SOCKET) ? 1 : 0
00052 #define HAS_PIPES(dt) (dt == APR_POLL_FILE) ? 1 : 0
00053 #endif
00054
00055
00056 #ifdef HAVE_KQUEUE
00057 #define POLLSET_USES_KQUEUE
00058 #elif defined(HAVE_PORT_CREATE)
00059 #define POLLSET_USES_PORT
00060 #elif defined(HAVE_EPOLL)
00061 #define POLLSET_USES_EPOLL
00062 #elif defined(HAVE_POLL)
00063 #define POLLSET_USES_POLL
00064 #else
00065 #define POLLSET_USES_SELECT
00066 #endif
00067
00068 #ifdef HAVE_POLL
00069 #define POLL_USES_POLL
00070 #else
00071 #define POLL_USES_SELECT
00072 #endif
00073
00074 #if defined(POLLSET_USES_KQUEUE) || defined(POLLSET_USES_EPOLL) || defined(POLLSET_USES_PORT)
00075
00076 #include "apr_ring.h"
00077
00078 #if APR_HAS_THREADS
00079 #include "apr_thread_mutex.h"
00080 #define pollset_lock_rings() \
00081 if (pollset->flags & APR_POLLSET_THREADSAFE) \
00082 apr_thread_mutex_lock(pollset->ring_lock);
00083 #define pollset_unlock_rings() \
00084 if (pollset->flags & APR_POLLSET_THREADSAFE) \
00085 apr_thread_mutex_unlock(pollset->ring_lock);
00086 #else
00087 #define pollset_lock_rings()
00088 #define pollset_unlock_rings()
00089 #endif
00090
00091 typedef struct pfd_elem_t pfd_elem_t;
00092
00093 struct pfd_elem_t {
00094 APR_RING_ENTRY(pfd_elem_t) link;
00095 apr_pollfd_t pfd;
00096 };
00097
00098 #endif
00099
00100 #endif