PKMESG(3PVM)

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

πŸ’Œ PKMESG(3PVM) β€” the "message in a message" era

okay bestie, PVM Version 3.4 called and it has the most unhinged little trick for you: putting whole messages inside other messages. like nesting dolls but make it ✨distributed computing✨. this is pvm_pkmesg, pvm_pkmesgbody, and pvm_upkmesg, and they ate, fr fr 🫢


✨ SYNOPSIS ✨

C girlies, here's your moment:

int info = pvm_pkmesg( int bufid )
int info = pvm_pkmesgbody( int bufid )
int newbufid = pvm_upkmesg( )

Fortran besties, you're also so valid:

call pvmfpkmesg( bufid, info )
call pvmfpkmesgbody( bufid, info )
call pvmfupkmesg( bufid, newbufid )

πŸŽ€ PARAMETERS πŸŽ€

  • bufid β€” the message buffer you're packing. your main character.
  • newbufid β€” the new message buffer that got unpacked, or a result code. she contains multitudes πŸ’…
  • info β€” the result code. lowkey the vibe check on whether it worked.

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically these functions let you include entire messages inside other messages, as data elements. messages in messages in messages. it's giving inception, no cap.

pvm_pkmesg packs the specified message into the current send buffer. and when we say "the whole message" we mean the entire body, plus all the header attributes, every single one, bestie:

  • length
  • context tag
  • message tag
  • wait identifier
  • encoding
  • checksum
  • source and destination addresses
🚨 the buffer you specify must not be the same as the current send buffer. do not do that. that's not the move.

you can pack multiple messages into a single message, and you can mix those packed messages with literally any other data types. it's a whole buffet 🌸

pvm_upkmesg unpacks a message from the current receive buffer, and it allocates a brand new message buffer for it. the body of this new baby message, plus all those header attributes listed above, match the one that was originally packed using pvm_pkmesg. like, exact match. iconic.

pvm_pkmesgbody is basically pvm_pkmesg's chill sibling, but she packs only the body of the specified message and skips the header fields entirely. in other words β€” it splices the messages together, and the included message is left unaltered. untouched. pristine. 🧚

⚠️ when you call pvm_pkmesgbody, the encoding types of the two messages must match, because the included message body is just appended straight onto the send buffer. no conversion, no glow-up, just vibes.

and yes, calls to pvm_pkmesgbody can be mixed with calls to pack any other data types. versatility queen πŸ‘‘

πŸ’€ Note: pvm_upkmesgbody doesn't exist. not because we forgot, but because PVM doesn't keep track of the boundary between the two messages. the line between them is simply gone. lost to the void. so don't go looking for her.

πŸ”₯ EXAMPLES πŸ”₯

here's the moment you've been waiting for:

pvm_recv(-1, -1);
pvm_initsend(PvmDataDefault);
pvm_pkstr("here is the message I received...");
pvm_pkmesg(pvm_getrbuf());

receiving a message, starting a new send, packing a little string, and then packing the entire message you just received into it. nesting. layers. main character energy. 😭


πŸ’€ ERRORS πŸ’€

these are the error conditions that pvm_pkmesg, pvm_pkmesgbody, or pvm_upkmesg can hand back to you:

  • PvmBadParam β€” you gave bufid an invalid value, or bufid is the current send buffer. (we told you not to do that, bestie.)
  • PvmNoSuchBuf β€” the message buffer bufid doesn't exist. she's not here. never was. πŸ™ˆ
  • PvmNoMem β€” libpvm can't allocate memory to pack the data. tragic.
  • PvmNoData β€” the end of the message has been reached, possibly because your pack and unpack calls were mismatched. you zigged when you should've zagged.
  • PvmNoBuf β€” there's no current send (or receive) buffer. nothing to work with. empty.
  • PvmMismatch β€” pvm_pkmesgbody was called and the encoding types of bufid and the current send buffer don't match. the two messages simply weren't compatible. it happens πŸ’”

πŸ‘‘ SEE ALSO πŸ‘‘

go read these next, i promise they're worth it:

  • pvm_getrbuf(3PVM)
  • pvm_getsbuf(3PVM)
  • pvm_pack(3PVM)

and that's the whole page, periodt. this was PVM Version 3.4 serving you PKMESG(3PVM), dated 10 February, 1995 β€” yes she's vintage, yes she still slays, and yes, the header said PKMESG(3PVM) at the top and the footer said it again at the bottom, because branding is forever πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from