rbb 99/05/19 08:17:18
Modified:include apr_network_io.h
apr/network_io/unix poll.c
Log:
Fixed some msitakes in ap_poll logic and added some more accessor functions.
Revision ChangesPath
1.19 +2 -0 apache-apr/include/apr_network_io.h
Index: apr_network_io.h
===
RCS file: /home/cvs/apache-apr/include/apr_network_io.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- apr_network_io.h 1999/05/12 19:46:14 1.18
+++ apr_network_io.h 1999/05/19 15:17:16 1.19
@@ -114,6 +114,8 @@
ap_pollfd_t *ap_setup_poll(ap_context_t *, ap_int32_t);
ap_int32_t ap_poll(ap_context_t *, ap_pollfd_t *, ap_int32_t, ap_int32_t);
void ap_add_poll_socket(ap_context_t *, ap_pollfd_t *, ap_socket_t *,
ap_int16_t, ap_int32_t);
+ap_int16_t ap_get_revents(ap_context_t *, ap_pollfd_t *, ap_int32_t);
+
/* accessor functions */
#ifdef __cplusplus
1.5 +27 -2 apache-apr/apr/network_io/unix/poll.c
Index: poll.c
===
RCS file: /home/cvs/apache-apr/apr/network_io/unix/poll.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- poll.c1999/05/12 19:46:17 1.4
+++ poll.c1999/05/19 15:17:17 1.5
@@ -87,6 +87,26 @@
return rv;
}
+ap_int16_t get_revent(ap_int16_t event)
+{
+ap_int16_t rv = 0;
+
+if (event & POLLIN)
+rv |= APR_POLLIN;
+if (event & POLLPRI)
+rv |= APR_POLLPRI;
+if (event & POLLOUT)
+rv |= APR_POLLOUT;
+if (event & POLLERR)
+rv |= APR_POLLERR;
+if (event & POLLHUP)
+rv |= APR_POLLHUP;
+if (event & POLLNVAL)
+rv |= APR_POLLNVAL;
+
+return rv;
+}
+
void ap_add_poll_socket(ap_context_t *cont, struct pollfd_t *aprset,
struct socket_t *sock, ap_int16_t event,
ap_int32_t pos)
@@ -108,11 +128,16 @@
pollset[i].events = aprset[i].events;
}
-rv = poll(pollset, nsds, timeout);
+rv = poll(pollset, nsds, timeout * 1000);
for (i = 0; i < nsds; i++) {
-pollset[i].revents = aprset[i].revents;
+aprset[i].revents = get_revent(pollset[i].revents);
}
return rv;
+}
+
+ap_int16_t ap_get_revents(ap_context_t *cont, struct pollfd_t *aprset,
ap_int32_t pos)
+{
+return aprset[pos].revents;
}