add NGX_PROCESS_HELPER process status

This commit is contained in:
Igor Sysoev 2009-11-23 15:46:21 +00:00
parent 8019121120
commit 72db760eca
9 changed files with 14 additions and 15 deletions

View File

@ -634,7 +634,7 @@ ngx_close_listening_sockets(ngx_cycle_t *cycle)
#if (NGX_HAVE_UNIX_DOMAIN) #if (NGX_HAVE_UNIX_DOMAIN)
if (ls[i].sockaddr->sa_family == AF_UNIX if (ls[i].sockaddr->sa_family == AF_UNIX
&& ngx_process != NGX_PROCESS_WORKER && ngx_process <= NGX_PROCESS_MASTER
&& ngx_new_binary == 0) && ngx_new_binary == 0)
{ {
u_char *name = ls[i].addr_text.data + sizeof("unix:") - 1; u_char *name = ls[i].addr_text.data + sizeof("unix:") - 1;

View File

@ -72,7 +72,7 @@ ngx_poll_init(ngx_cycle_t *cycle, ngx_msec_t timer)
nevents = 0; nevents = 0;
} }
if (ngx_process == NGX_PROCESS_WORKER if (ngx_process >= NGX_PROCESS_WORKER
|| cycle->old_cycle == NULL || cycle->old_cycle == NULL
|| cycle->old_cycle->connection_n < cycle->connection_n) || cycle->old_cycle->connection_n < cycle->connection_n)
{ {

View File

@ -81,7 +81,7 @@ ngx_select_init(ngx_cycle_t *cycle, ngx_msec_t timer)
nevents = 0; nevents = 0;
} }
if (ngx_process == NGX_PROCESS_WORKER if (ngx_process >= NGX_PROCESS_WORKER
|| cycle->old_cycle == NULL || cycle->old_cycle == NULL
|| cycle->old_cycle->connection_n < cycle->connection_n) || cycle->old_cycle->connection_n < cycle->connection_n)
{ {

View File

@ -82,7 +82,7 @@ ngx_select_init(ngx_cycle_t *cycle, ngx_msec_t timer)
nevents = 0; nevents = 0;
} }
if (ngx_process == NGX_PROCESS_WORKER if (ngx_process >= NGX_PROCESS_WORKER
|| cycle->old_cycle == NULL || cycle->old_cycle == NULL
|| cycle->old_cycle->connection_n < cycle->connection_n) || cycle->old_cycle->connection_n < cycle->connection_n)
{ {

View File

@ -388,6 +388,7 @@ ngx_signal_handler(int signo)
break; break;
case NGX_PROCESS_WORKER: case NGX_PROCESS_WORKER:
case NGX_PROCESS_HELPER:
switch (signo) { switch (signo) {
case ngx_signal_value(NGX_NOACCEPT_SIGNAL): case ngx_signal_value(NGX_NOACCEPT_SIGNAL):

View File

@ -714,6 +714,8 @@ ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
ngx_uint_t i; ngx_uint_t i;
ngx_connection_t *c; ngx_connection_t *c;
ngx_process = NGX_PROCESS_WORKER;
ngx_worker_process_init(cycle, 1); ngx_worker_process_init(cycle, 1);
ngx_setproctitle("worker process"); ngx_setproctitle("worker process");
@ -829,8 +831,6 @@ ngx_worker_process_init(ngx_cycle_t *cycle, ngx_uint_t priority)
ngx_core_conf_t *ccf; ngx_core_conf_t *ccf;
ngx_listening_t *ls; ngx_listening_t *ls;
ngx_process = NGX_PROCESS_WORKER;
if (ngx_set_environment(cycle, NULL) == NULL) { if (ngx_set_environment(cycle, NULL) == NULL) {
/* fatal */ /* fatal */
exit(2); exit(2);
@ -1289,6 +1289,8 @@ ngx_cache_manager_process_cycle(ngx_cycle_t *cycle, void *data)
cycle->connection_n = 512; cycle->connection_n = 512;
ngx_process = NGX_PROCESS_HELPER;
ngx_worker_process_init(cycle, 0); ngx_worker_process_init(cycle, 0);
ngx_close_listening_sockets(cycle); ngx_close_listening_sockets(cycle);

View File

@ -21,8 +21,9 @@
#define NGX_PROCESS_SINGLE 0 #define NGX_PROCESS_SINGLE 0
#define NGX_PROCESS_MASTER 1 #define NGX_PROCESS_MASTER 1
#define NGX_PROCESS_WORKER 2 #define NGX_PROCESS_SIGNALLER 2
#define NGX_PROCESS_SIGNALLER 3 #define NGX_PROCESS_WORKER 3
#define NGX_PROCESS_HELPER 4
typedef struct { typedef struct {

View File

@ -48,11 +48,6 @@ typedef struct {
} ngx_exec_ctx_t; } ngx_exec_ctx_t;
#define NGX_PROCESS_SINGLE 0
#define NGX_PROCESS_MASTER 1
#define NGX_PROCESS_WORKER 2
ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle, char *name, ngx_int_t respawn); ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle, char *name, ngx_int_t respawn);
ngx_pid_t ngx_execute(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx); ngx_pid_t ngx_execute(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx);

View File

@ -14,8 +14,8 @@
#define NGX_PROCESS_SINGLE 0 #define NGX_PROCESS_SINGLE 0
#define NGX_PROCESS_MASTER 1 #define NGX_PROCESS_MASTER 1
#define NGX_PROCESS_WORKER 2 #define NGX_PROCESS_SIGNALLER 2
#define NGX_PROCESS_SIGNALLER 3 #define NGX_PROCESS_WORKER 3
void ngx_master_process_cycle(ngx_cycle_t *cycle); void ngx_master_process_cycle(ngx_cycle_t *cycle);