LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-28-2005, 08:30 AM   #1
rickthemick
Member
 
Registered: Aug 2003
Location: Sweden
Distribution: Debian
Posts: 52

Rep: Reputation: 15
Kernel IPC question


IPC between the kernel and a user space program confuses me. Hopefully some of you can clear things up.

I want to be able to communicate with a kernel module from a user space prorgam in a fast and convinient (? :-)) way.

In my world I can imagine, in general, two basic ways how this can be performed:

1. Writing to some kind of file, where the parties can write/read to communicate.
2. Implement some kind of funtion call.

On the web I have found a few alternatives:

1. Implement a system call in the kernel module
2. Implement an ioctl in the kernel module
3. Use netlink/rtnetlink sockets
4. Register a device (e.g /dev)
5. Use the /proc file system thing

The problem is that I can't weigh pros and cons and then decide which one to use. I would appreciate it very much, if some one could say a few words on this and/or point me to some documentation (A link to a good document can be enough since I'm will to learn these things myself, but a few words from an experienced one will do no harm).

If there is a 2.4 vs 2.6 collision, I'm mostly interested in Linux 2.6.

Best Regards
Rickard
 
Old 10-28-2005, 11:45 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,691
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
Look at the way that, say, udev is done. Or, look at the module loader.

Perhaps you could describe more about what your kernel-module is to be designed to do...?
 
Old 10-30-2005, 09:23 AM   #3
rickthemick
Member
 
Registered: Aug 2003
Location: Sweden
Distribution: Debian
Posts: 52

Original Poster
Rep: Reputation: 15
Thank youy for your reply, I'll dig into that...

I'll try to create a firewall that can be mastered by passing rules from user space down to a the kernel module that make sure the rules are applied using the netfilter framework. The main purpose is to learn how stuff works... (I dont want to queue packets for userspace using the premade lib since this will be too slow I guess, and too easy...)

BR,
Rick
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IPC question... climbingmerlin Programming 4 11-03-2005 03:30 AM
about IPC iclinux Programming 1 01-14-2005 11:16 PM
IPC between kernel and user mode bun_zee Programming 1 06-04-2004 12:08 PM
using IPC::Open2 acid_kewpie Programming 7 09-18-2002 10:24 AM
IPC Shared Memory support in kernel? stevho Linux - General 1 01-17-2002 07:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration