annotate src/core/ngx_cycle.c @ 317:1308b98496a2

nginx-0.0.3-2004-04-15-19:34:36 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 15 Apr 2004 15:34:36 +0000
parents a0beefedaf94
children 56496082668b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
1
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
2 #include <ngx_config.h>
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
3 #include <ngx_core.h>
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
4 #include <ngx_event.h>
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
5
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
6
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
7 static void ngx_clean_old_cycles(ngx_event_t *ev);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
10 volatile ngx_cycle_t *ngx_cycle;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
11 ngx_array_t ngx_old_cycles;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
12
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
13 static ngx_pool_t *ngx_temp_pool;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
14 static ngx_event_t ngx_cleaner_event;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
15
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
16
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
17 /* STUB NAME */
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
18 static ngx_connection_t dumb;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
19 /* STUB */
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
20
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
21
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
22 ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
23 {
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
24 void *rv;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
25 ngx_uint_t i, n, failed;
317
1308b98496a2 nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents: 316
diff changeset
26 ngx_log_t *log;
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
27 ngx_conf_t conf;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
28 ngx_pool_t *pool;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
29 ngx_cycle_t *cycle, **old;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
30 ngx_socket_t fd;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
31 ngx_open_file_t *file;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
32 ngx_listening_t *ls, *nls;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
33 ngx_core_module_t *module;
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
34
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
35 log = old_cycle->log;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
36
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
37 if (!(pool = ngx_create_pool(16 * 1024, log))) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
38 return NULL;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
39 }
317
1308b98496a2 nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents: 316
diff changeset
40 pool->log = log;
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
41
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
42 if (!(cycle = ngx_pcalloc(pool, sizeof(ngx_cycle_t)))) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
43 ngx_destroy_pool(pool);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
44 return NULL;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
45 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
46 cycle->pool = pool;
316
a0beefedaf94 nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents: 311
diff changeset
47 cycle->log = log;
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
48 cycle->old_cycle = old_cycle;
255
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 249
diff changeset
49 cycle->conf_file = old_cycle->conf_file;
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
50
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
51
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
52 n = old_cycle->pathes.nelts ? old_cycle->pathes.nelts : 10;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
53 if (!(cycle->pathes.elts = ngx_pcalloc(pool, n * sizeof(ngx_path_t *)))) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
54 ngx_destroy_pool(pool);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
55 return NULL;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
56 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
57 cycle->pathes.nelts = 0;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
58 cycle->pathes.size = sizeof(ngx_path_t *);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
59 cycle->pathes.nalloc = n;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
60 cycle->pathes.pool = pool;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
61
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
62
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
63 n = old_cycle->open_files.nelts ? old_cycle->open_files.nelts : 20;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
64 cycle->open_files.elts = ngx_pcalloc(pool, n * sizeof(ngx_open_file_t));
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
65 if (cycle->open_files.elts == NULL) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
66 ngx_destroy_pool(pool);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
67 return NULL;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
68 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
69 cycle->open_files.nelts = 0;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
70 cycle->open_files.size = sizeof(ngx_open_file_t);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
71 cycle->open_files.nalloc = n;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
72 cycle->open_files.pool = pool;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
73
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
74
317
1308b98496a2 nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents: 316
diff changeset
75 if (!(cycle->new_log = ngx_log_create_errlog(cycle, NULL))) {
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
76 ngx_destroy_pool(pool);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
77 return NULL;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
78 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
79
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
80
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
81 n = old_cycle->listening.nelts ? old_cycle->listening.nelts : 10;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
82 cycle->listening.elts = ngx_pcalloc(pool, n * sizeof(ngx_listening_t));
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
83 if (cycle->listening.elts == NULL) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
84 ngx_destroy_pool(pool);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
85 return NULL;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
86 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
87 cycle->listening.nelts = 0;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
88 cycle->listening.size = sizeof(ngx_listening_t);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
89 cycle->listening.nalloc = n;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
90 cycle->listening.pool = pool;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
91
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
92
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
93 cycle->conf_ctx = ngx_pcalloc(pool, ngx_max_module * sizeof(void *));
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
94 if (cycle->conf_ctx == NULL) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
95 ngx_destroy_pool(pool);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
96 return NULL;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
97 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
98
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
99
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
100 for (i = 0; ngx_modules[i]; i++) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
101 if (ngx_modules[i]->type != NGX_CORE_MODULE) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
102 continue;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
103 }
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
104
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
105 module = ngx_modules[i]->ctx;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
106
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
107 if (module->create_conf) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
108 rv = module->create_conf(cycle);
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
109 if (rv == NGX_CONF_ERROR) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
110 ngx_destroy_pool(pool);
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
111 return NULL;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
112 }
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
113 cycle->conf_ctx[ngx_modules[i]->index] = rv;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
114 }
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
115 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
116
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
117
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
118 ngx_memzero(&conf, sizeof(ngx_conf_t));
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
119 /* STUB: init array ? */
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
120 conf.args = ngx_create_array(pool, 10, sizeof(ngx_str_t));
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
121 if (conf.args == NULL) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
122 ngx_destroy_pool(pool);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
123 return NULL;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
124 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
125
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
126 conf.ctx = cycle->conf_ctx;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
127 conf.cycle = cycle;
317
1308b98496a2 nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents: 316
diff changeset
128 conf.pool = pool;
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
129 conf.log = log;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
130 conf.module_type = NGX_CORE_MODULE;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
131 conf.cmd_type = NGX_MAIN_CONF;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
132
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
133
255
e6938ca7331a nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 249
diff changeset
134 if (ngx_conf_parse(&conf, &cycle->conf_file) != NGX_CONF_OK) {
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
135 ngx_destroy_pool(pool);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
136 return NULL;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
137 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
138
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
139
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
140 for (i = 0; ngx_modules[i]; i++) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
141 if (ngx_modules[i]->type != NGX_CORE_MODULE) {
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
142 continue;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
143 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
144
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
145 module = ngx_modules[i]->ctx;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
146
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
147 if (module->init_conf) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
148 if (module->init_conf(cycle, cycle->conf_ctx[ngx_modules[i]->index])
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
149 == NGX_CONF_ERROR)
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
150 {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
151 ngx_destroy_pool(pool);
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
152 return NULL;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
153 }
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
154 }
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
155 }
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
156
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
157
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
158 failed = 0;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
159
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
160
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
161 #if !(WIN32)
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
162 if (ngx_create_pidfile(cycle, old_cycle) == NGX_ERROR) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
163 failed = 1;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
164 }
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
165 #endif
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
166
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
167
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
168 if (!failed) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
169 file = cycle->open_files.elts;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
170 for (i = 0; i < cycle->open_files.nelts; i++) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
171 if (file[i].name.data == NULL) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
172 continue;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
173 }
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
174
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
175 file[i].fd = ngx_open_file(file[i].name.data,
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
176 NGX_FILE_RDWR,
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
177 NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
178
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
179 if (file[i].fd == NGX_INVALID_FILE) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
180 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
181 ngx_open_file_n " \"%s\" failed",
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
182 file[i].name.data);
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
183 failed = 1;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
184 break;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
185 }
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
186
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
187 #if (WIN32)
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
188 if (ngx_file_append_mode(file[i].fd) == NGX_ERROR) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
189 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
190 ngx_file_append_mode_n " \"%s\" failed",
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
191 file[i].name.data);
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
192 failed = 1;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
193 break;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
194 }
227
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
195 #else
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
196 if (fcntl(file[i].fd, F_SETFD, FD_CLOEXEC) == -1) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
197 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
198 "fcntl(FD_CLOEXEC) \"%s\" failed",
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
199 file[i].name.data);
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
200 failed = 1;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
201 break;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
202 }
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
203 #endif
227
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
204 }
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
205 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
206
317
1308b98496a2 nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents: 316
diff changeset
207 cycle->log = cycle->new_log;
1308b98496a2 nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents: 316
diff changeset
208 pool->log = cycle->new_log;
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
209
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
210 if (!failed) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
211 if (old_cycle->listening.nelts) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
212 ls = old_cycle->listening.elts;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
213 for (i = 0; i < old_cycle->listening.nelts; i++) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
214 ls[i].remain = 0;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
215 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
216
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
217 nls = cycle->listening.elts;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
218 for (n = 0; n < cycle->listening.nelts; n++) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
219 for (i = 0; i < old_cycle->listening.nelts; i++) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
220 if (ls[i].ignore) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
221 continue;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
222 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
223
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
224 if (ngx_memcmp(nls[n].sockaddr,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
225 ls[i].sockaddr, ls[i].socklen) == 0)
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
226 {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
227 fd = ls[i].fd;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
228 #if (WIN32)
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
229 /*
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
230 * Winsock assignes a socket number divisible by 4 so
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
231 * to find a connection we divide a socket number by 4.
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
232 */
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
233
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
234 fd /= 4;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
235 #endif
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
236 if (fd >= (ngx_socket_t) cycle->connection_n) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
237 ngx_log_error(NGX_LOG_EMERG, log, 0,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
238 "%d connections is not enough to hold "
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
239 "an open listening socket on %s, "
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
240 "required at least %d connections",
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
241 cycle->connection_n,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
242 ls[i].addr_text.data, fd);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
243 failed = 1;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
244 break;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
245 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
246
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
247 nls[n].fd = ls[i].fd;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
248 nls[i].remain = 1;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
249 ls[i].remain = 1;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
250 break;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
251 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
252 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
253
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
254 if (nls[n].fd == -1) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
255 nls[n].new = 1;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
256 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
257 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
258
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
259 } else {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
260 ls = cycle->listening.elts;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
261 for (i = 0; i < cycle->listening.nelts; i++) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
262 ls[i].new = 1;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
263 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
264 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
265
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
266 if (!failed) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
267 if (ngx_open_listening_sockets(cycle) == NGX_ERROR) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
268 failed = 1;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
269 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
270 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
271 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
272
286
fc8dc489247e nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
273 #if !(WIN32)
fc8dc489247e nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
274
278
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
275 if (dup2(cycle->log->file->fd, STDERR_FILENO) == NGX_ERROR) {
249
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 237
diff changeset
276 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 237
diff changeset
277 "dup2(STDERR) failed");
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 237
diff changeset
278 failed = 1;
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 237
diff changeset
279 }
286
fc8dc489247e nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
280
278
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
281 #endif
249
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 237
diff changeset
282
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
283 if (failed) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
284
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
285 /* rollback the new cycle configuration */
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
286
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
287 file = cycle->open_files.elts;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
288 for (i = 0; i < cycle->open_files.nelts; i++) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
289 if (file[i].fd == NGX_INVALID_FILE) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
290 continue;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
291 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
292
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
293 if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
294 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
295 ngx_close_file_n " \"%s\" failed",
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
296 file[i].name.data);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
297 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
298 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
299
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
300 ls = cycle->listening.elts;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
301 for (i = 0; i < cycle->listening.nelts; i++) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
302 if (ls[i].new && ls[i].fd == -1) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
303 continue;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
304 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
305
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
306 if (ngx_close_socket(ls[i].fd) == -1) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
307 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
308 ngx_close_socket_n " %s failed",
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
309 ls[i].addr_text.data);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
310 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
311 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
312
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
313 ngx_destroy_pool(pool);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
314 return NULL;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
315 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
316
249
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 237
diff changeset
317
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
318 /* commit the new cycle configuration */
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
319
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
320 pool->log = cycle->log;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
321
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
322
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
323 for (i = 0; ngx_modules[i]; i++) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
324 if (ngx_modules[i]->init_module) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
325 if (ngx_modules[i]->init_module(cycle) == NGX_ERROR) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
326 /* fatal */
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
327 exit(1);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
328 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
329 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
330 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
331
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
332 /* close and delete stuff that lefts from an old cycle */
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
333
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
334 /* close the unneeded listening sockets */
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
335
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
336 ls = old_cycle->listening.elts;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
337 for (i = 0; i < old_cycle->listening.nelts; i++) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
338 if (ls[i].remain) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
339 continue;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
340 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
341
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
342 if (ngx_close_socket(ls[i].fd) == -1) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
343 ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
344 ngx_close_socket_n " %s failed",
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
345 ls[i].addr_text.data);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
346 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
347 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
348
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
349
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
350 /* close the unneeded open files */
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
351
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
352 file = old_cycle->open_files.elts;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
353 for (i = 0; i < old_cycle->open_files.nelts; i++) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
354 if (file[i].fd == NGX_INVALID_FILE) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
355 continue;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
356 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
357
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
358 if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
359 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
360 ngx_close_file_n " \"%s\" failed",
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
361 file[i].name.data);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
362 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
363 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
364
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
365 if (old_cycle->connections == NULL) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
366 /* an old cycle is an init cycle */
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
367 ngx_destroy_pool(old_cycle->pool);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
368 return cycle;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
369 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
370
220
4f81b931e9ff nginx-0.0.1-2004-01-08-11:47:17 import
Igor Sysoev <igor@sysoev.ru>
parents: 219
diff changeset
371 if (ngx_process == NGX_PROCESS_MASTER) {
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
372 ngx_destroy_pool(old_cycle->pool);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
373 return cycle;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
374 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
375
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
376 if (ngx_temp_pool == NULL) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
377 ngx_temp_pool = ngx_create_pool(128, cycle->log);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
378 if (ngx_temp_pool == NULL) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
379 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
380 "can not create ngx_temp_pool");
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
381 exit(1);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
382 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
383
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
384 n = 10;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
385 ngx_old_cycles.elts = ngx_pcalloc(ngx_temp_pool,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
386 n * sizeof(ngx_cycle_t *));
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
387 if (ngx_old_cycles.elts == NULL) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
388 exit(1);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
389 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
390 ngx_old_cycles.nelts = 0;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
391 ngx_old_cycles.size = sizeof(ngx_cycle_t *);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
392 ngx_old_cycles.nalloc = n;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
393 ngx_old_cycles.pool = ngx_temp_pool;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
394
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
395 ngx_cleaner_event.event_handler = ngx_clean_old_cycles;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
396 ngx_cleaner_event.log = cycle->log;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
397 ngx_cleaner_event.data = &dumb;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
398 dumb.fd = (ngx_socket_t) -1;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
399 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
400
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
401 ngx_temp_pool->log = cycle->log;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
402
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
403 old = ngx_push_array(&ngx_old_cycles);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
404 if (old == NULL) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
405 exit(1);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
406 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
407 *old = old_cycle;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
408
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
409 if (!ngx_cleaner_event.timer_set) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
410 ngx_add_timer(&ngx_cleaner_event, 30000);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
411 ngx_cleaner_event.timer_set = 1;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
412 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
413
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
414 return cycle;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
415 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
416
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
417
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
418 #if !(WIN32)
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
419
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
420 ngx_int_t ngx_create_pidfile(ngx_cycle_t *cycle, ngx_cycle_t *old_cycle)
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
421 {
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
422 size_t len;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
423 u_char *name, pid[NGX_INT64_LEN + 1];
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
424 ngx_file_t file;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
425 ngx_core_conf_t *ccf, *old_ccf;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
426
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
427 if (old_cycle && old_cycle->conf_ctx == NULL) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
428
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
429 /*
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
430 * do not create the pid file in the first ngx_init_cycle() call
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
431 * because we need to write the demonized process pid
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
432 */
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
433
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
434 return NGX_OK;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
435 }
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
436
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
437 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
438
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
439 if (old_cycle) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
440 old_ccf = (ngx_core_conf_t *) ngx_get_conf(old_cycle->conf_ctx,
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
441 ngx_core_module);
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
442
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
443 if (ccf->pid.len == old_ccf->pid.len
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
444 && ngx_strcmp(ccf->pid.data, old_ccf->pid.data) == 0)
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
445 {
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
446 return NGX_OK;
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
447 }
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
448 }
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
449
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
450 len = ngx_snprintf((char *) pid, NGX_INT64_LEN + 1, PID_T_FMT, ngx_pid);
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
451
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
452 ngx_memzero(&file, sizeof(ngx_file_t));
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
453 file.name = (ngx_inherited && getppid() > 1) ? ccf->newpid : ccf->pid;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
454 file.log = cycle->log;
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
455
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
456 file.fd = ngx_open_file(file.name.data, NGX_FILE_RDWR,
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
457 NGX_FILE_CREATE_OR_OPEN);
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
458
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
459 if (file.fd == NGX_INVALID_FILE) {
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
460 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
461 ngx_open_file_n " \"%s\" failed", file.name.data);
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
462 return NGX_ERROR;
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
463 }
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
464
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
465 if (ngx_write_file(&file, pid, len, 0) == NGX_ERROR) {
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
466 return NGX_ERROR;
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
467 }
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
468
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
469 if (ngx_close_file(file.fd) == NGX_FILE_ERROR) {
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
470 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
471 ngx_close_file_n " \"%s\" failed", file.name.data);
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
472 }
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
473
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
474 ngx_delete_pidfile(old_cycle);
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
475
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
476 return NGX_OK;
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
477 }
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
478
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
479
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
480 void ngx_delete_pidfile(ngx_cycle_t *cycle)
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
481 {
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
482 u_char *name;
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
483 ngx_core_conf_t *ccf;
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
484
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
485 if (cycle == NULL || cycle->conf_ctx == NULL) {
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
486 return;
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
487 }
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
488
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
489 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
490
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
491 if (ngx_inherited && getppid() > 1) {
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
492 name = ccf->newpid.data;
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
493
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
494 } else {
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
495 name = ccf->pid.data;
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
496 }
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
497
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
498 if (ngx_delete_file(name) == NGX_FILE_ERROR) {
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
499 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
500 ngx_delete_file_n " \"%s\" failed", name);
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
501 }
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
502 }
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
503
311
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
504 #endif
11ff50a35d6d nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 310
diff changeset
505
310
a9a9af2c7370 nginx-0.0.3-2004-04-12-10:10:53 import
Igor Sysoev <igor@sysoev.ru>
parents: 290
diff changeset
506
278
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
507 void ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
508 {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
509 ngx_fd_t fd;
290
87e73f067470 nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents: 286
diff changeset
510 ngx_uint_t i;
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
511 ngx_open_file_t *file;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
512
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
513 file = cycle->open_files.elts;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
514 for (i = 0; i < cycle->open_files.nelts; i++) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
515 if (file[i].name.data == NULL) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
516 continue;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
517 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
518
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
519 fd = ngx_open_file(file[i].name.data, NGX_FILE_RDWR,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
520 NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
521
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
522 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
523 "reopen file \"%s\", old:%d new:%d",
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
524 file[i].name.data, file[i].fd, fd);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
525
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
526 if (fd == NGX_INVALID_FILE) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
527 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
528 ngx_open_file_n " \"%s\" failed", file[i].name.data);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
529 continue;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
530 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
531
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
532 #if (WIN32)
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
533 if (ngx_file_append_mode(fd) == NGX_ERROR) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
534 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
535 ngx_file_append_mode_n " \"%s\" failed",
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
536 file[i].name.data);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
537
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
538 if (ngx_close_file(fd) == NGX_FILE_ERROR) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
539 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
540 ngx_close_file_n " \"%s\" failed",
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
541 file[i].name.data);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
542 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
543
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
544 continue;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
545 }
227
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
546 #else
278
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
547 if (user != (ngx_uid_t) -1) {
290
87e73f067470 nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents: 286
diff changeset
548 if (chown((const char *) file[i].name.data, user, -1) == -1) {
278
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
549 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
550 "chown \"%s\" failed", file[i].name.data);
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
551
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
552 if (ngx_close_file(fd) == NGX_FILE_ERROR) {
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
553 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
554 ngx_close_file_n " \"%s\" failed",
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
555 file[i].name.data);
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
556 }
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
557 }
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
558 }
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
559
227
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
560 if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
561 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
562 "fcntl(FD_CLOEXEC) \"%s\" failed",
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
563 file[i].name.data);
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
564
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
565 if (ngx_close_file(fd) == NGX_FILE_ERROR) {
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
566 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
567 ngx_close_file_n " \"%s\" failed",
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
568 file[i].name.data);
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
569 }
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
570
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
571 continue;
2ba3477070ac nginx-0.0.1-2004-01-14-21:19:42 import
Igor Sysoev <igor@sysoev.ru>
parents: 220
diff changeset
572 }
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
573 #endif
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
574
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
575 if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
576 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
577 ngx_close_file_n " \"%s\" failed",
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
578 file[i].name.data);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
579 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
580
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
581 file[i].fd = fd;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
582 }
249
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 237
diff changeset
583
286
fc8dc489247e nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
584 #if !(WIN32)
fc8dc489247e nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
585
249
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 237
diff changeset
586 if (dup2(cycle->log->file->fd, STDERR_FILENO) == -1) {
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 237
diff changeset
587 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 237
diff changeset
588 "dup2(STDERR) failed");
2a0540287298 nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 237
diff changeset
589 }
286
fc8dc489247e nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 282
diff changeset
590
278
0ba4821f4460 nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 257
diff changeset
591 #endif
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
592 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
593
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
594
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
595 static void ngx_clean_old_cycles(ngx_event_t *ev)
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
596 {
290
87e73f067470 nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents: 286
diff changeset
597 ngx_uint_t i, n, found, live;
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
598 ngx_log_t *log;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
599 ngx_cycle_t **cycle;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
600
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
601 log = ngx_cycle->log;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
602 ngx_temp_pool->log = log;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
603
257
70e1c7d2b83d nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents: 255
diff changeset
604 ngx_log_debug0(NGX_LOG_DEBUG_CORE, log, 0, "clean old cycles");
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
605
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
606 live = 0;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
607
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
608 cycle = ngx_old_cycles.elts;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
609 for (i = 0; i < ngx_old_cycles.nelts; i++) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
610
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
611 if (cycle[i] == NULL) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
612 continue;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
613 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
614
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
615 found = 0;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
616
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
617 for (n = 0; n < cycle[i]->connection_n; n++) {
290
87e73f067470 nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents: 286
diff changeset
618 if (cycle[i]->connections[n].fd != (ngx_socket_t) -1) {
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
619 found = 1;
257
70e1c7d2b83d nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents: 255
diff changeset
620
70e1c7d2b83d nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents: 255
diff changeset
621 ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "live fd:%d", n);
70e1c7d2b83d nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents: 255
diff changeset
622
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
623 break;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
624 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
625 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
626
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
627 if (found) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
628 live = 1;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
629 continue;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
630 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
631
257
70e1c7d2b83d nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents: 255
diff changeset
632 ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "clean old cycle: %d", i);
70e1c7d2b83d nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents: 255
diff changeset
633
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
634 ngx_destroy_pool(cycle[i]->pool);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
635 cycle[i] = NULL;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
636 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
637
257
70e1c7d2b83d nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents: 255
diff changeset
638 ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "old cycles status: %d", live);
218
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
639
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
640 if (live) {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
641 ngx_add_timer(ev, 30000);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
642
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
643 } else {
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
644 ngx_destroy_pool(ngx_temp_pool);
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
645 ngx_temp_pool = NULL;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
646 ngx_old_cycles.nelts = 0;
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
647 }
05592fd7a436 nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
648 }