From: Jeff Trawick
Date: Mon, 6 Aug 2012 12:15:03 +0000 (+0000)
Subject: The Pidfile directive and ap_log_pid()/ap_remove_pid()/ap_read_pid()
X-Git-Tag: 2.5.0-alpha~6483
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6f86b92c214c73bfcd9a863f1506f523adce2cc;p=thirdparty%2Fapache%2Fhttpd.git
The Pidfile directive and ap_log_pid()/ap_remove_pid()/ap_read_pid()
now respect DefaultRuntimeDir
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1369808 13f79535-47bb-0310-9956-ffa450edef68
---
diff --git a/CHANGES b/CHANGES
index 16331d4606e..e9ebf17c76e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -17,10 +17,11 @@ Changes with Apache 2.5.0
*) mod_lua: Add new directive LuaCodeCache for controlling in-memory
caching of lua scripts. [Daniel Gruno]
- *) core: Respect DefaultRuntimeDir/DEFAULT_REL_RUNTIMEDIR for the
- scoreboard (ScoreBoardFile). mod_lbmethod_heartbeat, mod_heartmonitor:
- Respect DefaultRuntimeDir/DEFAULT_REL_RUNTIMEDIR for the heartbeat
- storage file. [Jeff Trawick]
+ *) The following now respect DefaultRuntimeDir/DEFAULT_REL_RUNTIMEDIR:
+ - APIs: ap_log_pid(), ap_remove_pid, ap_read_pid()
+ - core: the scoreboard (ScoreBoardFile) and pid file (PidFile)
+ - mod_lbmethod_heartbeat, mod_heartmonitor: heartbeat storage file
+ [Jeff Trawick]
*) mod_ssl: Add RFC 5878 support. [Ben Laurie]
diff --git a/docs/conf/extra/httpd-mpm.conf.in b/docs/conf/extra/httpd-mpm.conf.in
index c15c7e85da6..76d1554132e 100644
--- a/docs/conf/extra/httpd-mpm.conf.in
+++ b/docs/conf/extra/httpd-mpm.conf.in
@@ -9,7 +9,7 @@
# Note that this is the default PidFile for most MPMs.
#
- PidFile "@rel_runtimedir@/httpd.pid"
+ PidFile "httpd.pid"
#
diff --git a/docs/manual/mod/mpm_common.xml b/docs/manual/mod/mpm_common.xml
index 197754ee6c5..4d6ecb9f959 100644
--- a/docs/manual/mod/mpm_common.xml
+++ b/docs/manual/mod/mpm_common.xml
@@ -130,7 +130,7 @@ will exit.
File where the server records the process ID
of the daemon
PidFile filename
-PidFile logs/httpd.pid
+PidFile httpd.pid
server config
eventmpm_winnt
mpmt_os2preforkworker
@@ -140,7 +140,7 @@ of the daemon
The PidFile directive sets the file to
which the server records the process id of the daemon. If the
filename is not absolute then it is assumed to be relative to the
- ServerRoot.
+ DefaultRuntimeDir.
Example
diff --git a/include/ap_config.h b/include/ap_config.h
index ebb8cf7c83b..3bb667cdfd3 100644
--- a/include/ap_config.h
+++ b/include/ap_config.h
@@ -187,7 +187,7 @@
/* Where the main/parent process's pid is logged */
#ifndef DEFAULT_PIDLOG
-#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid"
+#define DEFAULT_PIDLOG "httpd.pid"
#endif
#if defined(NETWARE)
diff --git a/include/http_log.h b/include/http_log.h
index 77991fca7fc..7fc31a6f077 100644
--- a/include/http_log.h
+++ b/include/http_log.h
@@ -569,21 +569,24 @@ AP_DECLARE(void) ap_log_command_line(apr_pool_t *p, server_rec *s);
/**
* Log the current pid of the parent process
* @param p The pool to use for processing
- * @param fname The name of the file to log to
+ * @param fname The name of the file to log to. If the filename is not
+ * absolute then it is assumed to be relative to DefaultRuntimeDir.
*/
AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *fname);
/**
* Remove the pidfile.
* @param p The pool to use for processing
- * @param fname The name of the pid file to remove
+ * @param fname The name of the pid file to remove. If the filename is not
+ * absolute then it is assumed to be relative to DefaultRuntimeDir.
*/
AP_DECLARE(void) ap_remove_pid(apr_pool_t *p, const char *fname);
/**
* Retrieve the pid from a pidfile.
* @param p The pool to use for processing
- * @param filename The name of the file containing the pid
+ * @param filename The name of the file containing the pid. If the filename
+ * is not absolute then it is assumed to be relative to DefaultRuntimeDir.
* @param mypid Pointer to pid_t (valid only if return APR_SUCCESS)
*/
AP_DECLARE(apr_status_t) ap_read_pid(apr_pool_t *p, const char *filename, pid_t *mypid);
diff --git a/server/log.c b/server/log.c
index b33aa1fc1b9..1c9a59bb1e7 100644
--- a/server/log.c
+++ b/server/log.c
@@ -1394,7 +1394,7 @@ AP_DECLARE(void) ap_log_command_line(apr_pool_t *plog, server_rec *s)
AP_DECLARE(void) ap_remove_pid(apr_pool_t *p, const char *rel_fname)
{
apr_status_t rv;
- const char *fname = ap_server_root_relative(p, rel_fname);
+ const char *fname = ap_runtime_dir_relative(p, rel_fname);
if (fname != NULL) {
rv = apr_file_remove(fname, p);
@@ -1423,7 +1423,7 @@ AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *filename)
return;
}
- fname = ap_server_root_relative(p, filename);
+ fname = ap_runtime_dir_relative(p, filename);
if (!fname) {
ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT, APR_EBADPATH,
NULL, APLOGNO(00097) "Invalid PID file path %s, ignoring.", filename);
@@ -1476,7 +1476,7 @@ AP_DECLARE(apr_status_t) ap_read_pid(apr_pool_t *p, const char *filename,
return APR_EGENERAL;
}
- fname = ap_server_root_relative(p, filename);
+ fname = ap_runtime_dir_relative(p, filename);
if (!fname) {
ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT, APR_EBADPATH,
NULL, APLOGNO(00101) "Invalid PID file path %s, ignoring.", filename);
diff --git a/server/mpm_common.c b/server/mpm_common.c
index 4448ec60dcf..e33bd11c9eb 100644
--- a/server/mpm_common.c
+++ b/server/mpm_common.c
@@ -307,7 +307,7 @@ const char *ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy,
void ap_mpm_dump_pidfile(apr_pool_t *p, apr_file_t *out)
{
apr_file_printf(out, "PidFile: \"%s\"\n",
- ap_server_root_relative(p, ap_pid_fname));
+ ap_runtime_dir_relative(p, ap_pid_fname));
}
const char *ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy,