Name
startup � Called once to initialize hardcoded processes to the voice system
Synopsis
#include spp.h
int startup (qkey, slot_offset)
int qkey; /* message qkey of calling process */
int slot_offset; /* used to get the slot for posting */
Description
startup registers and initializes the calling process to the voice system. It should be called once at the onset and is used by hardcoded processes (that is, those that know beforehand what message queue they will use to receive IPC messages). startup posts the process in a certain pre-defined slot in the Bulletin Board (BB). The calling process has some control over what slot is selected. The slot selected depends on the qkey and slot_offset specified.
Note:
It is recommended that user DIPs use VSstartup when possible. See VSstartup.
It is important that processes choose a qkey and slot_offset that translates to a unique message queue and slot. The bbs command can be used to find out what processes are currently posted, to avoid interfering with another process. For DIPSs (identified by qkeys in the range from 20-54), startup selects a slot using the following equation:
slot = 32 + slot_offset
The slot_offset for DIPs must be between 0 and 34 or the slot_offset is set to zero. DIPs can read from the same message queue by specifying the same qkey but different slot_offsets.
In addition, startup initializes the trace facility so that the process can write out trace message using the db_pr family of functions.
startup is the old way of initializing hardcoded processes to the system and still is supported. New processes, however, should use VSstartup for initialization.
Specifically, startup does the following:
Examples
The following code fragment initializes a DIP with qkey DIP15 (as defined in mesg.h ) and posts it in slot 47.
#include mesg.h
#include spp.h
/* No need to check the return code from startup since
* it is successful if it returns at all.
* DIP15-DIP0 is actually the DIP number for the DIP (15).
* Remember slot = 32 + DIP15-DIP0 = 32 + 15 = 47.
*/
(void) startup (DIP15, DIP15-DIP0);
Diagnostics
Upon successful completion, startup returns zero. It does not return if unsuccessful. startup writes out a trace message and terminates the calling process if an error is encountered. Possible errors include:
However, in one case startup does not terminates. If another process is already posted in the slot, startup waits indefinitely until the process can post itself in the slot that already contains a posted process.
See also