Commit e2bd3d5a authored by Jeff Trawick's avatar Jeff Trawick
Browse files

Add "-k start|startssl|restart|graceful|stop" support to httpd

for the Unix MPMs.  These have semantics very similar to the
old apachectl commands of the same name.

The use of stderr/stdout and exit status for error conditions
needs to be revisited.  For now it matches apachectl behavior.

Justin Erenkrantz got the ball rolling with this feature.  Some
of his support code was used unchanged.  Other code was shuffled
around and modified or rewritten.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95237 13f79535-47bb-0310-9956-ffa450edef68
parent 5bbdfed2
Loading
Loading
Loading
Loading
+5 −0
Changes for CHANGES: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
Changes with Apache 2.0.37
  *) Add "-k start|startssl|restart|graceful|stop" support to httpd
     for the Unix MPMs.  These have semantics very similar to the
     old apachectl commands of the same name.
     [Justin Erenkrantz, Jeff Trawick]
  *) Make sure that the runtime dir is created by make install.
     PR 9233.  [Jeff Trawick]
+4 −0
Changes for include/http_main.h: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -59,6 +59,8 @@
#ifndef APACHE_HTTP_MAIN_H
#define APACHE_HTTP_MAIN_H

#include "apr_optional.h"

/* AP_SERVER_BASEARGS is the command argument list parsed by http_main.c
 * in apr_getopt() format.  Use this for default'ing args that the MPM
 * can safely ignore and pass on from its rewrite_args() handler.
@@ -89,6 +91,8 @@ AP_DECLARE_DATA extern apr_array_header_t *ap_server_post_read_config;
 *  effect the server based on command line options */
AP_DECLARE_DATA extern apr_array_header_t *ap_server_config_defines;

APR_DECLARE_OPTIONAL_FN(int, ap_signal_server, (int *, apr_pool_t *));

#ifdef __cplusplus
}
#endif
+5 −0
Changes for include/mpm_common.h: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -280,6 +280,11 @@ const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
                                   const char *arg);
#endif

#ifdef AP_MPM_WANT_SIGNAL_SERVER
int ap_signal_server(int *, apr_pool_t *);
void ap_mpm_rewrite_args(process_rec *);
#endif

#ifdef __cplusplus
}
#endif
+16 −1
Changes for server/main.c: 16 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@
#include "apr_uri.h"
#include "util_ebcdic.h"
#include "ap_mpm.h"
#include "mpm_common.h"

/* WARNING: Win32 binds http_main.c dynamically to the server. Please place
 *          extern functions and global data in another appropriate module.
@@ -309,7 +310,11 @@ static void usage(process_rec *process)
                 "       %s [-k install|config|uninstall] [-n service_name]",
                 pad);
#endif

#ifdef AP_MPM_WANT_SIGNAL_SERVER
    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                 "       %s [-k start|startssl|restart|graceful|stop]",
                 pad);
#endif
    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                 "       %s [-v] [-V] [-h] [-l] [-L] [-t] [-T]", pad);
    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
@@ -404,6 +409,7 @@ int main(int argc, const char * const argv[])
    apr_status_t rv;
    module **mod;
    const char *optarg;
    APR_OPTIONAL_FN_TYPE(ap_signal_server) *signal_server;

    AP_MONCONTROL(0); /* turn off profiling of startup */

@@ -565,6 +571,15 @@ int main(int argc, const char * const argv[])
        destroy_and_exit_process(process, 0);
    }

    signal_server = APR_RETRIEVE_OPTIONAL_FN(ap_signal_server);
    if (signal_server) {
        int exit_status;

        if (signal_server(&exit_status, pconf) != 0) {
            destroy_and_exit_process(process, exit_status);
        }
    }

    apr_pool_clear(plog);

    /* It is assumed that if you are going to fail the open_logs phase, then
+1 −0
Changes for server/mpm/prefork/mpm.h: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@
#define AP_MPM_WANT_SET_MAX_REQUESTS
#define AP_MPM_WANT_SET_COREDUMPDIR
#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
#define AP_MPM_WANT_SIGNAL_SERVER
#define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK

#define AP_MPM_USES_POD 1
Loading