Solved

communicating a kernel module and an application.

Posted on 2004-04-26
3
266 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

717 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