[comp.sys.sun] Message queues

raghu@timbaktu.osc.edu (Raghu) (09/29/89)

Two questions about message queues in SunOS:

1. I have a problem withe following piece of code.  I am trying to use the
message queue facility in UNIX and I have come across a strange problem.
The constant KERNEL_PORT is 2401 and the getuid call returns 104 ( my uid
on our SUNS at OSC).  Then, with a key of 2505 the call msgget blow out
with the message "Permission Denied". That should not happen as I set the
msgflag to reflect that (0000600).  Has anyone else seen this problem or
aware of this problem...


/*	if ((myqid = msgget((key_t) (KERNEL_PORT + getuid()), IPC_CREAT|0000600))	*/
	if ((myqid = msgget((key_t) getuid(),IPC_CREAT|0000600))
			== ERROR) {			
		perror("kernel (msgget)");
		exit(errno);
	}

2. I am exploring the use of message queues instead of the traditional
socket IPC operations.  The application involves a daemon-like program to
rendezvous two other processes and I want to use the message queue
facility to make synchronization possible. I am interesting in evaluating
on how much faster it would be to go this way.  Gut feeling indicates that
message queues could be faster than passing UDP packets around  and  this
might be  because the UNIX kernel supports this facility better ( and
probably uses it) .  

Any ideas or comments !!

Raghu

ghfeil@white.toronto.edu (Georg Feil) (10/03/89)

In article <1846@brazos.Rice.edu> raghu@timbaktu.osc.edu (Raghu) writes:
>X-Sun-Spots-Digest: Volume 8, Issue 148, message 6 of 10
>
>Then, with a key of 2505 the call msgget blow out
>with the message "Permission Denied". That should not happen as I set the
>msgflag to reflect that (0000600).  

This will happen if the queue exists owned by another user. Use ipcs to check.

Georg Feil
ghfeil@white.toronto.edu
...if that doesn't work try one of:
{uunet,pyramid,decvax,allegra,watmath,utzoo}!utcsri!white!ghfeil
ghfeil%white.toronto.edu@relay.cs.net     (ARPA)