Commit 7da7d0c7 authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Backport of PID table code from trunk to 2.2...

Create a branch for this until we test enough to
fold into 2.2


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/httpd-2.2-pid-table@546948 13f79535-47bb-0310-9956-ffa450edef68
parent a12fe7fa
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -350,6 +350,14 @@ extern const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy,
                                             const char *arg);
#endif

/*
 * The parent process pid table
 */
extern apr_table_t *ap_pid_table;
int ap_in_pid_table(pid_t pid);
void ap_set_pid_table(pid_t pid);
void ap_unset_pid_table(pid_t pid);

AP_DECLARE_HOOK(int,monitor,(apr_pool_t *p))

#ifdef __cplusplus
+1 −0
Original line number Diff line number Diff line
@@ -460,6 +460,7 @@ int main(int argc, const char * const argv[])
    ap_server_pre_read_config  = apr_array_make(pcommands, 1, sizeof(char *));
    ap_server_post_read_config = apr_array_make(pcommands, 1, sizeof(char *));
    ap_server_config_defines   = apr_array_make(pcommands, 1, sizeof(char *));
    ap_pid_table               = apr_table_make(pglobal, 1024);

    error = ap_setup_prelinked_modules(process);
    if (error) {
+4 −1
Original line number Diff line number Diff line
@@ -31,7 +31,10 @@

#define MPM_NAME "Beos"
#define MPM_CHILD_PID(i) (ap_scoreboard_image->servers[0][i].tid)
#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0)
#define MPM_NOTE_CHILD_KILLED(i) do {         \
        ap_unset_pid_table(MPM_CHILD_PID(i)); \
        MPM_CHILD_PID(i) = 0;                 \
    } while(0) 

#define AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
#define AP_MPM_WANT_WAIT_OR_TIMEOUT
+4 −1
Original line number Diff line number Diff line
@@ -1582,6 +1582,7 @@ static int make_child(server_rec * s, int slot)
    /* else */
    ap_scoreboard_image->parent[slot].quiescing = 0;
    ap_scoreboard_image->parent[slot].pid = pid;
    ap_set_pid_table(pid);
    return 0;
}

@@ -1999,6 +2000,7 @@ int ap_mpm_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s)
            active_children = 0;
            for (index = 0; index < ap_daemons_limit; ++index) {
                if (MPM_CHILD_PID(index) != 0) {
                    if (ap_in_pid_table(MPM_CHILD_PID(index))) {
                        if (kill(MPM_CHILD_PID(index), 0) == 0) {
                            active_children = 1;
                            /* Having just one child is enough to stay around */
@@ -2006,6 +2008,7 @@ int ap_mpm_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s)
                        }
                    }
                }
            }
        } while (!shutdown_pending && active_children &&
                 (!ap_graceful_shutdown_timeout || apr_time_now() < cutoff));

+4 −1
Original line number Diff line number Diff line
@@ -50,7 +50,10 @@
#define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK

#define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0)
#define MPM_NOTE_CHILD_KILLED(i) do {         \
        ap_unset_pid_table(MPM_CHILD_PID(i)); \
        MPM_CHILD_PID(i) = 0;                 \
    } while(0) 
#define MPM_ACCEPT_FUNC unixd_accept

extern int ap_threads_per_child;
Loading