comparison src/core/ngx_cycle.c @ 501:d4ea69372b94 release-0.1.25

nginx-0.1.25-RELEASE import *) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author Igor Sysoev <igor@sysoev.ru>
date Sat, 19 Mar 2005 12:38:37 +0000
parents c52408583801
children cd3117ad9aab
comparison
equal deleted inserted replaced
500:9a0f304470f5 501:d4ea69372b94
52 ngx_core_conf_t *ccf; 52 ngx_core_conf_t *ccf;
53 ngx_core_module_t *module; 53 ngx_core_module_t *module;
54 54
55 log = old_cycle->log; 55 log = old_cycle->log;
56 56
57 if (!(pool = ngx_create_pool(16 * 1024, log))) { 57 pool = ngx_create_pool(16 * 1024, log);
58 if (pool == NULL) {
58 return NULL; 59 return NULL;
59 } 60 }
60 pool->log = log; 61 pool->log = log;
61 62
62 if (!(cycle = ngx_pcalloc(pool, sizeof(ngx_cycle_t)))) { 63 cycle = ngx_pcalloc(pool, sizeof(ngx_cycle_t));
64 if (cycle == NULL) {
63 ngx_destroy_pool(pool); 65 ngx_destroy_pool(pool);
64 return NULL; 66 return NULL;
65 } 67 }
68
66 cycle->pool = pool; 69 cycle->pool = pool;
67 cycle->log = log; 70 cycle->log = log;
68 cycle->old_cycle = old_cycle; 71 cycle->old_cycle = old_cycle;
69 cycle->conf_file = old_cycle->conf_file; 72 cycle->conf_file = old_cycle->conf_file;
70 cycle->root.len = sizeof(NGX_PREFIX) - 1; 73 cycle->root.len = sizeof(NGX_PREFIX) - 1;
71 cycle->root.data = (u_char *) NGX_PREFIX; 74 cycle->root.data = (u_char *) NGX_PREFIX;
72 75
73 76
74 n = old_cycle->pathes.nelts ? old_cycle->pathes.nelts : 10; 77 n = old_cycle->pathes.nelts ? old_cycle->pathes.nelts : 10;
75 if (!(cycle->pathes.elts = ngx_pcalloc(pool, n * sizeof(ngx_path_t *)))) { 78
79 cycle->pathes.elts = ngx_pcalloc(pool, n * sizeof(ngx_path_t *));
80 if (cycle->pathes.elts == NULL) {
76 ngx_destroy_pool(pool); 81 ngx_destroy_pool(pool);
77 return NULL; 82 return NULL;
78 } 83 }
84
79 cycle->pathes.nelts = 0; 85 cycle->pathes.nelts = 0;
80 cycle->pathes.size = sizeof(ngx_path_t *); 86 cycle->pathes.size = sizeof(ngx_path_t *);
81 cycle->pathes.nalloc = n; 87 cycle->pathes.nalloc = n;
82 cycle->pathes.pool = pool; 88 cycle->pathes.pool = pool;
83 89
98 ngx_destroy_pool(pool); 104 ngx_destroy_pool(pool);
99 return NULL; 105 return NULL;
100 } 106 }
101 107
102 108
103 if (!(cycle->new_log = ngx_log_create_errlog(cycle, NULL))) { 109 cycle->new_log = ngx_log_create_errlog(cycle, NULL);
110 if (cycle->new_log == NULL) {
104 ngx_destroy_pool(pool); 111 ngx_destroy_pool(pool);
105 return NULL; 112 return NULL;
106 } 113 }
107 114
108 cycle->new_log->file->name = error_log; 115 cycle->new_log->file->name = error_log;
109 116
110 117
111 n = old_cycle->listening.nelts ? old_cycle->listening.nelts : 10; 118 n = old_cycle->listening.nelts ? old_cycle->listening.nelts : 10;
119
112 cycle->listening.elts = ngx_pcalloc(pool, n * sizeof(ngx_listening_t)); 120 cycle->listening.elts = ngx_pcalloc(pool, n * sizeof(ngx_listening_t));
113 if (cycle->listening.elts == NULL) { 121 if (cycle->listening.elts == NULL) {
114 ngx_destroy_pool(pool); 122 ngx_destroy_pool(pool);
115 return NULL; 123 return NULL;
116 } 124 }
125
117 cycle->listening.nelts = 0; 126 cycle->listening.nelts = 0;
118 cycle->listening.size = sizeof(ngx_listening_t); 127 cycle->listening.size = sizeof(ngx_listening_t);
119 cycle->listening.nalloc = n; 128 cycle->listening.nalloc = n;
120 cycle->listening.pool = pool; 129 cycle->listening.pool = pool;
121 130
145 } 154 }
146 155
147 156
148 ngx_memzero(&conf, sizeof(ngx_conf_t)); 157 ngx_memzero(&conf, sizeof(ngx_conf_t));
149 /* STUB: init array ? */ 158 /* STUB: init array ? */
150 conf.args = ngx_create_array(pool, 10, sizeof(ngx_str_t)); 159 conf.args = ngx_array_create(pool, 10, sizeof(ngx_str_t));
151 if (conf.args == NULL) { 160 if (conf.args == NULL) {
152 ngx_destroy_pool(pool); 161 ngx_destroy_pool(pool);
153 return NULL; 162 return NULL;
154 } 163 }
155 164
514 dumb.fd = (ngx_socket_t) -1; 523 dumb.fd = (ngx_socket_t) -1;
515 } 524 }
516 525
517 ngx_temp_pool->log = cycle->log; 526 ngx_temp_pool->log = cycle->log;
518 527
519 old = ngx_push_array(&ngx_old_cycles); 528 old = ngx_array_push(&ngx_old_cycles);
520 if (old == NULL) { 529 if (old == NULL) {
521 exit(1); 530 exit(1);
522 } 531 }
523 *old = old_cycle; 532 *old = old_cycle;
524 533
560 569
561 ngx_int_t ngx_create_pidfile(ngx_cycle_t *cycle, ngx_cycle_t *old_cycle) 570 ngx_int_t ngx_create_pidfile(ngx_cycle_t *cycle, ngx_cycle_t *old_cycle)
562 { 571 {
563 ngx_uint_t trunc; 572 ngx_uint_t trunc;
564 size_t len; 573 size_t len;
565 u_char *name, pid[NGX_INT64_LEN]; 574 u_char pid[NGX_INT64_LEN];
566 ngx_file_t file; 575 ngx_file_t file;
567 ngx_core_conf_t *ccf, *old_ccf; 576 ngx_core_conf_t *ccf, *old_ccf;
568 577
569 if (!ngx_test_config && old_cycle && old_cycle->conf_ctx == NULL) { 578 if (!ngx_test_config && old_cycle && old_cycle->conf_ctx == NULL) {
570 579