Solved

communicating a kernel module and an application.

Posted on 2004-04-26
3
263 Views
Last Modified: 2010-04-21
hi,
  I have written a an application(user mode) and a  kernel module. i want to establish a communication between them. What is the procedure to call and run the functions of kernal module from external applications or vice versa. I also want to pass a block of data from that module to my application.
 I was thinking of createing a kernelthread and communicate using message passing. But i dont know how to do it?
 
Thanks.

 
0
Comment
Question by:manish_regmi
3 Comments
 
LVL 3

Accepted Solution

by:
PerlKing earned 125 total points
ID: 10918336
I am not sure of this, but I think you have to use a "character device" to communicate to the kernel.

I remember that in one of the projects I worked on our application had to communicate to the kernel. So, the approach we took was to write a device driver for a character device and place the data in this device. The device driver takes care of putting it to the kernel. (Pardon me for talking vaguely here, but I was just a sophomore when I was involved in this project and I hardly remember anything now)

If you could find a copy of O'Reilly Linux Device Drivers, 2nd Ed., it is an excellent place to start. "Chap 3: Char devices" is what you should be looking for.

http://www.oreilly.com/catalog/linuxdrive2/toc.html
0
 
LVL 8

Assisted Solution

by:Anthony2000
Anthony2000 earned 125 total points
ID: 10919921
Here is a link to the book online: http://www.xml.com/ldd/chapter/book/

The example programs can be found: http://examples.oreilly.com/linuxdrive2/

There are several ways to facilitate communications between application (user mode) and driver modules. Rubini's book covers some (or all) of them.

I have used portions of Rubini's memory driver and I have used the ioctl function to pass data in and out of the driver.  I  have also used the open, read, write driver interface functions.

One of the easiest ways to start is to compile and try the examples in the book. If you get stuck, just post what you are running into here and we can help.

> What is the procedure to call and run the functions of kernal module from external applications
Basically you can use the ioctl interface or the open, read and write.

Why do you need a kernel thread? I was just wondering.

Anthony

0
 
LVL 8

Author Comment

by:manish_regmi
ID: 10924114
hi,
 perlking and anthony2000,

I already have those books. thanks anyway.
 I got your point. You mean i need to create a character device and communicate through it.

-->Why do you need a kernel thread? I was just wondering.

Because i was not sure what to do.

Thanks for all your help.




 
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to import linux vhd to sccvmm 1 154
Debian 3.16.7 3 149
Shell script / command to generate IO / IOPS load 22 367
awk file 6 53
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question