0
点赞
收藏
分享

微信扫一扫

nginx 数据类型解析


       最近在读nginx源码,一开始就有些困难,主要是他的各种数据类型的定义都是自定义的,需要在各种文件中进行查找,最终才能知道该种数据类型到底是哪一种基本类型,开始的时候是在文件中记录的,后来想想还不如直接在这里记一下,以供大家参考,不定时更新(笔者从main函数开始遇到新的数据类型,确定类型之后就记一下)

​​1.ngx_int_t​​2.ngx_log_t
3.ngx_cycle_t
4.ngx_pool_t

ngx_int_t是定义在core文件夹中的ngx_config.h文件中的定义如下:

typedef    intptr_t ngx_int_t;

ngx_log_t是定义在core文件夹中的ngx_log_t.h文件中的,定义如下:

struct ngx_log_s {
ngx_uint_t log_level;
ngx_open_file_t *file;

ngx_atomic_uint_t connection;

ngx_log_handler_pt handler;
void *data;

/*
* we declare "action" as "char *" because the actions are usually
* the static strings and in the "u_char *" case we have to override
* their types all the time
*/

char *action;
};


ngx_cycle_t是定义在core文件夹中的ngx_cycle.h文件中的,定义如下:

struct ngx_cycle_s {
void ****conf_ctx;
ngx_pool_t *pool;

ngx_log_t *log;
ngx_log_t new_log;

ngx_connection_t **files;
ngx_connection_t *free_connections;
ngx_uint_t free_connection_n;

ngx_queue_t reusable_connections_queue;

ngx_array_t listening;
ngx_array_t paths;
ngx_list_t open_files;
ngx_list_t shared_memory;

ngx_uint_t connection_n;
ngx_uint_t files_n;

ngx_connection_t *connections;
ngx_event_t *read_events;
ngx_event_t *write_events;

ngx_cycle_t *old_cycle;

ngx_str_t conf_file;
ngx_str_t conf_param;
ngx_str_t conf_prefix;
ngx_str_t prefix;
ngx_str_t lock_file;
ngx_str_t hostname;
};
ngx_core_conf_t的定义是


举报

相关推荐

0 条评论