-#if HAVE_SYS_POLL_H
-#include <sys/poll.h>
-#endif
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#ifdef WIN32
-#if FD_SETSIZE < 512
-#define FD_SETSIZE 512
-#endif
-#include <winsock.h>
-#endif
-
-
-/*
- * Note that ZOOM_event_sys_select() is limited as to how many file
- * descriptors it can multiplex due to its use of select() which in
- * turn uses the statically defined fd_set type to be a bitmap of the
- * file descriptors to check. On Ubuntu 6.06 (and almost certainly on
- * Debian, and probably on all Linuxes, and maybe all Unixes) this is
- * by default set to 1024 (though it may be possible to override this
- * using a #define before including <sys/select.h> -- I've not tried
- * this). 1024 file descriptors is a lot, but not enough in all
- * cases, e.g. when running IRSpy on a large target database. So you
- * should ensure that YAZ uses ZOOM_event_sys_poll() when possible.
- */
-ZOOM_API(int)
- ZOOM_event_sys_select(int no, ZOOM_connection *cs)
-{
- struct timeval tv;
- fd_set input, output, except;
- int i, r;
- int max_fd = 0;
- int timeout = 30;
- int nfds = 0;
-
- FD_ZERO(&input);
- FD_ZERO(&output);
- FD_ZERO(&except);
-
- for (i = 0; i<no; i++)
- {
- ZOOM_connection c = cs[i];
- int fd, mask;
-
- if (!c)
- continue;
- fd = ZOOM_connection_get_socket(c);
- mask = ZOOM_connection_get_mask(c);
- timeout = ZOOM_connection_get_timeout(c);
-
- if (fd == -1)
- continue;
- if (max_fd < fd)
- max_fd = fd;
-
- if (mask & ZOOM_SELECT_READ)
- FD_SET(fd, &input);
- if (mask & ZOOM_SELECT_WRITE)
- FD_SET(fd, &output);
- if (mask & ZOOM_SELECT_EXCEPT)
- FD_SET(fd, &except);
- if (mask)
- nfds++;
- }
- if (nfds == 0)
- return 0;