nginx
来源:互联网 发布:logback 自定义数据库 编辑:程序博客网 时间:2024/05/19 06:17
ngx_list_t
ngx_list_t是Nginx封装的链表容器,如HTTP的头部就是ngx_list_t来存储的。
typedef struct ngx_list_part_s struct ngx_list_part_tstruct ngx_list_part_s{ void *elts; ngx_uint_t nelts; ngx_list_part_t *next;}typedef struct { ngx_list_part_t *last; ngx_list_part_t part; size_t size;}ngx_list_t
ngx_list_t描述整个链表,而ngx_list_part_t只是描述链表的一个元素,可以成为存储数组的链表。就是每个链表元素ngx_list_part_t又是一个数组,拥有连续的内存,依赖ngx_list_t里的size和nalloc来表示数组的容量,又依靠每个ngx_list_part_t成员的nelts来表示数组当前使用来多少容量。事实上ngx_list_part_t数组中的元素才是用户想要存储的。
ngx_list_createj接口用于创建新的链表。
ngx_list_t *ngx_list_create(ngx_pool_t *pool,ngx_uint_t n ,size_t size);
ngx_list_init接口用于初始化一个已有的链表。
ngx_list_push接口用于添加新的元素。
模块编译进nginx
把源代码放入一个目录下,同时在目录下编写一个文件用于通知nginx如何编译本模块,文件名必须命名为config
这样只需要在configure脚本执行时候加入参数-add-module=PATH。
其实在执行完configure脚本后Nginx会生成objs/Makefile和objs/ngx_modules.c文件,完全可以修改这2个文件。
阅读全文
0 0
- nginx
- Nginx
- Nginx
- Nginx
- Nginx
- nginx
- nginx
- nginx
- nginx
- nginx
- nginx
- nginx
- nginx
- Nginx
- nginx
- nginx
- nginx
- nginx
- 可怕!Facebook 竟能识别出性工作者!你怎么看?
- chrome源码最后一个支持xp版本(49.0.2623.112)代码下载和编译
- C++可执行文件自定义成linux系统服务
- leetcode 79|212. Word Search 1|2
- Linux添加/删除用户和用户组知识
- nginx
- 深入理解Java的接口和抽象类
- 【面经】非科班渣本的秋招经历
- 1.1求值
- 设计介绍
- ERR_CONTENT_LENGTH_MISMATCH 问题的解决 手记
- 跟着别人学ssm+springSecurity(一)
- Tomcat7性能优化
- 45、我的C#学习笔记11