summaryrefslogtreecommitdiffstats
path: root/server/mpm_unix.c
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2011-04-25 23:21:22 +0200
committerJeff Trawick <trawick@apache.org>2011-04-25 23:21:22 +0200
commit462c69e0b533aa86d9a64fbbf8a0f2059520b126 (patch)
tree3da1ce7ff3322d2d8e08292764d1b07313e0d3b0 /server/mpm_unix.c
parentmod_ldap: Make LDAPSharedCacheSize 0 create a non-shared-memory cache per (diff)
downloadapache2-462c69e0b533aa86d9a64fbbf8a0f2059520b126.tar.xz
apache2-462c69e0b533aa86d9a64fbbf8a0f2059520b126.zip
Add child_status hook for tracking creation/termination of MPM child
processes. Add end_generation hook for notification when the last MPM child of a generation exits. end_generation is implemented completely by core using the child_status hook run by the MPM. simple and mpmt_os2 MPMs don't currently run the child_status hook, so neither hook is invoked with those MPMs. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1096609 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/mpm_unix.c')
-rw-r--r--server/mpm_unix.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/server/mpm_unix.c b/server/mpm_unix.c
index 467070e598..eec5171958 100644
--- a/server/mpm_unix.c
+++ b/server/mpm_unix.c
@@ -65,20 +65,22 @@ typedef enum {DO_NOTHING, SEND_SIGTERM, SEND_SIGKILL, GIVEUP} action_t;
typedef struct extra_process_t {
struct extra_process_t *next;
pid_t pid;
+ ap_generation_t gen;
} extra_process_t;
static extra_process_t *extras;
-void ap_register_extra_mpm_process(pid_t pid)
+void ap_register_extra_mpm_process(pid_t pid, ap_generation_t gen)
{
extra_process_t *p = (extra_process_t *)malloc(sizeof(extra_process_t));
p->next = extras;
p->pid = pid;
+ p->gen = gen;
extras = p;
}
-int ap_unregister_extra_mpm_process(pid_t pid)
+int ap_unregister_extra_mpm_process(pid_t pid, ap_generation_t *gen)
{
extra_process_t *cur = extras;
extra_process_t *prev = NULL;
@@ -95,6 +97,7 @@ int ap_unregister_extra_mpm_process(pid_t pid)
else {
extras = cur->next;
}
+ *gen = cur->gen;
free(cur);
return 1; /* found */
}
@@ -231,7 +234,7 @@ void ap_reclaim_child_processes(int terminate,
}
if (reclaim_one_pid(pid, action_table[cur_action].action)) {
- mpm_callback(i);
+ mpm_callback(i, 0, 0);
}
else {
++not_dead_yet;
@@ -240,10 +243,12 @@ void ap_reclaim_child_processes(int terminate,
cur_extra = extras;
while (cur_extra) {
+ ap_generation_t old_gen;
extra_process_t *next = cur_extra->next;
if (reclaim_one_pid(cur_extra->pid, action_table[cur_action].action)) {
- AP_DEBUG_ASSERT(1 == ap_unregister_extra_mpm_process(cur_extra->pid));
+ AP_DEBUG_ASSERT(1 == ap_unregister_extra_mpm_process(cur_extra->pid, &old_gen));
+ mpm_callback(-1, cur_extra->pid, old_gen);
}
else {
++not_dead_yet;
@@ -276,16 +281,18 @@ void ap_relieve_child_processes(ap_reclaim_callback_fn_t *mpm_callback)
}
if (reclaim_one_pid(pid, DO_NOTHING)) {
- mpm_callback(i);
+ mpm_callback(i, 0, 0);
}
}
cur_extra = extras;
while (cur_extra) {
+ ap_generation_t old_gen;
extra_process_t *next = cur_extra->next;
if (reclaim_one_pid(cur_extra->pid, DO_NOTHING)) {
- AP_DEBUG_ASSERT(1 == ap_unregister_extra_mpm_process(cur_extra->pid));
+ AP_DEBUG_ASSERT(1 == ap_unregister_extra_mpm_process(cur_extra->pid, &old_gen));
+ mpm_callback(-1, cur_extra->pid, old_gen);
}
cur_extra = next;
}