System V messages problem

Wonderly gregg at ihlpb.ATT.COM
Thu Oct 20 00:16:45 AEST 1988


>From article <1794 at runx.ips.oz>, by rosko at runx.ips.oz (Ross McKay):
> 
> Hello,
> 	I have been trying to get message passing to work on my Microport
> System.
> .....
>
> ------CUT HERE FOR EXAMPLE CODE---8<-----------------------------------------
> 
> 	for(i = 0; i < 20; ++i)
                      ^^^
PLEASE, PLEASE, PLEASE use NSIG here or something a little more portable.
Signal numbers start at 1 besides...

> 		signal(i, cleanup);
> 
> 	if((msgid = msgget(MSGKEY, -1)) == -1)
                                  ^^^
Try using the actual flag here.  MAKE IT OBVIOUS WHAT THE HECK YOU ARE
DOING.

You are also setting IPC_EXCL, IPC_NOWAIT besides IPC_CREATE.  If the key
already exists, then this will fail with EEXIST.

-- 
Gregg Wonderly
AT&T Bell Laboratories                   DOMAIN: gregg at ihlpb.att.com
IH2D217 - (312) 979-2794                 UUCP:   att!ihlpb!gregg



More information about the Comp.bugs.sys5 mailing list