PKMESG(3PVM)

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

πŸ’Œ PKMESG(3PVM) β€” bestie, you can put a whole message inside another message

okay so this is PKMESG(3PVM) from PVM Version 3.4 and it's literally the "message-ception" page. we're packing entire messages into other messages like it's nothing. nesting era. πŸ’…

The stars of the show are pvm_pkmesg, pvm_pkmesgbody, and pvm_upkmesg β€” they pack messages into other messages. fr fr.


✨ SYNOPSIS ✨

C:

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

Fortran:

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

πŸŽ€ PARAMETERS πŸŽ€

  • bufid β€” the message buffer you wanna pack. your little envelope 🫢
  • newbufid β€” the new message buffer that got unpacked, or a result code. depends on the vibes.
  • info β€” the result code. classic.

🌸 DESCRIPTION 🌸

So these functions are how you include messages inside other messages, treating them like just another data element. nesting! main character energy honestly. πŸ‘‘

pvm_pkmesg packs the specified message into the current send buffer. Not just the body β€” the entire body gets packed, along with all these header attributes:

  • length
  • context tag
  • message tag
  • wait identifier
  • encoding
  • checksum
  • source and destination addresses
🚨 lowkey important: the buffer you specify must not be the same as the current send buffer. no self-packaging bestie, that's not the move.

You can pack multiple messages into a single message, and you can mix those packed messages with any other data types. go off. πŸ”₯

pvm_upkmesg unpacks a message from the current receive buffer, and it allocates a brand new message buffer for it. The body of that newly created message, plus all those header attributes listed above, match the one you originally packed with pvm_pkmesg. it's giving exact replica. ✨

pvm_pkmesgbody is similar to pvm_pkmesg, except it packs only the body of the specified message and leaves the header fields out entirely. So basically it splices the messages together, and the included message is left unaltered. untouched. preserved. queen behavior. πŸ’–

⚠️ but listen: when you call pvm_pkmesgbody, the encoding types of the two messages must match, because the included message body just gets appended straight to the send buffer. no conversion, no translation, no mercy. they have to be twins.

Calls to pvm_pkmesgbody can be mixed with calls to pack any other data types, so you're free to be chaotic with it.

πŸ“Œ Note: pvm_upkmesgbody doesn't exist. like, at all. why? because PVM doesn't keep track of the boundary between the two messages. the line between them is simply lost to history. πŸ’€ rip to a function that never was.

πŸ¦‹ 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, packed a string, and then packed the entire received message in there too. obsessed. πŸ“


πŸ’€ ERRORS πŸ’€

Here's the drama β€” these 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, the self-pack thing again. don't.)
  • PvmNoSuchBuf β€” message buffer bufid doesn't exist. it's not real, bestie, it never was. πŸ‘»
  • PvmNoMem β€” Libpvm is unable to allocate memory to pack data. ran out of room, tragic.
  • PvmNoData β€” the end of the message has been reached, possibly because your pack and unpack calls were mismatched. mismatched? in this economy? 😭
  • PvmNoBuf β€” there is no current send (or receive) buffer. nothing to work with. empty. void.
  • PvmMismatch β€” pvm_pkmesgbody was called and the encoding types of bufid and the current send buffer don't match. told you they had to be twins. πŸ™ˆ

🌈 SEE ALSO 🌈

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

and that's the whole page, iykyk. this iconic lil manpage was living its best life back on 10 February, 1995, and yeah, that date is in the footer, so consider this your cute lil sign-off. mwah. πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from