- get rid of ZLOG_STUFF code redundancy

This commit is contained in:
Jérôme Loyet 2010-11-11 21:38:18 +00:00
parent 8dd82c5fde
commit 7bc07ff884
19 changed files with 159 additions and 159 deletions

View File

@ -47,7 +47,7 @@ int fpm_init(int argc, char **argv, char *config, struct event_base **base) /* {
return -1;
}
zlog(ZLOG_STUFF, ZLOG_NOTICE, "fpm is running, pid %d", (int) fpm_globals.parent_pid);
zlog(ZLOG_NOTICE, "fpm is running, pid %d", (int) fpm_globals.parent_pid);
return 0;
}

View File

@ -152,7 +152,7 @@ static void fpm_child_init(struct fpm_worker_pool_s *wp) /* {{{ */
0 > fpm_env_init_child(wp) ||
0 > fpm_php_init_child(wp)) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] child failed to initialize", wp->config->name);
zlog(ZLOG_ERROR, "[pool %s] child failed to initialize", wp->config->name);
exit(255);
}
}
@ -221,7 +221,7 @@ void fpm_children_bury(struct event_base *base) /* {{{ */
}
} else if (WIFSTOPPED(status)) {
zlog(ZLOG_STUFF, ZLOG_NOTICE, "child %d stopped for tracing", (int) pid);
zlog(ZLOG_NOTICE, "child %d stopped for tracing", (int) pid);
if (child && child->tracer) {
child->tracer(child);
@ -246,9 +246,9 @@ void fpm_children_bury(struct event_base *base) /* {{{ */
if (!fpm_pctl_can_spawn_children()) {
severity = ZLOG_DEBUG;
}
zlog(ZLOG_STUFF, severity, "[pool %s] child %d exited %s after %ld.%06d seconds from start", child->wp->config->name, (int) pid, buf, tv2.tv_sec, (int) tv2.tv_usec);
zlog(severity, "[pool %s] child %d exited %s after %ld.%06d seconds from start", child->wp->config->name, (int) pid, buf, tv2.tv_sec, (int) tv2.tv_usec);
} else {
zlog(ZLOG_STUFF, ZLOG_DEBUG, "[pool %s] child %d has been killed by the process managment after %ld.%06d seconds from start", child->wp->config->name, (int) pid, tv2.tv_sec, (int) tv2.tv_usec);
zlog(ZLOG_DEBUG, "[pool %s] child %d has been killed by the process managment after %ld.%06d seconds from start", child->wp->config->name, (int) pid, tv2.tv_sec, (int) tv2.tv_usec);
}
fpm_child_close(child, 1 /* in event_loop */);
@ -275,7 +275,7 @@ void fpm_children_bury(struct event_base *base) /* {{{ */
if (restart_condition) {
zlog(ZLOG_STUFF, ZLOG_WARNING, "failed processes threshold (%d in %d sec) is reached, initiating reload", fpm_global_config.emergency_restart_threshold, fpm_global_config.emergency_restart_interval);
zlog(ZLOG_WARNING, "failed processes threshold (%d in %d sec) is reached, initiating reload", fpm_global_config.emergency_restart_threshold, fpm_global_config.emergency_restart_interval);
fpm_pctl(FPM_PCTL_STATE_RELOADING, FPM_PCTL_ACTION_SET, base);
}
@ -289,7 +289,7 @@ void fpm_children_bury(struct event_base *base) /* {{{ */
}
}
} else {
zlog(ZLOG_STUFF, ZLOG_ALERT, "oops, unknown child exited %s", buf);
zlog(ZLOG_ALERT, "oops, unknown child exited %s", buf);
}
}
}
@ -302,7 +302,7 @@ static struct fpm_child_s *fpm_resources_prepare(struct fpm_worker_pool_s *wp) /
c = fpm_child_alloc();
if (!c) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] malloc failed", wp->config->name);
zlog(ZLOG_ERROR, "[pool %s] malloc failed", wp->config->name);
return 0;
}
@ -388,7 +388,7 @@ int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop, int nb_to
return 0;
case -1 :
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "fork() failed");
zlog(ZLOG_SYSERROR, "fork() failed");
enough = 1;
fpm_resources_discard(child);
@ -400,7 +400,7 @@ int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop, int nb_to
fpm_clock_get(&child->started);
fpm_parent_resources_use(child, base);
zlog(ZLOG_STUFF, is_debug ? ZLOG_DEBUG : ZLOG_NOTICE, "[pool %s] child %d started", wp->config->name, (int) pid);
zlog(is_debug ? ZLOG_DEBUG : ZLOG_NOTICE, "[pool %s] child %d started", wp->config->name, (int) pid);
}
}

View File

@ -37,7 +37,7 @@ int fpm_clock_get(struct timeval *tv) /* {{{ */
struct timespec ts;
if (0 > clock_gettime(CLOCK_MONOTONIC, &ts)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "clock_gettime() failed");
zlog(ZLOG_SYSERROR, "clock_gettime() failed");
return -1;
}
@ -69,7 +69,7 @@ int fpm_clock_init() /* {{{ */
ret = host_get_clock_service(mach_host_self(), REALTIME_CLOCK, &mach_clock);
if (ret != KERN_SUCCESS) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "host_get_clock_service() failed: %s", mach_error_string(ret));
zlog(ZLOG_ERROR, "host_get_clock_service() failed: %s", mach_error_string(ret));
return -1;
}
@ -77,7 +77,7 @@ int fpm_clock_init() /* {{{ */
ret = clock_get_time(mach_clock, &aTime);
if (ret != KERN_SUCCESS) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "clock_get_time() failed: %s", mach_error_string(ret));
zlog(ZLOG_ERROR, "clock_get_time() failed: %s", mach_error_string(ret));
return -1;
}
@ -93,7 +93,7 @@ int fpm_clock_get(struct timeval *tv) /* {{{ */
ret = clock_get_time(mach_clock, &aTime);
if (ret != KERN_SUCCESS) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "clock_get_time() failed: %s", mach_error_string(ret));
zlog(ZLOG_ERROR, "clock_get_time() failed: %s", mach_error_string(ret));
return -1;
}

View File

