eric@Cit-Vax (04/05/83)
In trying to use mpx files, I ran into some problems which the
following program illustrates:
main()
{
int fd;
int n,r;
char buf[512];
r = atoi(v[1]);
unlink("testmbox");
fd = mpx("testmbox",0666);
for (;;) {
n = read(fd,buf,READSIZE);
printf("%d\n",n);
}
}
I run this program in background, then do
% cat > testmbox
When READSIZE is 14 or more, everything works as expected, "cat"
tries to open the MPX file and a control message M_WATCH is sent,
and read by the program. It prints out 10, which is the size of
an M_WATCH control message (index,count,ccount,M_WATCH,uid: all shorts).
Then nothing happens because the program never does an attach.
However, when READSIZE is less than 14, the program prints out 0 in
an infinite loop. It seems to me that READSIZE == 10 should work.
What is going on??