too few arguments to function 'register_sysctl_table'
Hi, all
I met a strange error while building a kernel module.
I am new in kernel module and want to build one with /proc/sys support.
Below is the source code.
#include <linux/init.h>
#include <linux/module.h>
#include <linux/sysctl.h>
MODULE_LICENSE("Dual BSD/GPL");
unsigned int hello_log;
static ctl_table powersave_nap_ctl_table[]={
{
.ctl_name = KERN_PPC_POWERSAVE_NAP,
.procname = "yw-test",
.data = &hello_log,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec,
},
{}
};
static ctl_table hello_table[] = {
{
.ctl_name = CTL_KERN,
.procname = "kernel",
.mode = 0755,
.child = powersave_nap_ctl_table,
},
{}
};
static struct ctl_table_header *hello_table_header;
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
hello_table_header = register_sysctl_table(hello_table);
if(!hello_table_header)
return -ENOMEM;
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
unregister_sysctl_table(hello_table_header);
}
module_init(hello_init);
module_exit(hello_exit);
-----------------------------------------
Without the /proc/sys file, I can build it and install it.
The kernel version is 2.6.21-1.3194.fc7.
Anyone get some idea?
|