Mercurial > hg > nginx
diff src/os/unix/ngx_process.c @ 279:b79f021a644a
nginx-0.0.2-2004-03-04-19:34:23 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 04 Mar 2004 16:34:23 +0000 |
parents | d4e65d74db9f |
children | 6b91bfbc4123 |
line wrap: on
line diff
--- 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 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 "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 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 *c } -#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;