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,
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
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.
Nico De Ceulaer