当前位置: 技术问答>linux和unix
新手求助:简单用参数的hello world内核程序
来源: 互联网 发布时间:2017-04-16
本文导语: 基本照着ldd第三版写了个hello world带参数的程序 代码如下: #include #include MODULE_LICENSE("Dual DSD/GPL"); static char* whom = "world"; static int count = 1; module_param(count,int,S_IRUGO); module_param(whom,charp,S_IRUGO); static int hello_i...
基本照着ldd第三版写了个hello world带参数的程序
代码如下:
#include
#include
MODULE_LICENSE("Dual DSD/GPL");
static char* whom = "world";
static int count = 1;
module_param(count,int,S_IRUGO);
module_param(whom,charp,S_IRUGO);
static int hello_init(void)
{
int i;
for(i=0;iinit suspiciously returned 32, it should follow 0/-E convention
[674978.685888] sys_init_module: loading module anyway...
[674978.685892] Pid: 28494, comm: insmod Tainted: P N 2.6.32.12-0.7-pae #1
[674978.685895] Call Trace:
[674978.685910] [] try_stack_unwind+0x1b1/0x1f0
[674978.685917] [] dump_trace+0x3f/0xe0
[674978.685922] [] show_trace_log_lvl+0x4b/0x60
[674978.685927] [] show_trace+0x18/0x20
[674978.685933] [] dump_stack+0x6d/0x74
[674978.685940] [] sys_init_module+0x1bf/0x230
[674978.685946] [] sysenter_do_call+0x12/0x22
[674978.685954] [] 0xffffe424
请问这些是什么意思呢,是因为我用了char*的指针么?
代码如下:
#include
#include
MODULE_LICENSE("Dual DSD/GPL");
static char* whom = "world";
static int count = 1;
module_param(count,int,S_IRUGO);
module_param(whom,charp,S_IRUGO);
static int hello_init(void)
{
int i;
for(i=0;iinit suspiciously returned 32, it should follow 0/-E convention
[674978.685888] sys_init_module: loading module anyway...
[674978.685892] Pid: 28494, comm: insmod Tainted: P N 2.6.32.12-0.7-pae #1
[674978.685895] Call Trace:
[674978.685910] [] try_stack_unwind+0x1b1/0x1f0
[674978.685917] [] dump_trace+0x3f/0xe0
[674978.685922] [] show_trace_log_lvl+0x4b/0x60
[674978.685927] [] show_trace+0x18/0x20
[674978.685933] [] dump_stack+0x6d/0x74
[674978.685940] [] sys_init_module+0x1bf/0x230
[674978.685946] [] sysenter_do_call+0x12/0x22
[674978.685954] [] 0xffffe424
请问这些是什么意思呢,是因为我用了char*的指针么?
|
hello_init这个函数你得返回0啊