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;
}
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);
}
}
}
} 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);
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 */);
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);
}
}
}
} else {
- zlog(ZLOG_STUFF, ZLOG_ALERT, "oops, unknown child exited %s", buf);
+ zlog(ZLOG_ALERT, "oops, unknown child exited %s", buf);
}
}
}
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;
}
return 0;
case -1 :
- zlog(ZLOG_STUFF, ZLOG_SYSERROR, "fork() failed");
+ zlog(ZLOG_SYSERROR, "fork() failed");
enough = 1;
fpm_resources_discard(child);
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);
}
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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);
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;
}
}
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;
}
}
/* 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);
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;
}
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;
}
}
{
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;
}
}
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);
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;
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;
}
#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;
/* 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;
}
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;
}
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;
}
}
/* 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;
}
/* }}} */
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;
}
} 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;
}
} 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;
}
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;
}
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;;
}
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;
}
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;
}
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;
}
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;
}
{
*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;
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;
}
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;
}
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);
}
/* }}} */
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);
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"
"})",
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);
}
/* }}} */
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);
}
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);
}
}
/* }}} */
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;
}
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 :
/* 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;
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;
}
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 */
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;
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) {
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
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);
}
}
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;
}
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;
}
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;
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;
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;
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;
}
}
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);
}
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;
}
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;
}
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);
*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);
}
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;
}
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);
}
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;
}
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);
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;
}
}
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;
}
}
} 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);
*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) {
}
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;
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;
}
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;
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;
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;
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;
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;
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;
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;
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;
};
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
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;
}
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;
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;
}
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;
#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 */
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);
}
}
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;
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) {
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;
}
}
#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
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;
}
/* }}} */
-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];
#ifndef ZLOG_H
#define ZLOG_H 1
-#define ZLOG_STUFF __func__, __LINE__
+#define zlog(flags,...) zlog_ex(__func__, __LINE__, flags, __VA_ARGS__)
struct timeval;
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 {