您的位置:首页 > 其它

在内核中添加函数

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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  struct file module