System V message queues?

Bradley Smith bes at holin.ATT.COM
Wed Feb 22 22:56:29 AEST 1989


> 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?
I am not sure you want to use PRIVATE, but what you could do is
to use the same key. ie before the fork use getpid and save it,
after the fork then use that number as the key.  If you have 2 different
programgs, then send the number on the command line.
-- 
Bradley Smith
Computer Systems Offer Integration Laboratory
AT&T Bell Labs, Holmdel, NJ 
201-949-0090 att!holin!bes or bes at holin.ATT.COM



More information about the Comp.unix.questions mailing list