Revert "poll-loop: Enable checking whether a FD caused a wakeup."
authorBen Pfaff <blp@nicira.com>
Tue, 22 Nov 2011 19:05:53 +0000 (11:05 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 29 Nov 2011 00:54:44 +0000 (16:54 -0800)
This reverts commit 1e276d1a10539a8cd97d2ad63c073a9a43f0f1ef.
The poll_fd_woke() and nl_sock_woke() function added in that commit are
no longer used, so there is no reason to keep them in the tree.

lib/netlink-socket.c
lib/netlink-socket.h
lib/poll-loop.c
lib/poll-loop.h

index f117a6a..3e64de3 100644 (file)
@@ -854,14 +854,6 @@ nl_sock_wait(const struct nl_sock *sock, short int events)
     poll_fd_wait(sock->fd, events);
 }
 
-/* Checks whether this socket caused a wakeup in the previous run of the poll
- * loop. */
-short int
-nl_sock_woke(const struct nl_sock *sock)
-{
-    return poll_fd_woke(sock->fd);
-}
-
 /* Returns the PID associated with this socket. */
 uint32_t
 nl_sock_pid(const struct nl_sock *sock)
index 7e01acb..b6356b9 100644 (file)
@@ -60,7 +60,6 @@ int nl_sock_transact(struct nl_sock *, const struct ofpbuf *request,
 int nl_sock_drain(struct nl_sock *);
 
 void nl_sock_wait(const struct nl_sock *, short int events);
-short int nl_sock_woke(const struct nl_sock *);
 
 uint32_t nl_sock_pid(const struct nl_sock *);
 
index de080b4..5ff70d9 100644 (file)
@@ -62,15 +62,6 @@ static int timeout = -1;
 /* Location where waiter created. */
 static const char *timeout_where;
 
-/* Array of file descriptors from last run of poll_block(). */
-static struct pollfd *pollfds;
-
-/* Allocated size of pollfds. */
-static size_t max_pollfds;
-
-/* Current number of elements in pollfds. */
-static int n_pollfds;
-
 static struct poll_waiter *new_waiter(int fd, short int events,
                                       const char *where);
 
@@ -219,8 +210,11 @@ log_wakeup(const char *where, const struct pollfd *pollfd, int timeout)
 void
 poll_block(void)
 {
+    static struct pollfd *pollfds;
+    static size_t max_pollfds;
+
     struct poll_waiter *pw, *next;
-    int n_waiters;
+    int n_waiters, n_pollfds;
     int retval;
 
     /* Register fatal signal events before actually doing any real work for
@@ -281,25 +275,6 @@ poll_cancel(struct poll_waiter *pw)
         free(pw);
     }
 }
-
-/* Checks whether the given file descriptor caused the poll loop to wake up
- * in the previous iteration.  If it did, returns a bitmask of the events
- * that caused the wakeup.  Otherwise returns 0;
- */
-short int
-poll_fd_woke(int fd)
-{
-    int i;
-    short int events = 0;
-
-    for (i = 0; i < n_pollfds; i++) {
-        if (pollfds[i].fd == fd) {
-            events |= pollfds[i].revents;
-        }
-    }
-
-    return events;
-}
 \f
 /* Creates and returns a new poll_waiter for 'fd' and 'events'. */
 static struct poll_waiter *
index fa06a07..da8f6e2 100644 (file)
@@ -65,9 +65,6 @@ void poll_block(void);
 /* Cancel a file descriptor callback or event. */
 void poll_cancel(struct poll_waiter *);
 
-/* Checks whether the file descriptor caused a wakeup. */
-short int poll_fd_woke(int fd);
-
 #ifdef  __cplusplus
 }
 #endif