@ -411,7 +411,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
struct fpm_worker_pool_s *wp;
if (!fpm_worker_all_pools) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "at least one pool section must be specified in config file");
zlog(ZLOG_ERROR, "at least one pool section must be specified in config file");
return -1;
}
@ -424,22 +424,22 @@ static int fpm_conf_process_all_pools() /* {{{ */
fpm_evaluate_full_path(&wp->config->listen_address);
}
} else {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] no listen address have been defined!", wp->config->name);
zlog(ZLOG_ALERT, "[pool %s] no listen address have been defined!", wp->config->name);
return -1;
}
if (!wp->config->user) {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] user has not been defined", wp->config->name);
zlog(ZLOG_ALERT, "[pool %s] user has not been defined", wp->config->name);
return -1;
}
if (wp->config->pm != PM_STYLE_STATIC && wp->config->pm != PM_STYLE_DYNAMIC) {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] the process manager is missing (static or dynamic)", wp->config->name);
zlog(ZLOG_ALERT, "[pool %s] the process manager is missing (static or dynamic)", wp->config->name);
return -1;
}
if (wp->config->pm_max_children < 1) {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] pm.max_children must be a positive value", wp->config->name);
zlog(ZLOG_ALERT, "[pool %s] pm.max_children must be a positive value", wp->config->name);
return -1;
}
@ -447,32 +447,32 @@ static int fpm_conf_process_all_pools() /* {{{ */
struct fpm_worker_pool_config_s *config = wp->config;
if (config->pm_min_spare_servers <= 0) {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] pm.min_spare_servers(%d) must be a positive value", wp->config->name, config->pm_min_spare_servers);
zlog(ZLOG_ALERT, "[pool %s] pm.min_spare_servers(%d) must be a positive value", wp->config->name, config->pm_min_spare_servers);
return -1;
}
if (config->pm_max_spare_servers <= 0) {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] pm.max_spare_servers(%d) must be a positive value", wp->config->name, config->pm_max_spare_servers);
zlog(ZLOG_ALERT, "[pool %s] pm.max_spare_servers(%d) must be a positive value", wp->config->name, config->pm_max_spare_servers);
return -1;
}
if (config->pm_min_spare_servers > config->pm_max_children ||
config->pm_max_spare_servers > config->pm_max_children) {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] pm.min_spare_servers(%d) and pm.max_spare_servers(%d) cannot be greater than pm.max_children(%d)",
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;
}
if (config->pm_max_spare_servers < config->pm_min_spare_servers) {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] pm.max_spare_servers(%d) must not be less than pm.min_spare_servers(%d)", wp->config->name, config->pm_max_spare_servers, config->pm_min_spare_servers);
zlog(ZLOG_ALERT, "[pool %s] pm.max_spare_servers(%d) must not be less than pm.min_spare_servers(%d)", wp->config->name, config->pm_max_spare_servers, config->pm_min_spare_servers);
return -1;
}
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_STUFF, ZLOG_WARNING, "[pool %s] pm.start_servers is not set. It's been set to %d.", wp->config->name, config->pm_start_servers);
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_STUFF, 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);
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;
}
@ -482,14 +482,14 @@ static int fpm_conf_process_all_pools() /* {{{ */
if (wp->config->request_slowlog_timeout) {
#if HAVE_FPM_TRACE
if (! (wp->config->slowlog && *wp->config->slowlog)) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] 'slowlog' must be specified for use with 'request_slowlog_timeout'", wp->config->name);
zlog(ZLOG_ERROR, "[pool %s] 'slowlog' must be specified for use with 'request_slowlog_timeout'", wp->config->name);
return -1;
}
#else
static int warned = 0;
if (!warned) {
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] 'request_slowlog_timeout' is not supported on your system", wp->config->name);
zlog(ZLOG_WARNING, "[pool %s] 'request_slowlog_timeout' is not supported on your system", wp->config->name);
warned = 1;
}
@ -506,7 +506,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
fd = open(wp->config->slowlog, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR);
if (0 > fd) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "open(%s) failed", wp->config->slowlog);
zlog(ZLOG_SYSERROR, "open(%s) failed", wp->config->slowlog);
return -1;
}
close(fd);
@ -518,18 +518,18 @@ static int fpm_conf_process_all_pools() /* {{{ */
int i;
if (*ping != '/') {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping path '%s' must start with a '/'", wp->config->name, ping);
zlog(ZLOG_ERROR, "[pool %s] the ping path '%s' must start with a '/'", wp->config->name, ping);
return -1;
}
if (strlen(ping) < 2) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping path '%s' is not long enough", wp->config->name, ping);
zlog(ZLOG_ERROR, "[pool %s] the ping path '%s' is not long enough", wp->config->name, ping);
return -1;
}
for (i=0; i<strlen(ping); i++) {
if (!isalnum(ping[i]) && ping[i] != '/' && ping[i] != '-' && ping[i] != '_' && ping[i] != '.') {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping path '%s' must containt only the following characters '[alphanum]/_-.'", wp->config->name, ping);
zlog(ZLOG_ERROR, "[pool %s] the ping path '%s' must containt only the following characters '[alphanum]/_-.'", wp->config->name, ping);
return -1;
}
}
@ -538,7 +538,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
wp->config->ping_response = strdup("pong");
} else {
if (strlen(wp->config->ping_response) < 1) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping response page '%s' is not long enough", wp->config->name, wp->config->ping_response);
zlog(ZLOG_ERROR, "[pool %s] the ping response page '%s' is not long enough", wp->config->name, wp->config->ping_response);
return -1;
}
}
@ -555,24 +555,24 @@ static int fpm_conf_process_all_pools() /* {{{ */
/* struct fpm_status_s fpm_status; */
if (*status != '/') {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the status path '%s' must start with a '/'", wp->config->name, status);
zlog(ZLOG_ERROR, "[pool %s] the status path '%s' must start with a '/'", wp->config->name, status);
return -1;
}
if (strlen(status) < 2) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the status path '%s' is not long enough", wp->config->name, status);
zlog(ZLOG_ERROR, "[pool %s] the status path '%s' is not long enough", wp->config->name, status);
return -1;
}
for (i=0; i<strlen(status); i++) {
if (!isalnum(status[i]) && status[i] != '/' && status[i] != '-' && status[i] != '_' && status[i] != '.') {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the status path '%s' must contain only the following characters '[alphanum]/_-.'", wp->config->name, status);
zlog(ZLOG_ERROR, "[pool %s] the status path '%s' must contain only the following characters '[alphanum]/_-.'", wp->config->name, status);
return -1;
}
}
wp->shm_status = fpm_shm_alloc(sizeof(struct fpm_status_s));
if (!wp->shm_status) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to allocate shared memory for status page '%s'", wp->config->name, status);
zlog(ZLOG_ERROR, "[pool %s] unable to allocate shared memory for status page '%s'", wp->config->name, status);
return -1;
}
fpm_status_update_accepted_conn(wp->shm_status, 0);
@ -584,18 +584,18 @@ static int fpm_conf_process_all_pools() /* {{{ */
if (wp->config->chroot && *wp->config->chroot) {
if (*wp->config->chroot != '/') {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the chroot path '%s' must start with a '/'", wp->config->name, wp->config->chroot);
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_STUFF, ZLOG_ERROR, "[pool %s] the chroot path '%s' does not exist or is not a directory", wp->config->name, 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;
}
}
if (wp->config->chdir && *wp->config->chdir) {
if (*wp->config->chdir != '/') {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the chdir path '%s' must start with a '/'", wp->config->name, wp->config->chdir);
zlog(ZLOG_ERROR, "[pool %s] the chdir path '%s' must start with a '/'", wp->config->name, wp->config->chdir);
return -1;
}
@ -606,19 +606,19 @@ static int fpm_conf_process_all_pools() /* {{{ */
len = strlen(wp->config->chroot) + strlen(wp->config->chdir) + 1;
buf = malloc(sizeof(char) * len);
if (!buf) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] malloc() failed", wp->config->name);
zlog(ZLOG_SYSERROR, "[pool %s] malloc() failed", wp->config->name);
return -1;
}
snprintf(buf, len, "%s%s", wp->config->chroot, wp->config->chdir);
if (!fpm_conf_is_dir(buf)) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the chdir path '%s' within the chroot path '%s' ('%s') does not exist or is not a directory", wp->config->name, wp->config->chdir, wp->config->chroot, buf);
zlog(ZLOG_ERROR, "[pool %s] the chdir path '%s' within the chroot path '%s' ('%s') does not exist or is not a directory", wp->config->name, wp->config->chdir, wp->config->chroot, buf);
free(buf);
return -1;
}
free(buf);
} else {
if (!fpm_conf_is_dir(wp->config->chdir)) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the chdir path '%s' does not exist or is not a directory", wp->config->name, wp->config->chdir);
zlog(ZLOG_ERROR, "[pool %s] the chdir path '%s' does not exist or is not a directory", wp->config->name, wp->config->chdir);
return -1;
}
}
@ -632,7 +632,7 @@ int fpm_conf_unlink_pid() /* {{{ */
{
if (fpm_global_config.pid_file) {
if (0 > unlink(fpm_global_config.pid_file)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "unlink(\"%s\") failed", fpm_global_config.pid_file);
zlog(ZLOG_SYSERROR, "unlink(\"%s\") failed", fpm_global_config.pid_file);
return -1;
}
}
@ -652,14 +652,14 @@ int fpm_conf_write_pid() /* {{{ */
fd = creat(fpm_global_config.pid_file, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (fd < 0) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "creat(\"%s\") failed", fpm_global_config.pid_file);
zlog(ZLOG_SYSERROR, "creat(\"%s\") failed", fpm_global_config.pid_file);
return -1;
}
len = sprintf(buf, "%d", (int) fpm_globals.parent_pid);
if (len != write(fd, buf, len)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "write() failed");
zlog(ZLOG_SYSERROR, "write() failed");
return -1;
}
close(fd);
@ -718,12 +718,12 @@ static void fpm_conf_ini_parser_include(char *inc, void *arg TSRMLS_DC) /* {{{ *
if ((i = glob(inc, GLOB_ERR | GLOB_MARK | GLOB_NOSORT, NULL, &g)) != 0) {
#ifdef GLOB_NOMATCH
if (i == GLOB_NOMATCH) {
zlog(ZLOG_STUFF, ZLOG_WARNING, "Nothing matches the include pattern '%s' from %s at line %d.", inc, filename, ini_lineno);
zlog(ZLOG_WARNING, "Nothing matches the include pattern '%s' from %s at line %d.", inc, filename, ini_lineno);
efree(filename);
return;
}
#endif /* GLOB_NOMATCH */
zlog(ZLOG_STUFF, ZLOG_ERROR, "Unable to globalize '%s' (ret=%d) from %s at line %d.", inc, i, filename, ini_lineno);
zlog(ZLOG_ERROR, "Unable to globalize '%s' (ret=%d) from %s at line %d.", inc, i, filename, ini_lineno);
*error = 1;
efree(filename);
return;
@ -734,7 +734,7 @@ static void fpm_conf_ini_parser_include(char *inc, void *arg TSRMLS_DC) /* {{{ *
if (len < 1) continue;
if (g.gl_pathv[i][len - 1] == '/') continue; /* don't parse directories */
if (0 > fpm_conf_load_ini_file(g.gl_pathv[i] TSRMLS_CC)) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "Unable to include %s from %s at line %d", g.gl_pathv[i], filename, ini_lineno);
zlog(ZLOG_ERROR, "Unable to include %s from %s at line %d", g.gl_pathv[i], filename, ini_lineno);
*error = 1;
efree(filename);
return;
@ -744,7 +744,7 @@ static void fpm_conf_ini_parser_include(char *inc, void *arg TSRMLS_DC) /* {{{ *
}
#else /* HAVE_GLOB */
if (0 > fpm_conf_load_ini_file(inc TSRMLS_CC)) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "Unable to include %s from %s at line %d", inc, filename, ini_lineno);
zlog(ZLOG_ERROR, "Unable to include %s from %s at line %d", inc, filename, ini_lineno);
*error = 1;
efree(filename);
return;
@ -780,13 +780,13 @@ static void fpm_conf_ini_parser_section(zval *section, void *arg TSRMLS_DC) /* {
/* it's a new pool */
config = (struct fpm_worker_pool_config_s *)fpm_worker_pool_config_alloc();
if (!current_wp || !config) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] Unable to alloc a new WorkerPool for worker '%s'", ini_filename, ini_lineno, Z_STRVAL_P(section));
zlog(ZLOG_ERROR, "[%s:%d] Unable to alloc a new WorkerPool for worker '%s'", ini_filename, ini_lineno, Z_STRVAL_P(section));
*error = 1;
return;
}
config->name = strdup(Z_STRVAL_P(section));
if (!config->name) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] Unable to alloc memory for configuration name for worker '%s'", ini_filename, ini_lineno, Z_STRVAL_P(section));
zlog(ZLOG_ERROR, "[%s:%d] Unable to alloc memory for configuration name for worker '%s'", ini_filename, ini_lineno, Z_STRVAL_P(section));
*error = 1;
return;
}
@ -800,14 +800,14 @@ static void fpm_conf_ini_parser_entry(zval *name, zval *value, void *arg TSRMLS_
int *error = (int *)arg;
if (!value) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] value is NULL for a ZEND_INI_PARSER_ENTRY", ini_filename, ini_lineno);
zlog(ZLOG_ERROR, "[%s:%d] value is NULL for a ZEND_INI_PARSER_ENTRY", ini_filename, ini_lineno);
*error = 1;
return;
}
if (!strcmp(Z_STRVAL_P(name), "include")) {
if (ini_include) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] two includes at the same time !", ini_filename, ini_lineno);
zlog(ZLOG_ERROR, "[%s:%d] two includes at the same time !", ini_filename, ini_lineno);
*error = 1;
return;
}
@ -827,14 +827,14 @@ static void fpm_conf_ini_parser_entry(zval *name, zval *value, void *arg TSRMLS_
if (!strcasecmp(parser->name, Z_STRVAL_P(name))) {
char *ret;
if (!parser->parser) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] the parser for entry '%s' is not defined", ini_filename, ini_lineno, parser->name);
zlog(ZLOG_ERROR, "[%s:%d] the parser for entry '%s' is not defined", ini_filename, ini_lineno, parser->name);
*error = 1;
return;
}
ret = parser->parser(value, &config, parser->offset);
if (ret) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] unable to parse value for entry '%s': %s", ini_filename, ini_lineno, parser->name, ret);
zlog(ZLOG_ERROR, "[%s:%d] unable to parse value for entry '%s': %s", ini_filename, ini_lineno, parser->name, ret);
*error = 1;
return;
}
@ -845,7 +845,7 @@ static void fpm_conf_ini_parser_entry(zval *name, zval *value, void *arg TSRMLS_
}
/* nothing has been found if we got here */
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] unknown entry '%s'", ini_filename, ini_lineno, Z_STRVAL_P(name));
zlog(ZLOG_ERROR, "[%s:%d] unknown entry '%s'", ini_filename, ini_lineno, Z_STRVAL_P(name));
*error = 1;
}
/* }}} */
@ -857,19 +857,19 @@ static void fpm_conf_ini_parser_array(zval *name, zval *key, zval *value, void *
void *config;
if (!Z_STRVAL_P(key) || !Z_STRVAL_P(value) || !*Z_STRVAL_P(key)) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] Misspelled array ?", ini_filename, ini_lineno);
zlog(ZLOG_ERROR, "[%s:%d] Misspelled array ?", ini_filename, ini_lineno);
*error = 1;
return;
}
if (!current_wp || !current_wp->config) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] Array are not allowed in the global section", ini_filename, ini_lineno);
zlog(ZLOG_ERROR, "[%s:%d] Array are not allowed in the global section", ini_filename, ini_lineno);
*error = 1;
return;
}
if (!strcmp("env", Z_STRVAL_P(name))) {
if (!*Z_STRVAL_P(value)) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] empty value", ini_filename, ini_lineno);
zlog(ZLOG_ERROR, "[%s:%d] empty value", ini_filename, ini_lineno);
*error = 1;
return;
}
@ -878,7 +878,7 @@ static void fpm_conf_ini_parser_array(zval *name, zval *key, zval *value, void *
} else if (!strcmp("php_value", Z_STRVAL_P(name))) {
if (!*Z_STRVAL_P(value)) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] empty value", ini_filename, ini_lineno);
zlog(ZLOG_ERROR, "[%s:%d] empty value", ini_filename, ini_lineno);
*error = 1;
return;
}
@ -887,7 +887,7 @@ static void fpm_conf_ini_parser_array(zval *name, zval *key, zval *value, void *
} else if (!strcmp("php_admin_value", Z_STRVAL_P(name))) {
if (!*Z_STRVAL_P(value)) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] empty value", ini_filename, ini_lineno);
zlog(ZLOG_ERROR, "[%s:%d] empty value", ini_filename, ini_lineno);
*error = 1;
return;
}
@ -903,13 +903,13 @@ static void fpm_conf_ini_parser_array(zval *name, zval *key, zval *value, void *
err = fpm_conf_set_array(key, value, &config, 1);
} else {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] unknown directive '%s'", ini_filename, ini_lineno, Z_STRVAL_P(name));
zlog(ZLOG_ERROR, "[%s:%d] unknown directive '%s'", ini_filename, ini_lineno, Z_STRVAL_P(name));
*error = 1;
return;
}
if (err) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] error while parsing '%s[%s]' : %s", ini_filename, ini_lineno, Z_STRVAL_P(name), Z_STRVAL_P(key), err);
zlog(ZLOG_ERROR, "[%s:%d] error while parsing '%s[%s]' : %s", ini_filename, ini_lineno, Z_STRVAL_P(name), Z_STRVAL_P(key), err);
*error = 1;
return;
}
@ -935,7 +935,7 @@ static void fpm_conf_ini_parser(zval *arg1, zval *arg2, zval *arg3, int callback
fpm_conf_ini_parser_array(arg1, arg3, arg2, error TSRMLS_CC);
break;;
default:
zlog(ZLOG_STUFF, ZLOG_ERROR, "[%s:%d] Unknown INI syntax", ini_filename, ini_lineno);
zlog(ZLOG_ERROR, "[%s:%d] Unknown INI syntax", ini_filename, ini_lineno);
*error = 1;
break;;
}
@ -953,18 +953,18 @@ int fpm_conf_load_ini_file(char *filename TSRMLS_DC) /* {{{ */
int ret = 1;
if (!filename || !filename[0]) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "Configuration file is empty");
zlog(ZLOG_ERROR, "Configuration file is empty");
return -1;
}
fd = open(filename, O_RDONLY, 0);
if (fd < 0) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "Unable to open file '%s', errno=%d", filename, errno);
zlog(ZLOG_ERROR, "Unable to open file '%s', errno=%d", filename, errno);
return -1;
}
if (ini_recursion++ > 4) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "You can include more than 5 files recusively");
zlog(ZLOG_ERROR, "You can include more than 5 files recusively");
return -1;
}
@ -1023,7 +1023,7 @@ int fpm_conf_init_main() /* {{{ */
ret = fpm_conf_load_ini_file(filename TSRMLS_CC);
if (0 > ret) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "failed to load configuration file '%s'", filename);
zlog(ZLOG_ERROR, "failed to load configuration file '%s'", filename);
if (free) efree(filename);
return -1;
}
@ -1031,7 +1031,7 @@ int fpm_conf_init_main() /* {{{ */
if (free) efree(filename);
if (0 > fpm_conf_post_process()) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "failed to post process the configuration");
zlog(ZLOG_ERROR, "failed to post process the configuration");
return -1;
}

