apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r293094 - in /apr/apr/trunk: include/apr_poll.h poll/unix/poll.c
Date Sun, 02 Oct 2005 11:58:58 GMT
Author: trawick
Date: Sun Oct  2 04:58:55 2005
New Revision: 293094

URL: http://svn.apache.org/viewcvs?rev=293094&view=rev
Log:
apr_poll() - don't promise to fill in rtnevents if no event was
signalled

poll() implementation: don't bother filling in rtnevents from
uninitialized (accidental) data if no events were signalled

Modified:
    apr/apr/trunk/include/apr_poll.h
    apr/apr/trunk/poll/unix/poll.c

Modified: apr/apr/trunk/include/apr_poll.h
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/include/apr_poll.h?rev=293094&r1=293093&r2=293094&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_poll.h (original)
+++ apr/apr/trunk/include/apr_poll.h Sun Oct  2 04:58:55 2005
@@ -167,17 +167,19 @@
 
 
 /**
- * Poll the sockets in the poll structure
+ * Poll the descriptors in the poll structure
  * @param aprset The poll structure we will be using. 
- * @param numsock The number of sockets we are polling
- * @param nsds The number of sockets signalled.
+ * @param numsock The number of descriptors we are polling
+ * @param nsds The number of descriptors signalled.
  * @param timeout The amount of time in microseconds to wait.  This is 
- *                a maximum, not a minimum.  If a socket is signalled, we 
+ *                a maximum, not a minimum.  If a descriptor is signalled, we 
  *                will wake up before this time.  A negative number means 
- *                wait until a socket is signalled.
- * @remark The number of sockets signalled is returned in the third argument. 
+ *                wait until a descriptor is signalled.
+ * @remark The number of descriptors signalled is returned in the third argument. 
  *         This is a blocking call, and it will not return until either a 
- *         socket has been signalled, or the timeout has expired. 
+ *         descriptor has been signalled, or the timeout has expired. 
+ * @remark The rtnevents field in the apr_pollfd_t array will only be filled-
+ *         in if the return value is APR_SUCCESS.
  */
 APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t numsock,
                                    apr_int32_t *nsds, 

Modified: apr/apr/trunk/poll/unix/poll.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/poll/unix/poll.c?rev=293094&r1=293093&r2=293094&view=diff
==============================================================================
--- apr/apr/trunk/poll/unix/poll.c (original)
+++ apr/apr/trunk/poll/unix/poll.c Sun Oct  2 04:58:55 2005
@@ -121,8 +121,13 @@
     i = poll(pollset, num_to_poll, timeout);
     (*nsds) = i;
 
-    for (i = 0; i < num; i++) {
-        aprset[i].rtnevents = get_revent(pollset[i].revents);
+    if (i > 0) { /* poll() sets revents only if an event was signalled;
+                  * we don't promise to set rtnevents unless an event
+                  * was signalled
+                  */
+        for (i = 0; i < num; i++) {
+            aprset[i].rtnevents = get_revent(pollset[i].revents);
+        }
     }
     
 #if !defined(HAVE_VLA) && !defined(HAVE_ALLOCA)



Mime
View raw message