How can I use IPC between Kernel- & Userspace?

How can I use IPC between Kernel- & Userspace?

Post by J. Andersso » Tue, 24 Nov 1998 04:00:00



Hi,
I'm wondering if (how) it's possible to use some sort of InterProcess
Communication between a process in kernelspace and one in userspace?

Perhaps I could use a pipe for this?

Thanks in advance //
J. Andersson

 
 
 

How can I use IPC between Kernel- & Userspace?

Post by Geoff Winkles » Tue, 24 Nov 1998 04:00:00



>I'm wondering if (how) it's possible to use some sort of InterProcess
>Communication between a process in kernelspace and one in userspace?

System V IPC?

Geoff

 
 
 

How can I use IPC between Kernel- & Userspace?

Post by A Red Hat Linux us » Thu, 26 Nov 1998 04:00:00



> Hi,
> I'm wondering if (how) it's possible to use some sort of InterProcess
> Communication between a process in kernelspace and one in userspace?

> Perhaps I could use a pipe for this?

> Thanks in advance //
> J. Andersson

Have a look at linux/fs/nfs in the file inode.c:

/*
 * The way this works is that the mount process passes a structure
 * in the data argument which contains an open socket to the NFS
 * server and the root file handle obtained from the server's mount
 * daemon.  We stash these away in the private superblock fields.
 * Later we can add other mount parameters like caching values.
 */

struct super_block *nfs_read_super(struct super_block *sb, void
*raw_data,int silent)

The handling for a UNIX socket or a pipe should be similar.

G'day,
sjames

 
 
 

How can I use IPC between Kernel- & Userspace?

Post by Andreas Klee » Thu, 26 Nov 1998 04:00:00


: Hi,
: I'm wondering if (how) it's possible to use some sort of InterProcess
: Communication between a process in kernelspace and one in userspace?

The usual way is to create a character device driver and use the device for
kernel/user level communication. The user level side of things opens the
device and reads/writes data over it. The kernel has plenty of examples in
drivers/char/

In 2.1 there is a very elegant alternative too: a netlink socket. netlink
has the advantage that it already implements all code for pseudo reliable
delivery - you just pass it a buffer and netlink does the rest. With a device
you have to do your own queue management.

-Andi

 
 
 

1. Berkeley IPC & SysV IPC

I've noticed that SunOS4.1.3 has include files sys/msg.h, sys/sem.h,
and sys/shm.h even though it is a BSD4.3 os. OSF/1 V1.3 has the include
file socket.h, even though it is a SysV os. Since Berkeley IPC and
SysV IPC are distinct methods and useful in their own ways, I was wondering
how universal it is for Unices to have both methods. i.e. would it be
wise for a piece of PD software to rely on a system to have one, the other,
or both?
--
                                        Nelson Brown

2. How to Change Bootable Drive?

3. AT&T IPC-802 /IPC-900 Drivers for SCO?

4. CSLIP/PPP for Sun OS 4.1.3

5. Server design using sockets & IPC

6. Debugger question

7. Using AT&T Streams for IPC on AIX

8. Command complete near qfull count?

9. Fortran & IPC using System V shared memory

10. IPC cache & kernel fault

11. Solaris 2.5.1 & HP OpenView IPC/Semaphore kernel configuration problem

12. Fastest IPC Mechanism & How to choose b/w User Mode and Kernel Mode

13. Robotics Engineering Excellence && RTC (TCP/shared memory IPC package)