SETMINFO(3PVM)

πŸ“¦ version 3.4.6, in debian bookworm, ubuntu jammy

πŸ’Œ 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. if PvmDataRaw is 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, or 0x10000000 for 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 only ctx, tag, wid, src and dst may 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 the bufid or mi argument. you gave it something it cannot work with, bestie. 😭
  • PvmNoSuchBuf β€” message buffer bufid doesn'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