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))

最新文章

  1. 记一次Suse下的Django环境配置——第一弹
  2. plist的读取和写入
  3. if、if elif判断
  4. 用sql语句清除日志
  5. SharePoint2013的头像显示和读取
  6. Android Studio-设置鼠标悬停显示方法声明
  7. ThinkPHP CURD返回结果参考
  8. 【Python学习笔记】集合
  9. CF Exam (数学)
  10. 数据结构——AVL平衡树
  11. 微信小程序image组件binderror使用例子(对应html、js中的onerror)
  12. 》》初识移动端--rem
  13. BZOJ2751 [HAOI2012]容易题
  14. 解决git中upstream丢失问题Your branch is based on 'origin/xxxx', but the upstream is gone.
  15. Eureka服务注册中心相关错误com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
  16. c++简单的ATL COM开发和调用实例
  17. 使用postman给servlet传各种参数
  18. 【Ansible 文档】【译文】配置文件
  19. Dubbo架构设计详解(转载)
  20. JBoss 实战(2)

热门文章

  1. overflow-x: scroll;横向滑动详细讲解
  2. OC的内存管理和@class
  3. opencv摄像头捕获图像
  4. linux磁盘管理系列-软RAID的实现
  5. Mybatis分页插件PageHelper简单使用
  6. Mariadb Galera Cluster 群集 安装部署
  7. Vue 2.x + Webpack 3.x + Nodejs 多页面项目框架(上篇——纯前端多页面)
  8. yii2数据条件查询-where专题
  9. PHP 算法
  10. 如何打包静态库.framework文件 iOS