a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe/* Licensed to the Apache Software Foundation (ASF) under one or more
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * contributor license agreements. See the NOTICE file distributed with
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * this work for additional information regarding copyright ownership.
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * The ASF licenses this file to You under the Apache License, Version 2.0
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * (the "License"); you may not use this file except in compliance with
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * the License. You may obtain a copy of the License at
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * Unless required by applicable law or agreed to in writing, software
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * distributed under the License is distributed on an "AS IS" BASIS,
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * See the License for the specific language governing permissions and
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * limitations under the License.
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe/* The purpose of this file is to store the code that MOST mpm's will need
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * this does not mean a function only goes into this file if every MPM needs
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * it. It means that if a function is needed by more than one MPM, and
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * future maintenance would be served by making the code common, then the
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * function belongs here.
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * This is going in src/main because it is not platform specific, it is
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * specific to multi-process servers, but NOT to Unix. Which is why it
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * does not belong in src/os/unix
7184de27ec1d62a83c41cdeac0953ca9fd661e8csf/* we know core's module_index is 0 */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowetypedef enum {DO_NOTHING, SEND_SIGTERM, SEND_SIGKILL, GIVEUP} action_t;
2ba1586475aa4ec972ca7c19b06d53bf76f0ee7efuankgAP_DECLARE(void) ap_register_extra_mpm_process(pid_t pid, ap_generation_t gen)
3a59bb90be3bc6246632384c3d885b875ae507d5sf extra_process_t *p = (extra_process_t *)ap_malloc(sizeof(extra_process_t));
2ba1586475aa4ec972ca7c19b06d53bf76f0ee7efuankgAP_DECLARE(int) ap_unregister_extra_mpm_process(pid_t pid, ap_generation_t *old_gen)
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* we don't know about any such process */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* Ensure pid sanity. */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe waitret = apr_proc_wait(&proc, &status, &why, APR_NOWAIT);
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* ok, now it's being annoying */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe " still did not exit, "
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe "sending a SIGTERM",
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe " still did not exit, "
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe "sending a SIGKILL",
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* gave it our best shot, but alas... If this really
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * is a child we are trying to kill and it really hasn't
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * exited, we will likely fail to bind to the port
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * after the restart.
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe "attempting to continue anyway",
2ba1586475aa4ec972ca7c19b06d53bf76f0ee7efuankgAP_DECLARE(void) ap_reclaim_child_processes(int terminate,
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* this table of actions and elapsed times tells what action is taken
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * at which elapsed time from starting the reclaim
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe {DO_NOTHING, 0}, /* dummy entry for iterations where we reap
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * children but take no action against
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * stragglers
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe int cur_action; /* index of action we decided to take this
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * iteration
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* don't let waittime get longer than 1 second; otherwise, we don't
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * react quickly to the last child exiting, and taking action can
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * be delayed
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* see what action to take, if any */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe if (action_table[next_action].action_time <= apr_time_now() - starttime) {
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* now see who is done */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe for (i = 0; i < max_daemons; ++i) {
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe if (pid == 0) {
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe continue; /* not every scoreboard entry is in use */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe if (reclaim_one_pid(pid, action_table[cur_action].action)) {
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe if (reclaim_one_pid(cur_extra->pid, action_table[cur_action].action)) {
03ef97f46428f440af87766e2bdf98080fbfd4fatrawick if (ap_unregister_extra_mpm_process(cur_extra->pid, &old_gen) == 1) {
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe apr_proc_other_child_refresh_all(APR_OC_REASON_RESTART);
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe } while (not_dead_yet > 0 &&
2ba1586475aa4ec972ca7c19b06d53bf76f0ee7efuankgAP_DECLARE(void) ap_relieve_child_processes(ap_reclaim_callback_fn_t *mpm_callback)
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* now see who is done */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe for (i = 0; i < max_daemons; ++i) {
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe if (pid == 0) {
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe continue; /* not every scoreboard entry is in use */
03ef97f46428f440af87766e2bdf98080fbfd4fatrawick if (ap_unregister_extra_mpm_process(cur_extra->pid, &old_gen) == 1) {
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe/* Before sending the signal to the pid this function verifies that
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * the pid is a member of the current process group; either using
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * apr_proc_wait(), where waitpid() guarantees to fail for non-child
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * processes; or by using getpgid() directly, if available. */
2ba1586475aa4ec972ca7c19b06d53bf76f0ee7efuankgAP_DECLARE(apr_status_t) ap_mpm_safe_kill(pid_t pid, int sig)
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* Ensure pid sanity */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* The child already died - log the termination status if
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * necessary: */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* The child is already dead and reaped, or was a bogus pid -
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * log this either way. */
185aa71728867671e105178b4c66fbc22b65ae26sf ap_log_error(APLOG_MARK, APLOG_NOTICE, rv, ap_server_conf, APLOGNO(00048)
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe "cannot send signal %d to pid %ld (non-child or "
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* Ensure pid sanity. */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* Process already dead... */
185aa71728867671e105178b4c66fbc22b65ae26sf ap_log_error(APLOG_MARK, APLOG_ALERT, 0, ap_server_conf, APLOGNO(00049)
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe "refusing to send signal %d to pid %ld outside "
2ba1586475aa4ec972ca7c19b06d53bf76f0ee7efuankgAP_DECLARE(int) ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why,
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* Child died... if it died due to a fatal error,
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * we should simply bail out. The caller needs to
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * check for bad rc from us and exit, running any
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * appropriate cleanups.
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * If the child died due to a resource shortage,
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * the parent should limit the rate of forking
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe " returned a Fatal error... Apache is exiting!",
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe "child pid %ld exit signal %s (%d), "
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe "possible coredump in %s",
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe "child pid %ld exit signal %s (%d)",
a1a4e55fb7678118a8334019c18509c248b0c0b3wroweAP_DECLARE(apr_status_t) ap_mpm_pod_open(apr_pool_t *p, ap_pod_t **pod)
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe rv = apr_file_pipe_create_ex(&((*pod)->pod_in), &((*pod)->pod_out),
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe (*pod)->p = p;
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* close these before exec. */
a1a4e55fb7678118a8334019c18509c248b0c0b3wroweAP_DECLARE(apr_status_t) ap_mpm_pod_check(ap_pod_t *pod)
a1a4e55fb7678118a8334019c18509c248b0c0b3wroweAP_DECLARE(apr_status_t) ap_mpm_pod_close(ap_pod_t *pod)
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe rv = apr_file_write(pod->pod_out, &char_of_death, &one);
185aa71728867671e105178b4c66fbc22b65ae26sf ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, APLOGNO(00053)
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe "write pipe_of_death");
7cc77074d12e6ed11433da96af0df1e1a27e9b3djimAP_DECLARE(apr_status_t) ap_mpm_podx_open(apr_pool_t *p, ap_pod_t **pod)
7cc77074d12e6ed11433da96af0df1e1a27e9b3djim rv = apr_file_pipe_create(&((*pod)->pod_in), &((*pod)->pod_out), p);
7cc77074d12e6ed11433da96af0df1e1a27e9b3djim apr_file_pipe_timeout_set((*pod)->pod_in, 0);
7cc77074d12e6ed11433da96af0df1e1a27e9b3djim (*pod)->p = p;
7cc77074d12e6ed11433da96af0df1e1a27e9b3djim /* close these before exec. */
7cc77074d12e6ed11433da96af0df1e1a27e9b3djim /* we need to surface EINTR so we'll have to grab the
7cc77074d12e6ed11433da96af0df1e1a27e9b3djim * native file descriptor and do the OS read() ourselves
7cc77074d12e6ed11433da96af0df1e1a27e9b3djim switch (c) {
7cc77074d12e6ed11433da96af0df1e1a27e9b3djimAP_DECLARE(apr_status_t) ap_mpm_podx_close(ap_pod_t *pod)
7cc77074d12e6ed11433da96af0df1e1a27e9b3djim rv = apr_file_write(pod->pod_out, &char_of_death, &one);
dc09fa76d6e9783a9d7fd4eddc1f1dfedbaa743cjim ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, APLOGNO(02404)
7cc77074d12e6ed11433da96af0df1e1a27e9b3djim "write pipe_of_death");
7cc77074d12e6ed11433da96af0df1e1a27e9b3djimAP_DECLARE(apr_status_t) ap_mpm_podx_signal(ap_pod_t * pod,
7cc77074d12e6ed11433da96af0df1e1a27e9b3djimAP_DECLARE(void) ap_mpm_podx_killpg(ap_pod_t * pod, int num,
799ddc9f13bdcb23a662be8ec8276d44edd8b532jorton/* This function connects to the server and sends enough data to
799ddc9f13bdcb23a662be8ec8276d44edd8b532jorton * ensure the child wakes up and processes a new connection. This
799ddc9f13bdcb23a662be8ec8276d44edd8b532jorton * permits the MPM to skip the poll when there is only one listening
799ddc9f13bdcb23a662be8ec8276d44edd8b532jorton * socket, because it provides a alternate way to unblock an accept()
799ddc9f13bdcb23a662be8ec8276d44edd8b532jorton * when the pod is used. */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* create a temporary pool for the socket. pconf stays around too long */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* If possible, find a listener which is configured for
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * plain-HTTP, not SSL; using an SSL port would either be
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * expensive to do correctly (performing a complete SSL handshake)
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * or cause log spam by doing incorrectly (simply sending EOF). */
a742cbb3e85669473b3233f30e3978bb6a20083cylavic while (lp && lp->protocol && strcasecmp(lp->protocol, "http") != 0) {
a742cbb3e85669473b3233f30e3978bb6a20083cylavic rv = apr_socket_create(&sock, lp->bind_addr->family, SOCK_STREAM, 0, p);
a742cbb3e85669473b3233f30e3978bb6a20083cylavic ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, APLOGNO(00054)
a742cbb3e85669473b3233f30e3978bb6a20083cylavic "get socket to connect to listener");
a742cbb3e85669473b3233f30e3978bb6a20083cylavic /* on some platforms (e.g., FreeBSD), the kernel won't accept many
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * queued connections before it starts blocking local connects...
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * we need to keep from blocking too long and instead return an error,
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * because the MPM won't want to hold up a graceful restart for a
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * long time
a742cbb3e85669473b3233f30e3978bb6a20083cylavic rv = apr_socket_timeout_set(sock, apr_time_from_sec(3));
a742cbb3e85669473b3233f30e3978bb6a20083cylavic ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf, APLOGNO(00055)
a742cbb3e85669473b3233f30e3978bb6a20083cylavic "set timeout on socket to connect to listener");
a742cbb3e85669473b3233f30e3978bb6a20083cylavic /* probably some server processes bailed out already and there
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * is nobody around to call accept and clear out the kernel
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * connection queue; usually this is not worth logging
a742cbb3e85669473b3233f30e3978bb6a20083cylavic ap_log_error(APLOG_MARK, log_level, rv, ap_server_conf, APLOGNO(00056)
a742cbb3e85669473b3233f30e3978bb6a20083cylavic if (lp->protocol && strcasecmp(lp->protocol, "https") == 0) {
a742cbb3e85669473b3233f30e3978bb6a20083cylavic /* Send a TLS 1.0 close_notify alert. This is perhaps the
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * "least wrong" way to open and cleanly terminate an SSL
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * connection. It should "work" without noisy error logs if
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * the server actually expects SSLv3/TLSv1. With
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * SSLv23_server_method() OpenSSL's SSL_accept() fails
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * ungracefully on receipt of this message, since it requires
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * an 11-byte ClientHello message and this is too short. */
a742cbb3e85669473b3233f30e3978bb6a20083cylavic else /* ... XXX other request types here? */ {
a742cbb3e85669473b3233f30e3978bb6a20083cylavic /* Create an HTTP request string. We include a User-Agent so
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * that adminstrators can track down the cause of the
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * odd-looking requests in their logs. A complete request is
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * used since kernel-level filtering may require that much
a742cbb3e85669473b3233f30e3978bb6a20083cylavic * data before returning from accept(). */
a742cbb3e85669473b3233f30e3978bb6a20083cylavic data = apr_pstrcat(p, "OPTIONS * HTTP/1.0\r\nUser-Agent: ",
a1a4e55fb7678118a8334019c18509c248b0c0b3wroweAP_DECLARE(apr_status_t) ap_mpm_pod_signal(ap_pod_t *pod)
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* we don't write anything to the pod here... we assume
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * that the would-be reader of the pod has another way to
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * see that it is time to die once we wake it up
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * writing lots of things to the pod at once is very
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * problematic... we can fill the kernel pipe buffer and
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * be blocked until somebody consumes some bytes or
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * we hit a timeout... if we hit a timeout we can't just
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * keep trying because maybe we'll never successfully
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * write again... but then maybe we'll leave would-be
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * readers stranded (a number of them could be tied up for
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * a while serving time-consuming requests)
7f6bfe455bd605a6401d2fcc9423972a24266b16jim /* Recall: we only worry about IDLE child processes here */
7f6bfe455bd605a6401d2fcc9423972a24266b16jim if (ap_scoreboard_image->servers[i][0].status != SERVER_READY ||
185aa71728867671e105178b4c66fbc22b65ae26sf ap_log_error(APLOG_MARK, APLOG_STARTUP, errno, NULL, APLOGNO(00057)
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe "sending signal to server");
a1a4e55fb7678118a8334019c18509c248b0c0b3wroweint ap_signal_server(int *exit_status, apr_pool_t *pconf)
185aa71728867671e105178b4c66fbc22b65ae26sf ap_log_error(APLOG_MARK, APLOG_STARTUP, rv, NULL, APLOGNO(00058)
185aa71728867671e105178b4c66fbc22b65ae26sf ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, APLOGNO(00059)
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe "Remove it before continuing if it is corrupted.");
b761a57b4e63006c287823270876ab40d3212160covener if (!strcmp(dash_k_arg, "start") || dash_k_arg == dash_k_arg_noarg) {
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe *exit_status = send_signal(otherpid, AP_SIG_GRACEFUL);
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe *exit_status = send_signal(otherpid, AP_SIG_GRACEFUL_STOP);
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe mpm_new_argv = apr_array_make(process->pool, process->argc,
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe sizeof(const char **));
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe *(const char **)apr_array_push(mpm_new_argv) = process->argv[0];
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe apr_getopt_init(&opt, process->pool, process->argc, process->argv);
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* option char returned by apr_getopt() will be stored in optbuf[1] */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe if (!strcmp(optarg, "start") || !strcmp(optarg, "stop") ||
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe !strcmp(optarg, "restart") || !strcmp(optarg, "graceful") ||
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe *(const char **)apr_array_push(mpm_new_argv) = optarg;
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* back up to capture the bad argument */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe process->argv = (const char * const *)mpm_new_argv->elts;
a1a4e55fb7678118a8334019c18509c248b0c0b3wroweconst char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy,
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe const char *arg)
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe return "EnableExceptionHook directive not allowed in <VirtualHost>";
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe return "parameter must be 'on' or 'off'";
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe#endif /* AP_ENABLE_EXCEPTION_HOOK */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe/* handle all varieties of core dumping signals */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* linuxthreads issue calling getpid() here:
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * This comparison won't match if the crashing thread is
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * some module's thread that runs in the parent process.
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * The fallout, which is limited to linuxthreads:
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * The special log message won't be written when such a
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * thread in the parent causes the parent to crash.
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe "seg fault or similar nasty error detected "
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe "in the parent process");
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* XXX we can probably add some rudimentary cleanup code here,
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * like getting rid of the pid file. If any additional bad stuff
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * happens, we are protected from recursive errors taking down the
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * system since this function is no longer the signal handler GLA
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe /* At this point we've got sig blocked, because we're still inside
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * the signal handler. When we leave the signal handler it will
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * be unblocked, and we'll take the signal... and coredump or whatever
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * is appropriate for this particular Unix. In addition the parent
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * will see the real signal we received -- whereas if we called
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe * abort() here, the parent would only see SIGABRT.
2ba1586475aa4ec972ca7c19b06d53bf76f0ee7efuankgAP_DECLARE(apr_status_t) ap_fatal_signal_child_setup(server_rec *s)
2ba1586475aa4ec972ca7c19b06d53bf76f0ee7efuankgAP_DECLARE(apr_status_t) ap_fatal_signal_setup(server_rec *s,
185aa71728867671e105178b4c66fbc22b65ae26sf ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, APLOGNO(00061) "sigaction(SIGSEGV)");
185aa71728867671e105178b4c66fbc22b65ae26sf ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, APLOGNO(00062) "sigaction(SIGBUS)");
185aa71728867671e105178b4c66fbc22b65ae26sf ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, APLOGNO(00063) "sigaction(SIGABORT)");
185aa71728867671e105178b4c66fbc22b65ae26sf ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, APLOGNO(00064) "sigaction(SIGABRT)");
185aa71728867671e105178b4c66fbc22b65ae26sf ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, APLOGNO(00065) "sigaction(SIGILL)");
185aa71728867671e105178b4c66fbc22b65ae26sf ap_log_error(APLOG_MARK, APLOG_WARNING, errno, s, APLOGNO(00066) "sigaction(SIGFPE)");
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe#else /* NO_USE_SIGACTION */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe#endif /* SIGBUS */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe#endif /* SIGABORT */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe#endif /* SIGABRT */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe#endif /* SIGILL */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe#endif /* SIGFPE */
a1a4e55fb7678118a8334019c18509c248b0c0b3wrowe#endif /* NO_USE_SIGACTION */
31eeb74b832eea054c7a42081c1afdeccd987e5etrawick#endif /* WIN32 */