System V message queues?

Robert Claeson robert at PVAB.SE
Tue Feb 21 08:09:58 AEST 1989


I want to create a message queue that will serve as the communications
channel for two co-operating processes. The type field of the message
will be used to indicate what process the message is destined to.
One process will typically fork() and exec() the second process. And I
decided to use message queues (rather than pipes) since the messages
are delimited (with pipes, I only get a raw data stream, no matter if
the data was written byte-for-byte or in some other way).

Now, the first process creates a message queue with a parameter of
IPC_PRIVATE to msgget() before it starts the second process. But how
do I pass the queue id to the new process? I could probably use sema-
phores or shared memory for this, but how do I then pass the semaphore
id to the new process? How are the System V IPC facilities intended to
be used, by the way?

Enlighten me, please.
-- 
Robert Claeson, ERBE DATA AB, P.O. Box 77, S-175 22 Jarfalla, Sweden

Tel:   +46 758 202 50              EUnet:    rclaeson at ERBE.SE
Fax:   +46 758 197 20              Internet: rclaeson at ERBE.SE



More information about the Comp.unix.questions mailing list