You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by rb...@apache.org on 2002/07/10 07:43:20 UTC
[PATCH] apr_poll, take 2
FirstBill found a bug in my poll implementation today. It was working for
sockets most of the time, but it always failed with pipes. It also wasn't
correctly returning APR_TIMEUP. This new patch should fix the problems.
Same as last time, apply the patch, then in srclib/apr, untar the tarball.
Ryan
Index: modules/experimental/mod_ext_filter.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_ext_filter.c,v
retrieving revision 1.31
diff -u -d -b -w -u -r1.31 mod_ext_filter.c
--- modules/experimental/mod_ext_filter.c 28 Jun 2002 08:40:24 -0000 1.31
+++ modules/experimental/mod_ext_filter.c 10 Jul 2002 05:36:02 -0000
@@ -71,6 +71,7 @@
#include "apr_strings.h"
#include "apr_hash.h"
#include "apr_lib.h"
+#include "apr_poll.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
@@ -626,7 +627,7 @@
#if APR_FILES_AS_SOCKETS
int num_events;
- rv = apr_poll(ctx->pollset,
+ rv = apr_poll(ctx->pollset, 2
&num_events,
f->r->server->timeout);
if (rv || dc->debug >= DBGLVL_GORY) {
Index: modules/proxy/proxy_connect.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_connect.c,v
retrieving revision 1.59
diff -u -d -b -w -u -r1.59 proxy_connect.c
--- modules/proxy/proxy_connect.c 17 May 2002 11:24:16 -0000 1.59
+++ modules/proxy/proxy_connect.c 10 Jul 2002 05:36:02 -0000
@@ -61,6 +61,7 @@
#define CORE_PRIVATE
#include "mod_proxy.h"
+#include "apr_poll.h"
module AP_MODULE_DECLARE_DATA proxy_connect_module;
@@ -320,7 +321,7 @@
while (1) { /* Infinite loop until error (one side closes the connection) */
/* ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy: CONNECT: going to sleep (poll)");*/
- if ((rv = apr_poll(pollfd, &pollcnt, -1)) != APR_SUCCESS)
+ if ((rv = apr_poll(pollfd, 2, &pollcnt, -1)) != APR_SUCCESS)
{
apr_socket_close(sock);
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: CONNECT: error apr_poll()");
Index: server/mpm/beos/beos.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/beos/beos.c,v
retrieving revision 1.97
diff -u -d -b -w -u -r1.97 beos.c
--- server/mpm/beos/beos.c 4 Jul 2002 15:20:52 -0000 1.97
+++ server/mpm/beos/beos.c 10 Jul 2002 05:36:05 -0000
@@ -87,6 +87,7 @@
#include "mpm.h"
#include "mpm_default.h"
#include "apr_thread_mutex.h"
+#include "apr_poll.h"
extern int _kset_fd_limit_(int num);
@@ -421,7 +422,7 @@
apr_int16_t event;
apr_status_t ret;
- ret = apr_poll(pollset, &srv, -1);
+ ret = apr_poll(pollset, num_listening_sockets, &srv, -1);
if (ret != APR_SUCCESS) {
if (APR_STATUS_IS_EINTR(ret)) {
Index: server/mpm/experimental/leader/leader.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/experimental/leader/leader.c,v
retrieving revision 1.22
diff -u -d -b -w -u -r1.22 leader.c
--- server/mpm/experimental/leader/leader.c 4 Jul 2002 15:20:53 -0000 1.22
+++ server/mpm/experimental/leader/leader.c 10 Jul 2002 05:36:05 -0000
@@ -106,6 +106,7 @@
#include "ap_listen.h"
#include "scoreboard.h"
#include "mpm_default.h"
+#include "apr_poll.h"
#include <signal.h>
#include <limits.h> /* for INT_MAX */
@@ -888,7 +889,7 @@
apr_status_t ret;
apr_int16_t event;
- ret = apr_poll(pollset, &n, -1);
+ ret = apr_poll(pollset, num_listensocks, &n, -1);
if (ret != APR_SUCCESS) {
if (APR_STATUS_IS_EINTR(ret)) {
continue;
Index: server/mpm/experimental/perchild/perchild.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/experimental/perchild/perchild.c,v
retrieving revision 1.128
diff -u -d -b -w -u -r1.128 perchild.c
--- server/mpm/experimental/perchild/perchild.c 30 Jun 2002 21:59:50 -0000 1.128
+++ server/mpm/experimental/perchild/perchild.c 10 Jul 2002 05:36:09 -0000
@@ -95,6 +95,7 @@
#include "mpm.h"
#include "scoreboard.h"
#include "util_filter.h"
+#include "apr_poll.h"
/* ### should be APR-ized */
#include <poll.h>
@@ -748,7 +749,7 @@
while (!workers_may_exit) {
apr_int16_t event;
- srv = apr_poll(pollset, &n, -1);
+ srv = apr_poll(pollset, num_listensocks, &n, -1);
if (srv != APR_SUCCESS) {
if (APR_STATUS_IS_EINTR(srv)) {
Index: server/mpm/experimental/threadpool/threadpool.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/experimental/threadpool/threadpool.c,v
retrieving revision 1.12
diff -u -d -b -w -u -r1.12 threadpool.c
--- server/mpm/experimental/threadpool/threadpool.c 4 Jul 2002 15:20:53 -0000 1.12
+++ server/mpm/experimental/threadpool/threadpool.c 10 Jul 2002 05:36:12 -0000
@@ -69,6 +69,7 @@
#include "apr_file_io.h"
#include "apr_thread_proc.h"
#include "apr_signal.h"
+#include "apr_poll.h"
#include "apr_thread_mutex.h"
#include "apr_thread_cond.h"
#include "apr_proc_mutex.h"
@@ -913,7 +914,7 @@
apr_status_t ret;
apr_int16_t event;
- ret = apr_poll(pollset, &n, -1);
+ ret = apr_poll(pollset, num_listensocks, &n, -1);
if (ret != APR_SUCCESS) {
if (APR_STATUS_IS_EINTR(ret)) {
continue;
Index: server/mpm/mpmt_os2/mpmt_os2_child.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/mpmt_os2/mpmt_os2_child.c,v
retrieving revision 1.22
diff -u -d -b -w -u -r1.22 mpmt_os2_child.c
--- server/mpm/mpmt_os2/mpmt_os2_child.c 17 May 2002 11:11:39 -0000 1.22
+++ server/mpm/mpmt_os2/mpmt_os2_child.c 10 Jul 2002 05:36:13 -0000
@@ -73,6 +73,7 @@
#include "ap_mpm.h"
#include "ap_listen.h"
#include "apr_portable.h"
+#include "apr_poll.h"
#include "mpm_common.h"
#include "apr_strings.h"
#include <os2.h>
@@ -250,7 +251,7 @@
rv = APR_FROM_OS_ERROR(rc);
if (rv == APR_SUCCESS) {
- rv = apr_poll(pollset, &nsds, -1);
+ rv = apr_poll(pollset, num_listeners, &nsds, -1);
DosReleaseMutexSem(ap_mpm_accept_mutex);
}
Index: server/mpm/prefork/prefork.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/prefork/prefork.c,v
retrieving revision 1.268
diff -u -d -b -w -u -r1.268 prefork.c
--- server/mpm/prefork/prefork.c 4 Jul 2002 15:20:54 -0000 1.268
+++ server/mpm/prefork/prefork.c 10 Jul 2002 05:36:15 -0000
@@ -89,6 +89,7 @@
#include "mpm_common.h"
#include "ap_listen.h"
#include "ap_mmn.h"
+#include "apr_poll.h"
#ifdef HAVE_BSTRING_H
#include <bstring.h> /* for IRIX, FD_SET calls bzero() */
@@ -631,7 +632,7 @@
apr_int16_t event;
apr_int32_t n;
- ret = apr_poll(pollset, &n, -1);
+ ret = apr_poll(pollset, num_listensocks, &n, -1);
if (ret != APR_SUCCESS) {
if (APR_STATUS_IS_EINTR(ret)) {
continue;
Index: server/mpm/worker/worker.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/worker/worker.c,v
retrieving revision 1.130
diff -u -d -b -w -u -r1.130 worker.c
--- server/mpm/worker/worker.c 4 Jul 2002 22:41:48 -0000 1.130
+++ server/mpm/worker/worker.c 10 Jul 2002 05:36:18 -0000
@@ -71,6 +71,7 @@
#include "apr_signal.h"
#include "apr_thread_mutex.h"
#include "apr_proc_mutex.h"
+#include "apr_poll.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
@@ -758,7 +759,7 @@
apr_status_t ret;
apr_int16_t event;
- ret = apr_poll(pollset, &n, -1);
+ ret = apr_poll(pollset, num_listensocks, &n, -1);
if (ret != APR_SUCCESS) {
if (APR_STATUS_IS_EINTR(ret)) {
continue;
Index: srclib/apr/configure.in
===================================================================
RCS file: /home/cvs/apr/configure.in,v
retrieving revision 1.460
diff -u -d -b -w -u -r1.460 configure.in
--- srclib/apr/configure.in 2 Jul 2002 21:33:43 -0000 1.460
+++ srclib/apr/configure.in 10 Jul 2002 05:36:20 -0000
@@ -82,7 +82,7 @@
DEFAULT_OSDIR="unix"
echo "(Default will be ${DEFAULT_OSDIR})"
-apr_modules="file_io network_io threadproc misc locks time mmap shmem i18n user memory atomic"
+apr_modules="file_io network_io threadproc misc locks time mmap shmem i18n user memory atomic poll support"
dnl Checks for programs.
AC_PROG_MAKE_SET
Index: srclib/apr/file_io/unix/readwrite.c
===================================================================
RCS file: /home/cvs/apr/file_io/unix/readwrite.c,v
retrieving revision 1.80
diff -u -d -b -w -u -r1.80 readwrite.c
--- srclib/apr/file_io/unix/readwrite.c 4 Jul 2002 23:10:24 -0000 1.80
+++ srclib/apr/file_io/unix/readwrite.c 10 Jul 2002 05:36:20 -0000
@@ -55,6 +55,7 @@
#include "fileio.h"
#include "apr_strings.h"
#include "apr_thread_mutex.h"
+#include "apr_support.h"
/* The only case where we don't use wait_for_io_or_timeout is on
* pre-BONE BeOS, so this check should be sufficient and simpler */
@@ -62,43 +63,6 @@
#define USE_WAIT_FOR_IO
#endif
-#ifdef USE_WAIT_FOR_IO
-static apr_status_t wait_for_io_or_timeout(apr_file_t *file, int for_read)
-{
- struct timeval tv, *tvptr;
- fd_set fdset;
- int srv;
-
- /* TODO - timeout should be less each time through this loop */
-
- do {
- FD_ZERO(&fdset);
- FD_SET(file->filedes, &fdset);
- if (file->timeout >= 0) {
- tv.tv_sec = apr_time_sec(file->timeout);
- tv.tv_usec = apr_time_usec(file->timeout);
- tvptr = &tv;
- }
- else {
- tvptr = NULL;
- }
- srv = select(file->filedes + 1,
- for_read ? &fdset : NULL,
- for_read ? NULL : &fdset,
- NULL,
- tvptr);
- } while (srv == -1 && errno == EINTR);
-
- if (srv == 0) {
- return APR_TIMEUP;
- }
- else if (srv < 0) {
- return errno;
- }
- return APR_SUCCESS;
-}
-#endif
-
/* problems:
* 1) ungetchar not used for buffered files
*/
@@ -193,7 +157,7 @@
if (rv == -1 &&
(errno == EAGAIN || errno == EWOULDBLOCK) &&
thefile->timeout != 0) {
- apr_status_t arv = wait_for_io_or_timeout(thefile, 1);
+ apr_status_t arv = apr_wait_for_io_or_timeout(thefile, NULL, 1);
if (arv != APR_SUCCESS) {
*nbytes = bytes_read;
return arv;
@@ -272,7 +236,7 @@
if (rv == (apr_size_t)-1 &&
(errno == EAGAIN || errno == EWOULDBLOCK) &&
thefile->timeout != 0) {
- apr_status_t arv = wait_for_io_or_timeout(thefile, 0);
+ apr_status_t arv = apr_wait_for_io_or_timeout(thefile, NULL, 0);
if (arv != APR_SUCCESS) {
*nbytes = 0;
return arv;
Index: srclib/apr/include/apr_network_io.h
===================================================================
RCS file: /home/cvs/apr/include/apr_network_io.h,v
retrieving revision 1.124
diff -u -d -b -w -u -r1.124 apr_network_io.h
--- srclib/apr/include/apr_network_io.h 5 Jul 2002 17:58:10 -0000 1.124
+++ srclib/apr/include/apr_network_io.h 10 Jul 2002 05:36:21 -0000
@@ -187,7 +187,6 @@
#endif
typedef struct apr_socket_t apr_socket_t;
-typedef struct apr_pollfd_t apr_pollfd_t;
/**
* A structure to encapsulate headers and trailers for apr_sendfile
*/
@@ -634,123 +633,6 @@
APR_DECLARE(int) apr_sockaddr_equal(const apr_sockaddr_t *addr1,
const apr_sockaddr_t *addr2);
-/**
- * Setup the memory required for poll to operate properly
- * @param new_poll The poll structure to be used.
- * @param num The number of socket descriptors to be polled.
- * @param cont The pool to operate on.
- */
-APR_DECLARE(apr_status_t) apr_poll_setup(apr_pollfd_t **new_poll,
- apr_int32_t num,
- apr_pool_t *cont);
-
-/**
- * Poll the sockets in the poll structure
- * @param aprset The poll structure we will be using.
- * @param nsds The number of sockets we are polling.
- * @param timeout The amount of time in microseconds to wait. This is
- * a maximum, not a minimum. If a socket is signalled, we
- * will wake up before this time. A negative number means
- * wait until a socket is signalled.
- * @remark
- * <PRE>
- * The number of sockets signalled is returned in the second argument.
- *
- * This is a blocking call, and it will not return until either a
- * socket has been signalled, or the timeout has expired.
- * </PRE>
- */
-APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t *nsds,
- apr_interval_time_t timeout);
-
-/**
- * Add a socket to the poll structure.
- * @param aprset The poll structure we will be using.
- * @param socket The socket to add to the current poll structure.
- * @param event The events to look for when we do the poll. One of:
- * <PRE>
- * APR_POLLIN signal if read will not block
- * APR_POLLPRI signal if prioirty data is availble to be read
- * APR_POLLOUT signal if write will not block
- * </PRE>
- */
-APR_DECLARE(apr_status_t) apr_poll_socket_add(apr_pollfd_t *aprset,
- apr_socket_t *sock,
- apr_int16_t event);
-
-/**
- * Modify a socket in the poll structure with mask.
- * @param aprset The poll structure we will be using.
- * @param sock The socket to modify in poll structure.
- * @param events The events to stop looking for during the poll. One of:
- * <PRE>
- * APR_POLLIN signal if read will not block
- * APR_POLLPRI signal if priority data is available to be read
- * APR_POLLOUT signal if write will not block
- * </PRE>
- */
-APR_DECLARE(apr_status_t) apr_poll_socket_mask(apr_pollfd_t *aprset,
- apr_socket_t *sock,
- apr_int16_t events);
-/**
- * Remove a socket from the poll structure.
- * @param aprset The poll structure we will be using.
- * @param sock The socket to remove from the current poll structure.
- */
-APR_DECLARE(apr_status_t) apr_poll_socket_remove(apr_pollfd_t *aprset,
- apr_socket_t *sock);
-
-/**
- * Remove all sockets from the poll structure.
- * @param aprset The poll structure we will be using.
- * @param events The events to clear from all sockets. One of:
- * <PRE>
- * APR_POLLIN signal if read will not block
- * APR_POLLPRI signal if priority data is available to be read
- * APR_POLLOUT signal if write will not block
- * </PRE>
- */
-APR_DECLARE(apr_status_t) apr_poll_socket_clear(apr_pollfd_t *aprset,
- apr_int16_t events);
-
-/**
- * Get the return events for the specified socket.
- * @param event The returned events for the socket. One of:
- * <PRE>
- * APR_POLLIN Data is available to be read
- * APR_POLLPRI Priority data is availble to be read
- * APR_POLLOUT Write will succeed
- * APR_POLLERR An error occurred on the socket
- * APR_POLLHUP The connection has been terminated
- * APR_POLLNVAL This is an invalid socket to poll on.
- * Socket not open.
- * </PRE>
- * @param sock The socket we wish to get information about.
- * @param aprset The poll structure we will be using.
- */
-APR_DECLARE(apr_status_t) apr_poll_revents_get(apr_int16_t *event,
- apr_socket_t *sock,
- apr_pollfd_t *aprset);
-
-/**
- * Return the data associated with the current poll.
- * @param pollfd The currently open pollfd.
- * @param key The key to use for retrieving data associated with a poll struct.
- * @param data The user data associated with the pollfd.
- */
-APR_DECLARE(apr_status_t) apr_poll_data_get(apr_pollfd_t *pollfd,
- const char *key, void *data);
-
-/**
- * Set the data associated with the current poll.
- * @param pollfd The currently open pollfd.
- * @param data The key to associate with the data.
- * @param key The user data to associate with the pollfd.
- * @param cleanup The cleanup function
- */
-APR_DECLARE(apr_status_t) apr_poll_data_set(apr_pollfd_t *pollfd, void *data,
- const char *key,
- apr_status_t (*cleanup)(void *));
#if APR_FILES_AS_SOCKETS || defined(DOXYGEN)
Index: srclib/apr/include/arch/unix/networkio.h
===================================================================
RCS file: /home/cvs/apr/include/arch/unix/networkio.h,v
retrieving revision 1.53
diff -u -d -b -w -u -r1.53 networkio.h
--- srclib/apr/include/arch/unix/networkio.h 1 Apr 2002 14:13:45 -0000 1.53
+++ srclib/apr/include/arch/unix/networkio.h 10 Jul 2002 05:36:21 -0000
@@ -69,12 +69,6 @@
#if APR_HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
-#ifdef HAVE_SYS_POLL_H
-#include <sys/poll.h>
-#endif
-#ifdef HAVE_POLL_H
-#include <poll.h>
-#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
@@ -138,32 +132,8 @@
apr_int32_t inherit;
};
-struct apr_pollfd_t {
- apr_pool_t *cntxt;
-#ifdef HAVE_POLL
- struct pollfd *pollset;
- int num;
- int curpos;
-#else
- fd_set *read;
- fd_set *write;
- fd_set *except;
- int highsock;
- fd_set *read_set;
- fd_set *write_set;
- fd_set *except_set;
- apr_int16_t *events;
- apr_int16_t *revents;
-#ifdef BEOS
- int lowsock;
- int ncks;
-#endif
-#endif
-};
-
const char *apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size);
int apr_inet_pton(int af, const char *src, void *dst);
-apr_status_t apr_wait_for_io_or_timeout(apr_socket_t *sock, int for_read);
void apr_sockaddr_vars_set(apr_sockaddr_t *, int, apr_port_t);
#define apr_is_option_set(mask, option) ((mask & option) ==option)
Index: srclib/apr/network_io/unix/Makefile.in
===================================================================
RCS file: /home/cvs/apr/network_io/unix/Makefile.in,v
retrieving revision 1.23
diff -u -d -b -w -u -r1.23 Makefile.in
--- srclib/apr/network_io/unix/Makefile.in 22 Apr 2002 01:24:50 -0000 1.23
+++ srclib/apr/network_io/unix/Makefile.in 10 Jul 2002 05:36:21 -0000
@@ -2,7 +2,6 @@
VPATH = @srcdir@
TARGETS = \
- poll.lo \
sendrecv.lo \
sockets.lo \
sockopt.lo \
Index: srclib/apr/network_io/unix/sendrecv.c
===================================================================
RCS file: /home/cvs/apr/network_io/unix/sendrecv.c,v
retrieving revision 1.85
diff -u -d -b -w -u -r1.85 sendrecv.c
--- srclib/apr/network_io/unix/sendrecv.c 2 Jul 2002 21:33:43 -0000 1.85
+++ srclib/apr/network_io/unix/sendrecv.c 10 Jul 2002 05:36:22 -0000
@@ -53,6 +53,7 @@
*/
#include "networkio.h"
+#include "apr_support.h"
#if APR_HAS_SENDFILE
/* This file is needed to allow us access to the apr_file_t internals. */
@@ -63,40 +64,6 @@
#include <sys/sysctl.h>
#endif
-apr_status_t apr_wait_for_io_or_timeout(apr_socket_t *sock, int for_read)
-{
- struct timeval tv, *tvptr;
- fd_set fdset;
- int srv;
-
- do {
- FD_ZERO(&fdset);
- FD_SET(sock->socketdes, &fdset);
- if (sock->timeout < 0) {
- tvptr = NULL;
- }
- else {
- tv.tv_sec = sock->timeout / APR_USEC_PER_SEC;
- tv.tv_usec = sock->timeout % APR_USEC_PER_SEC;
- tvptr = &tv;
- }
- srv = select(sock->socketdes + 1,
- for_read ? &fdset : NULL,
- for_read ? NULL : &fdset,
- NULL,
- tvptr);
- /* TODO - timeout should be smaller on repeats of this loop */
- } while (srv == -1 && errno == EINTR);
-
- if (srv == 0) {
- return APR_TIMEUP;
- }
- else if (srv < 0) {
- return errno;
- }
- return APR_SUCCESS;
-}
-
apr_status_t apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len)
{
ssize_t rv;
@@ -114,7 +81,7 @@
&& sock->timeout != 0) {
apr_status_t arv;
do_select:
- arv = apr_wait_for_io_or_timeout(sock, 0);
+ arv = apr_wait_for_io_or_timeout(NULL, sock, 0);
if (arv != APR_SUCCESS) {
*len = 0;
return arv;
@@ -153,7 +120,7 @@
if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) &&
sock->timeout != 0) {
do_select:
- arv = apr_wait_for_io_or_timeout(sock, 1);
+ arv = apr_wait_for_io_or_timeout(NULL, sock, 1);
if (arv != APR_SUCCESS) {
*len = 0;
return arv;
@@ -191,7 +158,7 @@
if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)
&& sock->timeout != 0) {
- apr_status_t arv = apr_wait_for_io_or_timeout(sock, 0);
+ apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 0);
if (arv != APR_SUCCESS) {
*len = 0;
return arv;
@@ -224,7 +191,7 @@
if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) &&
sock->timeout != 0) {
- apr_status_t arv = apr_wait_for_io_or_timeout(sock, 1);
+ apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 1);
if (arv != APR_SUCCESS) {
*len = 0;
return arv;
@@ -272,7 +239,7 @@
sock->timeout != 0) {
apr_status_t arv;
do_select:
- arv = apr_wait_for_io_or_timeout(sock, 0);
+ arv = apr_wait_for_io_or_timeout(NULL, sock, 0);
if (arv != APR_SUCCESS) {
*len = 0;
return arv;
@@ -370,7 +337,7 @@
(errno == EAGAIN || errno == EWOULDBLOCK) &&
sock->timeout > 0) {
do_select:
- arv = apr_wait_for_io_or_timeout(sock, 0);
+ arv = apr_wait_for_io_or_timeout(NULL, sock, 0);
if (arv != APR_SUCCESS) {
*len = 0;
return arv;
@@ -528,7 +495,7 @@
if (sock->netmask & APR_INCOMPLETE_WRITE) {
apr_status_t arv;
sock->netmask &= ~APR_INCOMPLETE_WRITE;
- arv = apr_wait_for_io_or_timeout(sock, 0);
+ arv = apr_wait_for_io_or_timeout(NULL, sock, 0);
if (arv != APR_SUCCESS) {
*len = 0;
return arv;
@@ -590,7 +557,7 @@
if (rv == -1 &&
errno == EAGAIN &&
sock->timeout > 0) {
- apr_status_t arv = apr_wait_for_io_or_timeout(sock, 0);
+ apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 0);
if (arv != APR_SUCCESS) {
*len = 0;
return arv;
@@ -708,7 +675,7 @@
if (rc == -1 &&
(errno == EAGAIN || errno == EWOULDBLOCK) &&
sock->timeout > 0) {
- apr_status_t arv = apr_wait_for_io_or_timeout(sock, 0);
+ apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 0);
if (arv != APR_SUCCESS) {
*len = 0;
@@ -847,7 +814,7 @@
(errno == EAGAIN || errno == EWOULDBLOCK) &&
sock->timeout > 0) {
do_select:
- arv = apr_wait_for_io_or_timeout(sock, 0);
+ arv = apr_wait_for_io_or_timeout(NULL, sock, 0);
if (arv != APR_SUCCESS) {
*len = 0;
return arv;
@@ -957,7 +924,7 @@
*/
if (sock->netmask & APR_INCOMPLETE_WRITE) {
sock->netmask &= ~APR_INCOMPLETE_WRITE;
- arv = apr_wait_for_io_or_timeout(sock, 0);
+ arv = apr_wait_for_io_or_timeout(NULL, sock, 0);
if (arv != APR_SUCCESS) {
*len = 0;
return arv;
@@ -989,7 +956,7 @@
else if (!arv &&
apr_is_option_set(sock->netmask, APR_SO_TIMEOUT) == 1)
{
- apr_status_t t = apr_wait_for_io_or_timeout(sock, 0);
+ apr_status_t t = apr_wait_for_io_or_timeout(NULL, sock, 0);
if (t != APR_SUCCESS)
{
Index: srclib/apr/test/sendfile.c
===================================================================
RCS file: /home/cvs/apr/test/sendfile.c,v
retrieving revision 1.20
diff -u -d -b -w -u -r1.20 sendfile.c
--- srclib/apr/test/sendfile.c 13 Mar 2002 20:39:27 -0000 1.20
+++ srclib/apr/test/sendfile.c 10 Jul 2002 05:36:22 -0000
@@ -60,6 +60,7 @@
#include "apr_network_io.h"
#include "apr_errno.h"
#include "apr_general.h"
+#include "apr_poll.h"
#if !APR_HAS_SENDFILE
int main(void)
@@ -373,7 +374,7 @@
if (APR_STATUS_IS_EAGAIN(rv)) {
assert(tmplen == 0);
nsocks = 1;
- tmprv = apr_poll(pfd, &nsocks, -1);
+ tmprv = apr_poll(pfd, 1, &nsocks, -1);
assert(!tmprv);
assert(nsocks == 1);
/* continue; */
Index: srclib/apr/test/server.c
===================================================================
RCS file: /home/cvs/apr/test/server.c,v
retrieving revision 1.34
diff -u -d -b -w -u -r1.34 server.c
--- srclib/apr/test/server.c 13 Mar 2002 20:39:27 -0000 1.34
+++ srclib/apr/test/server.c 10 Jul 2002 05:36:23 -0000
@@ -58,6 +58,7 @@
#include <stdlib.h>
#include "apr_network_io.h"
#include "apr_getopt.h"
+#include "apr_poll.h"
#define STRLEN 15
@@ -138,7 +139,7 @@
pollres = 1;
APR_TEST_BEGIN(rv, "Polling for socket",
- apr_poll(sdset, &pollres, -1))
+ apr_poll(sdset, 1, &pollres, -1))
if (pollres == 0) {
fprintf(stdout, "Failed\n");
Index: srclib/apr/test/testfile.c
===================================================================
RCS file: /home/cvs/apr/test/testfile.c,v
retrieving revision 1.49
diff -u -d -b -w -u -r1.49 testfile.c
--- srclib/apr/test/testfile.c 5 Jul 2002 00:26:36 -0000 1.49
+++ srclib/apr/test/testfile.c 10 Jul 2002 05:36:24 -0000
@@ -61,6 +61,7 @@
#include "apr_network_io.h"
#include "apr_errno.h"
#include "apr_general.h"
+#include "apr_poll.h"
#include "apr_lib.h"
#include "test_apr.h"
@@ -157,7 +158,7 @@
apr_poll_socket_add(sdset, testsock, APR_POLLIN);
num = 1;
STD_TEST_NEQ(" Checking for incoming data",
- apr_poll(sdset, &num, apr_time_from_sec(1)));
+ apr_poll(sdset, 1, &num, apr_time_from_sec(1)));
if (num == 0) {
printf("** This platform doesn't return readability on a regular file.**\n");
}
Index: srclib/apr/test/testpoll.c
===================================================================
RCS file: /home/cvs/apr/test/testpoll.c,v
retrieving revision 1.8
diff -u -d -b -w -u -r1.8 testpoll.c
--- srclib/apr/test/testpoll.c 13 Mar 2002 20:39:27 -0000 1.8
+++ srclib/apr/test/testpoll.c 10 Jul 2002 05:36:24 -0000
@@ -57,6 +57,7 @@
#include "apr_general.h"
#include "apr_lib.h"
#include "apr_network_io.h"
+#include "apr_poll.h"
#if APR_HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -145,7 +146,7 @@
apr_socket_t *s[3];
apr_sockaddr_t *sa[3];
apr_pollfd_t *pollset;
- int i = 0, srv = 0;
+ int i = 0, srv = 3;
fprintf (stdout,"APR Poll Test\n*************\n\n");
@@ -186,29 +187,29 @@
printf("OK\n");
printf("Starting Tests\n");
- apr_poll(pollset, &srv, 10);
+ apr_poll(pollset, 3, &srv, 10);
check_sockets(pollset, s);
send_msg(s, sa, 2);
- apr_poll(pollset, &srv, 10);
+ apr_poll(pollset, 3, &srv, 10);
check_sockets(pollset, s);
recv_msg(s, 2, context);
send_msg(s, sa, 1);
- apr_poll(pollset, &srv, 10);
+ apr_poll(pollset, 3, &srv, 10);
check_sockets(pollset, s);
send_msg(s, sa, 2);
- apr_poll(pollset, &srv, 10);
+ apr_poll(pollset, 3, &srv, 10);
check_sockets(pollset, s);
recv_msg(s, 1, context);
send_msg(s, sa, 0);
- apr_poll(pollset, &srv, 10);
+ apr_poll(pollset, 3, &srv, 10);
check_sockets(pollset, s);
printf("Tests completed.\n");
Index: support/ab.c
===================================================================
RCS file: /home/cvs/httpd-2.0/support/ab.c,v
retrieving revision 1.108
diff -u -d -b -w -u -r1.108 ab.c
--- support/ab.c 8 Jul 2002 19:39:01 -0000 1.108
+++ support/ab.c 10 Jul 2002 05:36:28 -0000
@@ -166,6 +166,7 @@
#include "apr_lib.h"
#include "apr_portable.h"
#include "ap_release.h"
+#include "apr_poll.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
@@ -1648,7 +1649,7 @@
status = APR_SUCCESS;
else
#endif
- status = apr_poll(readbits, &n, aprtimeout);
+ status = apr_poll(readbits, concurrency, &n, aprtimeout);
if (status != APR_SUCCESS)
apr_err("apr_poll", status);
Re: [PATCH] apr_poll, take 2
Posted by Justin Erenkrantz <je...@apache.org>.
On Wed, Jul 10, 2002 at 01:43:20AM -0400, rbb@apache.org wrote:
> Index: modules/experimental/mod_ext_filter.c
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_ext_filter.c,v
> retrieving revision 1.31
> diff -u -d -b -w -u -r1.31 mod_ext_filter.c
> --- modules/experimental/mod_ext_filter.c 28 Jun 2002 08:40:24 -0000 1.31
> +++ modules/experimental/mod_ext_filter.c 10 Jul 2002 05:36:02 -0000
> @@ -71,6 +71,7 @@
> #include "apr_strings.h"
> #include "apr_hash.h"
> #include "apr_lib.h"
> +#include "apr_poll.h"
> #define APR_WANT_STRFUNC
> #include "apr_want.h"
>
> @@ -626,7 +627,7 @@
> #if APR_FILES_AS_SOCKETS
> int num_events;
>
> - rv = apr_poll(ctx->pollset,
> + rv = apr_poll(ctx->pollset, 2
Need a comma here. -- justin