模块API之__symbol_get/__symbol_put
来源:互联网 发布:数据库设计与开发 下载 编辑:程序博客网 时间:2024/06/05 04:08
__symbol_get/__symbol_put 是一对函数。分别用于根据一个symbol 找到对应的模块后,将模块的引用计数增加1或者减小1.其源码分析如下:void *__symbol_get(const char *symbol){struct module *owner;const struct kernel_symbol *sym;//find_symbol 会查找module list,因此需要通过preempt_disable 来禁止抢占preempt_disable();//找到symbol 对应的模块sym = find_symbol(symbol, &owner, NULL, true, true);//如果sym不为空,则说明找到,调用strong_try_module_get 将这个模块的引用计数增加1if (sym && strong_try_module_get(owner))sym = NULL;preempt_enable();return sym ? (void *)sym->value : NULL;}void __symbol_put(const char *symbol){struct module *owner;preempt_disable();//找到symbol 对应的模块if (!find_symbol(symbol, &owner, NULL, true, false))BUG();//module_put 将这个模块的引用计数减小1module_put(owner);preempt_enable();}
阅读全文
0 0
- 模块API之__symbol_get/__symbol_put
- 模块API之__module_address
- 模块API之__module_text_address
- 模块API之find_module
- 模块API之module_is_live
- 模块API之module_refcount
- 模块API之try_module_get
- 模块API之module_address_lookup
- 模块API之lookup_module_symbol_name
- 模块API之lookup_module_symbol_attrs
- 模块API之module_get_kallsym
- 模块API之print_modules
- 模块API之ref_module
- 模块API之register_module_notifier
- 模块API之each_symbol_section
- 模块API之symbol_put_addr
- 模块API之sprint_symbol
- 模块API之print_symbol
- osgEarth无数据像素透明案例 25.nodata.earth
- 【SpringMVC】springmvc与struts2的区别(九)
- 详解 CSS 居中布局技巧
- Android注解学习笔记
- jQuery 变量数字相加
- 模块API之__symbol_get/__symbol_put
- 使用VS2013 + EF6 + .NET4.5 连接Mysql数据库
- ROS_kinetic下rgbdslam_V2的安装和使用
- 设计模式-----创建型之工厂模式
- 李飞飞CS231n2017课程双语字幕版上线 !(附课程链接)
- 独家 | PHM数据竞赛首个中国夺冠团队经验分享(常用模型&赛题详解&PPT&视频)
- 网关相关
- 《锋利的jQuery》学习笔记(1)
- Vue和Ionic前车之鉴