Xref: utzoo comp.unix.wizards:11807 comp.bugs.sys5:626 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!pyrnj!pyrdc!uunet!munnari!otc!metro!ipso!runx!rosko From: rosko@runx.ips.oz (Ross McKay) Newsgroups: comp.unix.wizards,comp.bugs.sys5 Subject: System V messages problem Message-ID: <1794@runx.ips.oz> Date: 16 Oct 88 07:26:05 GMT Organization: RUNX Un*x Timeshare. Sydney, Australia. Lines: 61 Hello, I have been trying to get message passing to work on my Microport System (System V.2, uPort version 2.3, a '286 box (yes, I know it's hideous, but it's also cheap)). I tried using an example programme from Bach's book, "The Design of the Unix Operating System", shown below. The problem is that on the first msgget() call, the operating system return ENOENT, which according to the manual means "A message queue identifier does not exist for key and (msgflg & IPC_CREAT) is false." msgflg & IPC_CREAT is true, however, but uPort nicely returns the error anyway. I am running the kernel with message passing enabled, so I am wondering just what Microport did to message passing ... Jan Mikkelsen c/o rosko@runx.ips.oz.AU ------CUT HERE FOR EXAMPLE CODE---8<----------------------------------------- #include #include #include #define MSGKEY 75 struct msgform { long mtype; char mtext[256]; } msg; int msgid; main() { int i, pid, *pint; extern cleanup(); for(i = 0; i < 20; ++i) signal(i, cleanup); if((msgid = msgget(MSGKEY, -1)) == -1) { perror("msgget"); /* error check added by janm */ exit(1); } for(;;) { pint = (int *) msg.mtext; pid = *pint; printf("server: receive from pid %d\n", pid); msg.mtype = pid; *pint = getpid(); msgsnd(msgid, &msg, sizeof(int), 0); } } cleanup() { msgctl(msgid, IPC_RMID, 0); exit(); }