View File

@ -38,42 +38,42 @@ static void fpm_got_signal(int fd, short ev, void *arg) /* {{{ */
if (res <= 0) {
if (res < 0 && errno != EAGAIN && errno != EWOULDBLOCK) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "read() failed");
zlog(ZLOG_SYSERROR, "read() failed");
}
return;
}
switch (c) {
case 'C' : /* SIGCHLD */
zlog(ZLOG_STUFF, ZLOG_DEBUG, "received SIGCHLD");
zlog(ZLOG_DEBUG, "received SIGCHLD");
fpm_children_bury(base);
break;
case 'I' : /* SIGINT */
zlog(ZLOG_STUFF, ZLOG_DEBUG, "received SIGINT");
zlog(ZLOG_STUFF, ZLOG_NOTICE, "Terminating ...");
zlog(ZLOG_DEBUG, "received SIGINT");
zlog(ZLOG_NOTICE, "Terminating ...");
fpm_pctl(FPM_PCTL_STATE_TERMINATING, FPM_PCTL_ACTION_SET, base);
break;
case 'T' : /* SIGTERM */
zlog(ZLOG_STUFF, ZLOG_DEBUG, "received SIGTERM");
zlog(ZLOG_STUFF, ZLOG_NOTICE, "Terminating ...");
zlog(ZLOG_DEBUG, "received SIGTERM");
zlog(ZLOG_NOTICE, "Terminating ...");
fpm_pctl(FPM_PCTL_STATE_TERMINATING, FPM_PCTL_ACTION_SET, base);
break;
case 'Q' : /* SIGQUIT */
zlog(ZLOG_STUFF, ZLOG_DEBUG, "received SIGQUIT");
zlog(ZLOG_STUFF, ZLOG_NOTICE, "Finishing ...");
zlog(ZLOG_DEBUG, "received SIGQUIT");
zlog(ZLOG_NOTICE, "Finishing ...");
fpm_pctl(FPM_PCTL_STATE_FINISHING, FPM_PCTL_ACTION_SET, base);
break;
case '1' : /* SIGUSR1 */
zlog(ZLOG_STUFF, ZLOG_DEBUG, "received SIGUSR1");
zlog(ZLOG_DEBUG, "received SIGUSR1");
if (0 == fpm_stdio_open_error_log(1)) {
zlog(ZLOG_STUFF, ZLOG_NOTICE, "log file re-opened");
zlog(ZLOG_NOTICE, "log file re-opened");
} else {
zlog(ZLOG_STUFF, ZLOG_ERROR, "unable to re-opened log file");
zlog(ZLOG_ERROR, "unable to re-opened log file");
}
break;
case '2' : /* SIGUSR2 */
zlog(ZLOG_STUFF, ZLOG_DEBUG, "received SIGUSR2");
zlog(ZLOG_STUFF, ZLOG_NOTICE, "Reloading in progress ...");
zlog(ZLOG_DEBUG, "received SIGUSR2");
zlog(ZLOG_NOTICE, "Reloading in progress ...");
fpm_pctl(FPM_PCTL_STATE_RELOADING, FPM_PCTL_ACTION_SET, base);
break;
}
@ -90,7 +90,7 @@ int fpm_event_init_main(struct event_base **base) /* {{{ */
{
*base = event_base_new();
zlog(ZLOG_STUFF, ZLOG_DEBUG, "libevent %s: using %s", event_get_version(), event_base_get_method(*base));
zlog(ZLOG_DEBUG, "libevent %s: using %s", event_get_version(), event_base_get_method(*base));
if (0 > fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_event_cleanup, *base)) {
return -1;
@ -108,7 +108,7 @@ int fpm_event_loop(struct event_base *base) /* {{{ */
event_add(&signal_fd_event, 0);
fpm_pctl_heartbeat(-1, 0, base);
fpm_pctl_perform_idle_server_maintenance_heartbeat(-1, 0, base);
zlog(ZLOG_STUFF, ZLOG_NOTICE, "ready to handle connections");
zlog(ZLOG_NOTICE, "ready to handle connections");
event_base_dispatch(base);
return 0;
}

