summaryrefslogtreecommitdiffstats
path: root/poll
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-12 04:59:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-12 04:59:58 +0000
commitb8d375bcb1f462d5af5d1f480b32d7b0038417f6 (patch)
tree93d48ade79cc9d5892f17ff41c33753be6bb0879 /poll
parentAdding upstream version 1.7.2. (diff)
downloadapr-upstream/1.7.5.tar.xz
apr-upstream/1.7.5.zip
Adding upstream version 1.7.5.upstream/1.7.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'poll')
-rw-r--r--poll/os2/poll.c3
-rw-r--r--poll/os2/pollset.c2
-rw-r--r--poll/unix/epoll.c4
-rw-r--r--poll/unix/poll.c21
-rw-r--r--poll/unix/z_asio.c3
5 files changed, 19 insertions, 14 deletions
diff --git a/poll/os2/poll.c b/poll/os2/poll.c
index 3c36e5e..a9d5153 100644
--- a/poll/os2/poll.c
+++ b/poll/os2/poll.c
@@ -61,7 +61,8 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t num,
}
if (timeout > 0) {
- timeout /= 1000; /* convert microseconds to milliseconds */
+ /* convert microseconds to milliseconds (round up) */
+ timeout = (timeout + 999) / 1000;
}
i = select(pollset, num_read, num_write, num_except, timeout);
diff --git a/poll/os2/pollset.c b/poll/os2/pollset.c
index 87b3c18..c032199 100644
--- a/poll/os2/pollset.c
+++ b/poll/os2/pollset.c
@@ -223,7 +223,7 @@ APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
(*num) = 0;
if (timeout > 0) {
- timeout /= 1000;
+ timeout = (timeout + 999) / 1000;
}
rv = select(pollresult, pollset->num_read, pollset->num_write, pollset->num_except, timeout);
diff --git a/poll/unix/epoll.c b/poll/unix/epoll.c
index 4ab03f6..ad3cc0b 100644
--- a/poll/unix/epoll.c
+++ b/poll/unix/epoll.c
@@ -261,7 +261,7 @@ static apr_status_t impl_pollset_poll(apr_pollset_t *pollset,
*num = 0;
if (timeout > 0) {
- timeout /= 1000;
+ timeout = (timeout + 999) / 1000;
}
ret = epoll_wait(pollset->p->epoll_fd, pollset->p->pollset, pollset->nalloc,
@@ -442,7 +442,7 @@ static apr_status_t impl_pollcb_poll(apr_pollcb_t *pollcb,
apr_status_t rv = APR_SUCCESS;
if (timeout > 0) {
- timeout /= 1000;
+ timeout = (timeout + 999) / 1000;
}
ret = epoll_wait(pollcb->fd, pollcb->pollset.epoll, pollcb->nalloc,
diff --git a/poll/unix/poll.c b/poll/unix/poll.c
index 5b878f1..28090c4 100644
--- a/poll/unix/poll.c
+++ b/poll/unix/poll.c
@@ -114,7 +114,8 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t num,
num_to_poll = i;
if (timeout > 0) {
- timeout /= 1000; /* convert microseconds to milliseconds */
+ /* convert microseconds to milliseconds (round up) */
+ timeout = (timeout + 999) / 1000;
}
i = poll(pollset, num_to_poll, timeout);
@@ -252,14 +253,15 @@ static apr_status_t impl_pollset_poll(apr_pollset_t *pollset,
}
return APR_SUCCESS;
}
+#endif
+
if (timeout > 0) {
- timeout /= 1000;
+ timeout = (timeout + 999) / 1000;
}
+
+#ifdef WIN32
ret = WSAPoll(pollset->p->pollset, pollset->nelts, (int)timeout);
#else
- if (timeout > 0) {
- timeout /= 1000;
- }
ret = poll(pollset->p->pollset, pollset->nelts, timeout);
#endif
if (ret < 0) {
@@ -407,14 +409,15 @@ static apr_status_t impl_pollcb_poll(apr_pollcb_t *pollcb,
}
return APR_SUCCESS;
}
+#endif
+
if (timeout > 0) {
- timeout /= 1000;
+ timeout = (timeout + 999) / 1000;
}
+
+#ifdef WIN32
ret = WSAPoll(pollcb->pollset.ps, pollcb->nelts, (int)timeout);
#else
- if (timeout > 0) {
- timeout /= 1000;
- }
ret = poll(pollcb->pollset.ps, pollcb->nelts, timeout);
#endif
if (ret < 0) {
diff --git a/poll/unix/z_asio.c b/poll/unix/z_asio.c
index 48b531c..e7d9d9d 100644
--- a/poll/unix/z_asio.c
+++ b/poll/unix/z_asio.c
@@ -554,7 +554,7 @@ static posix_poll(apr_pollset_t *pollset,
DBG(4, "entered\n");
if (timeout > 0) {
- timeout /= 1000;
+ timeout = (timeout + 999) / 1000;
}
rv = poll(priv->pollset, pollset->nelts, timeout);
(*num) = rv;
@@ -698,6 +698,7 @@ static apr_status_t asio_pollset_poll(apr_pollset_t *pollset,
tv.tv_nsec = apr_time_usec(timeout) * 1000;
} else {
tv.tv_sec = INT_MAX; /* block until something is ready */
+ tv.tv_nsec = 0;
}
DBG2(6, "nothing on the ready ring "