Re: Kernel Modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




	Hi all,

	Take a look at http://kernelnewbies.org/code/intercept for 
example.
	You have to replace a entry on sys_call_table that isnīt used. 
Like up the 222, ie, sys_call_table[222]. Replace it for your syscall. 
Like hijack a syscall.

	For the user program call your syscall, put this code in user 
programīs source:

#include <asm/unistd.h> // _syscallX macro

#define __NR_my_newsyscall 222 // the number of your syscall on 
sys_call_table

_syscall1(int,my_newsyscall,int,x) //example, depend how many arg


        ok after it, is only call the syscall like:
main(){
int i;
i=my_newsyscall(100);
}

        The only difference beteween add and hijack is how the program
will call your syscall. case 2, you have to inform the user program which 
entry
on sys_call_table is your syscall. Case 1....

        If I forgot some detail, anyone....

	So, you donīt need to compile the kernel......

	[]īs
Thobias.

> 
> I am writing a kernel module.
> 
> Currently the entry point to my module is a SYSTEM
> CALL.
> 
> My problem is I have to compile the whole kernel each
> time I make any changes to my code. So I want to
> convert my code to a lodable module. So that I don't
> need to recompile the kernel each time.
> 
> I am not sure how should I provide an entry point to
> the user processes to my module. I don't want to use
> ioctl as an entry point to my module.
> 
> For Eg. My module has defined function "foo". How
> should I make this function available to the user
> process ?


----
Thobias Salazar Trevisan <thobias@cos.ufrj.br>
Home Page - http://www.cos.ufrj.br/~thobias
Parallel Computing Laboratory / COPPE
Federal University of Rio de Janeiro
Brazil
__________________________
|	                 |
| Against - HTML Mail    |
|                        |
--------------------------



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux