Mercurial > hg > nginx
comparison src/core/nginx.c @ 190:02a715e85df1
nginx-0.0.1-2003-11-19-00:34:08 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 18 Nov 2003 21:34:08 +0000 |
parents | c1f3a3c7c5db |
children | 71ce40b3c37b |
comparison
equal
deleted
inserted
replaced
189:c966c09be66b | 190:02a715e85df1 |
---|---|
4 #include <ngx_event.h> | 4 #include <ngx_event.h> |
5 #include <nginx.h> | 5 #include <nginx.h> |
6 | 6 |
7 | 7 |
8 /* STUB */ | 8 /* STUB */ |
9 void stub_init(ngx_log_t *log); | 9 void stub_init(ngx_cycle_t *cycle); |
10 | |
10 | 11 |
11 | 12 |
12 static ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle, ngx_log_t *log); | 13 static ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle, ngx_log_t *log); |
13 static int ngx_open_listening_sockets(ngx_cycle_t *cycle, ngx_log_t *log); | 14 static int ngx_open_listening_sockets(ngx_cycle_t *cycle, ngx_log_t *log); |
14 static void ngx_clean_old_cycles(ngx_event_t *ev); | 15 static void ngx_clean_old_cycles(ngx_event_t *ev); |
94 log = ngx_log_init_errlog(); | 95 log = ngx_log_init_errlog(); |
95 | 96 |
96 if (ngx_os_init(log) == NGX_ERROR) { | 97 if (ngx_os_init(log) == NGX_ERROR) { |
97 return 1; | 98 return 1; |
98 } | 99 } |
99 | |
100 #if 0 | |
101 stub_init(log); | |
102 #endif | |
103 | 100 |
104 ngx_max_module = 0; | 101 ngx_max_module = 0; |
105 for (i = 0; ngx_modules[i]; i++) { | 102 for (i = 0; ngx_modules[i]; i++) { |
106 ngx_modules[i]->index = ngx_max_module++; | 103 ngx_modules[i]->index = ngx_max_module++; |
107 } | 104 } |
257 return NULL; | 254 return NULL; |
258 } | 255 } |
259 cycle->pool = pool; | 256 cycle->pool = pool; |
260 | 257 |
261 cycle->old_cycle = old_cycle; | 258 cycle->old_cycle = old_cycle; |
259 | |
260 | |
261 n = old_cycle ? old_cycle->pathes.nelts : 10; | |
262 cycle->pathes.elts = ngx_pcalloc(pool, n * sizeof(ngx_path_t *)); | |
263 if (cycle->pathes.elts == NULL) { | |
264 ngx_destroy_pool(pool); | |
265 return NULL; | |
266 } | |
267 cycle->pathes.nelts = 0; | |
268 cycle->pathes.size = sizeof(ngx_path_t *); | |
269 cycle->pathes.nalloc = n; | |
270 cycle->pathes.pool = pool; | |
262 | 271 |
263 | 272 |
264 n = old_cycle ? old_cycle->open_files.nelts : 20; | 273 n = old_cycle ? old_cycle->open_files.nelts : 20; |
265 cycle->open_files.elts = ngx_pcalloc(pool, n * sizeof(ngx_open_file_t)); | 274 cycle->open_files.elts = ngx_pcalloc(pool, n * sizeof(ngx_open_file_t)); |
266 if (cycle->open_files.elts == NULL) { | 275 if (cycle->open_files.elts == NULL) { |
453 exit(1); | 462 exit(1); |
454 } | 463 } |
455 } | 464 } |
456 } | 465 } |
457 | 466 |
467 stub_init(cycle); | |
468 | |
458 if (old_cycle == NULL) { | 469 if (old_cycle == NULL) { |
459 return cycle; | 470 return cycle; |
460 } | 471 } |
461 | 472 |
462 ls = old_cycle->listening.elts; | 473 ls = old_cycle->listening.elts; |