httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@apache.org
Subject cvs commit: httpd-2.0/os/beos beosd.c beosd.h
Date Sun, 23 Dec 2001 14:13:07 GMT
dreid       01/12/23 06:13:07

  Modified:    os/beos  beosd.c beosd.h
  Log:
  Add a beosd_accept function.  If the worker MPM is used this is
  needed.
  
  Revision  Changes    Path
  1.18      +97 -0     httpd-2.0/os/beos/beosd.c
  
  Index: beosd.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/os/beos/beosd.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- beosd.c	2001/11/08 22:56:26	1.17
  +++ beosd.c	2001/12/23 14:13:07	1.18
  @@ -62,6 +62,8 @@
   #include "http_main.h"
   #include "http_log.h"
   #include "beosd.h"
  +#include "apr_lock.h"
  +#include "mpm_common.h"
   
   beosd_config_rec beosd_config;
   
  @@ -109,4 +111,99 @@
       /* Until the multi-user situation on BeOS is fixed,
          simply have a no-op here to allow for common conf files
        */
  +}
  +
  +AP_DECLARE(apr_status_t) beosd_accept(void **accepted, ap_listen_rec *lr,
  +                                      apr_pool_t *ptrans)
  +{
  +    apr_socket_t *csd;
  +    apr_status_t status;
  +    int sockdes;
  +
  +    status = apr_accept(&csd, lr->sd, ptrans);
  +    if (status == APR_SUCCESS) { 
  +        *accepted = csd;
  +        apr_os_sock_get(&sockdes, csd);
  +        if (sockdes >= FD_SETSIZE) {
  +            ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, NULL,
  +                         "new file descriptor %d is too large; you probably need "
  +                         "to rebuild Apache with a larger FD_SETSIZE "
  +                         "(currently %d)",
  +                         sockdes, FD_SETSIZE);
  +            apr_socket_close(csd);
  +            return APR_EINTR;
  +        } 
  +        return status;
  +    }
  +
  +    if (APR_STATUS_IS_EINTR(status)) {
  +        return status;
  +    }
  +    /* Our old behaviour here was to continue after accept()
  +     * errors.  But this leads us into lots of troubles
  +     * because most of the errors are quite fatal.  For
  +     * example, EMFILE can be caused by slow descriptor
  +     * leaks (say in a 3rd party module, or libc).  It's
  +     * foolish for us to continue after an EMFILE.  We also
  +     * seem to tickle kernel bugs on some platforms which
  +     * lead to never-ending loops here.  So it seems best
  +     * to just exit in most cases.
  +     */
  +    switch (status) {
  +#ifdef EPROTO
  +        /* EPROTO on certain older kernels really means
  +         * ECONNABORTED, so we need to ignore it for them.
  +         * See discussion in new-httpd archives nh.9701
  +         * search for EPROTO.
  +         *
  +         * Also see nh.9603, search for EPROTO:
  +         * There is potentially a bug in Solaris 2.x x<6,
  +         * and other boxes that implement tcp sockets in
  +         * userland (i.e. on top of STREAMS).  On these
  +         * systems, EPROTO can actually result in a fatal
  +         * loop.  See PR#981 for example.  It's hard to
  +         * handle both uses of EPROTO.
  +         */
  +        case EPROTO:
  +#endif
  +#ifdef ECONNABORTED
  +        case ECONNABORTED:
  +#endif
  +#ifdef ETIMEDOUT
  +        case ETIMEDOUT:
  +#endif
  +#ifdef EHOSTUNREACH
  +        case EHOSTUNREACH:
  +#endif
  +#ifdef ENETUNREACH
  +        case ENETUNREACH:
  +#endif
  +            break;
  +#ifdef ENETDOWN
  +        case ENETDOWN:
  +            /*
  +             * When the network layer has been shut down, there
  +             * is not much use in simply exiting: the parent
  +             * would simply re-create us (and we'd fail again).
  +             * Use the CHILDFATAL code to tear the server down.
  +             * @@@ Martin's idea for possible improvement:
  +             * A different approach would be to define
  +             * a new APEXIT_NETDOWN exit code, the reception
  +             * of which would make the parent shutdown all
  +             * children, then idle-loop until it detected that
  +             * the network is up again, and restart the children.
  +             * Ben Hyde noted that temporary ENETDOWN situations
  +             * occur in mobile IP.
  +             */
  +            ap_log_error(APLOG_MARK, APLOG_EMERG, status, ap_server_conf,
  +                         "apr_accept: giving up.");
  +            return APR_EGENERAL;
  +#endif /*ENETDOWN*/
  +
  +        default:
  +            ap_log_error(APLOG_MARK, APLOG_ERR, status, ap_server_conf,
  +                         "apr_accept: (client socket)");
  +            return APR_EGENERAL;
  +    }
  +    return status;
   }
  
  
  
  1.12      +4 -0      httpd-2.0/os/beos/beosd.h
  
  Index: beosd.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/os/beos/beosd.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- beosd.h	2001/11/13 06:04:24	1.11
  +++ beosd.h	2001/12/23 14:13:07	1.12
  @@ -59,6 +59,8 @@
   #ifndef BEOSD_H
   #define BEOSD_H
   
  +#include "httpd.h"
  +#include "ap_listen.h"
   /* common stuff that beos MPMs will want */
   
   /* Default user name and group name. These may be specified as numbers by
  @@ -85,6 +87,8 @@
                                            const char *arg);
   AP_DECLARE(const char *) beosd_set_group(cmd_parms *cmd, void *dummy, 
                                            const char *arg);
  +AP_DECLARE(apr_status_t) beosd_accept(void **accepted, ap_listen_rec *lr,
  +                                      apr_pool_t *ptrans);
   
   #define beosd_killpg(x, y)	(kill (-(x), (y)))
   
  
  
  

Mime
View raw message