xref: /unit/src/nxt_main.c (revision 0:a63ceefd6ab0)
1 
2 /*
3  * Copyright (C) Igor Sysoev
4  * Copyright (C) NGINX, Inc.
5  */
6 
7 #include <nxt_main.h>
8 #include <nxt_cycle.h>
9 
10 
11 extern char  **environ;
12 
13 
14 int nxt_cdecl
15 main(int argc, char **argv)
16 {
17     nxt_int_t     ret;
18     nxt_thread_t  *thr;
19 
20     static nxt_str_t   nxt_config_name = nxt_string_zero("nginx.conf");
21 
22     if (nxt_lib_start("nginman", argv, &environ) != NXT_OK) {
23         return 1;
24     }
25 
26 //    nxt_main_log.level = NXT_LOG_INFO;
27 
28     thr = nxt_thread();
29     nxt_thread_time_update(thr);
30 
31     nxt_main_log.handler = nxt_log_time_handler;
32 
33     nxt_log_error(NXT_LOG_INFO, thr->log, "nginman started");
34 
35     ret = nxt_cycle_create(thr, NULL, NULL, &nxt_config_name, 0);
36 
37     if (ret != NXT_OK) {
38         return 1;
39     }
40 
41     nxt_event_engine_start(thr->engine);
42 
43     nxt_unreachable();
44     return 0;
45 }
46