View File

@ -139,12 +139,12 @@ void fpm_php_trace(struct fpm_child_s *child) /* {{{ */
TSRMLS_FETCH();
FILE *slowlog;
zlog(ZLOG_STUFF, ZLOG_NOTICE, "about to trace %d", (int) child->pid);
zlog(ZLOG_NOTICE, "about to trace %d", (int) child->pid);
slowlog = fopen(child->wp->config->slowlog, "a+");
if (!slowlog) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "fopen(%s) failed", child->wp->config->slowlog);
zlog(ZLOG_SYSERROR, "fopen(%s) failed", child->wp->config->slowlog);
goto done0;
}
@ -167,7 +167,7 @@ done0:
fpm_pctl_kill(child->pid, FPM_PCTL_CONT);
child->tracer = 0;
zlog(ZLOG_STUFF, ZLOG_NOTICE, "finished trace of %d", (int) child->pid);
zlog(ZLOG_NOTICE, "finished trace of %d", (int) child->pid);
}
/* }}} */

View File

@ -78,7 +78,7 @@ static int fpm_pctl_timeout_set(int sec, struct event_base *base) /* {{{ */
static void fpm_pctl_exit() /* {{{ */
{
zlog(ZLOG_STUFF, ZLOG_NOTICE, "exiting, bye-bye!");
zlog(ZLOG_NOTICE, "exiting, bye-bye!");
fpm_conf_unlink_pid();
fpm_cleanups_run(FPM_CLEANUP_PARENT_EXIT_MAIN);
@ -91,7 +91,7 @@ static void fpm_pctl_exit() /* {{{ */
static void fpm_pctl_exec() /* {{{ */
{
zlog(ZLOG_STUFF, ZLOG_NOTICE, "reloading: execvp(\"%s\", {\"%s\""
zlog(ZLOG_NOTICE, "reloading: execvp(\"%s\", {\"%s\""
"%s%s%s" "%s%s%s" "%s%s%s" "%s%s%s" "%s%s%s"
"%s%s%s" "%s%s%s" "%s%s%s" "%s%s%s" "%s%s%s"
"})",
@ -110,7 +110,7 @@ static void fpm_pctl_exec() /* {{{ */
fpm_cleanups_run(FPM_CLEANUP_PARENT_EXEC);
execvp(saved_argv[0], saved_argv);
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "execvp() failed");
zlog(ZLOG_SYSERROR, "execvp() failed");
exit(1);
}
/* }}} */
@ -165,7 +165,7 @@ static void fpm_pctl_kill_all(int signo) /* {{{ */
for (child = wp->children; child; child = child->next) {
int res = kill(child->pid, signo);
zlog(ZLOG_STUFF, ZLOG_DEBUG, "[pool %s] sending signal %d %s to child %d",
zlog(ZLOG_DEBUG, "[pool %s] sending signal %d %s to child %d",
child->wp->config->name, signo,
fpm_signal_names[signo] ? fpm_signal_names[signo] : "", (int) child->pid);
@ -176,7 +176,7 @@ static void fpm_pctl_kill_all(int signo) /* {{{ */
}
if (alive_children) {
zlog(ZLOG_STUFF, ZLOG_DEBUG, "%d child(ren) still alive", alive_children);
zlog(ZLOG_DEBUG, "%d child(ren) still alive", alive_children);
}
}
/* }}} */
@ -231,7 +231,7 @@ void fpm_pctl(int new_state, int action, struct event_base *base) /* {{{ */
if (new_state == FPM_PCTL_STATE_TERMINATING) break;
case FPM_PCTL_STATE_TERMINATING :
/* nothing can override 'terminating' state */
zlog(ZLOG_STUFF, ZLOG_DEBUG, "not switching to '%s' state, because already in '%s' state",
zlog(ZLOG_DEBUG, "not switching to '%s' state, because already in '%s' state",
fpm_state_names[new_state], fpm_state_names[fpm_state]);
return;
}
@ -239,7 +239,7 @@ void fpm_pctl(int new_state, int action, struct event_base *base) /* {{{ */
fpm_signal_sent = 0;
fpm_state = new_state;
zlog(ZLOG_STUFF, ZLOG_DEBUG, "switching to '%s' state", fpm_state_names[fpm_state]);
zlog(ZLOG_DEBUG, "switching to '%s' state", fpm_state_names[fpm_state]);
/* fall down */
case FPM_PCTL_ACTION_TIMEOUT :
@ -356,7 +356,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now, struct
/* the rest is only used by PM_STYLE_DYNAMIC */
if (wp->config->pm != PM_STYLE_DYNAMIC) continue;
zlog(ZLOG_STUFF, ZLOG_DEBUG, "[pool %s] currently %d active children, %d spare children, %d running children. Spawning rate %d", wp->config->name, active, idle, wp->running_children, wp->idle_spawn_rate);
zlog(ZLOG_DEBUG, "[pool %s] currently %d active children, %d spare children, %d running children. Spawning rate %d", wp->config->name, active, idle, wp->running_children, wp->idle_spawn_rate);
if (idle > wp->config->pm_max_spare_servers && last_idle_child) {
last_idle_child->idle_kill = 1;
@ -369,7 +369,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now, struct
if (wp->running_children >= wp->config->pm_max_children) {
if (!wp->warn_max_children) {
fpm_status_increment_max_children_reached(wp->shm_status);
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
zlog(ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
wp->warn_max_children = 1;
}
wp->idle_spawn_rate = 1;
@ -377,7 +377,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now, struct
}
if (wp->idle_spawn_rate >= 8) {
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] seems busy (you may need to increase start_servers, or min/max_spare_servers), spawning %d children, there are %d idle, and %d total children", wp->config->name, wp->idle_spawn_rate, idle, wp->running_children);
zlog(ZLOG_WARNING, "[pool %s] seems busy (you may need to increase start_servers, or min/max_spare_servers), spawning %d children, there are %d idle, and %d total children", wp->config->name, wp->idle_spawn_rate, idle, wp->running_children);
}
/* compute the number of idle process to spawn */
@ -388,7 +388,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now, struct
if (children_to_fork <= 0) {
if (!wp->warn_max_children) {
fpm_status_increment_max_children_reached(wp->shm_status);
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
zlog(ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
wp->warn_max_children = 1;
}
wp->idle_spawn_rate = 1;
@ -405,7 +405,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now, struct
return;
}
zlog(ZLOG_STUFF, ZLOG_DEBUG, "[pool %s] %d child(ren) have been created dynamically", wp->config->name, children_to_fork);
zlog(ZLOG_DEBUG, "[pool %s] %d child(ren) have been created dynamically", wp->config->name, children_to_fork);
/* Double the spawn rate for the next iteration */
if (wp->idle_spawn_rate < FPM_MAX_SPAWN_RATE) {

View File

@ -136,7 +136,7 @@ void fpm_request_check_timed_out(struct fpm_child_s *child, struct timeval *now,
fpm_trace_signal(child->pid);
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] child %d, script '%s' executing too slow (%d.%06d sec), logging",
zlog(ZLOG_WARNING, "[pool %s] child %d, script '%s' executing too slow (%d.%06d sec), logging",
child->wp->config->name, (int) child->pid, purified_script_filename, (int) tv.tv_sec, (int) tv.tv_usec);
}
else
@ -145,7 +145,7 @@ void fpm_request_check_timed_out(struct fpm_child_s *child, struct timeval *now,
str_purify_filename(purified_script_filename, slot_c.script_filename, sizeof(slot_c.script_filename));
fpm_pctl_kill(child->pid, FPM_PCTL_TERM);
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] child %d, script '%s' execution timed out (%d.%06d sec), terminating",
zlog(ZLOG_WARNING, "[pool %s] child %d, script '%s' execution timed out (%d.%06d sec), terminating",
child->wp->config->name, (int) child->pid, purified_script_filename, (int) tv.tv_sec, (int) tv.tv_usec);
}
}

View File

@ -30,7 +30,7 @@ struct fpm_shm_s *fpm_shm_alloc(size_t sz) /* {{{ */
shm->mem = mmap(0, sz, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);
if (!shm->mem) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "mmap(MAP_ANONYMOUS | MAP_SHARED) failed");
zlog(ZLOG_SYSERROR, "mmap(MAP_ANONYMOUS | MAP_SHARED) failed");
free(shm);
return 0;
}

