PKMESG(3PVM)

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

πŸ’Œ PKMESG β€” packing messages inside messages, bestie πŸ’Œ

okay so this is PKMESG(3PVM) from PVM Version 3.4, and it's literally the "message-ception" page. we're putting whole messages inside other messages. no cap. 🫢


✨ NAME ✨

pvm_pkmesg, pvm_pkmesgbody, pvm_upkmesg β€” pack messages into other messages. yes the whole vibe is nesting. it's giving russian dolls but make it IPC. πŸͺ†


🌸 SYNOPSIS 🌸

C besties:

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

Fortran besties:

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

πŸŽ€ PARAMETERS πŸŽ€

  • bufid β€” the message buffer you're packing. the little guy going into the envelope πŸ’–
  • newbufid β€” either the new message buffer that got unpacked, or a result code. it's doing double duty, she contains multitudes ✨
  • info β€” result code. the receipts. 🧾

πŸ‘‘ DESCRIPTION πŸ‘‘

so these functions exist so you can shove entire messages into other messages, treating them like they're just another data element. iconic behavior honestly.

pvm_pkmesg packs the specified message into the current send buffer. and not just the body β€” the entire body plus all the header attributes go in:

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

the slay part: you can pack multiple messages into a single message, and packed messages can be mixed with any other data types. go off, truly. πŸ”₯

pvm_upkmesg unpacks a message from the current receive buffer, and it allocates a new message buffer for it. the body of the newly created message, plus all those header attributes listed above, match the one you originally packed with pvm_pkmesg. so it comes out looking exactly like it went in. periodt. πŸ’…

pvm_pkmesgbody is like pvm_pkmesg's chill sibling β€” it packs only the body of the specified message and omits the header fields. in other words, it splices the messages together, and the included message is left unaltered. untouched. pristine. πŸ¦‹

⚠️ but listen: when you call pvm_pkmesgbody, the encoding types of the two messages must match, because the included message body is simply appended to the send buffer. no matching encoding = no vibes. also, calls to pvm_pkmesgbody can be mixed with calls to pack any other data types. flexible queen.
πŸ“Œ Note: pvm_upkmesgbody doesn't exist, because PVM doesn't keep track of the boundary between the two messages. she simply cannot tell where one ends and the other begins 😭 so don't go looking for it, bestie.

🌈 EXAMPLES 🌈

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

look at that. received a message, started a new send buffer, packed a string, then packed the entire received message in after it. main character energy fr fr. 🌟


πŸ’€ ERRORS πŸ’€

the following error conditions can be returned by pvm_pkmesg, pvm_pkmesgbody or pvm_upkmesg:

  • PvmBadParam β€” an invalid value was specified for the bufid argument, or bufid is the current send buffer. (yeah, that thing we told you not to do.)
  • PvmNoSuchBuf β€” message buffer bufid doesn't exist. she's not here. πŸ™ˆ
  • PvmNoMem β€” Libpvm is unable to allocate memory to pack data. out of room, no space, the vibe is cramped.
  • PvmNoData β€” the end of the message has been reached, perhaps because pack and unpack calls were mismatched. you zigged when you should have zagged 😭
  • PvmNoBuf β€” there is 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. told you the encodings had to match!! ⚠️

πŸ¦‹ SEE ALSO πŸ¦‹

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

and that's the whole page, bestie. mwah. πŸ’œ

this was PVM Version 3.4, dated 10 February, 1995 β€” yes she's vintage, yes she still ate, and no we will not be discussing how old that makes her. πŸŽ€βœ¨

πŸ“¦ where this page comes from