#include "mypoll.h" #ifdef HAVE_POLL_H int mypoll(pollfd_struct* fds, int nfds, int timeout) { int i, ret; for(i=0; i maxfd) maxfd = fds[i].fd; if(fds[i].events & MYPOLL_READ) FD_SET(fds[i].fd, r); if(fds[i].events & MYPOLL_WRITE) FD_SET(fds[i].fd, w); } if(timeout >= 0) t = &tv; if(timeout > 0) tv.tv_sec = timeout; ret = select(maxfd+1, r, w, 0, t); switch(ret) { case -1: case 0: return ret; } for(i=0; i