View File

@ -182,17 +182,17 @@ int fpm_signals_init_main() /* {{{ */
struct sigaction act;
if (0 > socketpair(AF_UNIX, SOCK_STREAM, 0, sp)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "socketpair() failed");
zlog(ZLOG_SYSERROR, "socketpair() failed");
return -1;
}
if (0 > fd_set_blocked(sp[0], 0) || 0 > fd_set_blocked(sp[1], 0)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "fd_set_blocked() failed");
zlog(ZLOG_SYSERROR, "fd_set_blocked() failed");
return -1;
}
if (0 > fcntl(sp[0], F_SETFD, FD_CLOEXEC) || 0 > fcntl(sp[1], F_SETFD, FD_CLOEXEC)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "fcntl(F_SETFD, FD_CLOEXEC) failed");
zlog(ZLOG_SYSERROR, "fcntl(F_SETFD, FD_CLOEXEC) failed");
return -1;
}
@ -207,7 +207,7 @@ int fpm_signals_init_main() /* {{{ */
0 > sigaction(SIGCHLD, &act, 0) ||
0 > sigaction(SIGQUIT, &act, 0)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "sigaction() failed");
zlog(ZLOG_SYSERROR, "sigaction() failed");
return -1;
}
return 0;
@ -236,7 +236,7 @@ int fpm_signals_init_child() /* {{{ */
0 > sigaction(SIGCHLD, &act_dfl, 0) ||
0 > sigaction(SIGQUIT, &act, 0)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "sigaction() failed");
zlog(ZLOG_SYSERROR, "sigaction() failed");
return -1;
}
return 0;

