notification chains 简介
来源:互联网 发布:ubuntu卸载virtualbox 编辑:程序博客网 时间:2024/05/19 10:38
Why notification chains
Notification chain 应用于Linux内核各子系统之间,有时一个子系统会关心另外一个子系统发生的事件,这时就可以注册一个关心那个时间的chain。典型例子是USB设备拔插,网络接口的使用。
使用限制
1,仅用于内核的子系统之间。应用层请使用常规进程通信手段如信号量,信号,socket,共享内存,共享文件等。内核到上层的接口有proc,sysctl,sysfs等。
2,在多CPU的机器中,有可能存在多个CPU同时调用notifier_call_chain函数来通知同一个notification chain。所以如果回调函数需要处理临界区域,回调函数需要自己维护互斥关系。
数据结构
int (*notifier_call)(struct notifier_block *, unsighed long ,void *); // 回调函数
struct notifier_block *next; //指向下一个注册项
int priority; // 优先级
}
内核中的Sample Chains
inet6addr_chain
netdev_chain
function
notifier_chain_register(struct notifier_block **nl,struct notifier_block *n) //notification 注册
notifier_chain_unregiser(struct notifier_block **nl , struct notifier_block *n) // notification 注销
/* 通知函数,当某事件发生时调用该函数
@nl: 指向需要通知chain的头
@val: 回调函数使用的参数
@v:回调函数使用的指针
@nr_to_call :没明白呢 Numer of notifier function to be called
@nr_call :Records the number of notifications sent
@returns : 回调函数的返回值
*/
notifier_call_chain(struct notifier_block **nl , unsighed long val , void *v ,int nr_to_call, int *nr_calls)
some wrapper function
- notification chains 简介
- Notification Chains
- Notification Chains
- Linux Notification chains
- linux Notification chains
- Notification简介
- Notification简介
- Notification简介
- MMS Notification 简介
- android notification 简介
- Notification简介(转)
- 一、Notification简介
- android notification简介
- android Notification简介
- Linux内核事件通知链(Linux Notifier Chains)简介
- Notification(通知)的使用简介
- CXF WebService Notification(WS-N)使用简介
- Notifier Chains
- 青岛最新公交线路一览(371-801)
- Sqlserver2005附加数据库时出错提示操作系统错误5120的解决办法
- Android常见问题收集
- C#String.PadLeft函数,文本对齐以及填补解决方案
- 项目总结
- notification chains 简介
- JVM类加载机制(ClassLoader)源码解析(1)
- android 中管理短信
- 通过【偷取此锁定】或【破除锁定】解锁SVN被锁定的文件的控制权
- 从菜鸟到高手的linux教程(三)
- vimdiff 少量文件合并,方便快捷
- 唤醒自己-你我共勉
- JavaScript 6给力 Web开发 新增特性
- c/c++: uint8_t uint16_t uint32_t uint64_t size_t ssize_t数据类型