X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=fd.c;fp=fd.c;h=d72096e1e9674fb0d5307dc4005f8a3d3aa7e6dc;hb=fdd8a22e1df57a8c9254e7d0074301e7dde2c557;hp=33891d2e6c9f1c3568428b1df93b4b92e295ef61;hpb=5dcb47606caf94ba1fe3a07f7795890fda3bdcee;p=paraslash.git diff --git a/fd.c b/fd.c index 33891d2e..d72096e1 100644 --- a/fd.c +++ b/fd.c @@ -334,8 +334,7 @@ bool file_exists(const char *fn) * \param n The highest-numbered descriptor in any of the two sets, plus 1. * \param readfds fds that should be checked for readability. * \param writefds fds that should be checked for writablility. - * \param timeout_tv upper bound on the amount of time elapsed before select() - * returns. + * \param timeout Upper bound in milliseconds. * * \return The return value of the underlying select() call on success, the * negative system error code on errors. @@ -343,12 +342,14 @@ bool file_exists(const char *fn) * All arguments are passed verbatim to select(2). * \sa select(2) select_tut(2). */ -int para_select(int n, fd_set *readfds, fd_set *writefds, - struct timeval *timeout_tv) +int para_select(int n, fd_set *readfds, fd_set *writefds, int timeout) { int ret; + struct timeval tv; + + ms2tv(timeout, &tv); do - ret = select(n, readfds, writefds, NULL, timeout_tv); + ret = select(n, readfds, writefds, NULL, &tv); while (ret < 0 && errno == EINTR); if (ret < 0) return -ERRNO_TO_PARA_ERROR(errno); @@ -653,14 +654,11 @@ int para_munmap(void *start, size_t length) int write_ok(int fd) { - struct timeval tv; fd_set wfds; FD_ZERO(&wfds); FD_SET(fd, &wfds); - tv.tv_sec = 0; - tv.tv_usec = 0; - return para_select(fd + 1, NULL, &wfds, &tv); + return para_select(fd + 1, NULL, &wfds, 0); } /**