LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   I want add my own system call using LKM (loadable kernel module)... (https://www.linuxquestions.org/questions/linux-software-2/i-want-add-my-own-system-call-using-lkm-loadable-kernel-module-535104/)

raga4223688 03-06-2007 11:16 AM

I want add my own system call using LKM (loadable kernel module)...
 
I want add my own system call using LKM (loadable kernel module)...


Can anybody help me out....i need to customize the system call such that it would help me to send parametres to it and be able to return values.........

hal_2001 03-07-2007 07:21 AM

Not sure whether you really mean system call ? Perhaps you mean driver API ?

A solution is to create a kernel module that has an IOCTL interface to user-land. You need to create a /dev entry for the driver. The user-land application opens the /dev entry and uses your IOCTL messages.

Another method is to use /sys entries. Your kernel module creates /sys entries and assoicates functions to reading and writing of those /sys entries. Therefore, using command line cat and echo commands, the sys entries can be read or writen to respectively. This would allow you to read and write parameters into the kernel module.

Suggest you look at Linux O'Reilly books called "Linux Device Drivers" 3rd edition and "Understanding the Linux Kernel" 3rd edition.

Otherwise, find source code for an existing driver and use it as a template.


All times are GMT -5. The time now is 08:03 PM.