Commit 4df8f7ff authored by David Reid's avatar David Reid
Browse files

Some small changes...

- use palloc instead of pcalloc
- add code to set larger FD_SETSIZE if appropriate
- some formatting tidy up


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89616 13f79535-47bb-0310-9956-ffa450edef68
parent 7254d6ee
Loading
Loading
Loading
Loading
+20 −9
Original line number Diff line number Diff line
@@ -85,6 +85,8 @@
#include <sys/socket.h>
#include <signal.h>

extern int _kset_fd_limit_(int num);

/*
 * Actual definitions of config globals
 */
@@ -389,8 +391,8 @@ static int32 worker_thread(void * dummy)

                if (event & APR_POLLIN){
                    apr_sockaddr_t *rec_sa;
                    char *tmpbuf = apr_pcalloc(ptrans, sizeof(char) * 5);
                    apr_size_t len = 5;
                    char *tmpbuf = apr_palloc(ptrans, sizeof(char) * 5);
                    apr_sockaddr_info_get(&rec_sa, "127.0.0.1", APR_UNSPEC, 7772, 0, ptrans);
                    
                    if ((ret = apr_recvfrom(rec_sa, listening_sockets[0], 0, tmpbuf, &len))
@@ -491,7 +493,8 @@ static int make_worker(server_rec *s, int slot)
            "spawn_thread: Unable to start a new thread");
        /* In case system resources are maxxed out, we don't want
         * Apache running away with the CPU trying to fork over and
	     * over and over again. */
         * over and over again. 
         */
        (void) ap_update_child_status(0, slot, SERVER_DEAD, 
                                      (request_rec*)NULL);
        
@@ -540,7 +543,7 @@ static void perform_idle_server_maintenance(void)
    int i;
    int free_length;
    int free_slots[MAX_SPAWN_RATE];
    int last_non_dead;
    int last_non_dead  = -1;

    /* initialize the free_list */
    free_length = 0;
@@ -703,6 +706,14 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)

    ap_scoreboard_fname = DEFAULT_SCOREBOARD;

    /* Increase the available pool of fd's.  This code from
     * Joe Kloss <joek@be.com>
     */
    if( FD_SETSIZE > 128 && (i = _kset_fd_limit_( 128 )) < 0 ){
        ap_log_error(APLOG_MARK, APLOG_ERR, i, s,
            "could not set FD_SETSIZE (_kset_fd_limit_ failed)");
    }

    /* BeOS R5 doesn't support pipes on select() calls, so we use a 
       UDP socket as these are supported in both R5 and BONE.  If we only cared
       about BONE we'd use a pipe, but there it is.