comparison src/core/nginx.c @ 100:7ebc8b7fb816

nginx-0.0.1-2003-06-03-19:42:58 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 03 Jun 2003 15:42:58 +0000
parents c9b243802a17
children 6dfda4cf5200
comparison
equal deleted inserted replaced
99:a059e1aa65d4 100:7ebc8b7fb816
29 29
30 30
31 int main(int argc, char *const *argv) 31 int main(int argc, char *const *argv)
32 { 32 {
33 int i; 33 int i;
34 ngx_str_t conf_file; 34 ngx_str_t conf_file;
35 ngx_conf_t conf; 35 ngx_log_t *log;
36 ngx_conf_t conf;
36 37
37 ngx_max_sockets = -1; 38 ngx_max_sockets = -1;
38 39
40 #if 0
39 ngx_log.fd = STDERR_FILENO; 41 ngx_log.fd = STDERR_FILENO;
40 ngx_log.log_level = NGX_LOG_INFO; 42 ngx_log.log_level = NGX_LOG_INFO;
41 43
42 /* STUB */ ngx_log.log_level = NGX_LOG_DEBUG; 44 /* STUB */ ngx_log.log_level = NGX_LOG_DEBUG;
43 45 #endif
44 if (ngx_os_init(&ngx_log) == NGX_ERROR) { 46 log = ngx_log_init_errlog();
47
48 if (ngx_os_init(log) == NGX_ERROR) {
45 return 1; 49 return 1;
46 } 50 }
47 51
48 ngx_pool = ngx_create_pool(16 * 1024, &ngx_log); 52 ngx_pool = ngx_create_pool(16 * 1024, log);
49 /* */ 53 /* */
50 54
51 ngx_max_module = 0; 55 ngx_max_module = 0;
52 for (i = 0; ngx_modules[i]; i++) { 56 for (i = 0; ngx_modules[i]; i++) {
53 ngx_modules[i]->index = ngx_max_module++; 57 ngx_modules[i]->index = ngx_max_module++;
70 ngx_pcalloc(ngx_pool, ngx_max_module * sizeof(void *)), 74 ngx_pcalloc(ngx_pool, ngx_max_module * sizeof(void *)),
71 1); 75 1);
72 76
73 conf.ctx = ngx_conf_ctx; 77 conf.ctx = ngx_conf_ctx;
74 conf.pool = ngx_pool; 78 conf.pool = ngx_pool;
75 conf.log = &ngx_log; 79 conf.log = log;
76 conf.module_type = NGX_CORE_MODULE; 80 conf.module_type = NGX_CORE_MODULE;
77 conf.cmd_type = NGX_MAIN_CONF; 81 conf.cmd_type = NGX_MAIN_CONF;
78 82
79 conf_file.len = sizeof(NGINX_CONF) - 1; 83 conf_file.len = sizeof(NGINX_CONF) - 1;
80 conf_file.data = NGINX_CONF; 84 conf_file.data = NGINX_CONF;
81 85
82 if (ngx_conf_parse(&conf, &conf_file) != NGX_CONF_OK) { 86 if (ngx_conf_parse(&conf, &conf_file) != NGX_CONF_OK) {
83 return 1; 87 return 1;
84 } 88 }
89
90 #if 0
91 log = (ngx_log_t *) ngx_get_conf(ngx_errlog_module);
92 /* STUB */ log->log_level = NGX_LOG_DEBUG;
93 #endif
85 94
86 ngx_init_temp_number(); 95 ngx_init_temp_number();
87 96
88 ngx_io = ngx_os_io; 97 ngx_io = ngx_os_io;
89 98
93 return 1; 102 return 1;
94 } 103 }
95 } 104 }
96 } 105 }
97 106
98 if (ngx_open_listening_sockets(&ngx_log) == NGX_ERROR) { 107 if (ngx_open_listening_sockets(log) == NGX_ERROR) {
99 return 1; 108 return 1;
100 } 109 }
101 110
102 /* TODO: daemon, once only */ 111 /* TODO: daemon, once only */
103 112
104 /* TODO: fork */ 113 /* TODO: fork */
105 114
106 ngx_pre_thread(&ngx_listening_sockets, ngx_pool, &ngx_log); 115 ngx_pre_thread(&ngx_listening_sockets, ngx_pool, log);
107 116
108 /* TODO: threads */ 117 /* TODO: threads */
109 118
110 /* STUB */ 119 /* STUB */
111 ngx_worker(&ngx_log); 120 ngx_worker(log);
112 } 121 }
113 122
114 return 0; 123 return 0;
115 } 124 }
116 125