components/apr/patches/port_getn_rc.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 11 Mar 2013 10:38:09 -0700
branchs11-update
changeset 2520 ceec631e74d1
parent 203 887f23af6934
permissions -rw-r--r--
Close of build 10.

=== Patch is taken from
=== http://svn.apache.org/viewvc?view=revision&revision=836111
--- poll/unix/port.c.orig	2009-11-18 15:04:29.000000000 -0500
+++ poll/unix/port.c	2009-11-18 15:02:28.000000000 -0500
@@ -100,18 +100,27 @@
         tvptr = &tv;
     }
 
+    list[0].portev_user = (void *)-1; /* so we can double check that an
+                                       * event was returned
+                                       */
+
     ret = port_getn(port, list, max, nget, tvptr);
+    /* Note: 32-bit port_getn() on Solaris 10 x86 returns large negative 
+     * values instead of 0 when returning immediately.
+     */
 
-    if (ret < 0) {
+    if (ret == -1) {
         rv = apr_get_netos_error();
 
         switch(rv) {
         case EINTR:
         case ETIME:
-            if (*nget > 0) {
+            if (*nget > 0 && list[0].portev_user != (void *)-1) {
                 /* This confusing API can return an event at the same time
                  * that it reports EINTR or ETIME.  If that occurs, just
-                 * report the event.
+                 * report the event.  With EINTR, nget can be > 0 without
+                 * any event, so check that portev_user was filled in.
+                 *
                  * (Maybe it will be simplified; see thread
                  *   http://mail.opensolaris.org
                  *   /pipermail/networking-discuss/2009-August/011979.html