You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Brian Behlendorf <br...@hyperreal.com> on 1997/02/03 02:36:47 UTC

cvs commit: apache/support Makefile httpd_monitor.c

brian       97/02/02 17:36:46

  Modified:    support   Makefile httpd_monitor.c
  Log:
  Reviewed by:	Dean Gaudet <dg...@arctic.org>, Jim Jagielski <ji...@jaguNET.com>
  Submitted by:	Paul Sutton <pa...@ukweb.com>
  
  This is a repost of my patch to make httpd_monitor.c understand the
  current scoreboard format (if using a scoreboard file). It also cleans up
  the source a bit (removes unused defines, etc).
  
  Also, the Makefile in the support directory still has to be edited by hand
  to set the compiler name, cflags etc. Surely this can be automated by
  Configure? The same information that is pre-pended to Makefile.tmpl in src
  could be pre-pended to the Makefile in support.
  
  Revision  Changes    Path
  1.18      +8 -1      apache/support/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /export/home/cvs/apache/support/Makefile,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -C3 -r1.17 -r1.18
  *** Makefile	1997/01/07 07:23:43	1.17
  --- Makefile	1997/02/03 01:36:45	1.18
  ***************
  *** 12,17 ****
  --- 12,24 ----
    # For OS/2 port
    #EXTRA_LIBS= -llibufc -lsocket
    
  + # If you turned on extra status logging with the -DSTATUS flag in the
  + # Configuration file, you _must_ uncomment the following line for
  + # httpd_monitor to work (remember that httpd_monitor only works if
  + # you are using a scoreboard file -- on most systems the scoreboard
  + # will be held in memory and httpd_monitor will not work)
  + STATUS=-DSTATUS
  + 
    INCLUDES= -I../src -I../src/regex
    
    RM= /bin/rm -f
  ***************
  *** 62,68 ****
    	$(CC) $(CFLAGS) htdigest.c -o htdigest
    
    httpd_monitor: httpd_monitor.c
  ! 	$(CC) $(INCLUDES) $(CFLAGS) httpd_monitor.c -o httpd_monitor
    
    rotatelogs: rotatelogs.c
    	$(CC) $(INCLUDES) $(CFLAGS) rotatelogs.c -o rotatelogs
  --- 69,75 ----
    	$(CC) $(CFLAGS) htdigest.c -o htdigest
    
    httpd_monitor: httpd_monitor.c
  ! 	$(CC) $(INCLUDES) $(CFLAGS) $(STATUS) httpd_monitor.c -o httpd_monitor
    
    rotatelogs: rotatelogs.c
    	$(CC) $(INCLUDES) $(CFLAGS) rotatelogs.c -o rotatelogs
  
  
  
  1.7       +20 -14    apache/support/httpd_monitor.c
  
  Index: httpd_monitor.c
  ===================================================================
  RCS file: /export/home/cvs/apache/support/httpd_monitor.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -C3 -r1.6 -r1.7
  *** httpd_monitor.c	1997/01/01 18:26:16	1.6
  --- httpd_monitor.c	1997/02/03 01:36:45	1.7
  ***************
  *** 51,67 ****
    
     * simple script to monitor the child Apache processes
     *   Usage:
  !  *      httpd_monitor -p pid_file -s sleep_time
  !  *                Will give you an update ever sleep_time seconds
  !  *                 using pid_file as the location of the PID file.
     *                If you choose 0, it might chew up lots of CPU time.
     *
     * Output explanation..
     *
  !  *  s = sleeping but "ready to go" child
  !  *  R = active child
  !  *  _ = dead child (no longer needed)
  !  *  t = just starting
     *
     *
     *  Jim Jagielski <ji...@jaguNET.com>
  --- 51,72 ----
    
     * simple script to monitor the child Apache processes
     *   Usage:
  !  *      httpd_monitor [ -d serverdir | -f conffile ] [ -s sleep_time ]
  !  *                -d/-f options specify server dir or config files, as per
  !  *                      httpd.
  !  *                -s specifies how long to pause between screen updates
     *                If you choose 0, it might chew up lots of CPU time.
     *
     * Output explanation..
     *
  !  *  s = sleeping but "ready to go" child (this is '_' in mod_status)
  !  *  R = active child - writing to client
  !  *  W = active child - reading from client
  !  *  K = active child - waiting for additional request on kept-alive connection
  !  *  D = active child - doing DNS lookup
  !  *  L = active child - logging
  !  *  _ = dead child (no longer needed) (this is '.' in mod_status)
  !  *  t = just starting (this is 'S' in mod_status)
     *
     *
     *  Jim Jagielski <ji...@jaguNET.com>
  ***************
  *** 71,76 ****
  --- 76,84 ----
     *
     *   v1.1:
     *    Minor fixes
  +  *
  +  *   v1.2:
  +  *    Handles Apache 1.1.* scoreboard format (W/K/D/L states) -- PCS 09Jul96
     */
    
    #include <stdio.h>
  ***************
  *** 80,90 ****
    #include "../src/httpd.h"
    #include "../src/scoreboard.h"
    
  - #define PIDFILE_OPT		"PidFile"
  - #define	SCORE_OPT		"ScoreBoardFile"
    #define DEFAULT_SLEEPTIME	2
    #define ASIZE			1024
  ! #define MAX_PROC		40
    
    int
    main(argc, argv)
  --- 88,96 ----
    #include "../src/httpd.h"
    #include "../src/scoreboard.h"
    
    #define DEFAULT_SLEEPTIME	2
    #define ASIZE			1024
  ! #define MAX_PROC		HARD_SERVER_LIMIT
    
    int
    main(argc, argv)
  ***************
  *** 98,105 ****
        char score_name[ASIZE];
        char tbuf[ASIZE];
        char *ptmp;
  !     static char kid_stat[] = { '_', 's', 'R', 't' };
  !     char achar;
        long thepid;
        int score_fd;
        int sleep_time = DEFAULT_SLEEPTIME;
  --- 104,111 ----
        char score_name[ASIZE];
        char tbuf[ASIZE];
        char *ptmp;
  !     static char kid_stat[] = { '_', 's', 'R', 't', 'W', 'K', 'L', 'D' };
  !     int achar;
        long thepid;
        int score_fd;
        int sleep_time = DEFAULT_SLEEPTIME;
  ***************
  *** 199,205 ****
    	    achar = kid_stat[(int)scoreboard_image.status];
    	    if (scoreboard_image.pid != 0 && scoreboard_image.pid != thepid) {
    		total++;
  ! 		if (achar == 'R')
    		    running++;
    		*ptmp = achar;
    		*++ptmp = '\0';
  --- 205,212 ----
    	    achar = kid_stat[(int)scoreboard_image.status];
    	    if (scoreboard_image.pid != 0 && scoreboard_image.pid != thepid) {
    		total++;
  ! 		if (scoreboard_image.status != SERVER_DEAD &&
  ! 		    scoreboard_image.status != SERVER_READY)
    		    running++;
    		*ptmp = achar;
    		*++ptmp = '\0';
  ***************
  *** 266,272 ****
         * ServerRoot line... if not, we bail out
         */
        if (!*sroot) {
  - 	perror("httpd_monitor");
    	fprintf(stderr, "Can't find ServerRoot!\n");
    	exit(1);
        }
  --- 273,278 ----