]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - interactive.c
Switch from select(2) to poll(2).
[paraslash.git] / interactive.c
index 28937db4928879af417f7b7b528c6020d8a30394..812a7d5bef8a37bd3ebdbd5a2484b735827a3395 100644 (file)
@@ -593,26 +593,21 @@ void i9e_signal_dispatch(int sig_num)
 }
 
 /**
- * Wrapper for select(2) which does not restart on interrupts.
+ * Wrapper for poll(2) which handles EINTR and returns paraslash error codes.
  *
- * \param n \sa \ref para_select().
- * \param readfds \sa \ref para_select().
- * \param writefds \sa \ref para_select().
- * \param timeout \sa \ref para_select().
+ * \param fds See poll(2).
+ * \param nfds See poll(2).
+ * \param timeout See poll(2).
  *
- * \return \sa \ref para_select().
+ * \return See poll(2).
  *
- * The only difference between this function and \ref para_select() is that
- * \ref i9e_select() returns zero if the select call returned \p EINTR.
+ * The only difference between this function and \ref xpoll() is that \ref
+ * i9e_poll() returns zero if the system call was interrupted while xpoll()
+ * restarts the system call in this case.
  */
-int i9e_select(int n, fd_set *readfds, fd_set *writefds, int timeout)
+int i9e_poll(struct pollfd *fds, nfds_t nfds, int timeout)
 {
-       struct timeval tv;
-       int ret;
-
-       ms2tv(timeout, &tv);
-       ret = select(n, readfds, writefds, NULL, &tv);
-
+       int ret = poll(fds, nfds, timeout);
        if (ret < 0) {
                if (errno == EINTR)
                        ret = 0;