mpm_common.c revision 8966f6c6e6ed032cd17d020140e0ac1329d382b6
97a9a944b5887e91042b019776c41d5dd74557aferikabele/* Licensed to the Apache Software Foundation (ASF) under one or more
97a9a944b5887e91042b019776c41d5dd74557aferikabele * contributor license agreements. See the NOTICE file distributed with
97a9a944b5887e91042b019776c41d5dd74557aferikabele * this work for additional information regarding copyright ownership.
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive * The ASF licenses this file to You under the Apache License, Version 2.0
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive * (the "License"); you may not use this file except in compliance with
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive * the License. You may obtain a copy of the License at
5a58787efeb02a1c3f06569d019ad81fd2efa06end * Unless required by applicable law or agreed to in writing, software
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * distributed under the License is distributed on an "AS IS" BASIS,
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * See the License for the specific language governing permissions and
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * limitations under the License.
5a58787efeb02a1c3f06569d019ad81fd2efa06end/* The purpose of this file is to store the code that MOST mpm's will need
d229f940abfb2490dee17979e9a5ff31b7012eb5rbowen * this does not mean a function only goes into this file if every MPM needs
3f08db06526d6901aa08c110b5bc7dde6bc39905nd * it. It means that if a function is needed by more than one MPM, and
5a58787efeb02a1c3f06569d019ad81fd2efa06end * future maintenance would be served by making the code common, then the
5a58787efeb02a1c3f06569d019ad81fd2efa06end * function belongs here.
3f08db06526d6901aa08c110b5bc7dde6bc39905nd * This is going in src/main because it is not platform specific, it is
5a58787efeb02a1c3f06569d019ad81fd2efa06end * specific to multi-process servers, but NOT to Unix. Which is why it
a63f0ab647ad2ab72efc9bea7a66e24e9ebc5cc2nd * does not belong in src/os/unix
117c1f888a14e73cdd821dc6c23eb0411144a41cnd/* we know core's module_index is 0 */
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawickAP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, mpm_register_timed_callback,
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawickAP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, mpm_register_socket_callback,
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick (apr_socket_t **s, apr_pool_t *p, int for_read, ap_mpm_callback_fn_t *cbfn, void *baton),
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawickAP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, mpm_unregister_socket_callback,
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick (server_rec *s, pid_t pid, ap_generation_t gen, int slot, mpm_child_status status),
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick/* hooks with no args are implemented last, after disabling APR hook probes */
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawick#define APR_HOOK_PROBE_COMPLETE(ud,ns,name,src,rv,args)
8a6d5edcb07aeccca7afba02a17dd6904d6b206ctrawickAP_IMPLEMENT_HOOK_RUN_FIRST(const char *, mpm_get_name,
92510838f2eb125726e15c5eb4f7a23c7a0396e4slivetypedef struct mpm_gen_info_t {
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic int done; /* gen finished? (whether or not active processes) */
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalicstatic struct mpm_gen_info_head_t *geninfo, *unused_geninfo;
f0fa55ff14fa0bf8fd72d989f6625de6dc3260c8igalic/* variables representing config directives implemented here */
9b6a3a558cc90ffdaa0b50bd02546ffec424ded7slive/* Set defaults for config directives implemented here. This is
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * called from core's pre-config hook, so MPMs which need to override
4a31db3c3a0202003c1b9f87affa7cc143e120e5sf * one of these should run their pre-config hook after that of core.
709e3a21ba73b8433462959cd56c773454b34441trawick apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd/* number of calls to wait_or_timeout between writable probes */
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedoohAP_DECLARE(void) ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode,
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) {
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh rv = apr_proc_wait_all_procs(ret, exitcode, status, APR_NOWAIT, p);
#if defined(TCP_NODELAY)
#ifdef HAVE_GETPWNAM
#ifdef HAVE_GETGRNAM
#ifndef HAVE_INITGROUPS
struct group *g;
int index = 0;
setgrent();
char **names;
endgrent();
const char *arg)
return err;
return NULL;
const char *arg)
return err;
return NULL;
const char *arg)
const char *fname;
return err;
if (!fname) {
return NULL;
void *dummy,
const char *arg)
return err;
return NULL;
const char *arg)
long value;
return err;
return NULL;
const char *arg)
long value;
return err;
return NULL;
return rv;
return APR_SUCCESS;
return APR_SUCCESS;
switch(status) {
case MPM_CHILD_STARTED:
case MPM_CHILD_EXITED:
case MPM_CHILD_LOST_SLOT:
AP_DECLARE(apr_status_t) ap_mpm_register_timed_callback(apr_time_t t, ap_mpm_callback_fn_t *cbfn, void *baton)
AP_DECLARE(apr_status_t) ap_mpm_register_socket_callback(apr_socket_t **s, apr_pool_t *p, int for_read, ap_mpm_callback_fn_t *cbfn, void *baton)
return ap_run_mpm_unregister_socket_callback(s, p);
if (!name) {
return name;
if (last_mpm_name) {
return NULL;