#include "gwlib/gwlib.h"
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
 
Go to the source code of this file.
 | 
| int  | gw_poll (struct pollfd *fdarray, unsigned int numfds, int timeout) | 
|   | 
◆ gw_poll()
      
        
          | int gw_poll  | 
          ( | 
          struct pollfd *  | 
          fdarray,  | 
        
        
           | 
           | 
          unsigned int  | 
          numfds,  | 
        
        
           | 
           | 
          int  | 
          timeout  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 67 of file gwpoll.c.
References pollfd::events, pollfd::fd, POLLIN, POLLNVAL, POLLOUT, POLLPRI, and pollfd::revents.
   69     struct timeval tv, *tvp;
    72     fd_set readfds, *rfdp;
    73     fd_set writefds, *wfdp;
    74     fd_set exceptfds, *xfdp;
    93         tv.tv_sec = timeout / 1000;
    94         tv.tv_usec = (timeout % 1000) * 1000;
    99     for (i = 0; i < numfds; i++) {
   100         int fd = fdarray[i].
fd;
   101         int events = fdarray[i].
events;
   105             FD_SET(fd, &readfds);
   109             FD_SET(fd, &writefds);
   113             FD_SET(fd, &exceptfds);
   120     ret = select(maxfd + 1, rfdp, wfdp, xfdp, tvp);
   129     for (i = 0; i < numfds; i++) {
   130         if (fdarray[i].fd < 0) {
   135         if (rfdp && FD_ISSET(fdarray[i].fd, &readfds))
   137         if (wfdp && FD_ISSET(fdarray[i].fd, &writefds))
   139         if (xfdp && FD_ISSET(fdarray[i].fd, &exceptfds))
   141     if (fdarray[i].revents != 0)