]> granicus.if.org Git - graphviz/commitdiff
remove disabled poll() code
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 12 Sep 2020 19:44:05 +0000 (12:44 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 19 Sep 2020 00:35:04 +0000 (17:35 -0700)
The macro _lib_poll was undefined on all platforms that have select.h, which is
everything except Windows. Poll does not exist on Windows, so it was also
disabled there. Related to #1422 and #1521.

lib/sfio/sfhdr.h
lib/sfio/sfpkrd.c
lib/sfio/sfpoll.c

index 1b0a54ad091419517a223a5e0b25a88605de18ce..9cda8a8151772b45c546a4c02251b5f43d0e9796 100644 (file)
@@ -52,7 +52,6 @@ extern "C" {
 #ifdef _SFBINARY_H
 #undef  HAVE_SYS_ST
 #undef  HAVE_STAT_H
-#undef  _lib_poll
 #undef  _stream_peek
 #undef  _socket_peek
 #undef  HAVE_VFORK_H
@@ -102,23 +101,6 @@ extern "C" {
 #define POOLMTXRETURN(p,v)     { return(v); }
 
 /* functions for polling readiness of streams */
-#ifdef HAVE_SELECT
-#undef _lib_poll
-#else
-#if _lib_poll_fd_1 || _lib_poll_fd_2
-#define _lib_poll      1
-#endif
-#endif /*HAVE_SELECT*/
-
-#ifdef _lib_poll
-#include       <poll.h>
-
-#if _lib_poll_fd_1
-#define SFPOLL(pfd,n,tm)       poll((pfd),(ulong)(n),(tm))
-#else
-#define SFPOLL(pfd,n,tm)       poll((ulong)(n),(pfd),(tm))
-#endif
-#endif /*_lib_poll*/
 
 #if _stream_peek
 #include       <stropts.h>
@@ -786,14 +768,6 @@ extern "C" {
     extern pid_t vfork(void);
 #endif /*HAVE_VFORK*/
 
-#ifdef _lib_poll
-#if _lib_poll_fd_1
-    extern int poll(struct pollfd *, ulong, int);
-#else
-    extern int poll(ulong, struct pollfd *, int);
-#endif
-#endif /*_lib_poll*/
-
 #endif /*_SFHDR_H*/
 #ifdef __cplusplus
 }
index fd666ff3e883652eca656a770e5ad7c53bb3f1c8..09fc074b33a1902fd55f3dac847ed79e12b7a5f6 100644 (file)
@@ -96,25 +96,6 @@ ssize_t sfpkrd(int fd, void * argbuf, size_t n, int rc, long tm,
               /* let select be interrupted instead of recv which autoresumes */
               (t & SOCKET_PEEK)) {
            r = -2;
-#if _lib_poll
-           if (r == -2) {
-               struct pollfd po;
-               po.fd = fd;
-               po.events = POLLIN;
-               po.revents = 0;
-
-               if ((r = SFPOLL(&po, 1, tm)) < 0) {
-                   if (errno == EINTR)
-                       return -1;
-                   else if (errno == EAGAIN) {
-                       errno = 0;
-                       continue;
-                   } else
-                       r = -2;
-               } else
-                   r = (po.revents & POLLIN) ? 1 : -1;
-           }
-#endif /*_lib_poll*/
 #ifdef HAVE_SELECT
            if (r == -2) {
                fd_set rd;
@@ -142,7 +123,7 @@ ssize_t sfpkrd(int fd, void * argbuf, size_t n, int rc, long tm,
            }
 #endif /*HAVE_SELECT*/
            if (r == -2) {
-#if !_lib_poll && !defined(HAVE_SELECT)        /* both poll and select cann't be used */
+#if !defined(HAVE_SELECT)      /* select can't be used */
 #ifdef FIONREAD                        /* quick and dirty check for availability */
                long nsec = tm < 0 ? 0 : (tm + 999) / 1000;
                while (nsec > 0 && r < 0) {
index 1453eee1d726843b88686e93546d84400a3577e7..90fd44eafc972ffcf9fafc49705a1465af675189 100644 (file)
@@ -117,44 +117,6 @@ int sfpoll(Sfio_t ** fa, int n, int tm)
        }
     }
 
-#if _lib_poll
-    if (c > 0) {
-       struct pollfd *fds;
-
-       /* construct the poll array */
-       if (!(fds = (struct pollfd *) malloc(c * sizeof(struct pollfd))))
-           return -1;
-       for (r = 0; r < c; r++) {
-           fds[r].fd = fa[check[r]]->file;
-           fds[r].events =
-               (fa[check[r]]->mode & SF_READ) ? POLLIN : POLLOUT;
-           fds[r].revents = 0;
-       }
-
-       for (;;) {              /* this loop takes care of interrupts */
-           if ((r = SFPOLL(fds, c, tm)) == 0)
-               break;
-           else if (r < 0) {
-               if (errno == EINTR || errno == EAGAIN) {
-                   errno = 0;
-                   continue;
-               } else
-                   break;
-           }
-
-           for (r = 0; r < c; ++r) {
-               f = fa[check[r]];
-               if (((f->mode & SF_READ) && (fds[r].revents & POLLIN)) ||
-                   ((f->mode & SF_WRITE) && (fds[r].revents & POLLOUT)))
-                   status[check[r]] = 1;
-           }
-           break;
-       }
-
-       free((void *) fds);
-    }
-#endif /*_lib_poll*/
-
 #ifdef HAVE_SELECT
     if (c > 0) {
        fd_set rd, wr;