Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!dinl!noren From: noren@dinl.uucp (Charles Noren) Newsgroups: comp.unix.wizards Subject: System V Message Queue Question Summary: Why does it work on some Suns and not others? Keywords: suns, system V, message queues, msgget, msgsnd, msgrcv, whynot Message-ID: <859@dinl.mmc.UUCP> Date: 15 Mar 89 15:39:47 GMT Reply-To: noren@dinl.UUCP (Chuck Noren) Organization: Martin Marietta I&CS, Denver CO. Lines: 52 On one of our Sun systems (Sun 3/280 with SunOS 4.01) I've got some C code working using System V Message Queues. Running the program to any other of our networked machines (3/50, 3/260 with SunOS 4.01) the code fails on the msgget(2) call to create a non-existant message queue. errno indicates an invalid argument, which was valid on the machine it ran on. Any ideas on what the problem is an how to fix it? Is it a sysgen parameter that needs to be changed to allow message queues? Sample code: /* * Create message queue. * Create by also checking the existence of the message queue. * If the queue exists, the create attempt will fail. * * The flags of the first msgget perform the following: * * 00600 Set the permissions of the message queue * for read/write by user only. * * IPC_CREAT Create a message queue (defined in * ). * * IPC_EXCL Perform the operations only if the message * queue does not already exist (defined in * ). * */ if((qid = msgget(key, 00600 | IPC_CREAT| IPC_EXCL)) == -1) { /* * ...perform error processing. * */ } key is defined as key_t and I have used values from (key_t) 1 thru (key_t) 30. The errno I get is 22 (EINVAL -- Invalid argument) when I was expecting an errno of 17 (EEXIST -- File exists, which is what I get on the Sun that this stuff works on if the queue already exists). On the Suns that this does not work I cannot even create a "private" queue (key = IPC_PRIVATE). Any help will be appreciated. -- Chuck Noren NET: ncar!dinl!noren US-MAIL: Martin Marietta I&CS, MS XL8058, P.O. Box 1260, Denver, CO 80201-1260 Phone: (303) 971-7930