mode to not "daemonize" while detaching from the controlling terminal.
This is necessary for Apache to work with process-management tools like
AIX's "System Resource Controller" as well as Dan Bernstein's "daemontools".
What this means is apache must _NOT_ be a process group leader if called
with the -DNO_DETACH flag.
Submitted from: Jos Backus <josb@cncdsl.com>
Edited/Reviewed by: Aaron Bannert
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93535
13f79535-47bb-0310-9956-
ffa450edef68
if (restart_num++ == 1) {
is_graceful = 0;
- if (!one_process && !no_detach) {
- rv = apr_proc_detach();
+ if (!one_process) {
+ rv = apr_proc_detach(no_detach ? APR_PROC_DETACH_FOREGROUND
+ : APR_PROC_DETACH_DAEMONIZE);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
"apr_proc_detach failed");
if (restart_num++ == 1) {
is_graceful = 0;
- if (!one_process && !no_detach) {
- rv = apr_proc_detach();
+ if (!one_process) {
+ rv = apr_proc_detach(no_detach ? APR_PROC_DETACH_FOREGROUND
+ : APR_PROC_DETACH_DAEMONIZE);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
"apr_proc_detach failed");
if (restart_num++ == 1) {
is_graceful = 0;
- if (!one_process && !no_detach) {
- rv = apr_proc_detach();
+ if (!one_process) {
+ rv = apr_proc_detach(no_detach ? APR_PROC_DETACH_FOREGROUND
+ : APR_PROC_DETACH_DAEMONIZE);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
"apr_proc_detach failed");
if (restart_num++ == 1) {
is_graceful = 0;
- if (!one_process && !no_detach) {
- rv = apr_proc_detach();
+ if (!one_process) {
+ rv = apr_proc_detach(no_detach ? APR_PROC_DETACH_FOREGROUND
+ : APR_PROC_DETACH_DAEMONIZE);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
"apr_proc_detach failed");
}
}
else if (!max_clients
- && strncasecmp(pdir->directive, "MaxClients", 10) == 0) {
+ && strncasecmp(pdir->directive, "MaxClients", 10) == 0) {
max_clients = pdir;
}
}
debug = ap_exists_config_define("DEBUG");
- if (debug)
+ if (debug) {
no_detach = one_process = 1;
- else
- {
+ }
+ else {
one_process = ap_exists_config_define("ONE_PROCESS");
no_detach = ap_exists_config_define("NO_DETACH");
}
if (restart_num++ == 1) {
is_graceful = 0;
- if (!one_process && !no_detach) {
- rv = apr_proc_detach();
+ if (!one_process) {
+ rv = apr_proc_detach(no_detach ? APR_PROC_DETACH_FOREGROUND
+ : APR_PROC_DETACH_DAEMONIZE);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
"apr_proc_detach failed");