| 77 | } |
| 78 | |
| 79 | static void |
| 80 | fdset_add_fd(struct fdset *pfdset, int idx, int fd, |
| 81 | fd_cb rcb, fd_cb wcb, void *dat) |
| 82 | { |
| 83 | struct fdentry *pfdentry = &pfdset->fd[idx]; |
| 84 | struct pollfd *pfd = &pfdset->rwfds[idx]; |
| 85 | |
| 86 | pfdentry->fd = fd; |
| 87 | pfdentry->rcb = rcb; |
| 88 | pfdentry->wcb = wcb; |
| 89 | pfdentry->dat = dat; |
| 90 | |
| 91 | pfd->fd = fd; |
| 92 | pfd->events = rcb ? POLLIN : 0; |
| 93 | pfd->events |= wcb ? POLLOUT : 0; |
| 94 | pfd->revents = 0; |
| 95 | } |
| 96 | |
| 97 | void |
| 98 | fdset_init(struct fdset *pfdset) |