SETMINFO(3PVM)
π SETMINFO(3PVM) β get/set message header info, bestie edition π
okay so this is a page from the PVM Version 3.4 manual, and honestly? it's a little gem. two functions, both about peeking at (or tweaking) the header info on a message. let's get into it π«Ά
β¨ NAME β¨
pvm_getminfo, pvm_setminfo β literally just get or set the header information of a message. that's it. that's the whole job. π
πΈ SYNOPSIS πΈ
the C girlies get this:
int info = pvm_getminfo( int bufid, struct pvmminfo *mi )
int info = pvm_setminfo( int bufid, struct pvmminfo *mi )
and the Fortran besties get this:
call pvmfgetminfo( bufid, len, ctx, tag, wid, enc, crc,
src, dst, info )
call pvmfsetminfo( bufid, ctx, tag, wid, src, dst, info )
π PARAMETERS π
bufidβ the message buffer identifier. which buffer are we talking about, bestie? this one. πmiβ the struct that's holding all the header information. it's giving little container of secrets.infoβ the result code. how'd it go? this will tell you.
for a description of the Fortran parameters, see below π (no fr, keep scrolling, they're all down there)
π¦ DESCRIPTION π¦
so these functions read and set the information that gets passed around in message headers. is that info relevant to every app? no. is it relevant to certain apps? absolutely yes, and those apps know who they are. π
typically you'll reach for these when you need to grab the message context or the wait id so you can reuse those same values in a reply message. very "matching energy" of you. β¨
here's the full list of fields that get affected:
lenβ the length in bytes of the body of the message. ifPvmDataRawis what you're using, this will equal the actual size of the data packed. otherwise? it may include pad bytes. so, like, sometimes it's the real number and sometimes it's the real number plus accessories. πctxβ the context that was sent with the message.tagβ the tag that was sent with the message.widβ the Wait Identifier. this is what you use to match a reply message up to its corresponding request. it's the β¨soulmate mechanicβ¨ of message passing.encβ the Message Encoding. either the data signature of the sender, or0x10000000for XDR.crcβ the CRC checksum of the message body.srcβ the tid of the sender.dstβ the tid of the destination.
so important: all fields may be read, but onlyctx,tag,wid,srcanddstmay be set. do not try to set the others. it's not happening. not on this page. π
and also, per the original, pvm_getmwid and pvm_setmwid return PvmOk if successful, or else a negative error code. (yes, we know those aren't the function names at the top of the page. we are simply reporting what the manual says, exactly as written, no cap. π)
π₯ EXAMPLES π₯
returning a message to a caller with the same tag and wait id:
/* return a message to a caller with the same tag and wait id */
struct pvmminfo mi1, mi2;
pvm_recv(-1, -1);
/* ... process, compose reply message */
pvm_getminfo(pvm_getrbuf(), &mi1);
pvm_getminfo(pvm_getsbuf(), &mi2);
mi2.wid = mi1.wid;
pvm_send(mi1.src, mi1.tag);
see how we grabbed the receive buffer info, grabbed the send buffer info, then copied wid over so the reply lines up with the request? that's the move. iconic. π
π ERRORS π
here's what pvm_getmwid or pvm_setmwid can throw back at you when things go sideways:
PvmBadParamβ invalid value for thebufidormiargument. you gave it something it cannot work with, bestie. πPvmNoSuchBufβ message bufferbufiddoesn't exist. it's not there. it never was. it's giving ghosted. π»
π SEE ALSO π
pvm_bufinfo(3PVM)
and that's the whole page!! π written by the PVM 3.4 girlies, dated 13 March, 1996 β yeah, this manual is vintage vintage, but the wisdom? timeless. go forth and match your wait ids, bestie. slay. π β¨
π¦ where this page comes from
- debian bookworm: pvm-dev 3.4.6-5
- ubuntu jammy: pvm-dev 3.4.6-3.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms