PUTINFO(3PVM)
โจ NAME โจ
okay bestie, welcome to the PUTINFO(3PVM) page ๐ this is literally the manual for pvm_putinfo, pvm_recvinfo, pvm_getmboxinfo, and pvm_delinfo โ they store and retrieve messages in the global mailbox, periodt ๐.
๐ธ SYNOPSIS ๐ธ
C:
int index = pvm_putinfo( char *name, int bufid, int flags )
int bufid = pvm_recvinfo( char *name, int index, int flags )
int info = pvm_delinfo( char *name, int index, int flags )
int info = pvm_getmboxinfo( char *pattern, int *nclasses,
struct pvmmboxinfo **classes )
struct pvmmboxinfo {
char *mi_name; /* class name */
int mi_nentries; /* # of entries for this class */
int *mi_indices; /* mbox entry indices */
int *mi_owners; /* mbox entry owner tids */
int *mi_flags; /* mbox entry flags */
};
Fortran:
call pvmfputinfo( name, bufid, flags, index )
call pvmfrecvinfo( name, index, flags, bufid )
call pvmfdelinfo( name, index, flags, info )
call pvmfgetmboxinfo( pattern, name, nclasses, nentries,
index, owner, flags, info )
๐ PARAMETERS ๐
nameโ the database key (class name), any null-terminated string. it's giving "name your vibe" energy โจindexโ the database key (class index), must be>= 0. default index =0. so if you don't pick one, it's zero bestie ๐flagsโ user specified options. (see below, we got you) ๐bufidโ handle of message buffer to put in database, or message returned. a returnedbufid < 0indicates an error. so negative = red flag ๐ฉinfoโ resulting status code. it's the receipts ๐patternโ GNU regular expression (pattern) to match on names in mailbox database. additionally, the singular"*"will match on all names. wildcard slay ๐ซnclassesโ number of classes matchingpattern. count 'em ๐ขclassesโ array ofpvmmboxinfomailbox entries matchingpattern. it's the whole squad ๐ซnentriesโ number of entries for a given class. how many besties in this class ๐ownerโ task id that inserted entry into mailbox database. the original main character ๐
๐ DESCRIPTION ๐
these functions implement a "message mailbox" database that can be used by PVM tasks to advertise information to other PVM tasks. an example would be to advertise names or locations of services. another example would be to advertise a common "context" on which two tasks may communicate. it's literally a group chat for your tasks, no cap ๐ฌ
the database entries are PVM messages keyed by a user specified name and an optional index value. the name may be any null-terminated string and the index a non-negative integer. the index value is assigned by PVM and is used to uniquely identify one of multiple named instances within the database. so like, same name, different index = different bestie ๐ฆ
entries are "owned" by the task that created them. an entry is automatically removed from the database when the owner task exits unless the database entry was created with flag PvmMboxPersistent. so if the owner ghosts, the entry ghosts too โ unless you made it persistent ๐ป
when a task exits and leaves an entry in the mailbox, the owner tid of that entry is marked as zero (0) to indicate that there is no longer an active owner task. so zero tid = no active owner, just a memory ๐
pvm_putinfo inserts a record in the database, given a key and data (message). it returns mailbox index number if the record is successfully stored, PvmExists if a record with the given key already exists, or PvmDenied if an attempt is made to overwrite a locked record. so it's either a new entry, a "already taken bestie", or a "you shall not pass" ๐ซ
the following options are added together as the flags parameter to pvm_putinfo. yes, add them like toppings on a sundae ๐
PvmMboxDefaultโ inserts entry as the only named instance for a given name. this entry may only be modified and deleted by its owner. it is automatically deleted when its owner exits. so it's exclusive, no sharing ๐PvmMboxPersistentโ entry remains in the database when the owner task exits. entries are removed from the database when PVM is halted or a reset is issued from the console. so it survives the owner's exit but not the whole system going down ๐PvmMboxMultiInstanceโ permits multiple entry instances of the same name. PVM will assign an index key to each instance. so you can have a whole polycule of entries with the same name ๐ฏPvmMboxOverWritableโ permits other tasks to overwrite and delete this database entry. so it's open for edits, no gatekeeping ๐PvmMboxDirectIndex( index )โ performs an atomic delete and re-insert for the mailbox entry at the givenindex. valid index values for this macro are limited to the range[ 0 .. PvmMboxMaxDirectIndex ). the given mailbox entry must have been created with thePvmMboxOverWritableflag set. ifindexis greater than0, then the mailbox must also have been created with thePvmMboxMultiInstanceflag set. so it's a glow-up swap, but you gotta follow the rules bestie โจ
pvm_recvinfo operates just like a pvm_recv() except the message is coming from the database. the message should be unpacked after pvm_recvinfo(). like pvm_recv, pvm_recvinfo returns a pointer to a message buffer containing the record matching the key <name,index> from the database. returned value < 0 indicates an error. so it's recv but make it database ๐
the following options are added together as the flags parameter to pvm_recvinfo. again, add 'em up ๐งฎ
PvmMboxDefaultโ exact match on key<name, index>is returned. returnsPvmNotFoundif exact match not found. so it's giving precise, no fuzzy vibes ๐ฏPvmMboxFirstAvailโ the first entry in<name>with index greater than or equal to the specifiedindexparameter is returned.PvmMboxFirstAvailwithindex = 0will produce the same results as usingPvmMboxDefault. so it's the "first available" bestie, very chill ๐PvmMboxReadAndDeleteโ return entry and delete from database. task must be permitted to do both read and delete otherwise an error will occur.bufidreturnsPvmNotFoundif entry does not exist and will returnPvmDeniedif the record exists but may not be deleted. so it's read and yeet, but only if you're allowed ๐๏ธ
pvm_delinfo deletes database entry specified by the key <name, index>. returns PvmOK if the record was deleted, PvmNotFound if the record does not exist, or PvmDenied if an attempt is made to remove a "locked" record. so it's the delete button, but sometimes it says no ๐
there are no flags presently specified for pvm_delinfo. so no extra toppings here, it's plain vanilla ๐ฆ
pvm_getmboxinfo returns an array of pvmmboxinfo for all class names in the database. this is used, for example, by programs that clean up the database or for applications to find out what is available. classes returns a pointer to the array allocated by libpvm and freed on the next call to pvm_getmboxinfo. so it's the "what's in the mailbox" tour ๐
the Fortran function returns information on one entry per call. thus, if called repeatedly until an info value of PvmNotFound is returned, all entries matching the given pattern will have been returned. if a new pattern is desired, calling pvmfgetnames() with info = -1 will reset the entry name list and obtain a new list for the given pattern. so it's one at a time, keep calling till you hit PvmNotFound ๐
๐ฅ EXAMPLES ๐ฅ
C:
/*
* create and insert mailbox entry
*/
sprintf( service, "Task_A_service" );
sprintf( message, "Greetings from task A." );
pvm_initsend( PvmDataDefault );
pvm_pkint( &mytid, 1, 1 );
pvm_pkint( &context, 1, 1 );
pvm_pkstr( message );
if (( pvm_putinfo( service, pvm_getsbuf(), PvmMboxDefault )) == PvmExists ){
printf( "can't register - service already running0 );
exit( -1 );
}
/*
* look for and retrieve specified mailbox
*/
sprintf( service, "Task_A_service" );
if (( msg_buf = pvm_recvinfo(service, 0, PvmMboxFirstAvail )) >= 0 ){
pvm_setrbuf( msg_buf );
pvm_upkint( &their_tid, 1, 1 );
pvm_upkint( &their_context, 1, 1 );
pvm_upkstr( message );
}
Fortran:
we need the fortran examples...
๐ญ ERRORS ๐ญ
the following error conditions can be returned by one or more of these functions. it's giving error code realness ๐
PvmBadParamโ an invalid value was specified forbufidargument. bad param bestie, fix it ๐ฉPvmNoSuchBufโ message bufferbufiddoesn't exist. that buffer is not in the building ๐PvmNoMemโ libpvm is unable to allocate memory to pack data. no mem, no vibes, sorry ๐ญPvmExistsโ the requested key is already in use (pvm_putinfo). it's taken, periodt ๐PvmNotFoundโ the requested key does not exist (pvm_recvinfo,pvm_delinfo). not found, not today ๐PvmDeniedโ the key is locked by another task and cannot be replaced or deleted. denied, no entry, bye ๐
๐ฆ SEE ALSO ๐ฆ
pvm_initsend(3PVM)pvm_getsbuf(3PVM)pvm_pack(3PVM)
and that's the whole page bestie! this iconic manual is from PVM Version 3.4, dated 22 May, 1997 โ slay, periodt ๐ โจ๐
๐ฆ 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