在内核中添加函数
2007-05-22 20:50
183 查看
在内核中添加函数,自己用的一个比较简单的。
1)在linux/kernel/sched.c中添加函数
long my_sched_setscheduler(pid_t pid, int policy, struct sched_param *param)
{
return setscheduler(pid, policy, param);
}
2)修改 .../arch/mips/kernel/mips_ksyms.c
extern long my_sched_setscheduler(pid_t pid, int policy, struct sched_param *param);
EXPORT_SYMBOL(my_sched_setscheduler);
//------------------------------------------
If we want export some symbol in Kernel that is not in a module such as xxxx in the /arch/ppc/fec.c.
Firstly, define the xxxx in the fec.c;
Secondly, make a new file which contain the "extern" define the xxxx(for example, extern int xxxx);
Lastly, in the ppc_ksyms.c we includes the new file, and add the EXPORT_SYMBOL(xxxx).
Then we can use the xxxx.
1)在linux/kernel/sched.c中添加函数
long my_sched_setscheduler(pid_t pid, int policy, struct sched_param *param)
{
return setscheduler(pid, policy, param);
}
2)修改 .../arch/mips/kernel/mips_ksyms.c
extern long my_sched_setscheduler(pid_t pid, int policy, struct sched_param *param);
EXPORT_SYMBOL(my_sched_setscheduler);
//------------------------------------------
If we want export some symbol in Kernel that is not in a module such as xxxx in the /arch/ppc/fec.c.
Firstly, define the xxxx in the fec.c;
Secondly, make a new file which contain the "extern" define the xxxx(for example, extern int xxxx);
Lastly, in the ppc_ksyms.c we includes the new file, and add the EXPORT_SYMBOL(xxxx).
Then we can use the xxxx.
相关文章推荐
- 驱动模块的编写##向内核添加系统调用函数
- 第二步:在内核添加屏幕输出函数
- Kernel32--内核库函数提供的API AddAtom 向本地原子表添加一个字符串
- ubuntu 8.10 添加系统调用函数 及 内核编译
- 在内核中添加一个可以在用户态调用的函数
- 【转】CentOS 5.4 添加系统调用函数 及 内核编译
- 如何向pg内核中添加函数
- 解密jQuery内核 DOM操作的核心函数domManip
- c语言中如何添加计时函数,统计程序执行的时间
- 在LUA库中添加自己的函数库总结
- c语言中如何添加计时函数,统计程序执行的时间
- android studio如何添加重构函数
- linux-2.6.35内核移植—SD卡驱动的添加
- 内核关键函数KernelIoControl分析-非常好,很详细
- Linux内核中获取时间函数do_gettimeofday
- Linux添加内核系统调用报告
- ubuntu内核升级(还没成功,以后添加)
- 内核解惑:zw函数和nt函数的区别
- 在MTK中添加TASK与常用函数分析
- systemtap 列出所有linux 内核模块与相关函数2