Index: ossp-pkg/pth/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/pth/ChangeLog,v rcsdiff -q -kk '-r1.569' '-r1.570' -u '/v/ossp/cvs/ossp-pkg/pth/ChangeLog,v' 2>/dev/null --- ChangeLog 2002/10/15 20:34:22 1.569 +++ ChangeLog 2002/10/15 21:14:27 1.570 @@ -21,6 +21,10 @@ Changes between 1.4.1 and 1.5.0 (27-Jan-2002 to xx-Sep-2002) + *) Added support to pth_poll(3) for the poll(2) XPG.4 flags + POLLD{RD,WR}{NORM,BAND}. + [Jason Evans , Ralf S. Engelschall] + *) Fixed a long-standing termination bug in pth_exit(3): The event handler of pth_exit(3) didn't let pth_exit(3) finish if there were any threads on the "dead queue" (where non-detached Index: ossp-pkg/pth/pth.h.in RCS File: /v/ossp/cvs/ossp-pkg/pth/pth.h.in,v rcsdiff -q -kk '-r1.131' '-r1.132' -u '/v/ossp/cvs/ossp-pkg/pth/pth.h.in,v' 2>/dev/null --- pth.h.in 2002/01/27 11:03:40 1.131 +++ pth.h.in 2002/10/15 21:14:27 1.132 @@ -317,7 +317,20 @@ #define PTH_FAKE_POLL @PTH_FAKE_POLL@ #if !(PTH_FAKE_POLL) /* use vendor poll(2) environment */ +#define _XOPEN_SOURCE #include +#ifndef POLLRDNORM +#define POLLRDNORM POLLIN +#endif +#ifndef POLLRDBAND +#define POLLRDBAND POLLIN +#endif +#ifndef POLLWRNORM +#define POLLWRNORM POLLOUT +#endif +#ifndef POLLWRBAND +#define POLLWRBAND POLLOUT +#endif #ifndef INFTIM #define INFTIM (-1) #endif Index: ossp-pkg/pth/pth_high.c RCS File: /v/ossp/cvs/ossp-pkg/pth/pth_high.c,v rcsdiff -q -kk '-r1.84' '-r1.85' -u '/v/ossp/cvs/ossp-pkg/pth/pth_high.c,v' 2>/dev/null --- pth_high.c 2002/10/15 20:34:22 1.84 +++ pth_high.c 2002/10/15 21:14:27 1.85 @@ -413,13 +413,19 @@ for(i = 0; i < nfd; i++) { if (!pth_util_fd_valid(pfd[i].fd)) return_errno(-1, EBADF); - if (pfd[i].events & POLLIN) + if (pfd[i].events & (POLLIN|POLLRDNORM)) FD_SET(pfd[i].fd, &rfds); - if (pfd[i].events & POLLOUT) + /* see select(2): "the only exceptional condition detectable + is out-of-band data received on a socket", hence we push + POLLWRBAND events onto wfds instead of efds. */ + if (pfd[i].events & (POLLOUT|POLLWRNORM|POLLWRBAND)) FD_SET(pfd[i].fd, &wfds); - if (pfd[i].events & POLLPRI) + if (pfd[i].events & (POLLPRI|POLLRDBAND)) FD_SET(pfd[i].fd, &efds); - if (pfd[i].fd >= maxfd && (pfd[i].events & (POLLIN|POLLOUT|POLLPRI))) + if ( pfd[i].fd >= maxfd + && (pfd[i].events & (POLLIN|POLLOUT|POLLPRI| + POLLRDNORM|POLLRDBAND| + POLLWRNORM|POLLWRBAND))) maxfd = pfd[i].fd; } if (maxfd == -1) @@ -439,7 +445,10 @@ continue; } if (FD_ISSET(pfd[i].fd, &rfds)) { - pfd[i].revents |= POLLIN; + if (pfd[i].events & POLLIN) + pfd[i].revents |= POLLIN; + if (pfd[i].events & POLLRDNORM) + pfd[i].revents |= POLLRDNORM; ok++; /* support for POLLHUP */ if (recv(pfd[i].fd, data, 64, MSG_PEEK) == -1) { @@ -452,11 +461,19 @@ } } if (FD_ISSET(pfd[i].fd, &wfds)) { - pfd[i].revents |= POLLOUT; + if (pfd[i].events & POLLOUT) + pfd[i].revents |= POLLOUT; + if (pfd[i].events & POLLWRNORM) + pfd[i].revents |= POLLWRNORM; + if (pfd[i].events & POLLWRBAND) + pfd[i].revents |= POLLWRBAND; ok++; } if (FD_ISSET(pfd[i].fd, &efds)) { - pfd[i].revents |= POLLPRI; + if (pfd[i].events & POLLPRI) + pfd[i].revents |= POLLPRI; + if (pfd[i].events & POLLRDBAND) + pfd[i].revents |= POLLRDBAND; ok++; } if (ok)