Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!sri-spam!ames!ucbcad!ucbvax!sdcsvax!ucsdhub!hp-sdd!artecon!tony From: tony@artecon.UUCP Newsgroups: comp.unix.questions Subject: System V.2 IPC (msgop - message passing) ? Message-ID: <419@artecon.artecon.UUCP> Date: Fri, 10-Apr-87 16:31:11 EST Article-I.D.: artecon.419 Posted: Fri Apr 10 16:31:11 1987 Date-Received: Sat, 11-Apr-87 21:09:56 EST Organization: Artecon Inc., San Diego Lines: 49 Keywords: Include file definitions 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 , 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 * * -OR- hp-sdd!artecon!adp@nosc.ARPA * *******************************************************************************