summaryrefslogtreecommitdiff
path: root/poll/os2/pollset.c
diff options
context:
space:
mode:
authorBrian Havard <bjh@apache.org>2003-11-22 01:45:44 +0000
committerBrian Havard <bjh@apache.org>2003-11-22 01:45:44 +0000
commit788e0b9b288d53a711318c97c682ec8e3cf112da (patch)
treef0640d9bcea3d45f5a8784e7d8940f407b3c3e59 /poll/os2/pollset.c
parent8b182b0ae9a6cd1cbe79d3b9d9eb8465458097b3 (diff)
downloadapr-788e0b9b288d53a711318c97c682ec8e3cf112da.tar.gz
Resurrect poll.c for apr_poll() rather than having it in pollset.c.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64785 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poll/os2/pollset.c')
-rw-r--r--poll/os2/pollset.c87
1 files changed, 0 insertions, 87 deletions
diff --git a/poll/os2/pollset.c b/poll/os2/pollset.c
index 9d8c76a75..fd665e5c6 100644
--- a/poll/os2/pollset.c
+++ b/poll/os2/pollset.c
@@ -256,90 +256,3 @@ APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
*descriptors = pollset->result_set;
return APR_SUCCESS;
}
-
-APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t num,
- apr_int32_t *nsds, apr_interval_time_t timeout)
-{
- int *pollset;
- int i;
- int num_read = 0, num_write = 0, num_except = 0, num_total;
- int pos_read, pos_write, pos_except;
-
- for (i = 0; i < num; i++) {
- if (aprset[i].desc_type == APR_POLL_SOCKET) {
- num_read += (aprset[i].reqevents & APR_POLLIN) != 0;
- num_write += (aprset[i].reqevents & APR_POLLOUT) != 0;
- num_except += (aprset[i].reqevents & APR_POLLPRI) != 0;
- }
- }
-
- num_total = num_read + num_write + num_except;
- pollset = alloca(sizeof(int) * num_total);
- memset(pollset, 0, sizeof(int) * num_total);
-
- pos_read = 0;
- pos_write = num_read;
- pos_except = pos_write + num_write;
-
- for (i = 0; i < num; i++) {
- if (aprset[i].desc_type == APR_POLL_SOCKET) {
- if (aprset[i].reqevents & APR_POLLIN) {
- pollset[pos_read++] = aprset[i].desc.s->socketdes;
- }
-
- if (aprset[i].reqevents & APR_POLLOUT) {
- pollset[pos_write++] = aprset[i].desc.s->socketdes;
- }
-
- if (aprset[i].reqevents & APR_POLLPRI) {
- pollset[pos_except++] = aprset[i].desc.s->socketdes;
- }
-
- aprset[i].rtnevents = 0;
- }
- }
-
- if (timeout > 0) {
- timeout /= 1000; /* convert microseconds to milliseconds */
- }
-
- i = select(pollset, num_read, num_write, num_except, timeout);
- (*nsds) = i;
-
- if ((*nsds) < 0) {
- return APR_FROM_OS_ERROR(sock_errno());
- }
-
- if ((*nsds) == 0) {
- return APR_TIMEUP;
- }
-
- pos_read = 0;
- pos_write = num_read;
- pos_except = pos_write + num_write;
-
- for (i = 0; i < num; i++) {
- if (aprset[i].desc_type == APR_POLL_SOCKET) {
- if (aprset[i].reqevents & APR_POLLIN) {
- if (pollset[pos_read++] > 0) {
- aprset[i].rtnevents |= APR_POLLIN;
- }
- }
-
- if (aprset[i].reqevents & APR_POLLOUT) {
- if (pollset[pos_write++] > 0) {
- aprset[i].rtnevents |= APR_POLLOUT;
- }
- }
-
- if (aprset[i].reqevents & APR_POLLPRI) {
- if (pollset[pos_except++] > 0) {
- aprset[i].rtnevents |= APR_POLLPRI;
- }
- }
- }
- }
-
- return APR_SUCCESS;
-}
-