httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <>
Subject Re: Errno code in APR again.
Date Thu, 06 Apr 2000 18:36:08 GMT

As a real-life example, can you explain what you think should be
changed for the code at the bottom to work properly?   The particular
line of code I'm concerned about is the comparison of rv with

Note that this doesn't work on UNIX systems where EAGAIN and
EWOULDBLOCK have different values and read/write calls can return

(I'm tweaking some APR code now which internally looks for EAGAIN so
that it handles EWOULDBLOCK as well.  You guys were happy on Linux
since Linux apparently only uses EAGAIN.  glibc headers on Linux
define EWOULDBLOCK to EAGAIN.  Hopefully the optimizer will collapse
(errno == EAGAIN || errno == EWOULDBLOCK) when EAGAIN and EWOULDBLOCK
are the same.)

/* a wrapper around iol_read which checks for errors and EOFs */
static ap_status_t read_with_errors(BUFF *fb, void *buf, ap_size_t
                                    ap_ssize_t *bytes_read)
    ap_status_t rv;

    rv = iol_read(fb->iol, buf, nbyte, bytes_read);
    if (rv == APR_SUCCESS && *bytes_read == 0) {
        fb->flags |= B_EOF;
    else if (rv != APR_SUCCESS) {
        fb->berrno = rv;
        fb->saved_errno = rv;
        if (rv != APR_EAGAIN) {
            doerror(fb, B_RD);
    return rv;



Jeff Trawick | | PGP public key at web site:
          Born in Roswell... married an alien...

View raw message