Dustin wrote:

On Jul 19, 4:29 pm, Gary Z <[email protected]> wrote:
In order to make it work for Solaris10 x86 (not opensolaris), I had to
make following minor changes, two issues:

  Hey, we have a Solaris 10 sparc builder and OpenSolaris x86
builders.  Apparently that's not enough to cover it.

I believe our SPARC builder is using Sun Studio, not gcc. With the first one, it could be something gcc is catching (correctly?) which studio is not. The second one shouldn't cause a difference with compilers though.

Looking at the man page for syscalls (man -s 2 intro), I see the following:

        62 ETIME                Timer expired

                                The timer set for a STREAMS ioctl(2)
                                call  has expired. The cause of this
                                error is device-specific  and  could
                                indicate   either   a   hardware  or
                                software  failure,  or   perhaps   a
                                timeout  value that is too short for
                                the specific operation.  The  status
                                of the ioctl() operation is indeter-
                                minate. This is also returned in the
                                case  of  _lwp_cond_timedwait(2)  or
                                cond_timedwait(3C).

This doesn't seem to apply in the current context, does it? Did you get some sort of error during compliation, or were you just looking at errno.h for something you thought was equivalent?

Hmm, but looking deeper... there it is in port_getn(). http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/event_port.c#96

This defines errno as

        ETIME     The time  interval  expired  before  the  expected
                  number  of  events  have  been  posted to the port
                  (original value in nget), or nget is updated  with
                  the  number of returned port_event_t structures in
                  list[].

But... that return is to libevent from a port_getn().... which seems to handle the return value: http://src.opensolaris.org/source/xref/sfw/usr/src/lib/libevent/libevent-1.3e/evport.c#355 Sun would generally configure it to use /dev/poll rather than event port completion since it was an interface with more miles on it and it supports both. Event port completion is more useful if you're writing multithreaded code and don't want to have to dance around /dev/poll with your threads.

The section of code you're referring to has just a read(2)... and the man page for read(2) says nothing about returning ETIME. How did you see a need for this?


  ... or are you talking about something that's not breaking any of
our current tests?  If it doesn't, then it'd be really good to get a
test case for this.

  Any chance you can create a zone or something to run a buildbot
slave so we can keep this platform properly supported?  :)

1. using standard C prototype

2. solaris seems to return ETIME instead of EWOULDBLOCK for non-
blocking read
    In errno.h:
    #define EAGAIN  11      /* Resource temporarily unavailable     */
    #define EWOULDBLOCK     EAGAIN
    #define ETIME   62      /* timer expired                        */

With following changes, it built with GNU Make 3.80, SFW gcc 3.4.3 on
Solaris 10-u7-ga-x86, linked with libevent-1.4.6-stable.

diff -U2 ./solaris_priv.c ../memcached-1.4.0-sol10/./solaris_priv.c
--- ./solaris_priv.c    Thu Jul  9 09:43:42 2009
+++ ../memcached-1.4.0-sol10/./solaris_priv.c   Wed Jul 15 21:49:01
2009
@@ -3,4 +3,5 @@
 #include <stdio.h>

+extern void drop_privileges(void);
 /*
  * this section of code will drop all (Solaris) privileges including

diff -U2 ./memcached.h ../memcached-1.4.0-sol10/./memcached.h
--- ./memcached.h       Thu Jul  9 10:16:24 2009
+++ ../memcached-1.4.0-sol10/./memcached.h      Wed Jul 15 21:48:07
2009
@@ -465,5 +465,5 @@

 #if HAVE_DROP_PRIVILEGES
-extern void drop_privileges();
+extern void drop_privileges(void);
 #else
 #define drop_privileges()

diff -U2 ./memcached.c ../memcached-1.4.0-sol10/./memcached.c
--- ./memcached.c       Thu Jul  9 10:16:24 2009
+++ ../memcached-1.4.0-sol10/./memcached.c      Wed Jul 15 22:14:20
2009
@@ -3016,5 +3016,5 @@
         }
         if (res == -1) {
-            if (errno == EAGAIN || errno == EWOULDBLOCK) {
+            if (errno == EAGAIN || errno == EWOULDBLOCK || errno ==
ETIME) {
                 break;
             }
@@ -3115,5 +3115,5 @@
             return TRANSMIT_INCOMPLETE;
         }
-        if (res == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
+        if (res == -1 && (errno == EAGAIN || errno == EWOULDBLOCK ||
errno == ETIME)) {
             if (!update_event(c, EV_WRITE | EV_PERSIST)) {
                 if (settings.verbose > 0)
@@ -3267,5 +3267,4 @@
                 }
             }
-
             /*  now try reading from the socket */
             res = read(c->sfd, c->ritem, c->rlbytes);
@@ -3285,5 +3284,5 @@
                 break;
             }
-            if (res == -1 && (errno == EAGAIN || errno ==
EWOULDBLOCK)) {
+            if (res == -1 && (errno == EAGAIN || errno == EWOULDBLOCK
|| errno == ETIME)) {
                 if (!update_event(c, EV_READ | EV_PERSIST)) {
                     if (settings.verbose > 0)
@@ -3297,5 +3296,5 @@
             /* otherwise we have a real error, on which we close the
connection */
             if (settings.verbose > 0)
-                fprintf(stderr, "Failed to read, and not due to
blocking\n");
+                fprintf(stderr, "Failed to read, and not due to
blocking %d\n", errno);
             conn_set_state(c, conn_closing);
             break;
@@ -3330,5 +3329,5 @@
                 break;
             }
-            if (res == -1 && (errno == EAGAIN || errno ==
EWOULDBLOCK)) {
+            if (res == -1 && (errno == EAGAIN || errno == EWOULDBLOCK
|| errno == ETIME)) {
                 if (!update_event(c, EV_READ | EV_PERSIST)) {
                     if (settings.verbose > 0)

Reply via email to