From: Roy Marples Date: Fri, 26 Feb 2016 16:04:12 +0000 (+0000) Subject: Add POLLOUT to the pselect wrapper. X-Git-Tag: v6.10.2~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=659273b675dd6a3bbb8101515825992bb998af91;p=thirdparty%2Fdhcpcd.git Add POLLOUT to the pselect wrapper. --- diff --git a/eloop.c b/eloop.c index d260d0ec..1b429f18 100644 --- a/eloop.c +++ b/eloop.c @@ -208,11 +208,12 @@ static int eloop_pollts(struct pollfd * fds, nfds_t nfds, const struct timespec *ts, const sigset_t *sigmask) { - fd_set read_fds; + fd_set read_fds, write_fds; nfds_t n; int maxfd, r; FD_ZERO(&read_fds); + FD_ZERO(&write_fds); maxfd = 0; for (n = 0; n < nfds; n++) { if (fds[n].events & POLLIN) { @@ -220,13 +221,20 @@ eloop_pollts(struct pollfd * fds, nfds_t nfds, if (fds[n].fd > maxfd) maxfd = fds[n].fd; } + if (fds[n].events & POLLOUT) { + FD_SET(fds[n].fd, &write_fds); + if (fds[n].fd > maxfd) + maxfd = fds[n].fd; + } } - r = pselect(maxfd + 1, &read_fds, NULL, NULL, ts, sigmask); + r = pselect(maxfd + 1, &read_fds, &write_fds, NULL, ts, sigmask); if (r > 0) { for (n = 0; n < nfds; n++) { fds[n].revents = FD_ISSET(fds[n].fd, &read_fds) ? POLLIN : 0; + if (FD_ISSET(fds[n].fd, &write_fds)) + fds[n].revents |= POLLOUT; } }