- while ((r = select(max_fd+1, &input, &output, &except,
- (timeout == -1 ? 0 : &tv))) < 0 && errno == EINTR)
- {
- ;
- }
- if (r < 0)
- {
- yaz_log(YLOG_WARN|YLOG_ERRNO, "ZOOM_event_sys_select");
- return r;
- }
-
- for (i = 0; i<no; i++)
- {
- ZOOM_connection c = cs[i];
- int fd, mask;
-
- if (!c)
- continue;
- fd = ZOOM_connection_get_socket(c);
- mask = 0;
- if (r)
- {
- /* no timeout and real socket */
- if (FD_ISSET(fd, &input))
- mask += ZOOM_SELECT_READ;
- if (FD_ISSET(fd, &output))
- mask += ZOOM_SELECT_WRITE;
- if (FD_ISSET(fd, &except))
- mask += ZOOM_SELECT_EXCEPT;
- if (mask)
- ZOOM_connection_fire_event_socket(c, mask);
- }
- else
- ZOOM_connection_fire_event_timeout(c);
- }
- return r;
-}
-
-#if HAVE_SYS_POLL_H