diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-03-04 19:34:23 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-03-04 19:34:23 +0300 |
commit | 6a9304522227d4b4df873d3716cf06093d497700 (patch) | |
tree | bc6a3eb7d26df2048714235ce96b98471b813979 /src/os/unix/ngx_process.c | |
parent | a536298c7bd1f525db97facab814a2906214ee7f (diff) |
nginx-0.0.2-2004-03-04-19:34:23 import
Diffstat (limited to 'src/os/unix/ngx_process.c')
-rw-r--r-- | src/os/unix/ngx_process.c | 82 |
1 files changed, 4 insertions, 78 deletions
diff --git a/src/os/unix/ngx_process.c b/src/os/unix/ngx_process.c index 3210819f7..d49ba3258 100644 --- a/src/os/unix/ngx_process.c +++ b/src/os/unix/ngx_process.c @@ -3,7 +3,7 @@ #include <ngx_core.h> -static void ngx_exec_proc(ngx_cycle_t *cycle, void *data); +static void ngx_execute_proc(ngx_cycle_t *cycle, void *data); ngx_uint_t ngx_last_process; ngx_process_t ngx_processes[NGX_MAX_PROCESSES]; @@ -13,23 +13,8 @@ ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle, ngx_spawn_proc_pt proc, void *data, char *name, ngx_int_t respawn) { -#if 0 - sigset_t set, oset; -#endif ngx_pid_t pid; -#if 0 - if (respawn < 0) { - sigemptyset(&set); - sigaddset(&set, SIGCHLD); - if (sigprocmask(SIG_BLOCK, &set, &oset) == -1) { - ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, - "sigprocmask() failed while spawning %s", name); - return NGX_ERROR; - } - } -#endif - pid = fork(); if (pid == -1) { @@ -37,16 +22,6 @@ ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle, "fork() failed while spawning \"%s\"", name); } - if (pid == -1 || pid == 0) { -#if 0 - if (sigprocmask(SIG_SETMASK, &oset, &set) == -1) { - ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, - "sigprocmask() failed while spawning %s", name); - return NGX_ERROR; - } -#endif - } - switch (pid) { case -1: return NGX_ERROR; @@ -81,26 +56,18 @@ ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle, ngx_processes[ngx_last_process].exiting = 0; ngx_last_process++; -#if 0 - if (sigprocmask(SIG_SETMASK, &oset, &set) == -1) { - ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, - "sigprocmask() failed while spawning %s", name); - return NGX_ERROR; - } -#endif - return pid; } -ngx_pid_t ngx_exec(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx) +ngx_pid_t ngx_execute(ngx_cycle_t *cycle, ngx_exec_ctx_t *ctx) { - return ngx_spawn_process(cycle, ngx_exec_proc, ctx, ctx->name, + return ngx_spawn_process(cycle, ngx_execute_proc, ctx, ctx->name, NGX_PROCESS_DETACHED); } -static void ngx_exec_proc(ngx_cycle_t *cycle, void *data) +static void ngx_execute_proc(ngx_cycle_t *cycle, void *data) { ngx_exec_ctx_t *ctx = data; @@ -114,47 +81,6 @@ static void ngx_exec_proc(ngx_cycle_t *cycle, void *data) } -#if 0 - -void ngx_signal_processes(ngx_cycle_t *cycle) -{ - ngx_uint_t i; - - for (i = 0; i < ngx_last_process; i++) { - - if (ngx_processes[i].signal0 == 0) { - continue; - } - -#if 0 - if (ngx_processes[i].exited) { - if (i != --ngx_last_process) { - ngx_processes[i--] = ngx_processes[ngx_last_process]; - } - continue; - } -#endif - - ngx_log_debug2(NGX_LOG_DEBUG_CORE, cycle->log, 0, - "kill (" PID_T_FMT ", %d)" , - ngx_processes[i].pid, ngx_processes[i].signal0); - - if (kill(ngx_processes[i].pid, ngx_processes[i].signal0) == -1) { - ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, - "kill(%d, %d) failed", - ngx_processes[i].pid, ngx_processes[i].signal0); - continue; - } - - if (ngx_processes[i].signal0 != ngx_signal_value(NGX_REOPEN_SIGNAL)) { - ngx_processes[i].exiting = 1; - } - } -} - -#endif - - void ngx_respawn_processes(ngx_cycle_t *cycle) { ngx_uint_t i; |