[PLUG] kernel module

abhi abhi.elementx at gmail.com
Mon Jun 29 14:01:50 IST 2009


Hi. I have begun writing kernel modules and facing an issue regarding
passing args to the module:
Here's my code:
#include<linux/module.h>
#include<linux/kernel.h>
#include<linux/init.h>

static char *agent_name = "UNKNOWN";
static int agent_code = 47;

MODULE_PARM (agent_name, "s");
MODULE_PARM (agent_code, "i");

static int __init my_init_function(){
    printk(KERN_ALERT "\ninserted module : passing_args...");
    printk(KERN_ALERT "\nAGENT Name : %s", agent_name);
    printk(KERN_ALERT "\nAGENT CODE : %i", agent_code);
    return 0;
}

static void __exit my_exit_function(){
    printk(KERN_ALERT "removed module : passing_args");
}

module_init(my_init_function);
module_exit(my_exit_function);

*I get this error when i do the make:*

make -C /lib/modules/2.6.27.5-117.fc10.i686/build
SUBDIRS=/home/Demon/Linux_Modules/thrd_passing_args_module modules
make[1]: Entering directory `/usr/src/kernels/2.6.27.5-117.fc10.i686'
  CC [M]  /home/Demon/Linux_Modules/thrd_passing_args_module/passing_args.o
*/home/Demon/Linux_Modules/thrd_passing_args_module/passing_args.c:8: error:
expected ‘)’ before string constant
/home/Demon/Linux_Modules/thrd_passing_args_module/passing_args.c:9: error:
expected ‘)’ before string constant*
/home/Demon/Linux_Modules/thrd_passing_args_module/passing_args.c:11:
warning: function declaration isn’t a prototype
/home/Demon/Linux_Modules/thrd_passing_args_module/passing_args.c:18:
warning: function declaration isn’t a prototype
/home/Demon/Linux_Modules/thrd_passing_args_module/passing_args.c:23: fatal
error: opening dependency file
/home/Demon/Linux_Modules/thrd_passing_args_module/.passing_args.o.d:
Permission denied
compilation terminated.
make[2]: ***
[/home/Demon/Linux_Modules/thrd_passing_args_module/passing_args.o] Error 1
make[1]: *** [_module_/home/Demon/Linux_Modules/thrd_passing_args_module]
Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.27.5-117.fc10.i686'
make: *** [default] Error 2

Where am i going wrong?
Thank you.
-- 
"The best security against revolution is in constant correction of abuses
and the introduction of needed improvements. It is the neglect of timely
repair that makes rebuilding necessary."
-Richard Whately



More information about the Plug-mail mailing list