View File

@ -49,7 +49,7 @@ static int fpm_sockets_resolve_af_inet(char *node, char *service, struct sockadd
ret = getaddrinfo(node, service, &hints, &res);
if (ret != 0) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "can't resolve hostname '%s%s%s': getaddrinfo said: %s%s%s\n",
zlog(ZLOG_ERROR, "can't resolve hostname '%s%s%s': getaddrinfo said: %s%s%s\n",
node, service ? ":" : "", service ? service : "",
gai_strerror(ret), ret == EAI_SYSTEM ? ", system error: " : "", ret == EAI_SYSTEM ? strerror(errno) : "");
return -1;
@ -171,7 +171,7 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct
sock = socket(sa->sa_family, SOCK_STREAM, 0);
if (0 > sock) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "socket() failed");
zlog(ZLOG_SYSERROR, "socket() failed");
return -1;
}
@ -183,7 +183,7 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct
}
if (0 > bind(sock, sa, socklen)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "bind() for address '%s' failed", wp->config->listen_address);
zlog(ZLOG_SYSERROR, "bind() for address '%s' failed", wp->config->listen_address);
if (wp->listen_address_domain == FPM_AF_UNIX) {
umask(saved_umask);
}
@ -197,14 +197,14 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct
if (wp->socket_uid != -1 || wp->socket_gid != -1) {
if (0 > chown(path, wp->socket_uid, wp->socket_gid)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "chown() for address '%s' failed", wp->config->listen_address);
zlog(ZLOG_SYSERROR, "chown() for address '%s' failed", wp->config->listen_address);
return -1;
}
}
}
if (0 > listen(sock, wp->config->listen_backlog)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "listen() for address '%s' failed", wp->config->listen_address);
zlog(ZLOG_SYSERROR, "listen() for address '%s' failed", wp->config->listen_address);
return -1;
}
return sock;
@ -257,7 +257,7 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
}
if (port == 0) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "invalid port value '%s'", port_str);
zlog(ZLOG_ERROR, "invalid port value '%s'", port_str);
return -1;
}
@ -269,7 +269,7 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
if (0 > fpm_sockets_resolve_af_inet(addr, NULL, &sa_in)) {
return -1;
}
zlog(ZLOG_STUFF, ZLOG_NOTICE, "address '%s' resolved as %u.%u.%u.%u", addr, IPQUAD(&sa_in.sin_addr));
zlog(ZLOG_NOTICE, "address '%s' resolved as %u.%u.%u.%u", addr, IPQUAD(&sa_in.sin_addr));
}
} else {
sa_in.sin_addr.s_addr = htonl(INADDR_ANY);
@ -318,7 +318,7 @@ int fpm_sockets_init_main() /* {{{ */
*eq = '\0';
fd_no = atoi(eq + 1);
type = fpm_sockets_domain_from_address(inherited);
zlog(ZLOG_STUFF, ZLOG_NOTICE, "using inherited socket fd=%d, \"%s\"", fd_no, inherited);
zlog(ZLOG_NOTICE, "using inherited socket fd=%d, \"%s\"", fd_no, inherited);
fpm_sockets_hash_op(fd_no, 0, inherited, type, FPM_STORE_SOCKET);
}

View File

