How do I know my Q-KEY is unique ?

Robert Claeson prc at erbe.se
Mon Sep 25 03:05:14 AEST 1989


In article <1747 at draken.nada.kth.se> d88-jwa at nada.kth.se (Jon W{tte) writes:

>I am currently considering using message queues for a game I'm writing.
>The problem is: when I create a message queue, I pass a (hopefully)
>unique 32-bit key. How do I make SURE this key is unique ? (I need to
>compile the key into a server as well as a client...)

I asked about the same question about 1/2 year ago. The summary of the
respones were, that queues (and semaphores and shared memories) should
be created with the IPC_PRIVATE key. This forces a new queue to be created.
The queue id that I then get can be passed on the command-line to
subprocesses that are created (I originally needed this for a terminal
driver that I'm still writing). Some people mentioned a "ftokey()" function.
I didn't investigate it. From the descriptions that I got, it didn't seem
that ftokey is guaranteed to return a unique key.

-- 
          Robert Claeson      E-mail: rclaeson at erbe.se
	  ERBE DATA AB



More information about the Comp.unix.wizards mailing list