Solved

communicating a kernel module and an application.

Posted on 2004-04-26
3
261 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

17 Experts available now in Live!

Get 1:1 Help Now