Error message not relevant
Santosh Sivaraj
santosh at fossix.org
Wed Nov 20 11:51:42 EST 2013
* Nav Kamal <navkamal90 at gmail.com> wrote (on 2013-11-20 16:43:26 +0000):
> Am learning to write LKMs and wrote this program :
>
> #include<linux/init.h>
> #include<linux/module.h>
> static int module_entry(void){
> printk(KERN_ALERT "Hello World !!\n");
> return 0;
> }
> static void exit_module(void){
> printk(KERN_ALERT "Bye World .... \n");
> }
> module_init(module_entry);
> module_exit(exit_module);
>
> In this program if I change return value of function module_entry from 0 to
> something negative, the module fails to load. The error message is :
What was the exact value? Must be you returned -1, as an example try to pass
some other lower negative numbers. It converts to error string using err or
perror. So you get that permission denied for the value you passed.
>
> "insmod: ERROR: could not insert module test.ko: Operation not permitted"
>
> Failing to load module with negative return value is understandable but I
> can't understand why it says "Operation not permitted". Its not about user
> permissions, its about return value. Can somebody please guide me about
> this ?
Santosh
--
When you really want something (and take the first steps in that direction), the
entire universe will conspire to fulfill your desire. -- P. Coelho
More information about the Kernelnewbies
mailing list