pth_poll_ev() does not provide any support for POLLRDNORM, POLLWRNORM, POLLRDBAND, or POLLWRBAND. This causes surprising errors when calling poll(), if pth is configured with the --enable-syscall-hard flag. The following patch is adequate to support the additional poll() flags, but it still does not solve the whole problem. On Linux, it is necessary to define _GNU_SOURCE or _XOPEN_SOURCE (other definitions may also work) in order for the additional poll() flags to be exposed. This means that pth should probably always be built with _XOPEN_SOURCE on Linux, so that if an application chooses to use the additional poll() flags, pth is able to accomodate the application. Always building pth like this won't hurt anything in the case that the application does not know about the additional poll() flags.
A patch for the pth_poll_ev() problems follows. Thanks, Jason Evans --- pth-1.4.1.old/pth_high.c Sun Jan 27 05:14:36 2002 +++ pth-1.4.1/pth_high.c Sat Jun 22 16:18:12 2002 @@ -413,13 +413,42 @@ 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 +#ifdef POLLRDNORM + | POLLRDNORM +#endif + )) FD_SET(pfd[i].fd, &rfds); - if (pfd[i].events & POLLOUT) + if (pfd[i].events & (POLLOUT +#ifdef POLLWRNORM + | POLLWRNORM +#endif +#ifdef POLLWRBAND + | POLLWRBAND +#endif + )) FD_SET(pfd[i].fd, &wfds); - if (pfd[i].events & POLLPRI) + if (pfd[i].events & (POLLPRI +#ifdef POLLRDBAND + | POLLRDBAND +#endif + )) 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 +#ifdef POLLRDNORM + | POLLRDNORM +#endif +#ifdef POLLWRNORM + | POLLWRNORM +#endif +#ifdef POLLWRBAND + | POLLWRBAND +#endif +#ifdef POLLRDBAND + | POLLRDBAND +#endif + + ))) maxfd = pfd[i].fd; } if (maxfd == -1) @@ -439,7 +468,12 @@ continue; } if (FD_ISSET(pfd[i].fd, &rfds)) { - pfd[i].revents |= POLLIN; + if (pfd[i].events & POLLIN) + pfd[i].revents |= POLLIN; +#ifdef POLLRDNORM + if (pfd[i].events & POLLRDNORM) + pfd[i].revents |= POLLRDNORM; +#endif ok++; /* support for POLLHUP */ if (recv(pfd[i].fd, data, 64, MSG_PEEK) == -1) { @@ -452,11 +486,25 @@ } } if (FD_ISSET(pfd[i].fd, &wfds)) { - pfd[i].revents |= POLLOUT; + if (pfd[i].events & POLLOUT) + pfd[i].revents |= POLLOUT; +#ifdef POLLWRNORM + if (pfd[i].events & POLLWRNORM) + pfd[i].revents |= POLLWRNORM; +#endif +#ifdef POLLWRBAND + if (pfd[i].events & POLLWRBAND) + pfd[i].revents |= POLLWRBAND; +#endif ok++; } if (FD_ISSET(pfd[i].fd, &efds)) { - pfd[i].revents |= POLLPRI; + if (pfd[i].events & POLLPRI) + pfd[i].revents |= POLLPRI; +#ifdef POLLRDBAND + if (pfd[i].events & POLLRDBAND) + pfd[i].revents |= POLLRDBAND; +#endif ok++; } if (ok) ______________________________________________________________________ GNU Portable Threads (Pth) http://www.gnu.org/software/pth/ User Support Mailing List [EMAIL PROTECTED] Automated List Manager (Majordomo) [EMAIL PROTECTED]