@ -20,13 +20,13 @@ static char *fpm_status_pong= NULL;
int fpm_status_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
{
if (!wp || !wp->config) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "unable to init fpm_status because conf structure is NULL");
zlog(ZLOG_ERROR, "unable to init fpm_status because conf structure is NULL");
return -1;
}
if (wp->config->pm_status_path || wp->config->ping_path) {
if (wp->config->pm_status_path) {
if (!wp->shm_status) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to init fpm_status because the dedicated SHM has not been set", wp->config->name);
zlog(ZLOG_ERROR, "[pool %s] unable to init fpm_status because the dedicated SHM has not been set", wp->config->name);
return -1;
}
fpm_status_shm = wp->shm_status;
@ -37,7 +37,7 @@ int fpm_status_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
}
if (wp->config->ping_path) {
if (!wp->config->ping_response) {
zlog(ZLOG_STUFF, 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 pong is not set.", wp->config->name, wp->config->ping_path);
return -1;
}
fpm_status_ping = strdup(wp->config->ping_path);
@ -307,7 +307,7 @@ int fpm_status_handle_status(char *uri, char *query_string, char **output, char
}
if (!*output || !content_type) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to allocate status ouput buffer", fpm_status_pool);
zlog(ZLOG_ERROR, "[pool %s] unable to allocate status ouput buffer", fpm_status_pool);
return 1;
}

View File

@ -26,12 +26,12 @@ int fpm_stdio_init_main() /* {{{ */
int fd = open("/dev/null", O_RDWR);
if (0 > fd) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "open(\"/dev/null\") failed");
zlog(ZLOG_SYSERROR, "open(\"/dev/null\") failed");
return -1;
}
if (0 > dup2(fd, STDIN_FILENO) || 0 > dup2(fd, STDOUT_FILENO)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "dup2() failed");
zlog(ZLOG_SYSERROR, "dup2() failed");
return -1;
}
close(fd);
@ -46,7 +46,7 @@ int fpm_stdio_init_final() /* {{{ */
if (fpm_globals.error_log_fd != STDERR_FILENO) {
/* there might be messages to stderr from libevent, we need to log them all */
if (0 > dup2(fpm_globals.error_log_fd, STDERR_FILENO)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "dup2() failed");
zlog(ZLOG_SYSERROR, "dup2() failed");
return -1;
}
}
@ -64,7 +64,7 @@ int fpm_stdio_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
if (wp->listening_socket != STDIN_FILENO) {
if (0 > dup2(wp->listening_socket, STDIN_FILENO)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "dup2() failed");
zlog(ZLOG_SYSERROR, "dup2() failed");
return -1;
}
}
@ -94,7 +94,7 @@ static void fpm_stdio_child_said(int fd, short which, void *arg) /* {{{ */
} else { /* error or pipe is closed */
if (res < 0) { /* error */
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "read() failed");
zlog(ZLOG_SYSERROR, "read() failed");
}
fpm_event_del(ev);
@ -140,7 +140,7 @@ static void fpm_stdio_child_said(int fd, short which, void *arg) /* {{{ */
*nl = '\0';
}
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] child %d said into %s: \"%s\"%s", child->wp->config->name,
zlog(ZLOG_WARNING, "[pool %s] child %d said into %s: \"%s\"%s", child->wp->config->name,
(int) child->pid, is_stdout ? "stdout" : "stderr", buf, is_last_message ? ", pipe is closed" : "");
if (nl) {
@ -164,18 +164,18 @@ int fpm_stdio_prepare_pipes(struct fpm_child_s *child) /* {{{ */
}
if (0 > pipe(fd_stdout)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "pipe() failed");
zlog(ZLOG_SYSERROR, "pipe() failed");
return -1;
}
if (0 > pipe(fd_stderr)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "pipe() failed");
zlog(ZLOG_SYSERROR, "pipe() failed");
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_STUFF, ZLOG_SYSERROR, "fd_set_blocked() failed");
zlog(ZLOG_SYSERROR, "fd_set_blocked() failed");
close(fd_stdout[0]); close(fd_stdout[1]);
close(fd_stderr[0]); close(fd_stderr[1]);
return -1;
@ -237,7 +237,7 @@ int fpm_stdio_open_error_log(int reopen) /* {{{ */
fd = open(fpm_global_config.error_log, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR);
if (0 > fd) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "open(\"%s\") failed", fpm_global_config.error_log);
zlog(ZLOG_SYSERROR, "open(\"%s\") failed", fpm_global_config.error_log);
return -1;
}

View File

@ -37,7 +37,7 @@ static int fpm_mach_vm_read_page(vm_offset_t page) /* {{{ */
kr = mach_vm_read(target, page, fpm_pagesize, &local_page, &local_size);
if (kr != KERN_SUCCESS) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "mach_vm_read() failed: %s (%d)", mach_error_string(kr), kr);
zlog(ZLOG_ERROR, "mach_vm_read() failed: %s (%d)", mach_error_string(kr), kr);
return -1;
}
return 0;
@ -47,7 +47,7 @@ static int fpm_mach_vm_read_page(vm_offset_t page) /* {{{ */
int fpm_trace_signal(pid_t pid) /* {{{ */
{
if (0 > fpm_pctl_kill(pid, FPM_PCTL_STOP)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "kill(SIGSTOP) failed");
zlog(ZLOG_SYSERROR, "kill(SIGSTOP) failed");
return -1;
}
return 0;
@ -65,7 +65,7 @@ int fpm_trace_ready(pid_t pid) /* {{{ */
if (kr == KERN_FAILURE) {
msg = " It seems that master process does not have enough privileges to trace processes.";
}
zlog(ZLOG_STUFF, ZLOG_ERROR, "task_for_pid() failed: %s (%d)%s", mach_error_string(kr), kr, msg);
zlog(ZLOG_ERROR, "task_for_pid() failed: %s (%d)%s", mach_error_string(kr), kr, msg);
return -1;
}
return 0;

View File

@ -26,7 +26,7 @@ static int mem_file = -1;
int fpm_trace_signal(pid_t pid) /* {{{ */
{
if (0 > fpm_pctl_kill(pid, FPM_PCTL_STOP)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "kill(SIGSTOP) failed");
zlog(ZLOG_SYSERROR, "kill(SIGSTOP) failed");
return -1;
}
return 0;
@ -40,7 +40,7 @@ int fpm_trace_ready(pid_t pid) /* {{{ */
sprintf(buf, "/proc/%d/" PROC_MEM_FILE, (int) pid);
mem_file = open(buf, O_RDONLY);
if (0 > mem_file) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "open(%s) failed", buf);
zlog(ZLOG_SYSERROR, "open(%s) failed", buf);
return -1;
}
return 0;
@ -58,7 +58,7 @@ int fpm_trace_close(pid_t pid) /* {{{ */
int fpm_trace_get_long(long addr, long *data) /* {{{ */
{
if (sizeof(*data) != pread(mem_file, (void *) data, sizeof(*data), (uintptr_t) addr)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "pread() failed");
zlog(ZLOG_SYSERROR, "pread() failed");
return -1;
}
return 0;

View File

@ -29,7 +29,7 @@ static pid_t traced_pid;
int fpm_trace_signal(pid_t pid) /* {{{ */
{
if (0 > ptrace(PTRACE_ATTACH, pid, 0, 0)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "ptrace(ATTACH) failed");
zlog(ZLOG_SYSERROR, "ptrace(ATTACH) failed");
return -1;
}
return 0;
@ -46,7 +46,7 @@ int fpm_trace_ready(pid_t pid) /* {{{ */
int fpm_trace_close(pid_t pid) /* {{{ */
{
if (0 > ptrace(PTRACE_DETACH, pid, (void *) 1, 0)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "ptrace(DETACH) failed");
zlog(ZLOG_SYSERROR, "ptrace(DETACH) failed");
return -1;
}
traced_pid = 0;
@ -65,14 +65,14 @@ int fpm_trace_get_long(long addr, long *data) /* {{{ */
};
if (0 > ptrace(PT_IO, traced_pid, (void *) &ptio, 0)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "ptrace(PT_IO) failed");
zlog(ZLOG_SYSERROR, "ptrace(PT_IO) failed");
return -1;
}
#else
errno = 0;
*data = ptrace(PTRACE_PEEKDATA, traced_pid, (void *) addr, 0);
if (errno) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "ptrace(PEEKDATA) failed");
zlog(ZLOG_SYSERROR, "ptrace(PEEKDATA) failed");
return -1;
}
#endif

