Mercurial > hg > nginx-quic
comparison src/os/unix/ngx_process_cycle.c @ 452:23fb87bddda1 release-0.1.1
nginx-0.1.1-RELEASE import
*) Feature: the gzip_types directive.
*) Feature: the tcp_nodelay directive.
*) Feature: the send_lowat directive is working not only on OSes that
support kqueue NOTE_LOWAT, but also on OSes that support SO_SNDLOWAT.
*) Feature: the setproctitle() emulation for Linux and Solaris.
*) Bugfix: the "Location" header rewrite bug fixed while the proxying.
*) Bugfix: the ngx_http_chunked_module module may get caught in an
endless loop.
*) Bugfix: the /dev/poll module bugs fixed.
*) Bugfix: the responses were corrupted when the temporary files were
used while the proxying.
*) Bugfix: the unescaped requests were passed to the backend.
*) Bugfix: while the build configuration on Linux 2.4 the
--with-poll_module parameter was required.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 11 Oct 2004 15:07:03 +0000 |
parents | 3b1e8c9df9ad |
children | 295d97d70c69 |
comparison
equal
deleted
inserted
replaced
451:f40362e47689 | 452:23fb87bddda1 |
---|---|
12 | 12 |
13 static void ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n, | 13 static void ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n, |
14 ngx_int_t type); | 14 ngx_int_t type); |
15 static void ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo); | 15 static void ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo); |
16 static ngx_uint_t ngx_reap_childs(ngx_cycle_t *cycle); | 16 static ngx_uint_t ngx_reap_childs(ngx_cycle_t *cycle); |
17 static void ngx_master_exit(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx); | 17 static void ngx_master_exit(ngx_cycle_t *cycle); |
18 static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data); | 18 static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data); |
19 static void ngx_channel_handler(ngx_event_t *ev); | 19 static void ngx_channel_handler(ngx_event_t *ev); |
20 #if (NGX_THREADS) | 20 #if (NGX_THREADS) |
21 static void ngx_wakeup_worker_threads(ngx_cycle_t *cycle); | 21 static void ngx_wakeup_worker_threads(ngx_cycle_t *cycle); |
22 static void *ngx_worker_thread_cycle(void *data); | 22 static void *ngx_worker_thread_cycle(void *data); |
53 | 53 |
54 | 54 |
55 u_char master_process[] = "master process"; | 55 u_char master_process[] = "master process"; |
56 | 56 |
57 | 57 |
58 void ngx_master_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx) | 58 void ngx_master_process_cycle(ngx_cycle_t *cycle) |
59 { | 59 { |
60 char *title; | 60 char *title; |
61 u_char *p; | 61 u_char *p; |
62 size_t size; | 62 size_t size; |
63 ngx_int_t i; | 63 ngx_int_t i; |
88 sigemptyset(&set); | 88 sigemptyset(&set); |
89 | 89 |
90 | 90 |
91 size = sizeof(master_process); | 91 size = sizeof(master_process); |
92 | 92 |
93 for (i = 0; i < ctx->argc; i++) { | 93 for (i = 0; i < ngx_argc; i++) { |
94 size += ngx_strlen(ctx->argv[i]) + 1; | 94 size += ngx_strlen(ngx_argv[i]) + 1; |
95 } | 95 } |
96 | 96 |
97 title = ngx_palloc(cycle->pool, size); | 97 title = ngx_palloc(cycle->pool, size); |
98 | 98 |
99 p = ngx_cpymem(title, master_process, sizeof(master_process) - 1); | 99 p = ngx_cpymem(title, master_process, sizeof(master_process) - 1); |
100 for (i = 0; i < ctx->argc; i++) { | 100 for (i = 0; i < ngx_argc; i++) { |
101 *p++ = ' '; | 101 *p++ = ' '; |
102 p = ngx_cpystrn(p, (u_char *) ctx->argv[i], size); | 102 p = ngx_cpystrn(p, (u_char *) ngx_argv[i], size); |
103 } | 103 } |
104 | 104 |
105 ngx_setproctitle(title); | 105 ngx_setproctitle(title); |
106 | 106 |
107 | 107 |
147 | 147 |
148 live = ngx_reap_childs(cycle); | 148 live = ngx_reap_childs(cycle); |
149 } | 149 } |
150 | 150 |
151 if (!live && (ngx_terminate || ngx_quit)) { | 151 if (!live && (ngx_terminate || ngx_quit)) { |
152 ngx_master_exit(cycle, ctx); | 152 ngx_master_exit(cycle); |
153 } | 153 } |
154 | 154 |
155 if (ngx_terminate) { | 155 if (ngx_terminate) { |
156 if (delay == 0) { | 156 if (delay == 0) { |
157 delay = 50; | 157 delay = 50; |
229 } | 229 } |
230 | 230 |
231 if (ngx_change_binary) { | 231 if (ngx_change_binary) { |
232 ngx_change_binary = 0; | 232 ngx_change_binary = 0; |
233 ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "changing binary"); | 233 ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "changing binary"); |
234 ngx_new_binary = ngx_exec_new_binary(cycle, ctx->argv); | 234 ngx_new_binary = ngx_exec_new_binary(cycle, ngx_argv); |
235 } | 235 } |
236 | 236 |
237 if (ngx_noaccept) { | 237 if (ngx_noaccept) { |
238 ngx_noaccept = 0; | 238 ngx_noaccept = 0; |
239 ngx_noaccepting = 1; | 239 ngx_noaccepting = 1; |
242 } | 242 } |
243 } | 243 } |
244 } | 244 } |
245 | 245 |
246 | 246 |
247 void ngx_single_process_cycle(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx) | 247 void ngx_single_process_cycle(ngx_cycle_t *cycle) |
248 { | 248 { |
249 ngx_uint_t i; | 249 ngx_uint_t i; |
250 | |
251 #if 0 | |
252 ngx_setproctitle("single worker process"); | |
253 #endif | |
254 | 250 |
255 ngx_init_temp_number(); | 251 ngx_init_temp_number(); |
256 | 252 |
257 for (i = 0; ngx_modules[i]; i++) { | 253 for (i = 0; ngx_modules[i]; i++) { |
258 if (ngx_modules[i]->init_process) { | 254 if (ngx_modules[i]->init_process) { |
267 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle"); | 263 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle"); |
268 | 264 |
269 ngx_process_events(cycle); | 265 ngx_process_events(cycle); |
270 | 266 |
271 if (ngx_terminate || ngx_quit) { | 267 if (ngx_terminate || ngx_quit) { |
272 ngx_master_exit(cycle, ctx); | 268 ngx_master_exit(cycle); |
273 } | 269 } |
274 | 270 |
275 if (ngx_reconfigure) { | 271 if (ngx_reconfigure) { |
276 ngx_reconfigure = 0; | 272 ngx_reconfigure = 0; |
277 ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "reconfiguring"); | 273 ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "reconfiguring"); |
545 | 541 |
546 return live; | 542 return live; |
547 } | 543 } |
548 | 544 |
549 | 545 |
550 static void ngx_master_exit(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx) | 546 static void ngx_master_exit(ngx_cycle_t *cycle) |
551 { | 547 { |
552 ngx_delete_pidfile(cycle); | 548 ngx_delete_pidfile(cycle); |
553 | 549 |
554 ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exit"); | 550 ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exit"); |
555 | 551 |