httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject checking for EWOULDBLOCK/EAGAIN *inside* APR
Date Fri, 07 Apr 2000 18:56:44 GMT
For the moment, let's ignore the issue about what the *caller* of APR
does to handle EWOULDBLOCK/EAGAIN (I think Ryan wants me to call his
canonicalizer then compare the canonicalized ap_status_t with
APR_EAGAIN).  When I asked Ryan how the app-layer code I posted would
be made to work, I neglected to remind him that there were issues both
inside and outside of APR.

Surely we don't need to call a canonicalizer *inside* APR?

There is a bunch of code like this in APR that I need to change so
that it works on OS/390 and other platforms where EWOULDBLOCK !=
EAGAIN:

ap_status_t ap_send(ap_socket_t *sock, const char *buf, ap_ssize_t *len)
{
    ssize_t rv;
 
    do {
        rv = write(sock->socketdes, buf, (*len));
    } while (rv == -1 && errno == EINTR);
 
>>> if (rv == -1 && errno == EAGAIN && sock->timeout != 0) {<<<
        ap_status_t arv = wait_for_io_or_timeout(sock, 0);
        if (arv != APR_SUCCESS) {
            *len = 0;
            return arv;
        }

(Actually I've already changed it privately; Apache is busted on
OS/390 otherwise.)

Does anyone have a better solution than this that Ryan would agree
with? 

my current solution inside APR:

>>> if (rv == -1 && 
        (errno == EAGAIN || errno == EWOULDBLOCK) && 
        sock->timeout != 0) {<<<

In truth, if I simply change EAGAIN to EWOULDBLOCK it will work on
Linux, FreeBSD, OS/390, AIX, Solaris, and I suspect quite a few other
flavors.  The solution I'm using currently is certainly safer.

Ben mentioned a concern that something like "(errno == EAGAIN || errno
== EWOULDBLOCK)" might lead to a compiler warning.  gcc -Wall doesn't
emit one, however.  If we find a better solution later, we can always
handle it then.

Looking forward to a crisp consensus when I get back Sunday/Monday
(ha!), 

Jeff
-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Mime
View raw message