fat Sat, 08 Oct 2011 14:04:09 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=317901
Log:
- Backported from 5.4 branch:
* enhanced log messages
* code cosmetic
Changed paths:
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_cleanup.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.h
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_env.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_events.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_log.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php_trace.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_shm.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_signals.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_sockets.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_status.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_stdio.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_mach.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_pread.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_ptrace.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_unix.c
U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_worker_pool.c
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fastcgi.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -29,9 +29,9 @@
#include <limits.h>
#include <php_config.h>
-#include <fpm/fpm.h>
-#include <fpm/fpm_request.h>
-#include <fpm/zlog.h>
+#include "fpm.h"
+#include "fpm_request.h"
+#include "zlog.h"
#ifdef _WIN32
@@ -268,7 +268,7 @@
}
allowed_clients[n] = inet_addr(cur);
if (allowed_clients[n] == INADDR_NONE) {
- fprintf(stderr, "Wrong IP address '%s' in FCGI_WEB_SERVER_ADDRS or listen.allowed_clients\n", cur);
+ zlog(ZLOG_ERROR, "Wrong IP address '%s' in listen.allowed_clients", cur);
}
n++;
cur = end;
@@ -816,7 +816,7 @@
n++;
}
if (!allowed) {
- fprintf(stderr, "Connection from disallowed IP address '%s' is dropped.\n", inet_ntoa(sa.sa_inet.sin_addr));
+ zlog(ZLOG_ERROR, "Connection disallowed: IP address '%s' has been dropped.", inet_ntoa(sa.sa_inet.sin_addr));
closesocket(req->fd);
req->fd = -1;
continue;
@@ -872,7 +872,7 @@
}
fcgi_close(req, 1, 0);
} else {
- fprintf(stderr, "Too many open file descriptors. FD_SETSIZE limit exceeded.");
+ zlog(ZLOG_ERROR, "Too many open file descriptors. FD_SETSIZE limit exceeded.");
fcgi_close(req, 1, 0);
}
#endif
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -65,11 +65,13 @@
if (fpm_globals.test_successful) {
exit(0);
} else {
+ zlog(ZLOG_ERROR, "FPM initialization failed");
return -1;
}
}
if (0 > fpm_conf_write_pid()) {
+ zlog(ZLOG_ERROR, "FPM initialization failed");
return -1;
}
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -147,13 +147,13 @@
{
fpm_globals.max_requests = wp->config->pm_max_requests;
- if (0 > fpm_stdio_init_child(wp) ||
- 0 > fpm_log_init_child(wp) ||
- 0 > fpm_status_init_child(wp) ||
- 0 > fpm_unix_init_child(wp) ||
- 0 > fpm_signals_init_child() ||
- 0 > fpm_env_init_child(wp) ||
- 0 > fpm_php_init_child(wp)) {
+ if (0 > fpm_stdio_init_child(wp) ||
+ 0 > fpm_log_init_child(wp) ||
+ 0 > fpm_status_init_child(wp) ||
+ 0 > fpm_unix_init_child(wp) ||
+ 0 > fpm_signals_init_child() ||
+ 0 > fpm_env_init_child(wp) ||
+ 0 > fpm_php_init_child(wp)) {
zlog(ZLOG_ERROR, "[pool %s] child failed to initialize", wp->config->name);
exit(255);
@@ -292,7 +292,7 @@
}
}
} else {
- zlog(ZLOG_ALERT, "oops, unknown child (%d) exited %s", pid, buf);
+ zlog(ZLOG_ALERT, "oops, unknown child (%d) exited %s. Please open a bug report (https://bugs.php.net).", pid, buf);
}
}
}
@@ -305,7 +305,7 @@
c = fpm_child_alloc();
if (!c) {
- zlog(ZLOG_ERROR, "[pool %s] malloc failed", wp->config->name);
+ zlog(ZLOG_ERROR, "[pool %s] unable to malloc new child", wp->config->name);
return 0;
}
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_cleanup.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_cleanup.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_cleanup.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -8,7 +8,6 @@
#include "fpm_arrays.h"
#include "fpm_cleanup.h"
-#include "zlog.h"
struct cleanup_s {
int type;
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -47,7 +47,6 @@
#define STR2STR(a) (a ? a : "undefined")
#define BOOL2STR(a) (a ? "yes" : "no")
-#define PM2STR(a) (a == PM_STYLE_STATIC ? "static" : "dynamic")
#define GO(field) offsetof(struct fpm_global_config_s, field)
#define WPO(field) offsetof(struct fpm_worker_pool_config_s, field)
@@ -680,7 +679,7 @@
struct fpm_worker_pool_s *wp;
if (!fpm_worker_all_pools) {
- zlog(ZLOG_ERROR, "at least one pool section must be specified in config file");
+ zlog(ZLOG_ERROR, "No pool defined. at least one pool section must be specified in config file");
return -1;
}
@@ -742,8 +741,7 @@
if (config->pm_min_spare_servers > config->pm_max_children ||
config->pm_max_spare_servers > config->pm_max_children) {
- zlog(ZLOG_ALERT, "[pool %s] pm.min_spare_servers(%d) and pm.max_spare_servers(%d) cannot be greater than pm.max_children(%d)",
- wp->config->name, config->pm_min_spare_servers, config->pm_max_spare_servers, config->pm_max_children);
+ zlog(ZLOG_ALERT, "[pool %s] pm.min_spare_servers(%d) and pm.max_spare_servers(%d) cannot be greater than pm.max_children(%d)", wp->config->name, config->pm_min_spare_servers, config->pm_max_spare_servers, config->pm_max_children);
return -1;
}
@@ -755,6 +753,7 @@
if (config->pm_start_servers <= 0) {
config->pm_start_servers = config->pm_min_spare_servers + ((config->pm_max_spare_servers - config->pm_min_spare_servers) / 2);
zlog(ZLOG_WARNING, "[pool %s] pm.start_servers is not set. It's been set to %d.", wp->config->name, config->pm_start_servers);
+
} else if (config->pm_start_servers < config->pm_min_spare_servers || config->pm_start_servers > config->pm_max_spare_servers) {
zlog(ZLOG_ALERT, "[pool %s] pm.start_servers(%d) must not be less than pm.min_spare_servers(%d) and not greater than pm.max_spare_servers(%d)", wp->config->name, config->pm_start_servers, config->pm_min_spare_servers, config->pm_max_spare_servers);
return -1;
@@ -766,7 +765,6 @@
if (wp->config->pm_status_path && *wp->config->pm_status_path) {
int i;
char *status = wp->config->pm_status_path;
- /* struct fpm_status_s fpm_status; */
if (*status != '/') {
zlog(ZLOG_ERROR, "[pool %s] the status path '%s' must start with a '/'", wp->config->name, status);
@@ -860,7 +858,7 @@
fd = open(wp->config->slowlog, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR);
if (0 > fd) {
- zlog(ZLOG_SYSERROR, "open(%s) failed", wp->config->slowlog);
+ zlog(ZLOG_SYSERROR, "Unable to create or open slowlog(%s)", wp->config->slowlog);
return -1;
}
close(fd);
@@ -876,6 +874,7 @@
zlog(ZLOG_ERROR, "[pool %s] the chroot path '%s' must start with a '/'", wp->config->name, wp->config->chroot);
return -1;
}
+
if (!fpm_conf_is_dir(wp->config->chroot)) {
zlog(ZLOG_ERROR, "[pool %s] the chroot path '%s' does not exist or is not a directory", wp->config->name, wp->config->chroot);
return -1;
@@ -993,7 +992,7 @@
{
if (fpm_global_config.pid_file) {
if (0 > unlink(fpm_global_config.pid_file)) {
- zlog(ZLOG_SYSERROR, "unlink(\"%s\") failed", fpm_global_config.pid_file);
+ zlog(ZLOG_SYSERROR, "Unable to remove the PID file (%s).", fpm_global_config.pid_file);
return -1;
}
}
@@ -1013,14 +1012,14 @@
fd = creat(fpm_global_config.pid_file, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (fd < 0) {
- zlog(ZLOG_SYSERROR, "creat(\"%s\") failed", fpm_global_config.pid_file);
+ zlog(ZLOG_SYSERROR, "Unable to create the PID file (%s).", fpm_global_config.pid_file);
return -1;
}
len = sprintf(buf, "%d", (int) fpm_globals.parent_pid);
if (len != write(fd, buf, len)) {
- zlog(ZLOG_SYSERROR, "write() failed");
+ zlog(ZLOG_SYSERROR, "Unable to write to the PID file.");
return -1;
}
close(fd);
@@ -1355,18 +1354,18 @@
int ret = 1;
if (!filename || !filename[0]) {
- zlog(ZLOG_ERROR, "Configuration file is empty");
+ zlog(ZLOG_ERROR, "configuration filename is empty");
return -1;
}
fd = open(filename, O_RDONLY, 0);
if (fd < 0) {
- zlog(ZLOG_ERROR, "Unable to open file '%s', errno=%d", filename, errno);
+ zlog(ZLOG_SYSERROR, "failed to open configuration file '%s'", filename);
return -1;
}
if (ini_recursion++ > 4) {
- zlog(ZLOG_ERROR, "You can include more than 5 files recusively");
+ zlog(ZLOG_ERROR, "failed to include more than 5 files recusively");
return -1;
}
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.h
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.h 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.h 2011-10-08 14:04:09 UTC (rev 317901)
@@ -8,6 +8,8 @@
#include <stdint.h>
#include "php.h"
+#define PM2STR(a) (a == PM_STYLE_STATIC ? "static" : "dynamic")
+
#define FPM_CONF_MAX_PONG_LENGTH 64
struct key_value_s;
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_env.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_env.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_env.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -13,7 +13,6 @@
#include "fpm_env.h"
#include "fpm.h"
-#include "zlog.h"
#ifndef HAVE_SETPROCTITLE
#ifdef __linux__
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_events.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_events.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_events.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -66,7 +66,7 @@
if (res <= 0) {
if (res < 0 && errno != EAGAIN && errno != EWOULDBLOCK) {
- zlog(ZLOG_SYSERROR, "read() failed");
+ zlog(ZLOG_SYSERROR, "unable to read from the signal pipe");
}
return;
}
@@ -153,7 +153,7 @@
}
if (!(elt = malloc(sizeof(struct fpm_event_queue_s)))) {
- zlog(ZLOG_SYSERROR, "malloc() failed");
+ zlog(ZLOG_SYSERROR, "Unable to add the event to queue: malloc() failed");
return -1;
}
elt->prev = NULL;
@@ -232,7 +232,7 @@
/* malloc the max number of necessary fds for polling */
fpm_event_ufds = malloc(sizeof(php_pollfd) * fpm_event_nfds_max);
if (!fpm_event_ufds) {
- zlog(ZLOG_SYSERROR, "malloc() failed");
+ zlog(ZLOG_SYSERROR, "Error while initializing events: malloc() failed");
return -1;
}
@@ -318,7 +318,7 @@
/* wait for inconming event or timeout */
if ((ret = php_poll2(fpm_event_ufds, i, timeout)) == -1) {
if (errno != EINTR) {
- zlog(ZLOG_WARNING, "php_poll2() returns %d", errno);
+ zlog(ZLOG_SYSERROR, "failed to wait for events: php_poll2()");
}
} else if (ret > 0) {
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_log.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_log.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_log.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -44,7 +44,7 @@
fd = open(wp->config->access_log, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR);
if (0 > fd) {
- zlog(ZLOG_SYSERROR, "open(\"%s\") failed", wp->config->access_log);
+ zlog(ZLOG_SYSERROR, "failed to open access log (%s)", wp->config->access_log);
return -1;
}
@@ -124,12 +124,12 @@
if (!test) {
scoreboard = fpm_scoreboard_get();
if (!scoreboard) {
- zlog(ZLOG_WARNING, "unable to get scoreboard");
+ zlog(ZLOG_WARNING, "unable to get scoreboard while preparing the access log");
return -1;
}
proc_p = fpm_scoreboard_proc_acquire(NULL, -1, 0);
if (!proc_p) {
- zlog(ZLOG_WARNING, "[pool %s] Unable to acquire shm slot", scoreboard->pool);
+ zlog(ZLOG_WARNING, "[pool %s] Unable to acquire shm slot while preparing the access log", scoreboard->pool);
return -1;
}
proc = *proc_p;
@@ -147,7 +147,7 @@
while (*s != '\0') {
if (len > FPM_LOG_BUFFER) {
- zlog(ZLOG_NOTICE, "the log buffer is full (%d). The log request has been truncated.", FPM_LOG_BUFFER);
+ zlog(ZLOG_NOTICE, "the log buffer is full (%d). The access log request has been truncated.", FPM_LOG_BUFFER);
len = FPM_LOG_BUFFER - 1;
break;
}
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -100,13 +100,13 @@
#include "fastcgi.h"
#include <php_config.h>
-#include <fpm/fpm.h>
-#include <fpm/fpm_request.h>
-#include <fpm/fpm_status.h>
-#include <fpm/fpm_conf.h>
-#include <fpm/fpm_php.h>
-#include <fpm/fpm_log.h>
-#include <fpm/zlog.h>
+#include "fpm.h"
+#include "fpm_request.h"
+#include "fpm_status.h"
+#include "fpm_conf.h"
+#include "fpm_php.h"
+#include "fpm_log.h"
+#include "zlog.h"
#ifndef PHP_WIN32
/* XXX this will need to change later when threaded fastcgi is implemented. shane */
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -253,7 +253,7 @@
}
- zlog(ZLOG_NOTICE, "Access to the file '%s' has been denied (see security.limit_extensions)", path);
+ zlog(ZLOG_NOTICE, "Access to the script '%s' has been denied (see security.limit_extensions)", path);
return 1; /* extension not found: not allowed */
}
/* }}} */
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php_trace.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php_trace.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_php_trace.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -144,7 +144,7 @@
slowlog = fopen(child->wp->config->slowlog, "a+");
if (!slowlog) {
- zlog(ZLOG_SYSERROR, "fopen(%s) failed", child->wp->config->slowlog);
+ zlog(ZLOG_SYSERROR, "unable to open slowlog (%s)", child->wp->config->slowlog);
goto done0;
}
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_process_ctl.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -99,7 +99,7 @@
fpm_cleanups_run(FPM_CLEANUP_PARENT_EXEC);
execvp(saved_argv[0], saved_argv);
- zlog(ZLOG_SYSERROR, "execvp() failed");
+ zlog(ZLOG_SYSERROR, "failed to reload: execvp() failed");
exit(1);
}
/* }}} */
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_request.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -45,7 +45,7 @@
proc = fpm_scoreboard_proc_acquire(NULL, -1, 0);
if (proc == NULL) {
- zlog(ZLOG_WARNING, "unable to acquire proc scoreboard");
+ zlog(ZLOG_WARNING, "failed to acquire proc scoreboard");
return;
}
@@ -76,7 +76,7 @@
proc = fpm_scoreboard_proc_acquire(NULL, -1, 0);
if (proc == NULL) {
- zlog(ZLOG_WARNING, "unable to acquire proc scoreboard");
+ zlog(ZLOG_WARNING, "failed to acquire proc scoreboard");
return;
}
@@ -116,7 +116,7 @@
proc = fpm_scoreboard_proc_acquire(NULL, -1, 0);
if (proc == NULL) {
- zlog(ZLOG_WARNING, "unable to acquire proc scoreboard");
+ zlog(ZLOG_WARNING, "failed to acquire proc scoreboard");
return;
}
@@ -160,7 +160,7 @@
proc = fpm_scoreboard_proc_acquire(NULL, -1, 0);
if (proc == NULL) {
- zlog(ZLOG_WARNING, "unable to acquire proc scoreboard");
+ zlog(ZLOG_WARNING, "failed to acquire proc scoreboard");
return;
}
@@ -186,7 +186,7 @@
proc = fpm_scoreboard_proc_acquire(NULL, -1, 0);
if (proc == NULL) {
- zlog(ZLOG_WARNING, "unable to acquire proc scoreboard");
+ zlog(ZLOG_WARNING, "failed to acquire proc scoreboard");
return;
}
proc->request_stage = FPM_REQUEST_FINISHED;
@@ -213,7 +213,7 @@
proc = fpm_scoreboard_proc_acquire(NULL, -1, 0);
if (proc == NULL) {
- zlog(ZLOG_WARNING, "unable to acquire proc scoreboard");
+ zlog(ZLOG_WARNING, "failed to acquire proc scoreboard");
return;
}
@@ -231,7 +231,7 @@
proc_p = fpm_scoreboard_proc_acquire(child->wp->scoreboard, child->scoreboard_i, 1);
if (!proc_p) {
- zlog(ZLOG_WARNING, "unable to acquire scoreboard");
+ zlog(ZLOG_WARNING, "failed to acquire scoreboard");
return;
}
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_shm.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_shm.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_shm.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -49,7 +49,7 @@
}
if (munmap(mem, size) == -1) {
- zlog(ZLOG_SYSERROR, "Unable to free shm: %s", strerror(errno));
+ zlog(ZLOG_SYSERROR, "Unable to free shm");
return 0;
}
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_signals.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_signals.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_signals.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -182,17 +182,17 @@
struct sigaction act;
if (0 > socketpair(AF_UNIX, SOCK_STREAM, 0, sp)) {
- zlog(ZLOG_SYSERROR, "socketpair() failed");
+ zlog(ZLOG_SYSERROR, "failed to init signals: socketpair()");
return -1;
}
if (0 > fd_set_blocked(sp[0], 0) || 0 > fd_set_blocked(sp[1], 0)) {
- zlog(ZLOG_SYSERROR, "fd_set_blocked() failed");
+ zlog(ZLOG_SYSERROR, "failed to init signals: fd_set_blocked()");
return -1;
}
if (0 > fcntl(sp[0], F_SETFD, FD_CLOEXEC) || 0 > fcntl(sp[1], F_SETFD, FD_CLOEXEC)) {
- zlog(ZLOG_SYSERROR, "fcntl(F_SETFD, FD_CLOEXEC) failed");
+ zlog(ZLOG_SYSERROR, "falied to init signals: fcntl(F_SETFD, FD_CLOEXEC)");
return -1;
}
@@ -207,7 +207,7 @@
0 > sigaction(SIGCHLD, &act, 0) ||
0 > sigaction(SIGQUIT, &act, 0)) {
- zlog(ZLOG_SYSERROR, "sigaction() failed");
+ zlog(ZLOG_SYSERROR, "failed to init signals: sigaction()");
return -1;
}
return 0;
@@ -236,7 +236,7 @@
0 > sigaction(SIGCHLD, &act_dfl, 0) ||
0 > sigaction(SIGQUIT, &act, 0)) {
- zlog(ZLOG_SYSERROR, "sigaction() failed");
+ zlog(ZLOG_SYSERROR, "failed to init child signals: sigaction()");
return -1;
}
return 0;
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_sockets.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_sockets.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_sockets.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -172,7 +172,7 @@
sock = socket(sa->sa_family, SOCK_STREAM, 0);
if (0 > sock) {
- zlog(ZLOG_SYSERROR, "socket() failed");
+ zlog(ZLOG_SYSERROR, "failed to create new listening socket: socket()");
return -1;
}
@@ -184,7 +184,7 @@
}
if (0 > bind(sock, sa, socklen)) {
- zlog(ZLOG_SYSERROR, "bind() for address '%s' failed", wp->config->listen_address);
+ zlog(ZLOG_SYSERROR, "unable to bind listening socket for address '%s'", wp->config->listen_address);
if (wp->listen_address_domain == FPM_AF_UNIX) {
umask(saved_umask);
}
@@ -198,14 +198,14 @@
if (wp->socket_uid != -1 || wp->socket_gid != -1) {
if (0 > chown(path, wp->socket_uid, wp->socket_gid)) {
- zlog(ZLOG_SYSERROR, "chown() for address '%s' failed", wp->config->listen_address);
+ zlog(ZLOG_SYSERROR, "failed to chown() the socket '%s'", wp->config->listen_address);
return -1;
}
}
}
if (0 > listen(sock, wp->config->listen_backlog)) {
- zlog(ZLOG_SYSERROR, "listen() for address '%s' failed", wp->config->listen_address);
+ zlog(ZLOG_SYSERROR, "failed to listen to address '%s'", wp->config->listen_address);
return -1;
}
@@ -392,7 +392,7 @@
socklen_t len = sizeof(info);
if (0 > getsockopt(sock, IPPROTO_TCP, TCP_INFO, &info, &len)) {
- zlog(ZLOG_SYSERROR, "unable to retrieve TCP_INFO for socket");
+ zlog(ZLOG_SYSERROR, "failed to retrieve TCP_INFO for socket");
return -1;
}
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_status.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_status.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_status.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -13,6 +13,7 @@
#include "fpm_scoreboard.h"
#include "zlog.h"
#include "fpm_atomic.h"
+#include "fpm_conf.h"
#include <ext/standard/html.h>
static char *fpm_status_uri = NULL;
@@ -33,7 +34,7 @@
if (wp->config->ping_path) {
if (!wp->config->ping_response) {
- zlog(ZLOG_ERROR, "[pool %s] ping is set (%s) but pong is not set.", wp->config->name, wp->config->ping_path);
+ zlog(ZLOG_ERROR, "[pool %s] ping is set (%s) but ping.response is not set.", wp->config->name, wp->config->ping_path);
return -1;
}
fpm_status_ping_uri = strdup(wp->config->ping_path);
@@ -352,7 +353,7 @@
now_epoch = time(NULL);
spprintf(&buffer, 0, short_syntax,
scoreboard.pool,
- scoreboard.pm == PM_STYLE_STATIC ? "static" : "dynamic",
+ PM2STR(scoreboard.pm),
time_buffer,
now_epoch - scoreboard.start_epoch,
scoreboard.requests,
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_stdio.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_stdio.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_stdio.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -28,12 +28,12 @@
int fd = open("/dev/null", O_RDWR);
if (0 > fd) {
- zlog(ZLOG_SYSERROR, "open(\"/dev/null\") failed");
+ zlog(ZLOG_SYSERROR, "failed to init stdio: open(\"/dev/null\")");
return -1;
}
if (0 > dup2(fd, STDIN_FILENO) || 0 > dup2(fd, STDOUT_FILENO)) {
- zlog(ZLOG_SYSERROR, "dup2() failed");
+ zlog(ZLOG_SYSERROR, "failed to init stdio: dup2()");
return -1;
}
close(fd);
@@ -49,7 +49,7 @@
/* there might be messages to stderr from other parts of the code, we need to log them all */
if (0 > dup2(fpm_globals.error_log_fd, STDERR_FILENO)) {
- zlog(ZLOG_SYSERROR, "dup2() failed");
+ zlog(ZLOG_SYSERROR, "failed to init stdio: dup2()");
return -1;
}
}
@@ -74,7 +74,7 @@
if (wp->listening_socket != STDIN_FILENO) {
if (0 > dup2(wp->listening_socket, STDIN_FILENO)) {
- zlog(ZLOG_SYSERROR, "dup2() failed");
+ zlog(ZLOG_SYSERROR, "failed to init child stdio: dup2()");
return -1;
}
}
@@ -116,7 +116,7 @@
} else { /* error or pipe is closed */
if (res < 0) { /* error */
- zlog(ZLOG_SYSERROR, "read() failed");
+ zlog(ZLOG_SYSERROR, "unable to read what child say");
}
fpm_event_del(event);
@@ -186,20 +186,23 @@
}
if (0 > pipe(fd_stdout)) {
- zlog(ZLOG_SYSERROR, "pipe() failed");
+ zlog(ZLOG_SYSERROR, "failed to prepare the stdout pipe");
return -1;
}
if (0 > pipe(fd_stderr)) {
- zlog(ZLOG_SYSERROR, "pipe() failed");
- close(fd_stdout[0]); close(fd_stdout[1]);
+ zlog(ZLOG_SYSERROR, "failed to prepare the stderr pipe");
+ close(fd_stdout[0]);
+ close(fd_stdout[1]);
return -1;
}
if (0 > fd_set_blocked(fd_stdout[0], 0) || 0 > fd_set_blocked(fd_stderr[0], 0)) {
- zlog(ZLOG_SYSERROR, "fd_set_blocked() failed");
- close(fd_stdout[0]); close(fd_stdout[1]);
- close(fd_stderr[0]); close(fd_stderr[1]);
+ zlog(ZLOG_SYSERROR, "failed to unblock pipes");
+ close(fd_stdout[0]);
+ close(fd_stdout[1]);
+ close(fd_stderr[0]);
+ close(fd_stderr[1]);
return -1;
}
return 0;
@@ -273,7 +276,7 @@
fd = open(fpm_global_config.error_log, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR);
if (0 > fd) {
- zlog(ZLOG_SYSERROR, "open(\"%s\") failed", fpm_global_config.error_log);
+ zlog(ZLOG_SYSERROR, "failed to open error_log (%s)", fpm_global_config.error_log);
return -1;
}
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_mach.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_mach.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_mach.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -37,7 +37,7 @@
kr = mach_vm_read(target, page, fpm_pagesize, &local_page, &local_size);
if (kr != KERN_SUCCESS) {
- zlog(ZLOG_ERROR, "mach_vm_read() failed: %s (%d)", mach_error_string(kr), kr);
+ zlog(ZLOG_ERROR, "failed to read vm page: mach_vm_read(): %s (%d)", mach_error_string(kr), kr);
return -1;
}
return 0;
@@ -47,7 +47,7 @@
int fpm_trace_signal(pid_t pid) /* {{{ */
{
if (0 > fpm_pctl_kill(pid, FPM_PCTL_STOP)) {
- zlog(ZLOG_SYSERROR, "kill(SIGSTOP) failed");
+ zlog(ZLOG_SYSERROR, "failed to send SIGSTOP to %d", pid);
return -1;
}
return 0;
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_pread.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_pread.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_pread.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -26,7 +26,7 @@
int fpm_trace_signal(pid_t pid) /* {{{ */
{
if (0 > fpm_pctl_kill(pid, FPM_PCTL_STOP)) {
- zlog(ZLOG_SYSERROR, "kill(SIGSTOP) failed");
+ zlog(ZLOG_SYSERROR, "failed to send SIGSTOP to %d", pid);
return -1;
}
return 0;
@@ -40,7 +40,7 @@
sprintf(buf, "/proc/%d/" PROC_MEM_FILE, (int) pid);
mem_file = open(buf, O_RDONLY);
if (0 > mem_file) {
- zlog(ZLOG_SYSERROR, "open(%s) failed", buf);
+ zlog(ZLOG_SYSERROR, "failed to open %s", buf);
return -1;
}
return 0;
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_ptrace.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_ptrace.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_trace_ptrace.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -29,7 +29,7 @@
int fpm_trace_signal(pid_t pid) /* {{{ */
{
if (0 > ptrace(PTRACE_ATTACH, pid, 0, 0)) {
- zlog(ZLOG_SYSERROR, "ptrace(ATTACH) failed");
+ zlog(ZLOG_SYSERROR, "failed to ptrace(ATTACH) child %d", pid);
return -1;
}
return 0;
@@ -46,7 +46,7 @@
int fpm_trace_close(pid_t pid) /* {{{ */
{
if (0 > ptrace(PTRACE_DETACH, pid, (void *) 1, 0)) {
- zlog(ZLOG_SYSERROR, "ptrace(DETACH) failed");
+ zlog(ZLOG_SYSERROR, "failed to ptrace(DETACH) child %d", pid);
return -1;
}
traced_pid = 0;
@@ -65,14 +65,14 @@
};
if (0 > ptrace(PT_IO, traced_pid, (void *) &ptio, 0)) {
- zlog(ZLOG_SYSERROR, "ptrace(PT_IO) failed");
+ zlog(ZLOG_SYSERROR, "failed to ptrace(PT_IO) pid %d", traced_pid);
return -1;
}
#else
errno = 0;
*data = ptrace(PTRACE_PEEKDATA, traced_pid, (void *) addr, 0);
if (errno) {
- zlog(ZLOG_SYSERROR, "ptrace(PEEKDATA) failed");
+ zlog(ZLOG_SYSERROR, "failed to ptrace(PEEKDATA) pid %d", traced_pid);
return -1;
}
#endif
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_unix.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_unix.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_unix.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -73,6 +73,7 @@
static int fpm_unix_conf_wp(struct fpm_worker_pool_s *wp) /* {{{ */
{
+ struct passwd *pwd;
int is_root = !geteuid();
if (is_root) {
@@ -119,23 +120,20 @@
#endif
} else { /* not root */
if (wp->config->user && *wp->config->user) {
- zlog(ZLOG_WARNING, "[pool %s] 'user' directive is ignored", wp->config->name);
+ zlog(ZLOG_WARNING, "[pool %s] 'user' directive is ignored when FPM is not running as root", wp->config->name);
}
if (wp->config->group && *wp->config->group) {
- zlog(ZLOG_WARNING, "[pool %s] 'group' directive is ignored", wp->config->name);
+ zlog(ZLOG_WARNING, "[pool %s] 'group' directive is ignored when FPM is not running as root", wp->config->name);
}
if (wp->config->chroot && *wp->config->chroot) {
- zlog(ZLOG_WARNING, "[pool %s] 'chroot' directive is ignored", wp->config->name);
+ zlog(ZLOG_WARNING, "[pool %s] 'chroot' directive is ignored when FPM is not running as root", wp->config->name);
}
- { /* set up HOME and USER anyway */
- struct passwd *pwd;
-
- pwd = getpwuid(getuid());
- if (pwd) {
- wp->user = strdup(pwd->pw_name);
- wp->home = strdup(pwd->pw_dir);
- }
+ /* set up HOME and USER anyway */
+ pwd = getpwuid(getuid());
+ if (pwd) {
+ wp->user = strdup(pwd->pw_name);
+ wp->home = strdup(pwd->pw_dir);
}
}
return 0;
@@ -153,7 +151,7 @@
r.rlim_max = r.rlim_cur = (rlim_t) wp->config->rlimit_files;
if (0 > setrlimit(RLIMIT_NOFILE, &r)) {
- zlog(ZLOG_SYSERROR, "[pool %s] unable to set rlimit_files for this pool. Please check your system limits or decrease rlimit_files. setrlimit(RLIMIT_NOFILE, %d) failed (%d)", wp->config->name, wp->config->rlimit_files, errno);
+ zlog(ZLOG_SYSERROR, "[pool %s] failed to set rlimit_files for this pool. Please check your system limits or decrease rlimit_files. setrlimit(RLIMIT_NOFILE, %d)", wp->config->name, wp->config->rlimit_files);
}
}
@@ -163,13 +161,13 @@
r.rlim_max = r.rlim_cur = wp->config->rlimit_core == -1 ? (rlim_t) RLIM_INFINITY : (rlim_t) wp->config->rlimit_core;
if (0 > setrlimit(RLIMIT_CORE, &r)) {
- zlog(ZLOG_SYSERROR, "[pool %s] unable to set rlimit_core for this pool. Please check your system limits or decrease rlimit_core. setrlimit(RLIMIT_CORE, %d) failed (%d)", wp->config->name, wp->config->rlimit_core, errno);
+ zlog(ZLOG_SYSERROR, "[pool %s] failed to set rlimit_core for this pool. Please check your system limits or decrease rlimit_core. setrlimit(RLIMIT_CORE, %d)", wp->config->name, wp->config->rlimit_core);
}
}
if (is_root && wp->config->chroot && *wp->config->chroot) {
if (0 > chroot(wp->config->chroot)) {
- zlog(ZLOG_SYSERROR, "[pool %s] chroot(%s) failed", wp->config->name, wp->config->chroot);
+ zlog(ZLOG_SYSERROR, "[pool %s] failed to chroot(%s)", wp->config->name, wp->config->chroot);
return -1;
}
made_chroot = 1;
@@ -177,7 +175,7 @@
if (wp->config->chdir && *wp->config->chdir) {
if (0 > chdir(wp->config->chdir)) {
- zlog(ZLOG_SYSERROR, "[pool %s] chdir(%s) failed", wp->config->name, wp->config->chdir);
+ zlog(ZLOG_SYSERROR, "[pool %s] failed to chdir(%s)", wp->config->name, wp->config->chdir);
return -1;
}
} else if (made_chroot) {
@@ -187,17 +185,17 @@
if (is_root) {
if (wp->set_gid) {
if (0 > setgid(wp->set_gid)) {
- zlog(ZLOG_SYSERROR, "[pool %s] setgid(%d) failed", wp->config->name, wp->set_gid);
+ zlog(ZLOG_SYSERROR, "[pool %s] failed to setgid(%d)", wp->config->name, wp->set_gid);
return -1;
}
}
if (wp->set_uid) {
if (0 > initgroups(wp->config->user, wp->set_gid)) {
- zlog(ZLOG_SYSERROR, "[pool %s] initgroups(%s, %d) failed", wp->config->name, wp->config->user, wp->set_gid);
+ zlog(ZLOG_SYSERROR, "[pool %s] failed to initgroups(%s, %d)", wp->config->name, wp->config->user, wp->set_gid);
return -1;
}
if (0 > setuid(wp->set_uid)) {
- zlog(ZLOG_SYSERROR, "[pool %s] setuid(%d) failed", wp->config->name, wp->set_uid);
+ zlog(ZLOG_SYSERROR, "[pool %s] failed to setuid(%d)", wp->config->name, wp->set_uid);
return -1;
}
}
@@ -205,7 +203,7 @@
#ifdef HAVE_PRCTL
if (0 > prctl(PR_SET_DUMPABLE, 1, 0, 0, 0)) {
- zlog(ZLOG_SYSERROR, "[pool %s] prctl(PR_SET_DUMPABLE) failed", wp->config->name);
+ zlog(ZLOG_SYSERROR, "[pool %s] failed to prctl(PR_SET_DUMPABLE)", wp->config->name);
}
#endif
@@ -226,7 +224,7 @@
r.rlim_max = r.rlim_cur = (rlim_t) fpm_global_config.rlimit_files;
if (0 > setrlimit(RLIMIT_NOFILE, &r)) {
- zlog(ZLOG_SYSERROR, "unable to set rlimit_core for this pool. Please check your system limits or decrease rlimit_files. setrlimit(RLIMIT_NOFILE, %d) failed (%d)", fpm_global_config.rlimit_files, errno);
+ zlog(ZLOG_SYSERROR, "failed to set rlimit_core for this pool. Please check your system limits or decrease rlimit_files. setrlimit(RLIMIT_NOFILE, %d)", fpm_global_config.rlimit_files);
return -1;
}
}
@@ -237,7 +235,7 @@
r.rlim_max = r.rlim_cur = fpm_global_config.rlimit_core == -1 ? (rlim_t) RLIM_INFINITY : (rlim_t) fpm_global_config.rlimit_core;
if (0 > setrlimit(RLIMIT_CORE, &r)) {
- zlog(ZLOG_SYSERROR, "unable to set rlimit_core for this pool. Please check your system limits or decrease rlimit_core. setrlimit(RLIMIT_CORE, %d) failed (%d)", fpm_global_config.rlimit_core, errno);
+ zlog(ZLOG_SYSERROR, "failed to set rlimit_core for this pool. Please check your system limits or decrease rlimit_core. setrlimit(RLIMIT_CORE, %d)", fpm_global_config.rlimit_core);
return -1;
}
}
@@ -246,7 +244,7 @@
if (fpm_global_config.daemonize) {
switch (fork()) {
case -1 :
- zlog(ZLOG_SYSERROR, "daemonized fork() failed");
+ zlog(ZLOG_SYSERROR, "failed to daemonize");
return -1;
case 0 :
break;
Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_worker_pool.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_worker_pool.c 2011-10-08 14:00:07 UTC (rev 317900)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_worker_pool.c 2011-10-08 14:04:09 UTC (rev 317901)
@@ -15,7 +15,6 @@
#include "fpm_shm.h"
#include "fpm_scoreboard.h"
#include "fpm_conf.h"
-#include "zlog.h"
struct fpm_worker_pool_s *fpm_worker_all_pools;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php