Mercurial > hg > nginx-quic
annotate src/core/nginx.c @ 5361:7094d6da2806
Win32: $request_time fixed.
On win32, time_t is 64 bits wide by default, and passing an ngx_msec_int_t
argument for %T format specifier doesn't work. This doesn't manifest itself
on other platforms as time_t and ngx_msec_int_t are usually of the same size.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 04 Sep 2013 20:48:30 +0400 |
parents | 314c3d7cc3a5 |
children | 1209b8a7b077 |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
440
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
440
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
443
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
440
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
440
diff
changeset
|
6 |
98
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
7 |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
8 #include <ngx_config.h> |
c9b243802a17
nginx-0.0.1-2003-05-30-18:27:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
97
diff
changeset
|
9 #include <ngx_core.h> |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 #include <nginx.h> |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
13 static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle); |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
14 static ngx_int_t ngx_get_options(int argc, char *const *argv); |
2758 | 15 static ngx_int_t ngx_process_options(ngx_cycle_t *cycle); |
452 | 16 static ngx_int_t ngx_save_argv(ngx_cycle_t *cycle, int argc, char *const *argv); |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
17 static void *ngx_core_module_create_conf(ngx_cycle_t *cycle); |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
18 static char *ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf); |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
19 static char *ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
1069 | 20 static char *ngx_set_env(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
473 | 21 static char *ngx_set_priority(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
577 | 22 static char *ngx_set_cpu_affinity(ngx_conf_t *cf, ngx_command_t *cmd, |
23 void *conf); | |
4890
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
24 static char *ngx_set_worker_processes(ngx_conf_t *cf, ngx_command_t *cmd, |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
25 void *conf); |
3
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
2
diff
changeset
|
26 |
117
f6e3c5d019b6
nginx-0.0.1-2003-07-11-19:17:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
27 |
461 | 28 static ngx_conf_enum_t ngx_debug_points[] = { |
29 { ngx_string("stop"), NGX_DEBUG_POINTS_STOP }, | |
30 { ngx_string("abort"), NGX_DEBUG_POINTS_ABORT }, | |
31 { ngx_null_string, 0 } | |
577 | 32 }; |
461 | 33 |
34 | |
117
f6e3c5d019b6
nginx-0.0.1-2003-07-11-19:17:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
35 static ngx_command_t ngx_core_commands[] = { |
f6e3c5d019b6
nginx-0.0.1-2003-07-11-19:17:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
36 |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
37 { ngx_string("daemon"), |
563 | 38 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_FLAG, |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
39 ngx_conf_set_flag_slot, |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
40 0, |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
41 offsetof(ngx_core_conf_t, daemon), |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
42 NULL }, |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
43 |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
44 { ngx_string("master_process"), |
563 | 45 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_FLAG, |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
46 ngx_conf_set_flag_slot, |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
47 0, |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
48 offsetof(ngx_core_conf_t, master), |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
49 NULL }, |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
50 |
563 | 51 { ngx_string("timer_resolution"), |
52 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
53 ngx_conf_set_msec_slot, | |
54 0, | |
55 offsetof(ngx_core_conf_t, timer_resolution), | |
56 NULL }, | |
57 | |
543 | 58 { ngx_string("pid"), |
59 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
60 ngx_conf_set_str_slot, | |
61 0, | |
62 offsetof(ngx_core_conf_t, pid), | |
63 NULL }, | |
64 | |
611 | 65 { ngx_string("lock_file"), |
66 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
67 ngx_conf_set_str_slot, | |
68 0, | |
69 offsetof(ngx_core_conf_t, lock_file), | |
70 NULL }, | |
71 | |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
72 { ngx_string("worker_processes"), |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
73 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, |
4890
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
74 ngx_set_worker_processes, |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
75 0, |
4890
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
76 0, |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
77 NULL }, |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
78 |
461 | 79 { ngx_string("debug_points"), |
80 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
81 ngx_conf_set_enum_slot, | |
82 0, | |
83 offsetof(ngx_core_conf_t, debug_points), | |
84 &ngx_debug_points }, | |
85 | |
543 | 86 { ngx_string("user"), |
87 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE12, | |
88 ngx_set_user, | |
89 0, | |
90 0, | |
91 NULL }, | |
92 | |
93 { ngx_string("worker_priority"), | |
94 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
95 ngx_set_priority, | |
96 0, | |
97 0, | |
98 NULL }, | |
99 | |
577 | 100 { ngx_string("worker_cpu_affinity"), |
101 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_1MORE, | |
102 ngx_set_cpu_affinity, | |
103 0, | |
104 0, | |
105 NULL }, | |
106 | |
543 | 107 { ngx_string("worker_rlimit_nofile"), |
108 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
109 ngx_conf_set_num_slot, | |
110 0, | |
111 offsetof(ngx_core_conf_t, rlimit_nofile), | |
112 NULL }, | |
113 | |
589 | 114 { ngx_string("worker_rlimit_core"), |
115 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
3762
89002ac695e5
worker_rlimit_core should be off_t
Igor Sysoev <igor@sysoev.ru>
parents:
3750
diff
changeset
|
116 ngx_conf_set_off_slot, |
589 | 117 0, |
118 offsetof(ngx_core_conf_t, rlimit_core), | |
119 NULL }, | |
120 | |
543 | 121 { ngx_string("worker_rlimit_sigpending"), |
122 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
123 ngx_conf_set_num_slot, | |
124 0, | |
125 offsetof(ngx_core_conf_t, rlimit_sigpending), | |
126 NULL }, | |
127 | |
128 { ngx_string("working_directory"), | |
129 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
130 ngx_conf_set_str_slot, | |
131 0, | |
132 offsetof(ngx_core_conf_t, working_directory), | |
133 NULL }, | |
134 | |
1069 | 135 { ngx_string("env"), |
136 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, | |
137 ngx_set_env, | |
138 0, | |
139 0, | |
140 NULL }, | |
141 | |
376
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
142 #if (NGX_THREADS) |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
143 |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
144 { ngx_string("worker_threads"), |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
145 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
146 ngx_conf_set_num_slot, |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
147 0, |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
148 offsetof(ngx_core_conf_t, worker_threads), |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
149 NULL }, |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
150 |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
151 { ngx_string("thread_stack_size"), |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
152 NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
153 ngx_conf_set_size_slot, |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
154 0, |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
155 offsetof(ngx_core_conf_t, thread_stack_size), |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
156 NULL }, |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
157 |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
158 #endif |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
159 |
209
e1c815be05ae
nginx-0.0.1-2003-12-09-18:08:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
207
diff
changeset
|
160 ngx_null_command |
117
f6e3c5d019b6
nginx-0.0.1-2003-07-11-19:17:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
161 }; |
f6e3c5d019b6
nginx-0.0.1-2003-07-11-19:17:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
162 |
f6e3c5d019b6
nginx-0.0.1-2003-07-11-19:17:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
163 |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
164 static ngx_core_module_t ngx_core_module_ctx = { |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
165 ngx_string("core"), |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
166 ngx_core_module_create_conf, |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
167 ngx_core_module_init_conf |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
168 }; |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
169 |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
170 |
117
f6e3c5d019b6
nginx-0.0.1-2003-07-11-19:17:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
171 ngx_module_t ngx_core_module = { |
509 | 172 NGX_MODULE_V1, |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
173 &ngx_core_module_ctx, /* module context */ |
117
f6e3c5d019b6
nginx-0.0.1-2003-07-11-19:17:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
174 ngx_core_commands, /* module directives */ |
f6e3c5d019b6
nginx-0.0.1-2003-07-11-19:17:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
175 NGX_CORE_MODULE, /* module type */ |
541 | 176 NULL, /* init master */ |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
177 NULL, /* init module */ |
541 | 178 NULL, /* init process */ |
179 NULL, /* init thread */ | |
180 NULL, /* exit thread */ | |
181 NULL, /* exit process */ | |
182 NULL, /* exit master */ | |
183 NGX_MODULE_V1_PADDING | |
117
f6e3c5d019b6
nginx-0.0.1-2003-07-11-19:17:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
184 }; |
f6e3c5d019b6
nginx-0.0.1-2003-07-11-19:17:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
185 |
f6e3c5d019b6
nginx-0.0.1-2003-07-11-19:17:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
115
diff
changeset
|
186 |
2725 | 187 ngx_uint_t ngx_max_module; |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
188 |
2735 | 189 static ngx_uint_t ngx_show_help; |
2725 | 190 static ngx_uint_t ngx_show_version; |
191 static ngx_uint_t ngx_show_configure; | |
2758 | 192 static u_char *ngx_prefix; |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
193 static u_char *ngx_conf_file; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
194 static u_char *ngx_conf_params; |
2725 | 195 static char *ngx_signal; |
196 | |
639 | 197 |
1069 | 198 static char **ngx_os_environ; |
601 | 199 |
107
b5be4b0448d3
nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
106
diff
changeset
|
200 |
503 | 201 int ngx_cdecl |
499 | 202 main(int argc, char *const *argv) |
107
b5be4b0448d3
nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
106
diff
changeset
|
203 { |
452 | 204 ngx_int_t i; |
205 ngx_log_t *log; | |
206 ngx_cycle_t *cycle, init_cycle; | |
207 ngx_core_conf_t *ccf; | |
107
b5be4b0448d3
nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
106
diff
changeset
|
208 |
4222
2dd6c7cb211a
FreeBSD's MALLOC_OPTIONS must be set before any malloc() call.
Igor Sysoev <igor@sysoev.ru>
parents:
3798
diff
changeset
|
209 ngx_debug_init(); |
2dd6c7cb211a
FreeBSD's MALLOC_OPTIONS must be set before any malloc() call.
Igor Sysoev <igor@sysoev.ru>
parents:
3798
diff
changeset
|
210 |
3798
61d64ab739a0
move ngx_strerror_init() at the very start
Igor Sysoev <igor@sysoev.ru>
parents:
3787
diff
changeset
|
211 if (ngx_strerror_init() != NGX_OK) { |
61d64ab739a0
move ngx_strerror_init() at the very start
Igor Sysoev <igor@sysoev.ru>
parents:
3787
diff
changeset
|
212 return 1; |
61d64ab739a0
move ngx_strerror_init() at the very start
Igor Sysoev <igor@sysoev.ru>
parents:
3787
diff
changeset
|
213 } |
61d64ab739a0
move ngx_strerror_init() at the very start
Igor Sysoev <igor@sysoev.ru>
parents:
3787
diff
changeset
|
214 |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
215 if (ngx_get_options(argc, argv) != NGX_OK) { |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
216 return 1; |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
217 } |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
218 |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
219 if (ngx_show_version) { |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
220 ngx_write_stderr("nginx version: " NGINX_VER NGX_LINEFEED); |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
221 |
2735 | 222 if (ngx_show_help) { |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
223 ngx_write_stderr( |
3750 | 224 "Usage: nginx [-?hvVtq] [-s signal] [-c filename] " |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
225 "[-p prefix] [-g directives]" NGX_LINEFEED |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
226 NGX_LINEFEED |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
227 "Options:" NGX_LINEFEED |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
228 " -?,-h : this help" NGX_LINEFEED |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
229 " -v : show version and exit" NGX_LINEFEED |
2735 | 230 " -V : show version and configure options then exit" |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
231 NGX_LINEFEED |
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
232 " -t : test configuration and exit" NGX_LINEFEED |
3750 | 233 " -q : suppress non-error messages " |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
234 "during configuration testing" NGX_LINEFEED |
2738
ae81441e23f4
implement "-s signal" option for Unix
Igor Sysoev <igor@sysoev.ru>
parents:
2735
diff
changeset
|
235 " -s signal : send signal to a master process: " |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
236 "stop, quit, reopen, reload" NGX_LINEFEED |
2758 | 237 #ifdef NGX_PREFIX |
238 " -p prefix : set prefix path (default: " | |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
239 NGX_PREFIX ")" NGX_LINEFEED |
2758 | 240 #else |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
241 " -p prefix : set prefix path (default: NONE)" NGX_LINEFEED |
2758 | 242 #endif |
2735 | 243 " -c filename : set configuration file (default: " |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
244 NGX_CONF_PATH ")" NGX_LINEFEED |
2735 | 245 " -g directives : set global directives out of configuration " |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
246 "file" NGX_LINEFEED NGX_LINEFEED |
2735 | 247 ); |
248 } | |
249 | |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
250 if (ngx_show_configure) { |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
251 ngx_write_stderr( |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
252 #ifdef NGX_COMPILER |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
253 "built by " NGX_COMPILER NGX_LINEFEED |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
254 #endif |
3231 | 255 #if (NGX_SSL) |
3210 | 256 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
257 "TLS SNI support enabled" NGX_LINEFEED |
3231 | 258 #else |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
259 "TLS SNI support disabled" NGX_LINEFEED |
3231 | 260 #endif |
3210 | 261 #endif |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
4223
diff
changeset
|
262 "configure arguments:" NGX_CONFIGURE NGX_LINEFEED); |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
263 } |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
264 |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
265 if (!ngx_test_config) { |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
266 return 0; |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
267 } |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
268 } |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
269 |
108
adc093f880c8
nginx-0.0.1-2003-07-02-09:01:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
270 /* TODO */ ngx_max_sockets = -1; |
107
b5be4b0448d3
nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
106
diff
changeset
|
271 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
272 ngx_time_init(); |
221
401154e21826
nginx-0.0.1-2004-01-08-20:08:10 import
Igor Sysoev <igor@sysoev.ru>
parents:
220
diff
changeset
|
273 |
455 | 274 #if (NGX_PCRE) |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
194
diff
changeset
|
275 ngx_regex_init(); |
212
679f60139863
nginx-0.0.1-2003-12-19-11:15:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
276 #endif |
182
3c49eaf3f522
nginx-0.0.1-2003-11-13-09:14:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
144
diff
changeset
|
277 |
443
33aec431094b
nginx-0.1.0-2004-09-29-00:09:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
278 ngx_pid = ngx_getpid(); |
33aec431094b
nginx-0.1.0-2004-09-29-00:09:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
279 |
2758 | 280 log = ngx_log_init(ngx_prefix); |
501 | 281 if (log == NULL) { |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
443
diff
changeset
|
282 return 1; |
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
443
diff
changeset
|
283 } |
107
b5be4b0448d3
nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
106
diff
changeset
|
284 |
541 | 285 /* STUB */ |
393
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
376
diff
changeset
|
286 #if (NGX_OPENSSL) |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
376
diff
changeset
|
287 ngx_ssl_init(log); |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
376
diff
changeset
|
288 #endif |
5659d773cfa8
nginx-0.0.7-2004-07-15-20:35:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
376
diff
changeset
|
289 |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
290 /* |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
291 * init_cycle->log is required for signal handlers and |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
292 * ngx_process_options() |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
293 */ |
212
679f60139863
nginx-0.0.1-2003-12-19-11:15:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
294 |
679f60139863
nginx-0.0.1-2003-12-19-11:15:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
295 ngx_memzero(&init_cycle, sizeof(ngx_cycle_t)); |
679f60139863
nginx-0.0.1-2003-12-19-11:15:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
296 init_cycle.log = log; |
679f60139863
nginx-0.0.1-2003-12-19-11:15:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
297 ngx_cycle = &init_cycle; |
679f60139863
nginx-0.0.1-2003-12-19-11:15:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
210
diff
changeset
|
298 |
501 | 299 init_cycle.pool = ngx_create_pool(1024, log); |
300 if (init_cycle.pool == NULL) { | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
301 return 1; |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
302 } |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
303 |
611 | 304 if (ngx_save_argv(&init_cycle, argc, argv) != NGX_OK) { |
452 | 305 return 1; |
306 } | |
307 | |
2758 | 308 if (ngx_process_options(&init_cycle) != NGX_OK) { |
309 return 1; | |
310 } | |
448
241dc8092a33
nginx-0.1.0-2004-10-01-19:53:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
444
diff
changeset
|
311 |
611 | 312 if (ngx_os_init(log) != NGX_OK) { |
443
33aec431094b
nginx-0.1.0-2004-09-29-00:09:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
313 return 1; |
33aec431094b
nginx-0.1.0-2004-09-29-00:09:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
314 } |
33aec431094b
nginx-0.1.0-2004-09-29-00:09:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
315 |
1694
8c696afe46b3
rename ngx_crc32_init() to ngx_crc32_table_init()
Igor Sysoev <igor@sysoev.ru>
parents:
1407
diff
changeset
|
316 /* |
8c696afe46b3
rename ngx_crc32_init() to ngx_crc32_table_init()
Igor Sysoev <igor@sysoev.ru>
parents:
1407
diff
changeset
|
317 * ngx_crc32_table_init() requires ngx_cacheline_size set in ngx_os_init() |
8c696afe46b3
rename ngx_crc32_init() to ngx_crc32_table_init()
Igor Sysoev <igor@sysoev.ru>
parents:
1407
diff
changeset
|
318 */ |
930
45df22906c12
allocate aligned ngx_crc32_table_short globally
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
319 |
1694
8c696afe46b3
rename ngx_crc32_init() to ngx_crc32_table_init()
Igor Sysoev <igor@sysoev.ru>
parents:
1407
diff
changeset
|
320 if (ngx_crc32_table_init() != NGX_OK) { |
930
45df22906c12
allocate aligned ngx_crc32_table_short globally
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
321 return 1; |
45df22906c12
allocate aligned ngx_crc32_table_short globally
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
322 } |
45df22906c12
allocate aligned ngx_crc32_table_short globally
Igor Sysoev <igor@sysoev.ru>
parents:
860
diff
changeset
|
323 |
611 | 324 if (ngx_add_inherited_sockets(&init_cycle) != NGX_OK) { |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
325 return 1; |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
326 } |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
327 |
317
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
316
diff
changeset
|
328 ngx_max_module = 0; |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
316
diff
changeset
|
329 for (i = 0; ngx_modules[i]; i++) { |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
316
diff
changeset
|
330 ngx_modules[i]->index = ngx_max_module++; |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
316
diff
changeset
|
331 } |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
316
diff
changeset
|
332 |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
333 cycle = ngx_init_cycle(&init_cycle); |
108
adc093f880c8
nginx-0.0.1-2003-07-02-09:01:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
107
diff
changeset
|
334 if (cycle == NULL) { |
320
d621239c30f7
nginx-0.0.3-2004-04-18-23:06:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
335 if (ngx_test_config) { |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2738
diff
changeset
|
336 ngx_log_stderr(0, "configuration file %s test failed", |
2722 | 337 init_cycle.conf_file.data); |
320
d621239c30f7
nginx-0.0.3-2004-04-18-23:06:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
338 } |
d621239c30f7
nginx-0.0.3-2004-04-18-23:06:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
318
diff
changeset
|
339 |
107
b5be4b0448d3
nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
106
diff
changeset
|
340 return 1; |
b5be4b0448d3
nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
106
diff
changeset
|
341 } |
b5be4b0448d3
nginx-0.0.1-2003-07-01-19:00:03 import
Igor Sysoev <igor@sysoev.ru>
parents:
106
diff
changeset
|
342 |
317
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
316
diff
changeset
|
343 if (ngx_test_config) { |
3750 | 344 if (!ngx_quiet_mode) { |
345 ngx_log_stderr(0, "configuration file %s test is successful", | |
346 cycle->conf_file.data); | |
347 } | |
348 | |
317
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
316
diff
changeset
|
349 return 0; |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
316
diff
changeset
|
350 } |
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
316
diff
changeset
|
351 |
2923
d9c46f98b09f
a signaller process should stop configuration processing just after
Igor Sysoev <igor@sysoev.ru>
parents:
2767
diff
changeset
|
352 if (ngx_signal) { |
d9c46f98b09f
a signaller process should stop configuration processing just after
Igor Sysoev <igor@sysoev.ru>
parents:
2767
diff
changeset
|
353 return ngx_signal_process(cycle, ngx_signal); |
d9c46f98b09f
a signaller process should stop configuration processing just after
Igor Sysoev <igor@sysoev.ru>
parents:
2767
diff
changeset
|
354 } |
d9c46f98b09f
a signaller process should stop configuration processing just after
Igor Sysoev <igor@sysoev.ru>
parents:
2767
diff
changeset
|
355 |
449
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
448
diff
changeset
|
356 ngx_os_status(cycle->log); |
3b1e8c9df9ad
nginx-0.1.0-2004-10-04-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
448
diff
changeset
|
357 |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
358 ngx_cycle = cycle; |
113
d7f606e25b99
nginx-0.0.1-2003-07-04-19:10:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
111
diff
changeset
|
359 |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
360 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
361 |
2725 | 362 if (ccf->master && ngx_process == NGX_PROCESS_SINGLE) { |
363 ngx_process = NGX_PROCESS_MASTER; | |
364 } | |
220
4f81b931e9ff
nginx-0.0.1-2004-01-08-11:47:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
219
diff
changeset
|
365 |
2738
ae81441e23f4
implement "-s signal" option for Unix
Igor Sysoev <igor@sysoev.ru>
parents:
2735
diff
changeset
|
366 #if !(NGX_WIN32) |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
367 |
611 | 368 if (ngx_init_signals(cycle->log) != NGX_OK) { |
539 | 369 return 1; |
370 } | |
371 | |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
372 if (!ngx_inherited && ccf->daemon) { |
611 | 373 if (ngx_daemon(cycle->log) != NGX_OK) { |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
374 return 1; |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
375 } |
366
e411b1482ee3
nginx-0.0.7-2004-06-23-19:18:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
376 |
e411b1482ee3
nginx-0.0.7-2004-06-23-19:18:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
337
diff
changeset
|
377 ngx_daemonized = 1; |
115
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
378 } |
be27f922b9a2
nginx-0.0.1-2003-07-10-20:26:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
114
diff
changeset
|
379 |
4293
3bae3d8fb573
Fixed handling of SIGWINCH/NOACCEPT signal.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4283
diff
changeset
|
380 if (ngx_inherited) { |
3bae3d8fb573
Fixed handling of SIGWINCH/NOACCEPT signal.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4283
diff
changeset
|
381 ngx_daemonized = 1; |
3bae3d8fb573
Fixed handling of SIGWINCH/NOACCEPT signal.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4283
diff
changeset
|
382 } |
3bae3d8fb573
Fixed handling of SIGWINCH/NOACCEPT signal.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4283
diff
changeset
|
383 |
2725 | 384 #endif |
385 | |
611 | 386 if (ngx_create_pidfile(&ccf->pid, cycle->log) != NGX_OK) { |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
209
diff
changeset
|
387 return 1; |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
209
diff
changeset
|
388 } |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
209
diff
changeset
|
389 |
5260
e088695737c3
Core: consolidated log-related code.
Vladimir Homutov <vl@nginx.com>
parents:
5240
diff
changeset
|
390 if (ngx_log_redirect_stderr(cycle) != NGX_OK) { |
e088695737c3
Core: consolidated log-related code.
Vladimir Homutov <vl@nginx.com>
parents:
5240
diff
changeset
|
391 return 1; |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2738
diff
changeset
|
392 } |
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2738
diff
changeset
|
393 |
3199
b242aaf1dcfa
nginx did not close log file set by --error-log-path,
Igor Sysoev <igor@sysoev.ru>
parents:
3177
diff
changeset
|
394 if (log->file->fd != ngx_stderr) { |
b242aaf1dcfa
nginx did not close log file set by --error-log-path,
Igor Sysoev <igor@sysoev.ru>
parents:
3177
diff
changeset
|
395 if (ngx_close_file(log->file->fd) == NGX_FILE_ERROR) { |
b242aaf1dcfa
nginx did not close log file set by --error-log-path,
Igor Sysoev <igor@sysoev.ru>
parents:
3177
diff
changeset
|
396 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
b242aaf1dcfa
nginx did not close log file set by --error-log-path,
Igor Sysoev <igor@sysoev.ru>
parents:
3177
diff
changeset
|
397 ngx_close_file_n " built-in log failed"); |
b242aaf1dcfa
nginx did not close log file set by --error-log-path,
Igor Sysoev <igor@sysoev.ru>
parents:
3177
diff
changeset
|
398 } |
b242aaf1dcfa
nginx did not close log file set by --error-log-path,
Igor Sysoev <igor@sysoev.ru>
parents:
3177
diff
changeset
|
399 } |
b242aaf1dcfa
nginx did not close log file set by --error-log-path,
Igor Sysoev <igor@sysoev.ru>
parents:
3177
diff
changeset
|
400 |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2738
diff
changeset
|
401 ngx_use_stderr = 0; |
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2738
diff
changeset
|
402 |
2725 | 403 if (ngx_process == NGX_PROCESS_SINGLE) { |
404 ngx_single_process_cycle(cycle); | |
318
56496082668b
nginx-0.0.3-2004-04-16-09:14:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
317
diff
changeset
|
405 |
56496082668b
nginx-0.0.3-2004-04-16-09:14:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
317
diff
changeset
|
406 } else { |
2725 | 407 ngx_master_process_cycle(cycle); |
318
56496082668b
nginx-0.0.3-2004-04-16-09:14:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
317
diff
changeset
|
408 } |
220
4f81b931e9ff
nginx-0.0.1-2004-01-08-11:47:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
219
diff
changeset
|
409 |
4f81b931e9ff
nginx-0.0.1-2004-01-08-11:47:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
219
diff
changeset
|
410 return 0; |
4f81b931e9ff
nginx-0.0.1-2004-01-08-11:47:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
219
diff
changeset
|
411 } |
4f81b931e9ff
nginx-0.0.1-2004-01-08-11:47:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
219
diff
changeset
|
412 |
4f81b931e9ff
nginx-0.0.1-2004-01-08-11:47:17 import
Igor Sysoev <igor@sysoev.ru>
parents:
219
diff
changeset
|
413 |
499 | 414 static ngx_int_t |
415 ngx_add_inherited_sockets(ngx_cycle_t *cycle) | |
219
f57597ec5249
nginx-0.0.1-2004-01-06-19:49:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
416 { |
501 | 417 u_char *p, *v, *inherited; |
418 ngx_int_t s; | |
419 ngx_listening_t *ls; | |
219
f57597ec5249
nginx-0.0.1-2004-01-06-19:49:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
420 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
289
diff
changeset
|
421 inherited = (u_char *) getenv(NGINX_VAR); |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
422 |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
423 if (inherited == NULL) { |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
424 return NGX_OK; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
425 } |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
426 |
461 | 427 ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
428 "using inherited sockets from \"%s\"", inherited); |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
429 |
461 | 430 if (ngx_array_init(&cycle->listening, cycle->pool, 10, |
745 | 431 sizeof(ngx_listening_t)) |
2536
a6d6d762c554
small optimization: " == NGX_ERROR" > " != NGX_OK"
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
432 != NGX_OK) |
461 | 433 { |
434 return NGX_ERROR; | |
435 } | |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
436 |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
437 for (p = inherited, v = p; *p; p++) { |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
438 if (*p == ':' || *p == ';') { |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
439 s = ngx_atoi(v, p - v); |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
440 if (s == NGX_ERROR) { |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
441 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, |
537 | 442 "invalid socket number \"%s\" in " NGINX_VAR |
443 " environment variable, ignoring the rest" | |
444 " of the variable", v); | |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
445 break; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
446 } |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
447 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
289
diff
changeset
|
448 v = p + 1; |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
449 |
501 | 450 ls = ngx_array_push(&cycle->listening); |
451 if (ls == NULL) { | |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
452 return NGX_ERROR; |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
289
diff
changeset
|
453 } |
219
f57597ec5249
nginx-0.0.1-2004-01-06-19:49:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
454 |
523 | 455 ngx_memzero(ls, sizeof(ngx_listening_t)); |
456 | |
501 | 457 ls->fd = (ngx_socket_t) s; |
219
f57597ec5249
nginx-0.0.1-2004-01-06-19:49:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
458 } |
f57597ec5249
nginx-0.0.1-2004-01-06-19:49:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
459 } |
f57597ec5249
nginx-0.0.1-2004-01-06-19:49:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
460 |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
461 ngx_inherited = 1; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
462 |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
463 return ngx_set_inherited_sockets(cycle); |
219
f57597ec5249
nginx-0.0.1-2004-01-06-19:49:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
464 } |
f57597ec5249
nginx-0.0.1-2004-01-06-19:49:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
465 |
f57597ec5249
nginx-0.0.1-2004-01-06-19:49:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
466 |
1069 | 467 char ** |
468 ngx_set_environment(ngx_cycle_t *cycle, ngx_uint_t *last) | |
469 { | |
470 char **p, **env; | |
471 ngx_str_t *var; | |
472 ngx_uint_t i, n; | |
473 ngx_core_conf_t *ccf; | |
474 | |
475 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); | |
476 | |
1080 | 477 if (last == NULL && ccf->environment) { |
478 return ccf->environment; | |
1069 | 479 } |
480 | |
481 var = ccf->env.elts; | |
482 | |
483 for (i = 0; i < ccf->env.nelts; i++) { | |
484 if (ngx_strcmp(var[i].data, "TZ") == 0 | |
485 || ngx_strncmp(var[i].data, "TZ=", 3) == 0) | |
486 { | |
487 goto tz_found; | |
488 } | |
489 } | |
490 | |
491 var = ngx_array_push(&ccf->env); | |
1318 | 492 if (var == NULL) { |
493 return NULL; | |
494 } | |
1069 | 495 |
496 var->len = 2; | |
497 var->data = (u_char *) "TZ"; | |
498 | |
499 var = ccf->env.elts; | |
500 | |
501 tz_found: | |
502 | |
1080 | 503 n = 0; |
504 | |
1069 | 505 for (i = 0; i < ccf->env.nelts; i++) { |
506 | |
507 if (var[i].data[var[i].len] == '=') { | |
508 n++; | |
509 continue; | |
510 } | |
511 | |
512 for (p = ngx_os_environ; *p; p++) { | |
513 | |
514 if (ngx_strncmp(*p, var[i].data, var[i].len) == 0 | |
515 && (*p)[var[i].len] == '=') | |
516 { | |
517 n++; | |
518 break; | |
519 } | |
520 } | |
521 } | |
522 | |
523 if (last) { | |
1080 | 524 env = ngx_alloc((*last + n + 1) * sizeof(char *), cycle->log); |
1069 | 525 *last = n; |
526 | |
527 } else { | |
528 env = ngx_palloc(cycle->pool, (n + 1) * sizeof(char *)); | |
529 } | |
530 | |
531 if (env == NULL) { | |
532 return NULL; | |
533 } | |
534 | |
535 n = 0; | |
536 | |
537 for (i = 0; i < ccf->env.nelts; i++) { | |
538 | |
539 if (var[i].data[var[i].len] == '=') { | |
540 env[n++] = (char *) var[i].data; | |
541 continue; | |
542 } | |
543 | |
544 for (p = ngx_os_environ; *p; p++) { | |
545 | |
546 if (ngx_strncmp(*p, var[i].data, var[i].len) == 0 | |
547 && (*p)[var[i].len] == '=') | |
548 { | |
549 env[n++] = *p; | |
550 break; | |
551 } | |
552 } | |
553 } | |
554 | |
555 env[n] = NULL; | |
556 | |
557 if (last == NULL) { | |
558 ccf->environment = env; | |
559 environ = env; | |
560 } | |
561 | |
562 return env; | |
563 } | |
564 | |
565 | |
543 | 566 ngx_pid_t |
567 ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv) | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
568 { |
1069 | 569 char **env, *var; |
570 u_char *p; | |
571 ngx_uint_t i, n; | |
572 ngx_pid_t pid; | |
573 ngx_exec_ctx_t ctx; | |
574 ngx_core_conf_t *ccf; | |
575 ngx_listening_t *ls; | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
576 |
2745
1983932b8075
pass command lines options to workers
Igor Sysoev <igor@sysoev.ru>
parents:
2743
diff
changeset
|
577 ngx_memzero(&ctx, sizeof(ngx_exec_ctx_t)); |
1983932b8075
pass command lines options to workers
Igor Sysoev <igor@sysoev.ru>
parents:
2743
diff
changeset
|
578 |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
579 ctx.path = argv[0]; |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
580 ctx.name = "new binary process"; |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
581 ctx.argv = argv; |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
582 |
1069 | 583 n = 2; |
584 env = ngx_set_environment(cycle, &n); | |
585 if (env == NULL) { | |
586 return NGX_INVALID_PID; | |
587 } | |
588 | |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
589 var = ngx_alloc(sizeof(NGINX_VAR) |
501 | 590 + cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2, |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
591 cycle->log); |
5116
4d7027deb1bb
Core: guard against failed allocation during binary upgrade.
Ruslan Ermilov <ru@nginx.com>
parents:
4890
diff
changeset
|
592 if (var == NULL) { |
5122
3450eee1ee8d
Core: fixed resource leak if binary upgrade fails due to no memory.
Ruslan Ermilov <ru@nginx.com>
parents:
5116
diff
changeset
|
593 ngx_free(env); |
5116
4d7027deb1bb
Core: guard against failed allocation during binary upgrade.
Ruslan Ermilov <ru@nginx.com>
parents:
4890
diff
changeset
|
594 return NGX_INVALID_PID; |
4d7027deb1bb
Core: guard against failed allocation during binary upgrade.
Ruslan Ermilov <ru@nginx.com>
parents:
4890
diff
changeset
|
595 } |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
596 |
461 | 597 p = ngx_cpymem(var, NGINX_VAR "=", sizeof(NGINX_VAR)); |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
598 |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
599 ls = cycle->listening.elts; |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
600 for (i = 0; i < cycle->listening.nelts; i++) { |
461 | 601 p = ngx_sprintf(p, "%ud;", ls[i].fd); |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
602 } |
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
603 |
461 | 604 *p = '\0'; |
605 | |
1069 | 606 env[n++] = var; |
452 | 607 |
608 #if (NGX_SETPROCTITLE_USES_ENV) | |
609 | |
461 | 610 /* allocate the spare 300 bytes for the new binary process title */ |
452 | 611 |
1069 | 612 env[n++] = "SPARE=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" |
613 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
614 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
615 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
616 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; | |
452 | 617 |
618 #endif | |
619 | |
1069 | 620 env[n] = NULL; |
621 | |
622 #if (NGX_DEBUG) | |
623 { | |
624 char **e; | |
625 for (e = env; *e; e++) { | |
626 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cycle->log, 0, "env: %s", *e); | |
627 } | |
628 } | |
629 #endif | |
630 | |
631 ctx.envp = (char *const *) env; | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
632 |
543 | 633 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); |
634 | |
5137
f941cf265cc5
Use NGX_FILE_ERROR for handling file operations errors.
Valentin Bartenev <vbart@nginx.com>
parents:
5122
diff
changeset
|
635 if (ngx_rename_file(ccf->pid.data, ccf->oldpid.data) == NGX_FILE_ERROR) { |
543 | 636 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
637 ngx_rename_file_n " %s to %s failed " | |
638 "before executing new binary process \"%s\"", | |
639 ccf->pid.data, ccf->oldpid.data, argv[0]); | |
640 | |
1069 | 641 ngx_free(env); |
543 | 642 ngx_free(var); |
643 | |
644 return NGX_INVALID_PID; | |
645 } | |
646 | |
279
b79f021a644a
nginx-0.0.2-2004-03-04-19:34:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
647 pid = ngx_execute(cycle, &ctx); |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
648 |
543 | 649 if (pid == NGX_INVALID_PID) { |
5137
f941cf265cc5
Use NGX_FILE_ERROR for handling file operations errors.
Valentin Bartenev <vbart@nginx.com>
parents:
5122
diff
changeset
|
650 if (ngx_rename_file(ccf->oldpid.data, ccf->pid.data) |
f941cf265cc5
Use NGX_FILE_ERROR for handling file operations errors.
Valentin Bartenev <vbart@nginx.com>
parents:
5122
diff
changeset
|
651 == NGX_FILE_ERROR) |
f941cf265cc5
Use NGX_FILE_ERROR for handling file operations errors.
Valentin Bartenev <vbart@nginx.com>
parents:
5122
diff
changeset
|
652 { |
543 | 653 ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, |
1069 | 654 ngx_rename_file_n " %s back to %s failed after " |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4549
diff
changeset
|
655 "an attempt to execute new binary process \"%s\"", |
543 | 656 ccf->oldpid.data, ccf->pid.data, argv[0]); |
657 } | |
658 } | |
659 | |
1069 | 660 ngx_free(env); |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
661 ngx_free(var); |
226
b0c1e21e68db
nginx-0.0.1-2004-01-14-00:33:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
225
diff
changeset
|
662 |
b0c1e21e68db
nginx-0.0.1-2004-01-14-00:33:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
225
diff
changeset
|
663 return pid; |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
664 } |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
665 |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
666 |
543 | 667 static ngx_int_t |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
668 ngx_get_options(int argc, char *const *argv) |
255
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
669 { |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
670 u_char *p; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
671 ngx_int_t i; |
255
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
672 |
452 | 673 for (i = 1; i < argc; i++) { |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
674 |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
675 p = (u_char *) argv[i]; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
676 |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
677 if (*p++ != '-') { |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2738
diff
changeset
|
678 ngx_log_stderr(0, "invalid option: \"%s\"", argv[i]); |
255
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
679 return NGX_ERROR; |
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
680 } |
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
681 |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
682 while (*p) { |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
683 |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
684 switch (*p++) { |
255
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
685 |
2735 | 686 case '?': |
687 case 'h': | |
688 ngx_show_version = 1; | |
689 ngx_show_help = 1; | |
690 break; | |
691 | |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
692 case 'v': |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
693 ngx_show_version = 1; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
694 break; |
639 | 695 |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
696 case 'V': |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
697 ngx_show_version = 1; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
698 ngx_show_configure = 1; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
699 break; |
945 | 700 |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
701 case 't': |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
702 ngx_test_config = 1; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
703 break; |
317
1308b98496a2
nginx-0.0.3-2004-04-15-19:34:36 import
Igor Sysoev <igor@sysoev.ru>
parents:
316
diff
changeset
|
704 |
3750 | 705 case 'q': |
706 ngx_quiet_mode = 1; | |
707 break; | |
708 | |
2758 | 709 case 'p': |
710 if (*p) { | |
711 ngx_prefix = p; | |
712 goto next; | |
713 } | |
714 | |
715 if (argv[++i]) { | |
716 ngx_prefix = (u_char *) argv[i]; | |
717 goto next; | |
718 } | |
719 | |
720 ngx_log_stderr(0, "option \"-p\" requires directory name"); | |
721 return NGX_ERROR; | |
722 | |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
723 case 'c': |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
724 if (*p) { |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
725 ngx_conf_file = p; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
726 goto next; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
727 } |
316
a0beefedaf94
nginx-0.0.3-2004-04-15-00:34:05 import
Igor Sysoev <igor@sysoev.ru>
parents:
314
diff
changeset
|
728 |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
729 if (argv[++i]) { |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
730 ngx_conf_file = (u_char *) argv[i]; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
731 goto next; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
732 } |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
733 |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2738
diff
changeset
|
734 ngx_log_stderr(0, "option \"-c\" requires file name"); |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
735 return NGX_ERROR; |
255
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
736 |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
737 case 'g': |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
738 if (*p) { |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
739 ngx_conf_params = p; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
740 goto next; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
741 } |
2073 | 742 |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
743 if (argv[++i]) { |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
744 ngx_conf_params = (u_char *) argv[i]; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
745 goto next; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
746 } |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
747 |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2738
diff
changeset
|
748 ngx_log_stderr(0, "option \"-g\" requires parameter"); |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
749 return NGX_ERROR; |
2073 | 750 |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
751 case 's': |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
752 if (*p) { |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
753 ngx_signal = (char *) p; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
754 |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
755 } else if (argv[++i]) { |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
756 ngx_signal = argv[i]; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
757 |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
758 } else { |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2738
diff
changeset
|
759 ngx_log_stderr(0, "option \"-s\" requires parameter"); |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
760 return NGX_ERROR; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
761 } |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
762 |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
763 if (ngx_strcmp(ngx_signal, "stop") == 0 |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
764 || ngx_strcmp(ngx_signal, "quit") == 0 |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
765 || ngx_strcmp(ngx_signal, "reopen") == 0 |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
766 || ngx_strcmp(ngx_signal, "reload") == 0) |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
767 { |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
768 ngx_process = NGX_PROCESS_SIGNALLER; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
769 goto next; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
770 } |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
771 |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2738
diff
changeset
|
772 ngx_log_stderr(0, "invalid option: \"-s %s\"", ngx_signal); |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
773 return NGX_ERROR; |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
774 |
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
775 default: |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2738
diff
changeset
|
776 ngx_log_stderr(0, "invalid option: \"%c\"", *(p - 1)); |
2725 | 777 return NGX_ERROR; |
778 } | |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
779 } |
2725 | 780 |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
781 next: |
2725 | 782 |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
783 continue; |
255
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
784 } |
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
785 |
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
786 return NGX_OK; |
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
787 } |
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
788 |
e6938ca7331a
nginx-0.0.2-2004-02-09-23:47:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
789 |
499 | 790 static ngx_int_t |
791 ngx_save_argv(ngx_cycle_t *cycle, int argc, char *const *argv) | |
452 | 792 { |
501 | 793 #if (NGX_FREEBSD) |
794 | |
795 ngx_os_argv = (char **) argv; | |
796 ngx_argc = argc; | |
797 ngx_argv = (char **) argv; | |
798 | |
799 #else | |
452 | 800 size_t len; |
801 ngx_int_t i; | |
802 | |
803 ngx_os_argv = (char **) argv; | |
804 ngx_argc = argc; | |
805 | |
501 | 806 ngx_argv = ngx_alloc((argc + 1) * sizeof(char *), cycle->log); |
807 if (ngx_argv == NULL) { | |
452 | 808 return NGX_ERROR; |
809 } | |
810 | |
811 for (i = 0; i < argc; i++) { | |
812 len = ngx_strlen(argv[i]) + 1; | |
813 | |
501 | 814 ngx_argv[i] = ngx_alloc(len, cycle->log); |
815 if (ngx_argv[i] == NULL) { | |
452 | 816 return NGX_ERROR; |
817 } | |
818 | |
517 | 819 (void) ngx_cpystrn((u_char *) ngx_argv[i], (u_char *) argv[i], len); |
452 | 820 } |
821 | |
822 ngx_argv[i] = NULL; | |
823 | |
824 #endif | |
825 | |
1069 | 826 ngx_os_environ = environ; |
827 | |
452 | 828 return NGX_OK; |
829 } | |
830 | |
831 | |
2758 | 832 static ngx_int_t |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
833 ngx_process_options(ngx_cycle_t *cycle) |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
834 { |
2758 | 835 u_char *p; |
836 size_t len; | |
837 | |
838 if (ngx_prefix) { | |
839 len = ngx_strlen(ngx_prefix); | |
840 p = ngx_prefix; | |
841 | |
4783
2220ce29b9d3
Fixed the -p parameter handling.
Ruslan Ermilov <ru@nginx.com>
parents:
4593
diff
changeset
|
842 if (len && !ngx_path_separator(p[len - 1])) { |
2758 | 843 p = ngx_pnalloc(cycle->pool, len + 1); |
844 if (p == NULL) { | |
845 return NGX_ERROR; | |
846 } | |
847 | |
848 ngx_memcpy(p, ngx_prefix, len); | |
849 p[len++] = '/'; | |
850 } | |
851 | |
852 cycle->conf_prefix.len = len; | |
853 cycle->conf_prefix.data = p; | |
854 cycle->prefix.len = len; | |
855 cycle->prefix.data = p; | |
856 | |
857 } else { | |
858 | |
859 #ifndef NGX_PREFIX | |
860 | |
861 p = ngx_pnalloc(cycle->pool, NGX_MAX_PATH); | |
862 if (p == NULL) { | |
863 return NGX_ERROR; | |
864 } | |
865 | |
866 if (ngx_getcwd(p, NGX_MAX_PATH) == 0) { | |
867 ngx_log_stderr(ngx_errno, "[emerg]: " ngx_getcwd_n " failed"); | |
868 return NGX_ERROR; | |
869 } | |
870 | |
871 len = ngx_strlen(p); | |
872 | |
873 p[len++] = '/'; | |
874 | |
875 cycle->conf_prefix.len = len; | |
876 cycle->conf_prefix.data = p; | |
877 cycle->prefix.len = len; | |
878 cycle->prefix.data = p; | |
879 | |
880 #else | |
881 | |
882 #ifdef NGX_CONF_PREFIX | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3480
diff
changeset
|
883 ngx_str_set(&cycle->conf_prefix, NGX_CONF_PREFIX); |
2758 | 884 #else |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3480
diff
changeset
|
885 ngx_str_set(&cycle->conf_prefix, NGX_PREFIX); |
2758 | 886 #endif |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3480
diff
changeset
|
887 ngx_str_set(&cycle->prefix, NGX_PREFIX); |
2758 | 888 |
889 #endif | |
890 } | |
891 | |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
892 if (ngx_conf_file) { |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
893 cycle->conf_file.len = ngx_strlen(ngx_conf_file); |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
894 cycle->conf_file.data = ngx_conf_file; |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
895 |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
896 } else { |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3480
diff
changeset
|
897 ngx_str_set(&cycle->conf_file, NGX_CONF_PATH); |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
898 } |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
899 |
5330
314c3d7cc3a5
Backed out f1a91825730a and 7094bd12c1ff.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5317
diff
changeset
|
900 if (ngx_conf_full_name(cycle, &cycle->conf_file, 0) != NGX_OK) { |
2758 | 901 return NGX_ERROR; |
902 } | |
903 | |
904 for (p = cycle->conf_file.data + cycle->conf_file.len - 1; | |
905 p > cycle->conf_file.data; | |
906 p--) | |
907 { | |
908 if (ngx_path_separator(*p)) { | |
909 cycle->conf_prefix.len = p - ngx_cycle->conf_file.data + 1; | |
910 cycle->conf_prefix.data = ngx_cycle->conf_file.data; | |
911 break; | |
912 } | |
913 } | |
914 | |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
915 if (ngx_conf_params) { |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
916 cycle->conf_param.len = ngx_strlen(ngx_conf_params); |
2733
edc01cc34b3e
allow condensed command lines options
Igor Sysoev <igor@sysoev.ru>
parents:
2730
diff
changeset
|
917 cycle->conf_param.data = ngx_conf_params; |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
918 } |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
919 |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
920 if (ngx_test_config) { |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
921 cycle->log->log_level = NGX_LOG_INFO; |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
922 } |
2758 | 923 |
924 return NGX_OK; | |
2730
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
925 } |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
926 |
95a17423afdb
test command line options before ngx_log_init() and issue errors to stderr
Igor Sysoev <igor@sysoev.ru>
parents:
2725
diff
changeset
|
927 |
499 | 928 static void * |
929 ngx_core_module_create_conf(ngx_cycle_t *cycle) | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
930 { |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
931 ngx_core_conf_t *ccf; |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
932 |
501 | 933 ccf = ngx_pcalloc(cycle->pool, sizeof(ngx_core_conf_t)); |
934 if (ccf == NULL) { | |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
935 return NULL; |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
936 } |
479 | 937 |
938 /* | |
3480 | 939 * set by ngx_pcalloc() |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
940 * |
479 | 941 * ccf->pid = NULL; |
543 | 942 * ccf->oldpid = NULL; |
479 | 943 * ccf->priority = 0; |
577 | 944 * ccf->cpu_affinity_n = 0; |
945 * ccf->cpu_affinity = NULL; | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
946 */ |
479 | 947 |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
948 ccf->daemon = NGX_CONF_UNSET; |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
949 ccf->master = NGX_CONF_UNSET; |
563 | 950 ccf->timer_resolution = NGX_CONF_UNSET_MSEC; |
951 | |
300
502b03d9d2a3
nginx-0.0.3-2004-03-31-00:31:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
952 ccf->worker_processes = NGX_CONF_UNSET; |
461 | 953 ccf->debug_points = NGX_CONF_UNSET; |
543 | 954 |
955 ccf->rlimit_nofile = NGX_CONF_UNSET; | |
3762
89002ac695e5
worker_rlimit_core should be off_t
Igor Sysoev <igor@sysoev.ru>
parents:
3750
diff
changeset
|
956 ccf->rlimit_core = NGX_CONF_UNSET; |
543 | 957 ccf->rlimit_sigpending = NGX_CONF_UNSET; |
958 | |
517 | 959 ccf->user = (ngx_uid_t) NGX_CONF_UNSET_UINT; |
960 ccf->group = (ngx_gid_t) NGX_CONF_UNSET_UINT; | |
543 | 961 |
376
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
962 #if (NGX_THREADS) |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
963 ccf->worker_threads = NGX_CONF_UNSET; |
461 | 964 ccf->thread_stack_size = NGX_CONF_UNSET_SIZE; |
376
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
965 #endif |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
966 |
1069 | 967 if (ngx_array_init(&ccf->env, cycle->pool, 1, sizeof(ngx_str_t)) |
968 != NGX_OK) | |
969 { | |
970 return NULL; | |
971 } | |
972 | |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
973 return ccf; |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
974 } |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
975 |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
976 |
499 | 977 static char * |
978 ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf) | |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
979 { |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
980 ngx_core_conf_t *ccf = conf; |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
981 |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
982 ngx_conf_init_value(ccf->daemon, 1); |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
983 ngx_conf_init_value(ccf->master, 1); |
563 | 984 ngx_conf_init_msec_value(ccf->timer_resolution, 0); |
985 | |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
986 ngx_conf_init_value(ccf->worker_processes, 1); |
461 | 987 ngx_conf_init_value(ccf->debug_points, 0); |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
988 |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
989 #if (NGX_HAVE_CPU_AFFINITY) |
577 | 990 |
991 if (ccf->cpu_affinity_n | |
992 && ccf->cpu_affinity_n != 1 | |
993 && ccf->cpu_affinity_n != (ngx_uint_t) ccf->worker_processes) | |
994 { | |
995 ngx_log_error(NGX_LOG_WARN, cycle->log, 0, | |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
996 "the number of \"worker_processes\" is not equal to " |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
997 "the number of \"worker_cpu_affinity\" masks, " |
577 | 998 "using last mask for remaining worker processes"); |
999 } | |
1000 | |
1001 #endif | |
1002 | |
376
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
1003 #if (NGX_THREADS) |
577 | 1004 |
376
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
1005 ngx_conf_init_value(ccf->worker_threads, 0); |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
1006 ngx_threads_n = ccf->worker_threads; |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
1007 ngx_conf_init_size_value(ccf->thread_stack_size, 2 * 1024 * 1024); |
577 | 1008 |
376
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
1009 #endif |
d0451e402e27
nginx-0.0.7-2004-07-05-10:55:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
366
diff
changeset
|
1010 |
2725 | 1011 |
1012 if (ccf->pid.len == 0) { | |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3480
diff
changeset
|
1013 ngx_str_set(&ccf->pid, NGX_PID_PATH); |
2725 | 1014 } |
1015 | |
5330
314c3d7cc3a5
Backed out f1a91825730a and 7094bd12c1ff.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5317
diff
changeset
|
1016 if (ngx_conf_full_name(cycle, &ccf->pid, 0) != NGX_OK) { |
2725 | 1017 return NGX_CONF_ERROR; |
1018 } | |
1019 | |
1020 ccf->oldpid.len = ccf->pid.len + sizeof(NGX_OLDPID_EXT); | |
1021 | |
1022 ccf->oldpid.data = ngx_pnalloc(cycle->pool, ccf->oldpid.len); | |
1023 if (ccf->oldpid.data == NULL) { | |
1024 return NGX_CONF_ERROR; | |
1025 } | |
1026 | |
1027 ngx_memcpy(ngx_cpymem(ccf->oldpid.data, ccf->pid.data, ccf->pid.len), | |
1028 NGX_OLDPID_EXT, sizeof(NGX_OLDPID_EXT)); | |
1029 | |
1030 | |
461 | 1031 #if !(NGX_WIN32) |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
1032 |
517 | 1033 if (ccf->user == (uid_t) NGX_CONF_UNSET_UINT && geteuid() == 0) { |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1694
diff
changeset
|
1034 struct group *grp; |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1694
diff
changeset
|
1035 struct passwd *pwd; |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1036 |
1288 | 1037 ngx_set_errno(0); |
455 | 1038 pwd = getpwnam(NGX_USER); |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1039 if (pwd == NULL) { |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1040 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
455 | 1041 "getpwnam(\"" NGX_USER "\") failed"); |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1042 return NGX_CONF_ERROR; |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1043 } |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1044 |
473 | 1045 ccf->username = NGX_USER; |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1046 ccf->user = pwd->pw_uid; |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1047 |
1288 | 1048 ngx_set_errno(0); |
455 | 1049 grp = getgrnam(NGX_GROUP); |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1050 if (grp == NULL) { |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1051 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
455 | 1052 "getgrnam(\"" NGX_GROUP "\") failed"); |
440
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1053 return NGX_CONF_ERROR; |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1054 } |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1055 |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1056 ccf->group = grp->gr_gid; |
f390d1775430
nginx-0.1.0-2004-09-27-20:03:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
409
diff
changeset
|
1057 } |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
217
diff
changeset
|
1058 |
860
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1059 |
611 | 1060 if (ccf->lock_file.len == 0) { |
3516
dd1570b6f237
ngx_str_set() and ngx_str_null()
Igor Sysoev <igor@sysoev.ru>
parents:
3480
diff
changeset
|
1061 ngx_str_set(&ccf->lock_file, NGX_LOCK_PATH); |
611 | 1062 } |
1063 | |
5330
314c3d7cc3a5
Backed out f1a91825730a and 7094bd12c1ff.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5317
diff
changeset
|
1064 if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) != NGX_OK) { |
611 | 1065 return NGX_CONF_ERROR; |
1066 } | |
1067 | |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1694
diff
changeset
|
1068 { |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1694
diff
changeset
|
1069 ngx_str_t lock_file; |
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1694
diff
changeset
|
1070 |
860
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1071 lock_file = cycle->old_cycle->lock_file; |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1072 |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1073 if (lock_file.len) { |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1074 lock_file.len--; |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1075 |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1076 if (ccf->lock_file.len != lock_file.len |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1077 || ngx_strncmp(ccf->lock_file.data, lock_file.data, lock_file.len) |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1078 != 0) |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1079 { |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1080 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1081 "\"lock_file\" could not be changed, ignored"); |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1082 } |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1083 |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1084 cycle->lock_file.len = lock_file.len + 1; |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1085 lock_file.len += sizeof(".accept"); |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1086 |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1087 cycle->lock_file.data = ngx_pstrdup(cycle->pool, &lock_file); |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1088 if (cycle->lock_file.data == NULL) { |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1089 return NGX_CONF_ERROR; |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1090 } |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1091 |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1092 } else { |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1093 cycle->lock_file.len = ccf->lock_file.len + 1; |
2049 | 1094 cycle->lock_file.data = ngx_pnalloc(cycle->pool, |
860
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1095 ccf->lock_file.len + sizeof(".accept")); |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1096 if (cycle->lock_file.data == NULL) { |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1097 return NGX_CONF_ERROR; |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1098 } |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1099 |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1100 ngx_memcpy(ngx_cpymem(cycle->lock_file.data, ccf->lock_file.data, |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1101 ccf->lock_file.len), |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1102 ".accept", sizeof(".accept")); |
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1103 } |
1704
e584e946e198
move condition declarations inside blocks where they are used
Igor Sysoev <igor@sysoev.ru>
parents:
1694
diff
changeset
|
1104 } |
860
201d017ea470
slab allocator in shared memory
Igor Sysoev <igor@sysoev.ru>
parents:
796
diff
changeset
|
1105 |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
1106 #endif |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
1107 |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
1108 return NGX_CONF_OK; |
114
ac69ab96328d
nginx-0.0.1-2003-07-07-10:11:50 import
Igor Sysoev <igor@sysoev.ru>
parents:
113
diff
changeset
|
1109 } |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1110 |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1111 |
499 | 1112 static char * |
1113 ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1114 { |
461 | 1115 #if (NGX_WIN32) |
278
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
270
diff
changeset
|
1116 |
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
270
diff
changeset
|
1117 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, |
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
270
diff
changeset
|
1118 "\"user\" is not supported, ignored"); |
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
270
diff
changeset
|
1119 |
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
270
diff
changeset
|
1120 return NGX_CONF_OK; |
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
270
diff
changeset
|
1121 |
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
270
diff
changeset
|
1122 #else |
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
270
diff
changeset
|
1123 |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
1124 ngx_core_conf_t *ccf = conf; |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
310
diff
changeset
|
1125 |
455 | 1126 char *group; |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1127 struct passwd *pwd; |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1128 struct group *grp; |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1129 ngx_str_t *value; |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1130 |
517 | 1131 if (ccf->user != (uid_t) NGX_CONF_UNSET_UINT) { |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1132 return "is duplicate"; |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1133 } |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1134 |
455 | 1135 if (geteuid() != 0) { |
1136 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
1137 "the \"user\" directive makes sense only " | |
1138 "if the master process runs " | |
1139 "with super-user privileges, ignored"); | |
1140 return NGX_CONF_OK; | |
1141 } | |
1142 | |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1143 value = (ngx_str_t *) cf->args->elts; |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1144 |
473 | 1145 ccf->username = (char *) value[1].data; |
1146 | |
1288 | 1147 ngx_set_errno(0); |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
289
diff
changeset
|
1148 pwd = getpwnam((const char *) value[1].data); |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1149 if (pwd == NULL) { |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1150 ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno, |
452 | 1151 "getpwnam(\"%s\") failed", value[1].data); |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1152 return NGX_CONF_ERROR; |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1153 } |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1154 |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1155 ccf->user = pwd->pw_uid; |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1156 |
455 | 1157 group = (char *) ((cf->args->nelts == 2) ? value[1].data : value[2].data); |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1158 |
1288 | 1159 ngx_set_errno(0); |
455 | 1160 grp = getgrnam(group); |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1161 if (grp == NULL) { |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1162 ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno, |
455 | 1163 "getgrnam(\"%s\") failed", group); |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1164 return NGX_CONF_ERROR; |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1165 } |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1166 |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1167 ccf->group = grp->gr_gid; |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1168 |
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1169 return NGX_CONF_OK; |
278
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
270
diff
changeset
|
1170 |
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
270
diff
changeset
|
1171 #endif |
234
cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
231
diff
changeset
|
1172 } |
473 | 1173 |
1174 | |
499 | 1175 static char * |
1069 | 1176 ngx_set_env(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
1177 { | |
1178 ngx_core_conf_t *ccf = conf; | |
1179 | |
1180 ngx_str_t *value, *var; | |
1181 ngx_uint_t i; | |
1182 | |
1183 var = ngx_array_push(&ccf->env); | |
1184 if (var == NULL) { | |
1185 return NGX_CONF_ERROR; | |
1186 } | |
1187 | |
1188 value = cf->args->elts; | |
1189 *var = value[1]; | |
1190 | |
1191 for (i = 0; i < value[1].len; i++) { | |
1192 | |
1193 if (value[1].data[i] == '=') { | |
1194 | |
1195 var->len = i; | |
1196 | |
1197 return NGX_CONF_OK; | |
1198 } | |
1199 } | |
1200 | |
1201 return NGX_CONF_OK; | |
1202 } | |
1203 | |
1204 | |
1205 static char * | |
499 | 1206 ngx_set_priority(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
473 | 1207 { |
1208 ngx_core_conf_t *ccf = conf; | |
1209 | |
1210 ngx_str_t *value; | |
1211 ngx_uint_t n, minus; | |
1212 | |
1213 if (ccf->priority != 0) { | |
1214 return "is duplicate"; | |
1215 } | |
1216 | |
1217 value = cf->args->elts; | |
1218 | |
1219 if (value[1].data[0] == '-') { | |
1220 n = 1; | |
1221 minus = 1; | |
1222 | |
1223 } else if (value[1].data[0] == '+') { | |
1224 n = 1; | |
1225 minus = 0; | |
1226 | |
1227 } else { | |
1228 n = 0; | |
1229 minus = 0; | |
1230 } | |
1231 | |
1232 ccf->priority = ngx_atoi(&value[1].data[n], value[1].len - n); | |
1233 if (ccf->priority == NGX_ERROR) { | |
1234 return "invalid number"; | |
1235 } | |
1236 | |
1237 if (minus) { | |
1238 ccf->priority = -ccf->priority; | |
1239 } | |
1240 | |
1241 return NGX_CONF_OK; | |
1242 } | |
577 | 1243 |
1244 | |
1245 static char * | |
1246 ngx_set_cpu_affinity(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
1247 { | |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
1248 #if (NGX_HAVE_CPU_AFFINITY) |
577 | 1249 ngx_core_conf_t *ccf = conf; |
1250 | |
1251 u_char ch; | |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
1252 uint64_t *mask; |
577 | 1253 ngx_str_t *value; |
1254 ngx_uint_t i, n; | |
1255 | |
1256 if (ccf->cpu_affinity) { | |
1257 return "is duplicate"; | |
1258 } | |
1259 | |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
1260 mask = ngx_palloc(cf->pool, (cf->args->nelts - 1) * sizeof(uint64_t)); |
577 | 1261 if (mask == NULL) { |
1262 return NGX_CONF_ERROR; | |
1263 } | |
1264 | |
1265 ccf->cpu_affinity_n = cf->args->nelts - 1; | |
1266 ccf->cpu_affinity = mask; | |
1267 | |
1268 value = cf->args->elts; | |
1269 | |
1270 for (n = 1; n < cf->args->nelts; n++) { | |
1271 | |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
1272 if (value[n].len > 64) { |
577 | 1273 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
1274 "\"worker_cpu_affinity\" supports up to 64 CPUs only"); |
577 | 1275 return NGX_CONF_ERROR; |
1276 } | |
1277 | |
1278 mask[n - 1] = 0; | |
1279 | |
1280 for (i = 0; i < value[n].len; i++) { | |
1281 | |
1282 ch = value[n].data[i]; | |
1283 | |
1284 if (ch == ' ') { | |
1285 continue; | |
1286 } | |
1287 | |
1288 mask[n - 1] <<= 1; | |
1289 | |
1290 if (ch == '0') { | |
1291 continue; | |
1292 } | |
1293 | |
1294 if (ch == '1') { | |
1295 mask[n - 1] |= 1; | |
1296 continue; | |
1297 } | |
1298 | |
1299 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
1300 "invalid character \"%c\" in \"worker_cpu_affinity\"", | |
1301 ch); | |
2024 | 1302 return NGX_CONF_ERROR; |
577 | 1303 } |
1304 } | |
1305 | |
1306 #else | |
1307 | |
1308 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
1309 "\"worker_cpu_affinity\" is not supported " | |
1310 "on this platform, ignored"); | |
1311 #endif | |
1312 | |
1313 return NGX_CONF_OK; | |
1314 } | |
1315 | |
1316 | |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
1317 uint64_t |
577 | 1318 ngx_get_cpu_affinity(ngx_uint_t n) |
1319 { | |
1320 ngx_core_conf_t *ccf; | |
1321 | |
1322 ccf = (ngx_core_conf_t *) ngx_get_conf(ngx_cycle->conf_ctx, | |
1323 ngx_core_module); | |
1324 | |
1325 if (ccf->cpu_affinity == NULL) { | |
1326 return 0; | |
1327 } | |
1328 | |
1329 if (ccf->cpu_affinity_n > n) { | |
1330 return ccf->cpu_affinity[n]; | |
1331 } | |
1332 | |
1333 return ccf->cpu_affinity[ccf->cpu_affinity_n - 1]; | |
1334 } | |
4890
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1335 |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1336 |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1337 static char * |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1338 ngx_set_worker_processes(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1339 { |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1340 ngx_str_t *value; |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1341 ngx_core_conf_t *ccf; |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1342 |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1343 ccf = (ngx_core_conf_t *) conf; |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1344 |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1345 if (ccf->worker_processes != NGX_CONF_UNSET) { |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1346 return "is duplicate"; |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1347 } |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1348 |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1349 value = (ngx_str_t *) cf->args->elts; |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1350 |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1351 if (ngx_strcmp(value[1].data, "auto") == 0) { |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1352 ccf->worker_processes = ngx_ncpu; |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1353 return NGX_CONF_OK; |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1354 } |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1355 |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1356 ccf->worker_processes = ngx_atoi(value[1].data, value[1].len); |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1357 |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1358 if (ccf->worker_processes == NGX_ERROR) { |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1359 return "invalid value"; |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1360 } |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1361 |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1362 return NGX_CONF_OK; |
173cd5458281
Core: the "auto" parameter of the "worker_processes" directive.
Andrey Belov <defan@nginx.com>
parents:
4783
diff
changeset
|
1363 } |