summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2010-01-11 13:09:46 +0000
committerAntony Dovgal <tony2001@php.net>2010-01-11 13:09:46 +0000
commitc077c39f09e59a9b4f5a2d46efe5c2507f021c95 (patch)
tree2db7abf9aa32fd8f9ef095dcab4c43df1a1c3000
parent71b6810ecfb550cd2d9188621a613e758f40a1ea (diff)
downloadphp-git-c077c39f09e59a9b4f5a2d46efe5c2507f021c95.tar.gz
fix CS/WS
-rw-r--r--sapi/fpm/fpm/fpm_conf.c28
-rw-r--r--sapi/fpm/fpm/fpm_env.c2
-rw-r--r--sapi/fpm/fpm/fpm_request.c2
-rw-r--r--sapi/fpm/fpm/fpm_status.c50
4 files changed, 46 insertions, 36 deletions
diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c
index 6cc4185c06..0d0832904a 100644
--- a/sapi/fpm/fpm/fpm_conf.c
+++ b/sapi/fpm/fpm/fpm_conf.c
@@ -402,7 +402,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
if (wp->config->pm == NULL) {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] the process manager is missing (static or dynamic)", wp->config->name);
- return(-1);
+ return -1;
}
if (wp->config->pm->style == PM_STYLE_DYNAMIC) {
@@ -410,24 +410,24 @@ static int fpm_conf_process_all_pools() /* {{{ */
if (pm->dynamic.min_spare_servers <= 0) {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] min_spare_servers(%d) must be a positive value", wp->config->name, pm->dynamic.min_spare_servers);
- return(-1);
+ return -1;
}
if (pm->dynamic.max_spare_servers <= 0) {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] max_spare_servers(%d) must be a positive value", wp->config->name, pm->dynamic.max_spare_servers);
- return(-1);
+ return -1;
}
if (pm->dynamic.min_spare_servers > pm->max_children ||
pm->dynamic.max_spare_servers > pm->max_children) {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] min_spare_servers(%d) and max_spare_servers(%d) cannot be greater than max_children(%d)",
wp->config->name, pm->dynamic.min_spare_servers, pm->dynamic.max_spare_servers, pm->max_children);
- return(-1);
+ return -1;
}
if (pm->dynamic.max_spare_servers < pm->dynamic.min_spare_servers) {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] max_spare_servers(%d) must not be less than min_spare_servers(%d)", wp->config->name, pm->dynamic.max_spare_servers, pm->dynamic.min_spare_servers);
- return(-1);
+ return -1;
}
if (pm->dynamic.start_servers <= 0) {
@@ -435,7 +435,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
zlog(ZLOG_STUFF, ZLOG_NOTICE, "[pool %s] start_servers has been set to %d", wp->config->name, pm->dynamic.start_servers);
} else if (pm->dynamic.start_servers < pm->dynamic.min_spare_servers || pm->dynamic.start_servers > pm->dynamic.max_spare_servers) {
zlog(ZLOG_STUFF, ZLOG_ALERT, "[pool %s] start_servers(%d) must not be less than min_spare_servers(%d) and not greater than max_spare_servers(%d)", wp->config->name, pm->dynamic.start_servers, pm->dynamic.min_spare_servers, pm->dynamic.max_spare_servers);
- return(-1);
+ return -1;
}
}
@@ -482,18 +482,18 @@ static int fpm_conf_process_all_pools() /* {{{ */
if (*ping != '/') {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping page '%s' must start with a '/'", wp->config->name, ping);
- return(-1);
+ return -1;
}
if (strlen(ping) < 2) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping page '%s' is not long enough", wp->config->name, ping);
- return(-1);
+ 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 page '%s' must containt only the following characters '[alphanum]/_-.'", wp->config->name, ping);
- return(-1);
+ return -1;
}
}
@@ -502,7 +502,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
} else {
if (strlen(wp->config->pm->pong) < 1) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the ping response page '%s' is not long enough", wp->config->name, wp->config->pm->pong);
- return(-1);
+ return -1;
}
}
} else {
@@ -519,24 +519,24 @@ static int fpm_conf_process_all_pools() /* {{{ */
if (*status != '/') {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the status page '%s' must start with a '/'", wp->config->name, status);
- return(-1);
+ return -1;
}
if (strlen(status) < 2) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the status page '%s' is not long enough", wp->config->name, status);
- return(-1);
+ 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 page '%s' must containt only the following characters '[alphanum]/_-.'", wp->config->name, status);
- return(-1);
+ 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);
- return(-1);
+ return -1;
}
fpm_status_update_accepted_conn(wp->shm_status, 0);
fpm_status_update_activity(wp->shm_status, -1, -1, -1, 1);
diff --git a/sapi/fpm/fpm/fpm_env.c b/sapi/fpm/fpm/fpm_env.c
index 26a4c41be8..3bf514e51d 100644
--- a/sapi/fpm/fpm/fpm_env.c
+++ b/sapi/fpm/fpm/fpm_env.c
@@ -106,7 +106,7 @@ static char * nvmatch(char *s1, char *s2) /* {{{ */
if(*s1 == '\0' && *(s2-1) == '=') {
return s2;
}
- return(NULL);
+ return NULL;
}
/* }}} */
#endif
diff --git a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c
index 8dda9d1463..8fff8bea32 100644
--- a/sapi/fpm/fpm/fpm_request.c
+++ b/sapi/fpm/fpm/fpm_request.c
@@ -159,7 +159,7 @@ int fpm_request_is_idle(struct fpm_child_s *child) /* {{{ */
slot = fpm_shm_slot(child);
if (!fpm_shm_slots_acquire(slot, 1)) {
- return(-1);
+ return -1;
}
slot_c = *slot;
diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c
index f05fafd432..c9eadc820b 100644
--- a/sapi/fpm/fpm/fpm_status.c
+++ b/sapi/fpm/fpm/fpm_status.c
@@ -21,13 +21,13 @@ 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");
- return(-1);
+ return -1;
}
if (wp->config->pm->status || wp->config->pm->ping) {
if (wp->config->pm->status) {
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);
- return(-1);
+ return -1;
}
fpm_status_shm = wp->shm_status;
}
@@ -38,13 +38,13 @@ int fpm_status_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
if (wp->config->pm->ping) {
if (!wp->config->pm->pong) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] ping is set (%s) but pong is not set.", wp->config->name, wp->config->pm->ping);
- return(-1);
+ return -1;
}
fpm_status_ping = strdup(wp->config->pm->ping);
fpm_status_pong = strdup(wp->config->pm->pong);
}
}
- return(0);
+ return 0;
}
/* }}} */
@@ -63,6 +63,7 @@ void fpm_status_set_pm(struct fpm_shm_s *shm, int pm) /* {{{ */
/* one shot operation */
*(struct fpm_status_s *)shm->mem = status;
}
+/* }}} */
void fpm_status_increment_accepted_conn(struct fpm_shm_s *shm) /* {{{ */
{
@@ -127,20 +128,29 @@ int fpm_status_get(int *idle, int *active, int *total, int *pm) /* {{{ */
struct fpm_status_s status;
if (!fpm_status_shm || !fpm_status_shm->mem) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to access status shared memory", fpm_status_pool);
- return(0);
+ return 0;
}
if (!idle || !active || !total) {
zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] unable to get status information : pointers are NULL", fpm_status_pool);
- return(0);
+ return 0;
}
/* one shot operation */
status = *(struct fpm_status_s *)fpm_status_shm->mem;
- if (idle) *idle = status.idle;
- if (active) *active = status.active;
- if (total) *total = status.total;
- if (pm) *pm = status.pm;
+ if (idle) {
+ *idle = status.idle;
+ }
+ if (active) {
+ *active = status.active;
+ }
+ if (total) {
+ *total = status.total;
+ }
+ if (pm) {
+ *pm = status.pm;
+ }
+ return 1;
}
/* }}} */
@@ -215,27 +225,27 @@ int fpm_status_handle_status(char *uri, char *query_string, char **output, char
struct fpm_status_s status;
if (!fpm_status_uri || !uri) {
- return(0);
+ return 0;
}
/* It's not the status page */
if (strcmp(fpm_status_uri, uri)) {
- return(0);
+ return 0;
}
if (!output || !content_type || !fpm_status_shm) {
- return(1);
+ return 1;
}
if (!fpm_status_shm->mem) {
- return(1);
+ return 1;
}
/* one shot operation */
status = *(struct fpm_status_s *)fpm_status_shm->mem;
if (status.idle < 0 || status.active < 0 || status.total < 0) {
- return(1);
+ return 1;
}
if (query_string && strstr(query_string, "html")) {
@@ -248,25 +258,25 @@ 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);
- return(1);
+ return 1;
}
- return(1);
+ return 1;
}
/* }}} */
char *fpm_status_handle_ping(char *uri) /* {{{ */
{
if (!fpm_status_ping || !fpm_status_pong || !uri) {
- return(NULL);
+ return NULL;
}
/* It's not the status page */
if (strcmp(fpm_status_ping, uri)) {
- return(NULL);
+ return NULL;
}
- return(fpm_status_pong);
+ return fpm_status_pong;
}
/* }}} */