message passing between user processes AND between a user process and kernel space

message passing between user processes AND between a user process and kernel space

Post by Nico De Ceulae » Fri, 22 Mar 2002 01:57:37



Hi,

I'm struggling here to fit an existing OS API on top of linux so we can
ditch the old OS but keep the existing userland code.
The thing I'm having some sort of trouble with is the message passing
mechanism in linux.

In our existing SW, all processes loop around a call OS_RECEIVE_MSG. This
function waits for the next message for that perticular process. In theory,
a message can have several sources.
1) Somebody else sent us a message (typically another process). This maps
nicely to System V IPC msgsnd and msgrcv
2) A timer event (timers are started within this process, but more than 1
timer can be active at a time)
3) A timeout of the receive function (we can specify the maximum time we
want to wait for a new message)
4) A signal

We decided System V IPC message queues would fit best (better than FIFO's,
pipes).

The timeouts are handled by starting a timer when doing the OS_RECEIVE_MSG
call. So a timeout event is nothing different from a timer event.

Signals are sent through OS_SEND_SIGNAL. We just translate this to a msgsnd
and reserve a field in our message to hold all the signal info. No problems
there (these aren't Linux signals - it something called signal in our
original OS).

First problem: we only have 1 timer per process ! We decided to fix this by
writing a small kernel module that gives us unlimited timers. See the last
problem below for why we can't do this !

Last problem (but the hardest for us) is interrupts/kernel timers. We have
several devices that are supposed to send a message to a process. Our
interrupt handler lives in kernel space, and we can't send IPV messages from
kernel space. Some digging showed us that in the 2.0.x kernels, there was an
option in msg.c to send IPC from kernel space to user space (just what I
need !). But this code was removed in 2.2.x (or something in between these
two kernel releases).

So this is my question:
How do I send messages between (A) two user processes and (B) kernel space
and a user process.

best regards,
Nico De Ceulaer

 
 
 

1. message passing between user processes and kernel space

Hi,

I'm struggling here to fit an existing OS API on top of linux so we can
ditch the old OS but keep the existing userland code.
The thing I'm having some sort of trouble with is the message passing
mechanism in linux.

In our existing SW, all processes loop around a call OS_RECEIVE_MSG. This
function waits for the next message for that perticular process. In theory,
a message can have several sources.
1) Somebody else sent us a message (typically another process). This maps
nicely to System V IPC msgsnd and msgrcv
2) A timer event (timers are started within this process, but more than 1
timer can be active at a time)
3) A timeout of the receive function (we can specify the maximum time we
want to wait for a new message)
4) A signal

We decided System V IPC message queues would fit best (better than FIFO's,
pipes).

The timeouts are handled by starting a timer when doing the OS_RECEIVE_MSG
call. So a timeout event is nothing different from a timer event.

Signals are sent through OS_SEND_SIGNAL. We just translate this to a msgsnd
and reserve a field in our message to hold all the signal info. No problems
there (these aren't Linux signals - it something called signal in our
original OS).

First problem: we only have 1 timer per process ! We decided to fix this by
writing a small kernel module that gives us unlimited timers. See the last
problem below for why we can't do this !

Last problem (but the hardest for us) is interrupts/kernel timers. We have
several devices that are supposed to send a message to a process. Our
interrupt handler lives in kernel space, and we can't send IPV messages from
kernel space. Some digging showed us that in the 2.0.x kernels, there was an
option in msg.c to send IPC from kernel space to user space (just what I
need !). But this code was removed in 2.2.x (or something in between these
two kernel releases).

So this is my question:
How do I send messages between (A) two user processes and (B) kernel space
and a user process.

best regards,
Nico De Ceulaer

2. network users problem

3. Matrox Mystique ands X.

4. strange hard drive behaviour

5. How to allow user process to continue after shell exits and user logs out?

6. nfs install

7. newbie q: how to let a user kill another user's process?

8. autofs or am-utils, which one?

9. urgent help required ulimit / max user processes aloowed (for a single user)

10. How to kill user processes and log users off??

11. Kill 'Old' User Process on Login of Same User

12. Data passing from kernel module to user space?

13. filesystem in user process space