Hi,
I was wondering about the 'num' parameter of apr_poll_setup(). The header
(apr_network_io.h) says it's "The number of socket descriptors to be
polled".
However, in win32's poll.c apr_poll_setup() first allocates num
apr_pollfd_t's, then sets values in the first apr_pollfd_t, ie allocates an
fd_set for each of read, write and except. After that, it's only the
fd_set's in the first apr_pollfd_t that get used. In winsock2.h the fd_set
is defined as:
typedef struct fd_set {
u_int fd_count; /* how many are SET? */
SOCKET fd_array[FD_SETSIZE]; /* an array of SOCKETs */
} fd_set;
FD_SETSIZE defaults to 64, but can be set to a different value before
including winsock2.h, and it will use that. So, the actual number of sockets
which can be polled is 64. The num parameter to apr_poll_setup() is ignored,
except for allocating some wasted memory.
I had a quick look at unix's poll.c, and the version which uses select (ie
if HAVE_POLL is zero) does much the same thing. I had a look through the
headers on my Linux machine, and while fd_set is a different structure, it
also contains space for a fixed number of sockets, but this time the limit
is 1024.
Or maybe I've missed the point entirely :)
This is all based on a cvs snapshot I downloaded yesterday, called
apr_20020322112848.tar.gz.
bye,
Saxon