Intercept System call using Kernel module is 2.6 kernel

Jenkins, Clive Clive.Jenkins at xerox.com
Wed Jun 7 03:14:19 EST 2006


>        x=mitesh_func(); 
>        printf("mitesh_func returned %d\n",x);

The first thing would be to change your user-space program
to print the error number from errno after your "system call".

        x=mitesh_func(); 
        printf("mitesh_func returned %d, errno=%d\n",x,errno);

Or you can use perror() -- look it up.

Clive
  


4) I verify from the system logs that when I insmod the kernel module I
get all the print statements. I verified from the logs  that the address
of the sys_call_table is correctly passed and from /proc/kallsysms I can
see that my function mitesh_func has been defined and has the address as
indicated in the logs. 

The problem is that when I execute my user app I expect to see two
things: 
 a) I should see a message in the log "Executing mitesh_func..." and 
 b) A return value of 2 

However I get an error value -1 returned. 

Any help and ideas are highly appreciated.  

Thank you in advance, 
Mitesh 



More information about the Linuxppc-dev mailing list