Avaya Logo

Previous Topic

Next Topic

Book Contents

Book Index

VSstartup

Name

VSstartup � Called once to initialize process to the voice system

Synopsis

#include <sys/types.h>
#include VS.h

key_t VSstartup (procName, instance, flag)
char *procName; /* name associated with process */
short instance; /* process instance */
long flag; /* Is process a DIP? */

Description

VSstartup is called once to initialize a process to the system. VSstartup returns the DIP name, its instance, and a DIP flag. The DIP flag can take one of two values, constants DIP_PROC or NONDIP_PROC. Setting the flag to the constant DIP_PROC allows the DIP to send messages to and receive messages from TSM scripts. If the flag is set to the constant NONDIP_RPOC, messages sent by the IDP to TSM scripts are ignored by TSM.

Processes specifying the same procName and difference instance numbers will be assigned the same message queue key to read from, but will be posted in separate Bulletin Board (BB) slots.

The instance can be any arbitrary value in the range from 0 to 32767. However, the instance should be unique across processes using the same procName. A common use of the instance number is to differentiate between multiple copies of a process.

Specifically, VSstartup does the following:

  1. Attach the BB and initialize the global BB variables used by the rest of the interface functions
  2. Post the calling process in the BB and get its dynamically assigned Qkey
  3. Acquire the process semaphore associated with the slot
  4. Calls the db_init library functions to set up the trace facility for the calling process

Upon encountering an error, VSstartup will immediately return a pre-defined negative value.

Example

/* Post instance 0 of process xferdip as a DIP */
#define TRANSFER_DIP "xferdip"
key_t Qkey;
char *emsg;
Qkey = VSstartup(TRANSFER_DIP, 0, DIP_PROC);
if (myQkey <= 0) {
db_pr("%s: Can't get qkey: VSstartup: %s\n";
VSerror(myQkey));
logMsg(APPL_INITFAIL,EL_FL,Myname,"Can't get qkey");
sleep(5); /* to slow down continuous respawning */
exit(1);
}

Diagnostics

Upon successful completion, the assigned Qkey is returned. Errors in the VSstartup indicate failure in assigning a message queue key, in which case one of the following negative values is returned.

Value

Description

VS_EINVAL

procName argument cannot be NULL

VS_ELEN

Length of procName is out of range

VS_ERESV

procName is reserved for hardcoded processes

VS_ENOPRT

Non-printable character found in procName

VS_ENUM

Instance is negative or out of range

VS_BADPROC

Another process with the same procName and instance is running already

VS_ENOFREE

No BB slots available for posting process

VS_ESHMAT

Can not attach the BB shared memory

See also

� 2002 Avaya Inc. All Rights Reserved.