Ngx_strerror_init
The main function is to save the error information in the ngx_sys_errlist array, to do a errno->errmsg map array, when the system error occurs, directly through errno to find ErrMsg, reduce API calls.
Ngx_get_options (argc, argv)
This function is mainly based on the user's input to set some flag variable and save the user input parameters.
Paramflag?/hngx_show_version=1/ngx_show_help=1vngx_show_version=1vngx_show_version=1/ngx_show_configure=1tngx_ Test_config=1qngx_quiet_mode=1pngx_prefix=argv[index] Support-p/home/work/nginx or–p/home/work/nginxcngx_conf_file= P Support Way ibid. gngx_conf_param=p Support Sngx_signal=p/ngx_process=ngx_process_signaller (stop, quit, reopen, reload)
Ngx_time_init->ngx_time_update
To update the following times by locking and unlocking
Variableformatngx_cached_time = Tp;ngx_cached_http_time.data = P0; " Mon, Sep 1970 06:00:00 GMT "ngx_cached_err_log_time.data = P1;" 1970/09/28 12:00:00 "ngx_cached_http_log_time.data = p2;" 28/sep/1970:12:00:00 +0600 "ngx_cached_http_log_iso8601.data = P3 " 1970-09-28t12:00:00+06:00 "
Ngx_regex_init ()
Main set two PCRE global allocation and recycling functions
Ngx_pid = Getpid ();//Get main process PID
Ngx_log_init (Ngx_prefix)
#if (NGX_WIN32) if (name[1]! = ': ') {#else if (name[0]! = '/') {#endif if (prefix) { Plen = Ngx_strlen (pre FIX)//if user entered-p prefix } else {#ifdef ngx_prefix prefix = (U_char *) ngx_prefix;//user not entered, use Configure path Plen = Ngx_strlen (prefix); #else plen = 0; #endif } if (plen) { name = malloc (Plen + Nlen + 2); if (name = = null) { return null; } p = ngx_cpymem (name, prefix, plen),//copy prefix if (!ngx_path_separator (* (p-1))) { *p++ = '/'; } NGX_CPYSTRN (P, (U_char *) Ngx_error_log_path, Nlen + 1);//copy PATH p = name; } }
The last return value and the Ngx_log of the function construct
Ngx_log{ngx_log.file = &ngx_log_file;{ ngx_fd_tfd;//Open error log ngx_str_tname;//not set u_char*buffer;//not set u_char*pos;//not set u_char*last;//not set}log_level = NGX_LOG_ NOTICE;}
Init_cycle.pool = Ngx_create_pool (1024x768, log);//Allocate a memory pool node, a specific memory pool, can
See the Memory Pool analysis document
ngx_save_argv
The function saves the user input parameters in the NGX_ARGV array.
Ngx_process_options
This function mainly deals with user input parameters, configuration files, test profiles,
Conf_file =/home/work/hunter/nginx/nginx_gdb/conf/nginx.conf
Conf_prefix =/home/work/hunter/nginx/nginx_gdb/conf
Prefix =/home/work/hunter/nginx/nginx_gdb
Ngx_crc32_table_init ()//Initialize CRC table
Set the module index for each module
Ngx_max_module = 0;for (i = 0; ngx_modules[i]; i++) {ngx_modules[i]->index = ngx_max_module++;}
Then analyze the configuration resolution
NGX_INIT_CYCL ()
The above describes the [Nginx source code Analysis] Main function parsing, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.