View | Details | Raw Unified | Return to bug 61558
Collapse All | Expand All

(-)os/unix/unixd.c (+35 lines)
Lines 582-588 AP_DECLARE(void) ap_unixd_mpm_set_signals(apr_pool Link Here
582
                              apr_pool_cleanup_null);
582
                              apr_pool_cleanup_null);
583
}
583
}
584
584
585
static int ap_unixd_mpm_query(int query_code, int *result, apr_status_t *rv)
586
{
587
    if (retained_data && retained_data->mpm_query_fn) {
588
        return retained_data->mpm_query_fn(query_code, result, rv);
589
    }
590
    else {
591
        return DECLINED;
592
    }
593
}
585
594
595
static apr_status_t ap_unixd_mpm_query_cleanup(void *fn)
596
{
597
    if (retained_data && retained_data->mpm_query_fn == fn) {
598
        retained_data->mpm_query_fn = NULL;
599
    }
600
    return APR_SUCCESS;
601
}
602
603
/* To cope with restarts (when the mpm_query function may have been unloaded
604
 * with the DSO), we register the hook once and keep/clear the current function
605
 * in retained_data->mpm_query_fn, according to the given pool's lifetime.
606
 */
607
AP_DECLARE(void) ap_unixd_hook_mpm_query(apr_pool_t *p,
608
                                         int (*fn)(int, int*, apr_status_t*))
609
{
610
    static int once = 0;
611
    if (!once) {
612
        once = 1;
613
        ap_hook_mpm_query(ap_unixd_mpm_query, NULL, NULL, APR_HOOK_MIDDLE);
614
    }
615
616
    ap_unixd_mpm_get_retained_data()->mpm_query_fn = fn;
617
    apr_pool_cleanup_register(p, fn, ap_unixd_mpm_query_cleanup,
618
                              apr_pool_cleanup_null);
619
}
620
586
#ifdef _OSD_POSIX
621
#ifdef _OSD_POSIX
587
622
588
#include "apr_lib.h"
623
#include "apr_lib.h"
(-)os/unix/unixd.h (+6 lines)
Lines 129-139 typedef struct { Link Here
129
     * eg. idle_spawn_rate).
129
     * eg. idle_spawn_rate).
130
     */
130
     */
131
    int num_buckets, max_buckets;
131
    int num_buckets, max_buckets;
132
133
    /* Hooked mpm_query function. */
134
    int (*mpm_query_fn)(int, int*, apr_status_t*);
132
} ap_unixd_mpm_retained_data;
135
} ap_unixd_mpm_retained_data;
133
136
134
AP_DECLARE(ap_unixd_mpm_retained_data *) ap_unixd_mpm_get_retained_data(void);
137
AP_DECLARE(ap_unixd_mpm_retained_data *) ap_unixd_mpm_get_retained_data(void);
135
AP_DECLARE(void) ap_unixd_mpm_set_signals(apr_pool_t *pconf, int once_process);
138
AP_DECLARE(void) ap_unixd_mpm_set_signals(apr_pool_t *pconf, int once_process);
136
139
140
AP_DECLARE(void) ap_unixd_hook_mpm_query(apr_pool_t *p,
141
                                         int (*fn)(int, int *, apr_status_t*));
142
137
#ifdef __cplusplus
143
#ifdef __cplusplus
138
}
144
}
139
#endif
145
#endif
(-)server/mpm/event/event.c (-1 / +1 lines)
Lines 3597-3603 static void event_hooks(apr_pool_t * p) Link Here
3597
    ap_hook_post_config(event_post_config, NULL, NULL, APR_HOOK_MIDDLE);
3597
    ap_hook_post_config(event_post_config, NULL, NULL, APR_HOOK_MIDDLE);
3598
    ap_hook_check_config(event_check_config, NULL, NULL, APR_HOOK_MIDDLE);
3598
    ap_hook_check_config(event_check_config, NULL, NULL, APR_HOOK_MIDDLE);
3599
    ap_hook_mpm(event_run, NULL, NULL, APR_HOOK_MIDDLE);
3599
    ap_hook_mpm(event_run, NULL, NULL, APR_HOOK_MIDDLE);
3600
    ap_hook_mpm_query(event_query, NULL, NULL, APR_HOOK_MIDDLE);
3600
    ap_unixd_hook_mpm_query(p, event_query);
3601
    ap_hook_mpm_register_timed_callback(event_register_timed_callback, NULL, NULL,
3601
    ap_hook_mpm_register_timed_callback(event_register_timed_callback, NULL, NULL,
3602
                                        APR_HOOK_MIDDLE);
3602
                                        APR_HOOK_MIDDLE);
3603
    ap_hook_pre_read_request(event_pre_read_request, NULL, NULL, APR_HOOK_MIDDLE);
3603
    ap_hook_pre_read_request(event_pre_read_request, NULL, NULL, APR_HOOK_MIDDLE);
(-)server/mpm/prefork/prefork.c (-1 / +1 lines)
Lines 1423-1429 static void prefork_hooks(apr_pool_t *p) Link Here
1423
    ap_hook_pre_config(prefork_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST);
1423
    ap_hook_pre_config(prefork_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST);
1424
    ap_hook_check_config(prefork_check_config, NULL, NULL, APR_HOOK_MIDDLE);
1424
    ap_hook_check_config(prefork_check_config, NULL, NULL, APR_HOOK_MIDDLE);
1425
    ap_hook_mpm(prefork_run, NULL, NULL, APR_HOOK_MIDDLE);
1425
    ap_hook_mpm(prefork_run, NULL, NULL, APR_HOOK_MIDDLE);
1426
    ap_hook_mpm_query(prefork_query, NULL, NULL, APR_HOOK_MIDDLE);
1426
    ap_unixd_hook_mpm_query(p, prefork_query);
1427
    ap_hook_mpm_get_name(prefork_get_name, NULL, NULL, APR_HOOK_MIDDLE);
1427
    ap_hook_mpm_get_name(prefork_get_name, NULL, NULL, APR_HOOK_MIDDLE);
1428
}
1428
}
1429
1429
(-)server/mpm/worker/worker.c (-1 / +1 lines)
Lines 2257-2263 static void worker_hooks(apr_pool_t *p) Link Here
2257
    ap_hook_pre_config(worker_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST);
2257
    ap_hook_pre_config(worker_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST);
2258
    ap_hook_check_config(worker_check_config, NULL, NULL, APR_HOOK_MIDDLE);
2258
    ap_hook_check_config(worker_check_config, NULL, NULL, APR_HOOK_MIDDLE);
2259
    ap_hook_mpm(worker_run, NULL, NULL, APR_HOOK_MIDDLE);
2259
    ap_hook_mpm(worker_run, NULL, NULL, APR_HOOK_MIDDLE);
2260
    ap_hook_mpm_query(worker_query, NULL, NULL, APR_HOOK_MIDDLE);
2260
    ap_unixd_hook_mpm_query(p, worker_query);
2261
    ap_hook_mpm_get_name(worker_get_name, NULL, NULL, APR_HOOK_MIDDLE);
2261
    ap_hook_mpm_get_name(worker_get_name, NULL, NULL, APR_HOOK_MIDDLE);
2262
}
2262
}
2263
2263

Return to bug 61558