Solved

communicating a kernel module and an application.

Posted on 2004-04-26
3
262 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now