Listing 2

int msqid;             /* Message queue identifier */
key_t key=0x1024;      /* Name of message queue    */

if ((msqid=msgget(key, 066 | IPC_CREAT | IPC_EXCL))==-1)}
   /* Can't create a new message queue. One already
    * exists by the same name. It is possible another
    * process is using the same key to get a message
    * queue. This prevents us from stepping on each
    * other.
   */
     fprintf(stderr,"Message queue already exists\n");
     return(-1);
}