You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Jim Jagielski <ji...@hyperreal.com> on 1996/06/07 19:39:31 UTC

cvs commit: apache/src http_config.c http_core.c http_main.c httpd.h mod_imap.c mod_status.c scoreboard.h

jim         96/06/07 10:39:30

  Modified:    src       http_config.c http_core.c http_main.c httpd.h
                        mod_imap.c  mod_status.c scoreboard.h
  Log:
  mod_imap.c cleanup and combine SERVER_LIMIT
  
  Revision  Changes    Path
  1.11      +1 -1      apache/src/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_config.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -C3 -r1.10 -r1.11
  *** http_config.c	1996/04/29 11:40:16	1.10
  --- http_config.c	1996/06/07 17:39:23	1.11
  ***************
  *** 718,724 ****
        daemons_to_start = DEFAULT_START_DAEMON;
        daemons_min_free = DEFAULT_MIN_FREE_DAEMON;
        daemons_max_free = DEFAULT_MAX_FREE_DAEMON;
  !     daemons_limit = DEFAULT_SERVER_LIMIT;
        pid_fname = DEFAULT_PIDLOG;
        scoreboard_fname = DEFAULT_SCOREBOARD;
        max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
  --- 718,724 ----
        daemons_to_start = DEFAULT_START_DAEMON;
        daemons_min_free = DEFAULT_MIN_FREE_DAEMON;
        daemons_max_free = DEFAULT_MAX_FREE_DAEMON;
  !     daemons_limit = HARD_SERVER_LIMIT;
        pid_fname = DEFAULT_PIDLOG;
        scoreboard_fname = DEFAULT_SCOREBOARD;
        max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
  
  
  
  1.13      +2 -0      apache/src/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_core.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -C3 -r1.12 -r1.13
  *** http_core.c	1996/05/22 17:35:36	1.12
  --- http_core.c	1996/06/07 17:39:24	1.13
  ***************
  *** 713,718 ****
  --- 713,720 ----
    
    char *set_server_limit (cmd_parms *cmd, void *dummy, char *arg) {
        daemons_limit = atoi (arg);
  +     if (daemons_limit > HARD_SERVER_LIMIT)
  +     	daemons_limit = HARD_SERVER_LIMIT;
        return NULL;
    }
    
  
  
  
  1.32      +11 -11    apache/src/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_main.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -C3 -r1.31 -r1.32
  *** http_main.c	1996/05/31 20:16:27	1.31
  --- http_main.c	1996/06/07 17:39:24	1.32
  ***************
  *** 428,434 ****
        caddr_t m;
    #if defined(MAP_ANON) || defined(MAP_FILE)
    /* BSD style */
  !     m = mmap((caddr_t)0, HARD_SERVER_MAX*sizeof(short_score),
    	     PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
        if (m == (caddr_t)-1)
        {
  --- 428,434 ----
        caddr_t m;
    #if defined(MAP_ANON) || defined(MAP_FILE)
    /* BSD style */
  !     m = mmap((caddr_t)0, HARD_SERVER_LIMIT*sizeof(short_score),
    	     PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
        if (m == (caddr_t)-1)
        {
  ***************
  *** 447,453 ****
    	fprintf(stderr, "httpd: Could not open /dev/zero\n");
    	exit(1);
        }
  !     m = mmap((caddr_t)0, HARD_SERVER_MAX*sizeof(short_score),
    	     PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
        if (m == (caddr_t)-1)
        {
  --- 447,453 ----
    	fprintf(stderr, "httpd: Could not open /dev/zero\n");
    	exit(1);
        }
  !     m = mmap((caddr_t)0, HARD_SERVER_LIMIT*sizeof(short_score),
    	     PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
        if (m == (caddr_t)-1)
        {
  ***************
  *** 467,473 ****
    
    static void setup_shared_mem(void)
    {
  !     int score_size = HARD_SERVER_MAX*sizeof(short_score);
        char errstr[MAX_STRING_LEN];
        struct shmid_ds shmbuf;
    #ifdef MOVEBREAK
  --- 467,473 ----
    
    static void setup_shared_mem(void)
    {
  !     int score_size = HARD_SERVER_LIMIT*sizeof(short_score);
        char errstr[MAX_STRING_LEN];
        struct shmid_ds shmbuf;
    #ifdef MOVEBREAK
  ***************
  *** 551,557 ****
    }
    
    #else
  ! static short_score scoreboard_image[HARD_SERVER_MAX];
    static int have_scoreboard_fname = 0;
    static int scoreboard_fd;
    
  --- 551,557 ----
    }
    
    #else
  ! static short_score scoreboard_image[HARD_SERVER_LIMIT];
    static int have_scoreboard_fname = 0;
    static int scoreboard_fd;
    
  ***************
  *** 594,600 ****
        {
    	setup_shared_mem();
        }
  !     memset(scoreboard_image, 0, HARD_SERVER_MAX*sizeof(short_score));
    #else
        scoreboard_fname = server_root_relative (p, scoreboard_fname);
    
  --- 594,600 ----
        {
    	setup_shared_mem();
        }
  !     memset(scoreboard_image, 0, HARD_SERVER_LIMIT*sizeof(short_score));
    #else
        scoreboard_fname = server_root_relative (p, scoreboard_fname);
    
  ***************
  *** 707,713 ****
    
    int get_child_status (int child_num)
    {
  !     if (child_num<0 || child_num>=HARD_SERVER_MAX)
        	return -1;
        else
    	return scoreboard_image[child_num].status;
  --- 707,713 ----
    
    int get_child_status (int child_num)
    {
  !     if (child_num<0 || child_num>=HARD_SERVER_LIMIT)
        	return -1;
        else
    	return scoreboard_image[child_num].status;
  ***************
  *** 718,724 ****
        int i;
        int res = 0;
    
  !     for (i = 0; i < HARD_SERVER_MAX; ++i)
          if (scoreboard_image[i].status == SERVER_BUSY_READ ||
                  scoreboard_image[i].status == SERVER_BUSY_WRITE ||
                  scoreboard_image[i].status == SERVER_BUSY_KEEPALIVE ||
  --- 718,724 ----
        int i;
        int res = 0;
    
  !     for (i = 0; i < HARD_SERVER_LIMIT; ++i)
          if (scoreboard_image[i].status == SERVER_BUSY_READ ||
                  scoreboard_image[i].status == SERVER_BUSY_WRITE ||
                  scoreboard_image[i].status == SERVER_BUSY_KEEPALIVE ||
  ***************
  *** 769,775 ****
        int i;
        int res = 0;
    
  !     for (i = 0; i < HARD_SERVER_MAX; ++i)
    	if (scoreboard_image[i].status == SERVER_READY
    	  || scoreboard_image[i].status == SERVER_STARTING)
    	    ++res;
  --- 769,775 ----
        int i;
        int res = 0;
    
  !     for (i = 0; i < HARD_SERVER_LIMIT; ++i)
    	if (scoreboard_image[i].status == SERVER_READY
    	  || scoreboard_image[i].status == SERVER_STARTING)
    	    ++res;
  ***************
  *** 781,787 ****
    {
        int i;
    
  !     for (i = 0; i < HARD_SERVER_MAX; ++i)
    	if (scoreboard_image[i].status == SERVER_DEAD)
    	    return i;
    
  --- 781,787 ----
    {
        int i;
    
  !     for (i = 0; i < HARD_SERVER_LIMIT; ++i)
    	if (scoreboard_image[i].status == SERVER_DEAD)
    	    return i;
    
  ***************
  *** 792,798 ****
    {
        int i;
    
  !     for (i = 0; i < HARD_SERVER_MAX; ++i)
    	if (scoreboard_image[i].pid == pid)
    	    return i;
    
  --- 792,798 ----
    {
        int i;
    
  !     for (i = 0; i < HARD_SERVER_LIMIT; ++i)
    	if (scoreboard_image[i].pid == pid)
    	    return i;
    
  ***************
  *** 805,811 ****
        int my_pid = getpid();
    
        sync_scoreboard_image();
  !     for (i = 0; i < HARD_SERVER_MAX; ++i) {
    	int pid = scoreboard_image[i].pid;
    
    	if (pid != my_pid && pid != 0)
  --- 805,811 ----
        int my_pid = getpid();
    
        sync_scoreboard_image();
  !     for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
    	int pid = scoreboard_image[i].pid;
    
    	if (pid != my_pid && pid != 0)
  
  
  
  1.25      +10 -2     apache/src/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/httpd.h,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -C3 -r1.24 -r1.25
  *** httpd.h	1996/06/05 15:23:05	1.24
  --- httpd.h	1996/06/07 17:39:25	1.25
  ***************
  *** 206,214 ****
    /* Limit on the total --- clients will be locked out if more servers than
     * this are needed.  It is intended solely to keep the server from crashing
     * when things get out of hand.
     */
  ! 
  ! #define DEFAULT_SERVER_LIMIT 150
    
    /* Number of requests to try to handle in a single process.  If <= 0,
     * the children don't die off.  That's the default here, since I'm still
  --- 206,222 ----
    /* Limit on the total --- clients will be locked out if more servers than
     * this are needed.  It is intended solely to keep the server from crashing
     * when things get out of hand.
  +  *
  +  * We keep a hard maximum number of servers, for two reasons --- first off,
  +  * in case something goes seriously wrong, we want to stop the fork bomb
  +  * short of actually crashing the machine we're running on by filling some
  +  * kernel table (I was originally going to make this 256, but it turns out
  +  * that that would actually fill the process table on reasonably configured
  +  * machines).  Secondly, it keeps the size of the scoreboard file small
  +  * enough that we can read the whole thing without worrying too much about
  +  * the overhead.
     */
  ! #define HARD_SERVER_LIMIT 150
    
    /* Number of requests to try to handle in a single process.  If <= 0,
     * the children don't die off.  That's the default here, since I'm still
  
  
  
  1.9       +13 -11    apache/src/mod_imap.c
  
  Index: mod_imap.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_imap.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -C3 -r1.8 -r1.9
  *** mod_imap.c	1996/06/07 17:30:05	1.8
  --- mod_imap.c	1996/06/07 17:39:25	1.9
  ***************
  *** 679,685 ****
        if (sscanf(input, "%s %s", directive, value) != 2) {
          continue;                           /* make sure we read two fields */
        }
  !     /* Now skip what we just read */
        while (!(isspace(*string_pos)))	/* past directive */
    	string_pos++;
        while (isspace(*string_pos))	/* and whitespace */
  --- 679,685 ----
        if (sscanf(input, "%s %s", directive, value) != 2) {
          continue;                           /* make sure we read two fields */
        }
  !     /* Now skip what we just read... we can't use ANSIism %n */
        while (!(isspace(*string_pos)))	/* past directive */
    	string_pos++;
        while (isspace(*string_pos))	/* and whitespace */
  ***************
  *** 709,724 ****
    
        vertex = 0;
        while ( vertex < MAXVERTS &&  
  ! 	   sscanf(string_pos, "%lf,%lf", &pointarray[vertex][X], 
  ! 		  &pointarray[vertex][Y])   == 2) {
  !       while(isspace(*string_pos))	/* past whitespace */
  ! 	string_pos++;
  !       while(isdigit(*string_pos))	/* and the 1st number */
  ! 	string_pos++;
  !       string_pos++;			/* skip the ',' */
  !       while(isdigit(*string_pos))	/* 2nd number */
  ! 	string_pos++;
  !       vertex++;
        }                /* so long as there are more vertices to read, and
    			we have room, read them in.  We start where we left
    			off of the last sscanf, not at the beginning.*/
  --- 709,726 ----
    
        vertex = 0;
        while ( vertex < MAXVERTS &&  
  !      sscanf(string_pos, "%lf,%lf",
  !      &pointarray[vertex][X], &pointarray[vertex][Y])   == 2)
  !     {
  ! 	/* Now skip what we just read... we can't use ANSIism %n */
  ! 	while(isspace(*string_pos))	/* past whitespace */
  ! 	    string_pos++;
  ! 	while(isdigit(*string_pos))	/* and the 1st number */
  ! 	    string_pos++;
  ! 	string_pos++;			/* skip the ',' */
  ! 	while(isdigit(*string_pos))	/* 2nd number */
  ! 	    string_pos++;
  ! 	vertex++;
        }                /* so long as there are more vertices to read, and
    			we have room, read them in.  We start where we left
    			off of the last sscanf, not at the beginning.*/
  
  
  
  1.23      +4 -4      apache/src/mod_status.c
  
  Index: mod_status.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_status.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -C3 -r1.22 -r1.23
  *** mod_status.c	1996/05/29 09:26:44	1.22
  --- mod_status.c	1996/06/07 17:39:26	1.23
  ***************
  *** 180,186 ****
        server_rec *server = r->server;
        short_score score_record;
        char status[]="??????????";
  !     char stat_buffer[HARD_SERVER_MAX];
        clock_t tu,ts,tcu,tcs;
    
        tu=ts=tcu=tcs=0;
  --- 180,186 ----
        server_rec *server = r->server;
        short_score score_record;
        char status[]="??????????";
  !     char stat_buffer[HARD_SERVER_LIMIT];
        clock_t tu,ts,tcu,tcs;
    
        tu=ts=tcu=tcs=0;
  ***************
  *** 237,243 ****
    	return 0;
    
        sync_scoreboard_image();
  !     for (i = 0; i<HARD_SERVER_MAX; ++i)
        {
            score_record = get_scoreboard_info(i);
            res = score_record.status;
  --- 237,243 ----
    	return 0;
    
        sync_scoreboard_image();
  !     for (i = 0; i<HARD_SERVER_LIMIT; ++i)
        {
            score_record = get_scoreboard_info(i);
            res = score_record.status;
  ***************
  *** 338,344 ****
    
        rputs("\n",r);
    
  !     for (i = 0; i<HARD_SERVER_MAX; ++i)
        {
    	rputc(stat_buffer[i], r);
    	if(i%STATUS_MAXLINE == (STATUS_MAXLINE - 1))
  --- 338,344 ----
    
        rputs("\n",r);
    
  !     for (i = 0; i<HARD_SERVER_LIMIT; ++i)
        {
    	rputc(stat_buffer[i], r);
    	if(i%STATUS_MAXLINE == (STATUS_MAXLINE - 1))
  ***************
  *** 372,378 ****
                rputs("<p>\n\n<table border=0><tr><th>Srv<th>PID<th>Acc<th>M<th>CPU\n<th>SS<th>Conn<th>Child<th>Slot<th>Host<th>Request</tr>\n\n",r);
    
    
  !     for (i = 0; i<HARD_SERVER_MAX; ++i)
        {
            score_record=get_scoreboard_info(i);
            lres = score_record.access_count;
  --- 372,378 ----
                rputs("<p>\n\n<table border=0><tr><th>Srv<th>PID<th>Acc<th>M<th>CPU\n<th>SS<th>Conn<th>Child<th>Slot<th>Host<th>Request</tr>\n\n",r);
    
    
  !     for (i = 0; i<HARD_SERVER_LIMIT; ++i)
        {
            score_record=get_scoreboard_info(i);
            lres = score_record.access_count;
  
  
  
  1.12      +0 -13     apache/src/scoreboard.h
  
  Index: scoreboard.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/scoreboard.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -C3 -r1.11 -r1.12
  *** scoreboard.h	1996/05/28 09:14:25	1.11
  --- scoreboard.h	1996/06/07 17:39:26	1.12
  ***************
  *** 90,107 ****
    #endif
    } short_score;
    
  - /*
  -  * We keep a hard maximum number of servers, for two reasons --- first off,
  -  * in case something goes seriously wrong, we want to stop the fork bomb
  -  * short of actually crashing the machine we're running on by filling some
  -  * kernel table (I was originally going to make this 256, but it turns out
  -  * that that would actually fill the process table on reasonably configured
  -  * machines).  Secondly, it keeps the size of the scoreboard file small
  -  * enough that we can read the whole thing without worrying too much about
  -  * the overhead.
  -  */
  - 
  - #define HARD_SERVER_MAX 150
  - 
    extern void sync_scoreboard_image(void);
    short_score get_scoreboard_info(int x);
  --- 90,94 ----