cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
manoj 99/08/27 14:22:30 Modified:src/modules/mpm/dexter dexter.c Log: Fix a bug in setting max_daemons_limit that could lead to not noticing that a child has died in some cases. Revision ChangesPath 1.28 +8 -3 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -u -r1.27 -r1.28 --- dexter.c 1999/08/17 22:04:54 1.27 +++ dexter.c 1999/08/27 21:22:28 1.28 @@ -100,6 +100,9 @@ * The max child slot ever assigned, preserved across restarts. Necessary * to deal with NumServers changes across SIGWINCH restarts. We use this * value to optimize routines that have to scan the entire scoreboard. + * + * XXX - It might not be worth keeping this code in. There aren't very + * many child processes in this MPM. */ int max_daemons_limit = -1; @@ -1141,13 +1144,15 @@ unsigned char status = ap_scoreboard_image[i].status; if (status == SERVER_DEAD) { -free_slots[free_length] = i; -++free_length; +if (free_length < spawn_rate) { +free_slots[free_length] = i; +++free_length; +} } else { last_non_dead = i; } - if (free_length >= spawn_rate) { + if (i >= max_daemons_limit && free_length >= spawn_rate) { break; } }
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
manoj 99/08/27 14:28:17 Modified:src/modules/mpm/dexter dexter.c Log: Be consistent with how we indicate child death and use status = SERVER_DEAD instead of pid = 0. I don't think this actually caused any bugs, but just in case... Revision ChangesPath 1.29 +2 -2 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -u -r1.28 -r1.29 --- dexter.c 1999/08/27 21:22:28 1.28 +++ dexter.c 1999/08/27 21:28:16 1.29 @@ -319,12 +319,12 @@ for (i = 0; i < max_daemons_limit; ++i) { int pid = ap_scoreboard_image[i].pid; - if (pid == my_pid || pid == 0) + if (ap_scoreboard_image[i].status == SERVER_DEAD) continue; waitret = waitpid(pid, &status, WNOHANG); if (waitret == pid || waitret == -1) { - ap_scoreboard_image[i].pid = 0; + ap_scoreboard_image[i].status = SERVER_DEAD; continue; } ++not_dead_yet;
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
rse 99/08/28 05:32:11 Modified:src/modules/mpm/dexter dexter.c Log: Fix the following bunch of warnings in dexter MPM: egcc -c -I../../../os/unix -I../../../include -I../../../modules/mpm/dexter -pipe -O2 -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wno-long-long -funsigned-char -DTARGET=\"apache\" -DUSE_EXPAT -I../../../lib/expat-lite `../../../apaci` dexter.c dexter.c:188: warning: no previous prototype for `clean_child_exit' dexter.c:491: warning: no previous prototype for `ap_start_shutdown' dexter.c:504: warning: no previous prototype for `ap_start_restart' dexter.c:682: warning: declaration of `pconf' shadows global declaration dexter.c: In function `setup_listeners': dexter.c:683: warning: declaration of `pconf' shadows global declaration dexter.c: In function `process_socket': dexter.c:744: warning: pointer targets in passing arg 3 of `getsockname' differ in signedness dexter.c: In function `worker_thread': dexter.c:932: warning: pointer targets in passing arg 3 of `accept' differ in signedness dexter.c: In function `ap_mpm_run': dexter.c:1365: warning: declaration of `i' shadows previous local dexter.c: At top level: dexter.c:1404: warning: declaration of `pconf' shadows global declaration dexter.c: In function `dexter_pre_config': dexter.c:1405: warning: declaration of `pconf' shadows global declaration Revision ChangesPath 1.31 +8 -9 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- dexter.c 1999/08/27 22:16:17 1.30 +++ dexter.c 1999/08/28 12:32:11 1.31 @@ -184,7 +184,7 @@ /* a clean exit from a child with proper cleanup static void clean_child_exit(int code) __attribute__ ((noreturn)); */ -void clean_child_exit(int code) +static void clean_child_exit(int code) { if (pchild) { ap_destroy_pool(pchild); @@ -487,7 +487,7 @@ * child to force an exit) and so do an exit anyway. */ -void ap_start_shutdown(void) +static void ap_start_shutdown(void) { if (shutdown_pending == 1) { /* Um, is this _probably_ not an error, if the user has @@ -500,7 +500,7 @@ } /* do a graceful restart if graceful == 1 */ -void ap_start_restart(int graceful) +static void ap_start_restart(int graceful) { if (restart_pending == 1) { @@ -679,12 +679,12 @@ } } -static int setup_listeners(pool *pconf, server_rec *s) +static int setup_listeners(pool *p, server_rec *s) { ap_listen_rec *lr; int num_listeners = 0; -if (ap_listen_open(pconf, s->port)) { +if (ap_listen_open(p, s->port)) { return 0; } for (lr = ap_listeners; lr; lr = lr->next) { @@ -736,7 +736,7 @@ int conn_id) { struct sockaddr sa_server; /* */ -size_t len = sizeof(struct sockaddr); +NET_SIZE_T len = sizeof(struct sockaddr); BUFF *conn_io; conn_rec *current_conn; ap_iol *iol; @@ -850,7 +850,7 @@ int sd = -1; int srv; int curr_pollfd, last_pollfd = 0; -size_t len = sizeof(struct sockaddr); +NET_SIZE_T len = sizeof(struct sockaddr); int thread_just_started = 1; int thread_num = *((int *) arg); long conn_id = child_num * HARD_THREAD_LIMIT + thread_num; @@ -1362,7 +1362,6 @@ } if (is_graceful) { - int i; char char_of_death = '!'; ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, @@ -1401,7 +1400,7 @@ return 0; } -static void dexter_pre_config(pool *pconf, pool *plog, pool *ptemp) +static void dexter_pre_config(pool *p, pool *plog, pool *ptemp) { static int restart_num = 0;
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
martin 99/10/07 15:21:09 Modified:src/modules/mpm/dexter dexter.c Log: This module wouldn't even compile: the parameter list of setup_listeners() was wrong Revision ChangesPath 1.41 +1 -1 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /export/home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- dexter.c 1999/10/07 20:48:09 1.40 +++ dexter.c 1999/10/07 22:21:04 1.41 @@ -681,7 +681,7 @@ } } -static int setup_listeners(ap_context_t *p, server_rec *s) +static int setup_listeners(server_rec *s) { ap_listen_rec *lr; int num_listeners = 0;
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
manoj 99/10/25 23:07:38 Modified:src/modules/mpm/dexter dexter.c Log: Take advantage of ap_new_apr_connection in dexter Revision ChangesPath 1.47 +7 -19 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -u -r1.46 -r1.47 --- dexter.c 1999/10/24 13:08:27 1.46 +++ dexter.c 1999/10/26 06:07:36 1.47 @@ -737,21 +737,14 @@ * Child process main loop. */ -static void process_socket(ap_context_t *p, struct sockaddr *sa_client, int csd, - int conn_id) +static void process_socket(ap_context_t *p, ap_socket_t *sock, long conn_id) { -struct sockaddr sa_server; /* */ -NET_SIZE_T len = sizeof(struct sockaddr); BUFF *conn_io; conn_rec *current_conn; ap_iol *iol; - -if (getsockname(csd, &sa_server, &len) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf, "getsockname"); - close(csd); - return; -} +int csd; +ap_get_os_sock(&csd, sock); sock_disable_nagle(csd); iol = unix_attach_socket(csd); @@ -766,17 +759,15 @@ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, NULL, "error attaching to socket"); } -close(csd); +ap_close_socket(sock); return; } conn_io = ap_bcreate(p, B_RDWR); ap_bpush_iol(conn_io, iol); -current_conn = ap_new_connection(p, server_conf, conn_io, - (const struct sockaddr_in *) sa_client, - (const struct sockaddr_in *) &sa_server, - conn_id); +current_conn = ap_new_apr_connection(p, server_conf, conn_io, sock, + conn_id); ap_process_connection(current_conn); } @@ -848,7 +839,6 @@ static void *worker_thread(void *arg) { -struct sockaddr sa_client; ap_socket_t *csd = NULL; ap_context_t *tpool; /* Pool for this thread */ ap_context_t *ptrans;/* Pool for per-transaction stuff */ @@ -858,7 +848,6 @@ int thread_just_started = 1; int thread_num = *((int *) arg); long conn_id = child_num * HARD_THREAD_LIMIT + thread_num; -int native_socket; pthread_mutex_lock(&thread_pool_create_mutex); ap_create_context(&tpool, thread_pool_parent); @@ -955,8 +944,7 @@ pthread_mutex_unlock(&idle_thread_count_mutex); break; } -ap_get_os_sock(&native_socket, csd); -process_socket(ptrans, &sa_client, native_socket, conn_id); +process_socket(ptrans, csd, conn_id); ap_clear_pool(ptrans); requests_this_child--; }
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
manoj 99/10/26 23:16:49 Modified:src/modules/mpm/dexter dexter.c Log: A little bit of error logging to help with debugging. Revision ChangesPath 1.49 +9 -2 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -u -r1.48 -r1.49 --- dexter.c 1999/10/27 06:11:19 1.48 +++ dexter.c 1999/10/27 06:16:48 1.49 @@ -743,8 +743,11 @@ conn_rec *current_conn; ap_iol *iol; int csd; +ap_status_t rv; -ap_get_os_sock(&csd, sock); +if ((rv = ap_get_os_sock(&csd, sock)) != APR_SUCCESS) { +ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, "ap_get_os_sock"); +} sock_disable_nagle(csd); iol = unix_attach_socket(csd); @@ -923,7 +926,11 @@ } got_fd: if (!workers_may_exit) { -ap_accept(&csd, sd, ptrans); +ap_status_t rv; + +if ((rv = ap_accept(&csd, sd, ptrans)) != APR_SUCCESS) { +ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, "ap_accept"); +} SAFE_ACCEPT(accept_mutex_off(0)); SAFE_ACCEPT(intra_mutex_off(0)); pthread_mutex_lock(&idle_thread_count_mutex);
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
manoj 99/10/29 13:43:06 Modified:src/modules/mpm/dexter dexter.c Log: Fix a couple of pool-related bugs that may or may not be causing actual problems. This makes sure that all interactions with the thread_pool_parent are mutexed, and makes ap_put_os_sock use the correct pool in worker_thread(). Revision ChangesPath 1.50 +8 -6 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -u -r1.49 -r1.50 --- dexter.c 1999/10/27 06:16:48 1.49 +++ dexter.c 1999/10/29 20:42:49 1.50 @@ -162,7 +162,7 @@ static ap_context_t *pconf; /* Pool for config stuff */ static ap_context_t *pchild; /* Pool for httpd child stuff */ static ap_context_t *thread_pool_parent; /* Parent of per-thread pools */ -static pthread_mutex_t thread_pool_create_mutex; +static pthread_mutex_t thread_pool_parent_mutex; static int child_num; static int my_pid; /* Linux getpid() doesn't work except in main thread. Use @@ -852,9 +852,9 @@ int thread_num = *((int *) arg); long conn_id = child_num * HARD_THREAD_LIMIT + thread_num; -pthread_mutex_lock(&thread_pool_create_mutex); +pthread_mutex_lock(&thread_pool_parent_mutex); ap_create_context(&tpool, thread_pool_parent); -pthread_mutex_unlock(&thread_pool_create_mutex); +pthread_mutex_unlock(&thread_pool_parent_mutex); ap_create_context(&ptrans, tpool); while (!workers_may_exit) { @@ -918,7 +918,7 @@ /* XXX: Should we check for POLLERR? */ if (listenfds[curr_pollfd].revents & POLLIN) { last_pollfd = curr_pollfd; -ap_put_os_sock(&sd, &listenfds[curr_pollfd].fd, tpool); +ap_put_os_sock(&sd, &listenfds[curr_pollfd].fd, ptrans); goto got_fd; } } while (curr_pollfd != last_pollfd); @@ -956,7 +956,9 @@ ap_clear_pool(ptrans); } -ap_destroy_pool(tpool); +pthread_mutex_lock(&thread_pool_parent_mutex); +ap_destroy_context(tpool); +pthread_mutex_unlock(&thread_pool_parent_mutex); pthread_mutex_lock(&worker_thread_count_mutex); worker_thread_count--; worker_thread_free_ids[worker_thread_count] = thread_num; @@ -1026,7 +1028,7 @@ worker_thread_free_ids[i] = i; } ap_create_context(&thread_pool_parent, pchild); -pthread_mutex_init(&thread_pool_create_mutex, NULL); +pthread_mutex_init(&thread_pool_parent_mutex, NULL); pthread_mutex_init(&idle_thread_count_mutex, NULL); pthread_mutex_init(&worker_thread_count_mutex, NULL); pthread_mutex_init(&pipe_of_death_mutex, NULL);
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
manoj 99/10/29 18:49:54 Modified:src/modules/mpm/dexter dexter.c Log: Force ap_put_os_sock() to create a new ap_socket_t by presetting what's passed in to NULL. Revision ChangesPath 1.51 +1 -0 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -u -r1.50 -r1.51 --- dexter.c 1999/10/29 20:42:49 1.50 +++ dexter.c 1999/10/30 01:49:53 1.51 @@ -918,6 +918,7 @@ /* XXX: Should we check for POLLERR? */ if (listenfds[curr_pollfd].revents & POLLIN) { last_pollfd = curr_pollfd; +sd = NULL; ap_put_os_sock(&sd, &listenfds[curr_pollfd].fd, ptrans); goto got_fd; }
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
manoj 99/11/15 14:26:42 Modified:src/modules/mpm/dexter dexter.c Log: Allow NO_SERIALIZED_ACCEPT to work. Revision ChangesPath 1.54 +16 -9 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -u -r1.53 -r1.54 --- dexter.c 1999/11/15 21:22:47 1.53 +++ dexter.c 1999/11/15 22:26:35 1.54 @@ -102,8 +102,6 @@ unsigned char status; } child_table[HARD_SERVER_LIMIT]; -#define SAFE_ACCEPT(stmt) do {stmt;} while (0) - /* * The max child slot ever assigned, preserved across restarts. Necessary * to deal with NumServers changes across SIGWINCH restarts. We use this @@ -172,9 +170,14 @@ static pthread_mutex_t idle_thread_count_mutex; /* Locks for accept serialization */ -static pthread_mutex_t thread_accept_mutex = PTHREAD_MUTEX_INITIALIZER; +#ifdef NO_SERIALIZED_ACCEPT +#define SAFE_ACCEPT(stmt) APR_SUCCESS +#else +#define SAFE_ACCEPT(stmt) (stmt) static ap_lock_t *process_accept_mutex; +#endif /* NO_SERIALIZED_ACCEPT */ static char *lock_fname; +static pthread_mutex_t thread_accept_mutex = PTHREAD_MUTEX_INITIALIZER; /* Global, alas, so http_core can talk to us */ enum server_token_type ap_server_tokens = SrvTk_FULL; @@ -879,7 +882,8 @@ pthread_mutex_unlock(&thread_accept_mutex); break; } -if ((rv = ap_lock(process_accept_mutex)) != APR_SUCCESS) { +if ((rv = SAFE_ACCEPT(ap_lock(process_accept_mutex))) +!= APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf, "ap_lock failed. Attempting to shutdown " "process gracefully."); @@ -936,7 +940,8 @@ if ((rv = ap_accept(&csd, sd, ptrans)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, "ap_accept"); } -if ((rv = ap_unlock(process_accept_mutex)) != APR_SUCCESS) { +if ((rv = SAFE_ACCEPT(ap_unlock(process_accept_mutex))) +!= APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf, "ap_unlock failed. Attempting to shutdown " "process gracefully."); @@ -956,7 +961,8 @@ process_socket(ptrans, csd, conn_id); requests_this_child--; } else { -if ((rv = ap_unlock(process_accept_mutex)) != APR_SUCCESS) { +if ((rv = SAFE_ACCEPT(ap_unlock(process_accept_mutex))) +!= APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf, "ap_unlock failed. Attempting to shutdown " "process gracefully."); @@ -1001,7 +1007,8 @@ /*stuff to do before we switch id's, so we have permissions.*/ -rv = ap_child_init_lock(&process_accept_mutex, lock_fname, pchild); +rv = SAFE_ACCEPT(ap_child_init_lock(&process_accept_mutex, lock_fname, +pchild)); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf, "Couldn't initialize cross-process lock in child"); @@ -1335,8 +1342,8 @@ lock_fname = ap_psprintf(_pconf, "%s.%lu", ap_server_root_relative(_pconf, lock_fname), my_pid); -rv = ap_create_lock(&process_accept_mutex, APR_MUTEX, APR_CROSS_PROCESS, - lock_fname, _pconf); +rv = SAFE_ACCEPT(ap_create_lock(&process_accept_mutex, APR_MUTEX, +APR_CROSS_PROCESS, lock_fname, _pconf)); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "Couldn't create cross-process lock");
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c dexter.h
manoj 99/11/15 19:00:46 Modified:src/modules/mpm/dexter dexter.c dexter.h Log: ap_clean_child_exit is static in dexter now, and the ap_ prefix is gone. Revision ChangesPath 1.55 +5 -6 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -u -r1.54 -r1.55 --- dexter.c 1999/11/15 22:26:35 1.54 +++ dexter.c 1999/11/16 03:00:38 1.55 @@ -187,9 +187,8 @@ return (server_conf); } -/* a clean exit from a child with proper cleanup - static void ap_clean_child_exit(int code) __attribute__ ((noreturn)); */ -void ap_clean_child_exit(int code) +/* a clean exit from a child with proper cleanup */ +static void clean_child_exit(int code) { if (pchild) { ap_destroy_pool(pchild); @@ -463,7 +462,7 @@ static void just_die(int sig) { -ap_clean_child_exit(0); +clean_child_exit(0); } /* @@ -1012,11 +1011,11 @@ if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf, "Couldn't initialize cross-process lock in child"); -ap_clean_child_exit(APEXIT_CHILDFATAL); +clean_child_exit(APEXIT_CHILDFATAL); } if (unixd_setup_child()) { - ap_clean_child_exit(APEXIT_CHILDFATAL); + clean_child_exit(APEXIT_CHILDFATAL); } ap_child_init_hook(pchild, server_conf); 1.5 +0 -1 apache-2.0/src/modules/mpm/dexter/dexter.h Index: dexter.h === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -u -r1.4 -r1.5 --- dexter.h 1999/08/28 13:00:35 1.4 +++ dexter.h 1999/11/16 03:00:42 1.5 @@ -59,6 +59,5 @@ #define APACHE_MPM_DEXTER_H extern int max_daemons_limit; -extern void ap_clean_child_exit(int); #endif /* APACHE_MPM_DEXTER_H */
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c scoreboard.c scoreboard.h
manoj 99/10/13 13:14:58 Modified:src/modules/mpm/dexter dexter.c scoreboard.c scoreboard.h Log: Add a config directive to Dexter to not maintain any connection status, similarly to what ExtendedStatus did in 1.3. It's not perfect, since the server might still go through effort to derive status info only to have it not recorded, but it does go most of the way. Revision ChangesPath 1.44 +16 -1 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -u -r1.43 -r1.44 --- dexter.c 1999/10/13 05:24:14 1.43 +++ dexter.c 1999/10/13 20:14:51 1.44 @@ -1214,7 +1214,7 @@ child_slot = i; for (j = 0; j < HARD_THREAD_LIMIT; j++) { -ap_reset_connection_status(i * HARD_THREAD_LIMIT + j); +ap_dexter_force_reset_connection_status(i * HARD_THREAD_LIMIT + j); } break; } @@ -1448,6 +1448,7 @@ ap_pid_fname = DEFAULT_PIDLOG; ap_lock_fname = DEFAULT_LOCKFILE; max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; +ap_dexter_set_maintain_connection_status(1); ap_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); } @@ -1591,6 +1592,18 @@ return NULL; } +static const char *set_maintain_connection_status(cmd_parms *cmd, + core_dir_config *d, int arg) +{ +const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); +if (err != NULL) { +return err; +} + +ap_dexter_set_maintain_connection_status(arg != 0); +return NULL; +} + static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg) { struct stat finfo; @@ -1662,6 +1675,8 @@ "Maximum number of threads per child" }, { "MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF, TAKE1, "Maximum number of requests a particular child serves before dying." }, +{ "ConnectionStatus", set_maintain_connection_status, NULL, RSRC_CONF, FLAG, + "Whether or not to maintain status information on current connections"}, { "CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, TAKE1, "The location of the directory Apache changes to before dumping core" }, { NULL } 1.4 +24 -1 apache-2.0/src/modules/mpm/dexter/scoreboard.c Index: scoreboard.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/scoreboard.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -u -r1.3 -r1.4 --- scoreboard.c 1999/10/13 05:24:15 1.3 +++ scoreboard.c 1999/10/13 20:14:52 1.4 @@ -439,7 +439,16 @@ * Above code is shmem code. Below code is interacting with the shmem / -void ap_reset_connection_status(long conn_id) +static int maintain_connection_status = 1; + +void ap_dexter_set_maintain_connection_status(int flag) { +maintain_connection_status = flag; +return; +} + +/* Useful to erase the status of children that might be from previous + * generations */ +void ap_dexter_force_reset_connection_status(long conn_id) { int i; @@ -448,12 +457,20 @@ } } +void ap_reset_connection_status(long conn_id) +{ +if (maintain_connection_status) { +ap_dexter_force_reset_connection_status(conn_id); +} +} + /* Don't mess with the string you get back from this function */ const char *ap_get_connection_status(long conn_id, const char *key) { int i = 0; status_table_entry *ss; +if (!maintain_connection_status) return ""; while (i < STATUSES_PER_CONNECTION) { ss = &(ap_scoreboard_image->table[conn_id][i]); if (ss->key[0] == '\0') { @@ -477,6 +494,7 @@ int i = 0; status_table_entry *ss; +if (!maintain_connection_status) return; while (i < STATUSES_PER_CONNECTION) { ss = &(ap_scoreboard_image->table[conn_id][i]); if (ss->key[0] == '\0') { @@ -506,6 +524,11 @@ status_table_entry *ss; server_status = ap_make_array(p, 0, sizeof(ap_status_table_row_t)); + +/* Go ahead and return what's in the connection status table even if we + * aren't maintaining it. We can at least look at what children from + * previous generations are up to. */ + for (i = 0; i < max_daemons_limit*HARD_THREAD_LIMIT; i++) { if (ap_scoreboard_image->table[i][0].key[0] == '\0') continue; 1.4 +3 -0 apache-2.0/src/modules/mpm/dexter/scoreboard.h Index: scoreboard.h