From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,cf7b099c99ee894b X-Google-Attributes: gidfc89c,public X-Google-Thread: fee84,cf7b099c99ee894b X-Google-Attributes: gidfee84,public X-Google-Thread: 1014db,cf7b099c99ee894b X-Google-Attributes: gid1014db,public X-Google-Thread: f678f,cf7b099c99ee894b X-Google-Attributes: gidf678f,public From: Charles M Richmond Subject: Re: Digital Unix message queue programming problem!! Date: 1997/02/27 Message-ID: <3315745B.41C6@iisc.com>#1/1 X-Deja-AN: 221800909 References: <33162B5F.437B@silicon.net.my> To: fskok@silicon.net.my Organization: Integrated International Systems Corp. Newsgroups: comp.unix.osf.osf1,comp.unix.programmer,comp.unix.osf.misc,comp.lang.c Your test code worked fine on Dunix 3.2d, SunOS 4.1.4, Ultrix 4.4, and Solaris 2.5. The only error was in running as non-root, which caused an errno 13 (access). Kok Fock Seng wrote: > > Hi out there, > > I am writing a program utilize the message queue (IPC) feature > in Dec Unix. > > The scenario is the queue can be created using msgget(). > I use ipcs to view it. By when I call msgsnd(), it will > block there (no return) if I set the flag to 0. If I > set the flag to IPC_NOWAIT, it will return with errno = 35. > Well, somehow, the data I want to send cannot get thro. > I have check all the manual and man page. No finding. > Is the any system parameters that I need to set? > > TIA. > > Here's my full test code : > > #include > #include > #include > #include > #include > #include > > int nIndexQueueId; /* message queue id for INDEX */ > > extern int errno; > > typedef struct { > long msgtype; /* queue type */ > char msgbuf [ 100 ]; /* contains the data */ > } MSGQ; > > MSGQ m; > > void main () > { > int messageid; > > m.msgtype = 1L ; > strcpy(m.msgbuf,"This is a test msg!") ; > > if (( messageid = msgget ((key_t)(6000L), IPC_CREAT)) == -1 ) > exit (-1); > fprintf(stderr, "[%d]", messageid); > > if ( msgsnd ( messageid, &m, strlen(m.msgbuf)+1, 0) == -1) > fprintf(stderr, "Test Queue got problem!\n err [%d]", errno); > else fprintf(stderr, "Test Queue OK!\n"); > printf(stderr, "[%d]\n", errno) ; > > } > > Regards, > Kok Fock Seng > fskok@silicon.net.my > System Administrator > Silicon Communications. -- *********************************************************************** * Charles Richmond Integrated International Systems Corporation * * cmr@iisc.com cmr@koibito.iisc.com cmr@shore.net * * UNIX Internals, I18N, L10N, X, Realtime Imaging, and Custom S/W * * One Longfellow Place Suite 3309 , Boston , Ma. USA 02114-2431 * * (617) 723 7695 (617) 367 3151 FAX (617) 723 6861 * ***********************************************************************