nginx的核心数据结构ngx_cycle

本文详细解析了 ngx_cycle_s 结构体,它是 Nginx 中核心的数据结构之一,用于管理 Nginx 的运行周期。文章介绍了该结构体中各个成员变量的功能,包括配置上下文数组、内存池、日志、连接文件等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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               pathes;        //路径数组
    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;     //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;      //主机名
};

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值