Mercurial > hg > nginx
comparison src/os/unix/ngx_process.c @ 272:d4e65d74db9f
nginx-0.0.2-2004-03-01-00:03:02 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 29 Feb 2004 21:03:02 +0000 |
parents | 2a0540287298 |
children | b79f021a644a |
comparison
equal
deleted
inserted
replaced
271:e16dfb9b9afa | 272:d4e65d74db9f |
---|---|
11 | 11 |
12 ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle, | 12 ngx_pid_t ngx_spawn_process(ngx_cycle_t *cycle, |
13 ngx_spawn_proc_pt proc, void *data, | 13 ngx_spawn_proc_pt proc, void *data, |
14 char *name, ngx_int_t respawn) | 14 char *name, ngx_int_t respawn) |
15 { | 15 { |
16 #if 0 | |
16 sigset_t set, oset; | 17 sigset_t set, oset; |
18 #endif | |
17 ngx_pid_t pid; | 19 ngx_pid_t pid; |
18 | 20 |
21 #if 0 | |
19 if (respawn < 0) { | 22 if (respawn < 0) { |
20 sigemptyset(&set); | 23 sigemptyset(&set); |
21 sigaddset(&set, SIGCHLD); | 24 sigaddset(&set, SIGCHLD); |
22 if (sigprocmask(SIG_BLOCK, &set, &oset) == -1) { | 25 if (sigprocmask(SIG_BLOCK, &set, &oset) == -1) { |
23 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | 26 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
24 "sigprocmask() failed while spawning %s", name); | 27 "sigprocmask() failed while spawning %s", name); |
25 return NGX_ERROR; | 28 return NGX_ERROR; |
26 } | 29 } |
27 } | 30 } |
31 #endif | |
28 | 32 |
29 pid = fork(); | 33 pid = fork(); |
30 | 34 |
31 if (pid == -1) { | 35 if (pid == -1) { |
32 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | 36 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
33 "fork() failed while spawning \"%s\"", name); | 37 "fork() failed while spawning \"%s\"", name); |
34 } | 38 } |
35 | 39 |
36 if (pid == -1 || pid == 0) { | 40 if (pid == -1 || pid == 0) { |
41 #if 0 | |
37 if (sigprocmask(SIG_SETMASK, &oset, &set) == -1) { | 42 if (sigprocmask(SIG_SETMASK, &oset, &set) == -1) { |
38 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | 43 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
39 "sigprocmask() failed while spawning %s", name); | 44 "sigprocmask() failed while spawning %s", name); |
40 return NGX_ERROR; | 45 return NGX_ERROR; |
41 } | 46 } |
47 #endif | |
42 } | 48 } |
43 | 49 |
44 switch (pid) { | 50 switch (pid) { |
45 case -1: | 51 case -1: |
46 return NGX_ERROR; | 52 return NGX_ERROR; |
73 (respawn == NGX_PROCESS_DETACHED) ? 1 : 0; | 79 (respawn == NGX_PROCESS_DETACHED) ? 1 : 0; |
74 ngx_processes[ngx_last_process].exited = 0; | 80 ngx_processes[ngx_last_process].exited = 0; |
75 ngx_processes[ngx_last_process].exiting = 0; | 81 ngx_processes[ngx_last_process].exiting = 0; |
76 ngx_last_process++; | 82 ngx_last_process++; |
77 | 83 |
84 #if 0 | |
78 if (sigprocmask(SIG_SETMASK, &oset, &set) == -1) { | 85 if (sigprocmask(SIG_SETMASK, &oset, &set) == -1) { |
79 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, | 86 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
80 "sigprocmask() failed while spawning %s", name); | 87 "sigprocmask() failed while spawning %s", name); |
81 return NGX_ERROR; | 88 return NGX_ERROR; |
82 } | 89 } |
90 #endif | |
83 | 91 |
84 return pid; | 92 return pid; |
85 } | 93 } |
86 | 94 |
87 | 95 |