apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Reitzel <creit...@rcn.com>
Subject RE: Patch for unix/poll.c (!HAVE_POLL)
Date Thu, 26 Sep 2002 20:31:42 GMT
Sorry to spam, but here is an improved version:

     for (i = 0; i < num; i++) {
         apr_os_sock_t fd;

         aprset[i].rtnevents = 0; /* Always clear events */

         if (aprset[i].desc_type == APR_POLL_SOCKET) {
             fd = aprset[i].desc.s->socketdes;
         }
         else if (aprset[i].desc_type == APR_NO_DESC) {
             continue;           /* No-op socket OK */
         }
#if APR_FILES_AS_SOCKETS
         if (aprset[i].desc_type == APR_POLL_FILE) {
             fd = aprset[i].desc.f->filedes;
         }
#endif
         else {
             return APR_EBADF;   /* Unknown fd type */
         }

         if (FD_ISSET(fd, &readset)) {
             aprset[i].rtnevents |= APR_POLLIN;
         }
         if (FD_ISSET(fd, &writeset)) {
             aprset[i].rtnevents |= APR_POLLOUT;
         }
         if (FD_ISSET(fd, &exceptset)) {
             aprset[i].rtnevents |= APR_POLLERR;
         }
     }

     return APR_SUCCESS;
}

Mime
View raw message