jim         96/04/01 15:03:34

  Modified:    src       http_main.c mod_status.c scoreboard.h
  Log:
  Add host and request info to scoreboard
  
  Revision  Changes    Path
  1.18      +22 -9     apache/src/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_main.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -C3 -r1.17 -r1.18
  *** http_main.c       1996/03/30 16:43:50     1.17
  --- http_main.c       1996/04/01 23:03:29     1.18
  ***************
  *** 656,662 ****
    #endif
    }
    
  ! void update_child_status (int child_num, int status)
    {
        short_score new_score_rec;
        memcpy(&new_score_rec,&scoreboard_image[child_num],sizeof 
new_score_rec);
  --- 656,662 ----
    #endif
    }
    
  ! void update_child_status (int child_num, int status, request_rec *r)
    {
        short_score new_score_rec;
        memcpy(&new_score_rec,&scoreboard_image[child_num],sizeof 
new_score_rec);
  ***************
  *** 672,677 ****
  --- 672,689 ----
        new_score_rec.my_access_count = 0;
        new_score_rec.my_bytes_served = 0;
        }
  +     if (r) {
  +     int slot_size;
  +     conn_rec *c = r->connection;
  +     slot_size = sizeof(new_score_rec.client) - 1;
  +     strncpy(new_score_rec.client, get_remote_host(c, r->per_dir_config,
  +      REMOTE_NAME), slot_size);
  +     new_score_rec.client[slot_size] = '\0';
  +     slot_size = sizeof(new_score_rec.request) - 1;
  +     strncpy(new_score_rec.request, (r->the_request ? r->the_request :
  +      "NULL"), slot_size);
  +     new_score_rec.request[slot_size] = '\0';
  +     }
    #endif
    
    #if defined(HAVE_MMAP) || defined(HAVE_SHMGET)
  ***************
  *** 1068,1074 ****
        child_num = child_num_arg;
        requests_this_child = 0;
        reopen_scoreboard (pconf);
  !     update_child_status (child_num, SERVER_READY);
    
        /* Only try to switch if we're running as root */
        if(!geteuid() && setuid(user_id) == -1) {
  --- 1080,1086 ----
        child_num = child_num_arg;
        requests_this_child = 0;
        reopen_scoreboard (pconf);
  !     update_child_status (child_num, SERVER_READY, (request_rec*)NULL);
    
        /* Only try to switch if we're running as root */
        if(!geteuid() && setuid(user_id) == -1) {
  ***************
  *** 1106,1112 ****
        }
    
        clen=sizeof(sa_client);
  !     update_child_status (child_num, SERVER_READY);
        
        accept_mutex_on();  /* Lock around "accept", if necessary */
    
  --- 1118,1124 ----
        }
    
        clen=sizeof(sa_client);
  !     update_child_status (child_num, SERVER_READY, (request_rec*)NULL);
        
        accept_mutex_on();  /* Lock around "accept", if necessary */
    
  ***************
  *** 1143,1149 ****
            continue;
        }
        
  !     update_child_status (child_num, SERVER_BUSY_READ);
        conn_io = bcreate(ptrans, B_RDWR);
        dupped_csd = csd;
    #if defined(NEED_DUPPED_CSD)
  --- 1155,1161 ----
            continue;
        }
        
  !     update_child_status (child_num, SERVER_BUSY_READ, (request_rec*)NULL);
        conn_io = bcreate(ptrans, B_RDWR);
        dupped_csd = csd;
    #if defined(NEED_DUPPED_CSD)
  ***************
  *** 1159,1165 ****
                                       (struct sockaddr_in *)&sa_server);
        
        r = read_request (current_conn);
  !     update_child_status (child_num, SERVER_BUSY_WRITE);
        if (r) process_request (r); /* else premature EOF --- ignore */
    
    #if defined(STATUS_INSTRUMENTATION)
  --- 1171,1177 ----
                                       (struct sockaddr_in *)&sa_server);
        
        r = read_request (current_conn);
  !     update_child_status (child_num, SERVER_BUSY_WRITE, r);
        if (r) process_request (r); /* else premature EOF --- ignore */
    
    #if defined(STATUS_INSTRUMENTATION)
  ***************
  *** 1168,1176 ****
        while (r && current_conn->keepalive) {
          bflush(conn_io);
          destroy_pool(r->pool);
  !       update_child_status (child_num, SERVER_BUSY_READ);
          r = read_request (current_conn);
  !       update_child_status (child_num, SERVER_BUSY_WRITE);
          if (r) process_request (r);
    
    #if defined(STATUS_INSTRUMENTATION)
  --- 1180,1188 ----
        while (r && current_conn->keepalive) {
          bflush(conn_io);
          destroy_pool(r->pool);
  !       update_child_status (child_num, SERVER_BUSY_READ, (request_rec*)NULL);
          r = read_request (current_conn);
  !       update_child_status (child_num, SERVER_BUSY_WRITE, r);
          if (r) process_request (r);
    
    #if defined(STATUS_INSTRUMENTATION)
  ***************
  *** 1347,1353 ****
            /* Child died... note that it's gone in the scoreboard. */
            sync_scoreboard_image();
            child_slot = find_child_by_pid (pid);
  !         if (child_slot >= 0) update_child_status (child_slot, SERVER_DEAD);
            }
    
        sync_scoreboard_image();
  --- 1359,1366 ----
            /* Child died... note that it's gone in the scoreboard. */
            sync_scoreboard_image();
            child_slot = find_child_by_pid (pid);
  !         if (child_slot >= 0) update_child_status (child_slot, SERVER_DEAD,
  !          (request_rec*)NULL);
            }
    
        sync_scoreboard_image();
  ***************
  *** 1355,1361 ****
            && (child_slot = find_free_child_num()) >= 0
            && child_slot <= daemons_limit)
            {
  !         update_child_status(child_slot,SERVER_STARTING);
            make_child(server_conf, child_slot);
            }
        }
  --- 1368,1374 ----
            && (child_slot = find_free_child_num()) >= 0
            && child_slot <= daemons_limit)
            {
  !         update_child_status(child_slot,SERVER_STARTING,(request_rec*)NULL);
            make_child(server_conf, child_slot);
            }
        }
  
  
  
  1.7       +3 -0      apache/src/mod_status.c
  
  Index: mod_status.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_status.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -C3 -r1.6 -r1.7
  *** mod_status.c      1996/03/29 15:44:32     1.6
  --- mod_status.c      1996/04/01 23:03:30     1.7
  ***************
  *** 261,266 ****
  --- 261,269 ----
                rputs("|",r);
                format_byte_out(r,bytes);
                rputs(")",r);
  +             sprintf(buffer," %s {%s}", score_record.client,
  +                     score_record.request);
  +             rputs(buffer,r);
            }
            tu+=score_record.times.tms_utime;
            ts+=score_record.times.tms_stime;
  
  
  
  1.6       +2 -0      apache/src/scoreboard.h
  
  Index: scoreboard.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/scoreboard.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -C3 -r1.5 -r1.6
  *** scoreboard.h      1996/03/29 15:44:33     1.5
  --- scoreboard.h      1996/04/01 23:03:31     1.6
  ***************
  *** 79,84 ****
  --- 79,86 ----
        long my_bytes_served;
        struct tms times;
        time_t last_used;
  +     char client[32];        /* Keep 'em small... */
  +     char request[64];       /* We just want an idea... */
    #endif
    } short_score;
    
  
  
  

Reply via email to