Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbosgd!gatech!hope From: hope@gatech.CSNET (Theodore Hope) Newsgroups: net.unix Subject: Sys V IPC: My final word Message-ID: <2666@gatech.CSNET> Date: Tue, 11-Feb-86 16:33:35 EST Article-I.D.: gatech.2666 Posted: Tue Feb 11 16:33:35 1986 Date-Received: Wed, 12-Feb-86 08:32:07 EST Organization: School of Information and Computer Science, Georgia Tech, Atlanta Lines: 42 Keywords: ipc, msg Since I'm the one who originally asked for info regarding the use of the message queue system calls, let me say a few things. First of all, thanks to all who responded. The man pages for msgop(2) describe the msgbuf struct as containing long mtype; /* message type */ char mtext []; /* message text */ This kind of struc, especially in a syscall-passing sense, seems odd to me. It is obvious that mtext should be char mtext [some_number]; "Oh," said I. "I'll bet that's a misprint. Let's look at the file to see what they _really_ mean." Well, surprise. The .h file defines struct msgbuf { long mtype; char mtext [1]; <- Notice: it says [1] } Am I overlooking something obvious? After looking through the kernel source, it appeared that the msgsnd and msgrcv syscalls expect the data to start at msg.mtext, so by defining my own structs as struct Msgbuf { long mtype; char mtext [MAXMTEXT]; } everything is ok. Several folks suggested to read the Sys V IPC Primer, which I don't have handy. Others suggested the book "Advanced Systems Programming with Unix" (I can't remember the authors' names). -- Theodore Hope School of Information & Computer Science, Georgia Tech, Atlanta GA 30332 CSNet: hope@gatech ARPA: Hope%GATech.CSNet @ CSNet-Relay.ARPA uucp: ...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-sally}!gatech!hope