notifier实例
来源:互联网 发布:神华招标采购 知乎 编辑:程序博客网 时间:2024/05/01 01:06
#include<linux/notifier.h>
#include<linux/module.h>
#include<linux/init.h>
#include<linux/kernel.h>
#include<linux/fs.h>
#define TESTCHAIN_INIT 0x52U
static RAW_NOTIFIER_HEAD(test_chain);
static int call_test_notifier(unsigned long val,void *v)
{
return raw_notifier_call_chain(&test_chain,val,v);
}
EXPORT_SYMBOL(call_test_notifier);
static int register_test_notifier(struct notifier_block *nb)
{
int err;
err = raw_notifier_chain_register(&test_chain,nb);
if(err)
goto out;
out:
return err;
}
EXPORT_SYMBOL(register_test_notifier);
static int __init test_chain_0_init(void)
{
printk("**%s**\n",__FUNCTION__);
return 0;
}
static void __exit test_chain_0_exit(void)
{
printk("***%s***\n",__FUNCTION__);
}
module_init(test_chain_0_init);
module_exit(test_chain_0_exit);
#include<linux/notifier.h>
#include<linux/module.h>
#include<linux/init.h>
#include<linux/kernel.h>
#include<linux/fs.h>
extern int register_test_notifier(struct notifier_block *nb);
#define TESTCHAIN_INIT 0x52U
int test_init_event(struct notifier_block *nb,unsigned long event,void *v)
{
switch(event)
{
case TESTCHAIN_INIT:
printk("**testchain_init**");
break;
default:
break;
}
return NOTIFY_DONE;
}
static struct notifier_block test_init_notifier =
{
.notifier_call = test_init_event,
};
static int __init test_chain_1_init(void)
{
printk("**i am in test_chain_1\n");
register_test_notifier(&test_init_notifier);
return 0;
}
static void __exit test_chain_1_exit(void)
{
printk();
}
module_init();
module_exit();
#include...
extern int call_test_notifier(unsigned long val,void *v)
#define TESTCHAIN_INIT 0X52U
static int __init test_chain_2_init(void)
{
printk("***i am in test_chain_2\n");
call_test_notifier(TESTCHAIN_INIT,"no_use");
return 0;
}
static void __exit test_chain_2_exit(void)
{
printk();
}
#include<linux/module.h>
#include<linux/init.h>
#include<linux/kernel.h>
#include<linux/fs.h>
#define TESTCHAIN_INIT 0x52U
static RAW_NOTIFIER_HEAD(test_chain);
static int call_test_notifier(unsigned long val,void *v)
{
return raw_notifier_call_chain(&test_chain,val,v);
}
EXPORT_SYMBOL(call_test_notifier);
static int register_test_notifier(struct notifier_block *nb)
{
int err;
err = raw_notifier_chain_register(&test_chain,nb);
if(err)
goto out;
out:
return err;
}
EXPORT_SYMBOL(register_test_notifier);
static int __init test_chain_0_init(void)
{
printk("**%s**\n",__FUNCTION__);
return 0;
}
static void __exit test_chain_0_exit(void)
{
printk("***%s***\n",__FUNCTION__);
}
module_init(test_chain_0_init);
module_exit(test_chain_0_exit);
#include<linux/notifier.h>
#include<linux/module.h>
#include<linux/init.h>
#include<linux/kernel.h>
#include<linux/fs.h>
extern int register_test_notifier(struct notifier_block *nb);
#define TESTCHAIN_INIT 0x52U
int test_init_event(struct notifier_block *nb,unsigned long event,void *v)
{
switch(event)
{
case TESTCHAIN_INIT:
printk("**testchain_init**");
break;
default:
break;
}
return NOTIFY_DONE;
}
static struct notifier_block test_init_notifier =
{
.notifier_call = test_init_event,
};
static int __init test_chain_1_init(void)
{
printk("**i am in test_chain_1\n");
register_test_notifier(&test_init_notifier);
return 0;
}
static void __exit test_chain_1_exit(void)
{
printk();
}
module_init();
module_exit();
#include...
extern int call_test_notifier(unsigned long val,void *v)
#define TESTCHAIN_INIT 0X52U
static int __init test_chain_2_init(void)
{
printk("***i am in test_chain_2\n");
call_test_notifier(TESTCHAIN_INIT,"no_use");
return 0;
}
static void __exit test_chain_2_exit(void)
{
printk();
}
0 0
- notifier实例
- Notifier
- java 多线程(1) wait和notifier实例
- Notifier Chains
- linux notifier
- git-notifier
- linux notifier
- linux notifier
- MySQL Notifier
- linux notifier
- Notifier chain 全面分析
- Linux Notifier Chains
- Linux Notifier Chains
- Linux Notifier Chains mechanism
- Notifier chain 分析
- Linux notifier chain机制
- Linux Notifier Chains
- Linux Notifier机制
- redis做消息队列
- JSP页面分页显示数据
- ZOJ-3705-Applications
- AMD, CommonJS, UMD简介
- Tomcat 8(二)server.xml详解
- notifier实例
- Java中的String、StringBuilder及StringBuffer的区别
- HTML基础之常用标记
- Android IPC之Messenger介绍
- 第三章 上机练习
- Mac下终端执行命令,如果提示权限不足解决方案
- 抓取android log
- 【小梅哥FPGA进阶教程】第九章 基于串口猎人软件的串口示波器
- Spring cloud Eureka服务注册及发现(一)创建Eurake服务器