nginx取结构体地址
2024-10-19 06:22:45
linux内核提供了一个container_of()宏,可以根据结构体某个成员的地址找到父结构的地址。
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr);\
(type *)( (char *)__mptr - offsetof(type,member) );)
而在Nginx也是效仿采用一样的宏获取父结构地址。
#define ngx_queue_data(q, type, link) \
(type *) ((u_char *) q - offsetof(type, link))
最新文章
- 记一次Suse下的Django环境配置——第一弹
- plist的读取和写入
- if、if elif判断
- 用sql语句清除日志
- SharePoint2013的头像显示和读取
- Android Studio-设置鼠标悬停显示方法声明
- ThinkPHP CURD返回结果参考
- 【Python学习笔记】集合
- CF Exam (数学)
- 数据结构——AVL平衡树
- 微信小程序image组件binderror使用例子(对应html、js中的onerror)
- 》》初识移动端--rem
- BZOJ2751 [HAOI2012]容易题
- 解决git中upstream丢失问题Your branch is based on 'origin/xxxx', but the upstream is gone.
- Eureka服务注册中心相关错误com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
- c++简单的ATL COM开发和调用实例
- 使用postman给servlet传各种参数
- 【Ansible 文档】【译文】配置文件
- Dubbo架构设计详解(转载)
- JBoss 实战(2)