System V messages problem
Ross McKay
rosko at runx.ips.oz
Sun Oct 16 17:26:05 AEST 1988
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 at runx.ips.oz.AU
------CUT HERE FOR EXAMPLE CODE---8<-----------------------------------------
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#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();
}
More information about the Comp.bugs.sys5
mailing list