View File

@ -45,7 +45,7 @@ int fpm_unix_resolve_socket_premissions(struct fpm_worker_pool_s *wp) /* {{{ */
pwd = getpwnam(c->listen_owner);
if (!pwd) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] cannot get uid for user '%s'", wp->config->name, c->listen_owner);
zlog(ZLOG_SYSERROR, "[pool %s] cannot get uid for user '%s'", wp->config->name, c->listen_owner);
return -1;
}
@ -58,7 +58,7 @@ int fpm_unix_resolve_socket_premissions(struct fpm_worker_pool_s *wp) /* {{{ */
grp = getgrnam(c->listen_group);
if (!grp) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] cannot get gid for group '%s'", wp->config->name, c->listen_group);
zlog(ZLOG_SYSERROR, "[pool %s] cannot get gid for group '%s'", wp->config->name, c->listen_group);
return -1;
}
wp->socket_gid = grp->gr_gid;
@ -84,7 +84,7 @@ static int fpm_unix_conf_wp(struct fpm_worker_pool_s *wp) /* {{{ */
pwd = getpwnam(wp->config->user);
if (!pwd) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] cannot get uid for user '%s'", wp->config->name, wp->config->user);
zlog(ZLOG_ERROR, "[pool %s] cannot get uid for user '%s'", wp->config->name, wp->config->user);
return -1;
}
@ -104,7 +104,7 @@ static int fpm_unix_conf_wp(struct fpm_worker_pool_s *wp) /* {{{ */
grp = getgrnam(wp->config->group);
if (!grp) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] cannot get gid for group '%s'", wp->config->name, wp->config->group);
zlog(ZLOG_ERROR, "[pool %s] cannot get gid for group '%s'", wp->config->name, wp->config->group);
return -1;
}
wp->set_gid = grp->gr_gid;
@ -113,19 +113,19 @@ static int fpm_unix_conf_wp(struct fpm_worker_pool_s *wp) /* {{{ */
#ifndef I_REALLY_WANT_ROOT_PHP
if (wp->set_uid == 0 || wp->set_gid == 0) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] please specify user and group other than root", wp->config->name);
zlog(ZLOG_ERROR, "[pool %s] please specify user and group other than root", wp->config->name);
return -1;
}
#endif
} else { /* not root */
if (wp->config->user && *wp->config->user) {
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] 'user' directive is ignored", wp->config->name);
zlog(ZLOG_WARNING, "[pool %s] 'user' directive is ignored", wp->config->name);
}
if (wp->config->group && *wp->config->group) {
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] 'group' directive is ignored", wp->config->name);
zlog(ZLOG_WARNING, "[pool %s] 'group' directive is ignored", wp->config->name);
}
if (wp->config->chroot && *wp->config->chroot) {
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] 'chroot' directive is ignored", wp->config->name);
zlog(ZLOG_WARNING, "[pool %s] 'chroot' directive is ignored", wp->config->name);
}
{ /* set up HOME and USER anyway */
@ -153,7 +153,7 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
r.rlim_max = r.rlim_cur = (rlim_t) wp->config->rlimit_files;
if (0 > setrlimit(RLIMIT_NOFILE, &r)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] setrlimit(RLIMIT_NOFILE, %d) failed (%d)", wp->config->name, wp->config->rlimit_files, errno);
zlog(ZLOG_SYSERROR, "[pool %s] setrlimit(RLIMIT_NOFILE, %d) failed (%d)", wp->config->name, wp->config->rlimit_files, errno);
}
}
@ -163,13 +163,13 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
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_STUFF, ZLOG_SYSERROR, "[pool %s] setrlimit(RLIMIT_CORE, %d) failed (%d)", wp->config->name, wp->config->rlimit_core, errno);
zlog(ZLOG_SYSERROR, "[pool %s] setrlimit(RLIMIT_CORE, %d) failed (%d)", wp->config->name, wp->config->rlimit_core, errno);
}
}
if (is_root && wp->config->chroot && *wp->config->chroot) {
if (0 > chroot(wp->config->chroot)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] chroot(%s) failed", wp->config->name, wp->config->chroot);
zlog(ZLOG_SYSERROR, "[pool %s] chroot(%s) failed", wp->config->name, wp->config->chroot);
return -1;
}
made_chroot = 1;
@ -177,7 +177,7 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
if (wp->config->chdir && *wp->config->chdir) {
if (0 > chdir(wp->config->chdir)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] chdir(%s) failed", wp->config->name, wp->config->chdir);
zlog(ZLOG_SYSERROR, "[pool %s] chdir(%s) failed", wp->config->name, wp->config->chdir);
return -1;
}
} else if (made_chroot) {
@ -187,17 +187,17 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
if (is_root) {
if (wp->set_gid) {
if (0 > setgid(wp->set_gid)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] setgid(%d) failed", wp->config->name, wp->set_gid);
zlog(ZLOG_SYSERROR, "[pool %s] setgid(%d) failed", wp->config->name, wp->set_gid);
return -1;
}
}
if (wp->set_uid) {
if (0 > initgroups(wp->config->user, wp->set_gid)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] initgroups(%s, %d) failed", wp->config->name, wp->config->user, wp->set_gid);
zlog(ZLOG_SYSERROR, "[pool %s] initgroups(%s, %d) failed", wp->config->name, wp->config->user, wp->set_gid);
return -1;
}
if (0 > setuid(wp->set_uid)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] setuid(%d) failed", wp->config->name, wp->set_uid);
zlog(ZLOG_SYSERROR, "[pool %s] setuid(%d) failed", wp->config->name, wp->set_uid);
return -1;
}
}
@ -205,7 +205,7 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
#ifdef HAVE_PRCTL
if (0 > prctl(PR_SET_DUMPABLE, 1, 0, 0, 0)) {
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "[pool %s] prctl(PR_SET_DUMPABLE) failed", wp->config->name);
zlog(ZLOG_SYSERROR, "[pool %s] prctl(PR_SET_DUMPABLE) failed", wp->config->name);
}
#endif
@ -224,7 +224,7 @@ int fpm_unix_init_main() /* {{{ */
if (fpm_global_config.daemonize) {
switch (fork()) {
case -1 :
zlog(ZLOG_STUFF, ZLOG_SYSERROR, "daemonized fork() failed");
zlog(ZLOG_SYSERROR, "daemonized fork() failed");
return -1;
case 0 :
break;

View File

@ -58,7 +58,7 @@ int zlog_set_level(int new_value) /* {{{ */
}
/* }}} */
void zlog(const char *function, int line, int flags, const char *fmt, ...) /* {{{ */
void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /* {{{ */
{
struct timeval tv;
char buf[MAX_LINE_LENGTH];

View File

@ -5,7 +5,7 @@
#ifndef ZLOG_H
#define ZLOG_H 1
#define ZLOG_STUFF __func__, __LINE__
#define zlog(flags,...) zlog_ex(__func__, __LINE__, flags, __VA_ARGS__)
struct timeval;
@ -14,7 +14,7 @@ int zlog_set_level(int new_value);
size_t zlog_print_time(struct timeval *tv, char *timebuf, size_t timebuf_len);
void zlog(const char *function, int line, int flags, const char *fmt, ...)
void zlog_ex(const char *function, int line, int flags, const char *fmt, ...)
__attribute__ ((format(printf,4,5)));
enum {