1. System V.2 IPC (msgop - message passing) ?
Question about System V message passing (IPC):
In the man pages for msgop(2), it shows the message to be passed
as type *msgbuf. The man pages say the struct is:
struct msgbuf{
int mtype; /* type of message (arbitrary) */
char mtext[]; /* body of message */
}
Now this implies that the pointer mtext can be assigned to an
array or can be malloc'd to. (which makes sense)
However, looking at the include file when this is defined <sys/msg.h>,
it defines the structure like this:
struct msgbuf {
int mtype;
char mtext[1]; /* note the '1' */
}
What is going on here, I can't redefine this pointer, and I certainly
can't pass descent messages in *1* byte.
Of course the work around is obvious, define the structure myself as:
struct whatever {
int mtype;
char mtext[100]; /* or char *mtype */
}
This works just fine, however, it is no longer portible code.
What if some versions of sys V (maybe some in the future) throw
in another flag. Then my code is F*CKED.
So, anyone know the story?? This is not an isolated case, as both
HP-UX (based on sys V) and even Sun's System V compatibility mode
use this same definition (char mtext[1]).
Thanx in advance (as usual),
Tony
--
**************** Insert 'Standard' Disclaimer here: OOP ACK! *****************
* Tony Parkhurst -- {hplabs|sdcsvax|ncr-sd|hpfcla|ihnp4}!hp-sdd!artecon!adp *
***************************************************************************
2. Dip-problems
3. Need help with rpc.statd and rpc.lockd messages (AIX 3.2)
4. eth interface hardware-problem?
5. RPC - system call to support RPC API
7. How to change default icons in GNOME (MC)?
8. How to use rpc.portmap, rpc.mountd, rpc.nfsd?
9. Where are rpc.portmap, rpc.mountd, rpc.nfsd?
10. Dangers of rpc.portmap, rpc.mountd, rpc.nfsd
11. RPC 4.0 vs RPC 4.1 vs TI RPC