srv_regexec

Description

Execute a registered procedure.

Syntax

CS_RETCODE srv_regexec(spp, infop)
SRV_PROC         *spp;
CS_INT              *infop;

Parameters

spp

A pointer to an internal thread control structure.

infop

A pointer to a CS_INT. Table 3-94 describes the possible values returned in *infop if srv_regexec returns CS_FAIL:

Table 3-94: Values for infop (srv_regexec)

Value

Description

SRV_I_PNOTKNOWN

The procedure is not registered.

SRV_I_PPARAMERR

There is a parameter error.

SRV_I_PNOTIFYERR

An error occurred while sending notifications.

Returns

Table 3-95: Return values (srv_regexec)

Returns

To indicate

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Examples

Example 1

#include <ospublic.h>

/*
** Local Prototype
*/
CS_RETCODE      ex_srv_regexec PROTOTYPE((
SRV_PROC        *spp,
CS_INT          &infop
));

/*
** EX_SRV_REGEXEC
**
**   Example routine to complete the execution of a registered
**   procedure using srv_regexec. This routine should be called
**   after srv_reginit and srv_regparam.
**
** Arguments:
**   spp       A pointer to an internal thread control structure.
**   infop     A return pointer to an integer containing more
**             descriptive error information if this routine
**             returns CS_FAIL.
**
** Returns:
**    CS_SUCCEED    Registered procedure executed successfully.
**    CS_FAIL       Registered procedure not executed, or 
**                  notifications not completed successfully.
*/
CS_RETCODE ex_srv_regexec(spp, infop)
SRV_PROC   *spp;
CS_INT     &infop;
{
      /* Initialization. */
      &infop = (CS_INT)0;

      /* Execute the procedure. */
      if (srv_regexec(spp, infop) != CS_SUCCEED)
      {
           /* 
           ** Open Server has set the argument to a specific 
           ** error. 
           */
           return(CS_FAIL);
      }
      return(CS_SUCCEED);
}

Usage

WARNING! Open Server system registered procedures send a final DONE. If an application executes a system registered procedure from an event handler using srv_regexec, the application must not send a final DONE from the event handler code. Doing so will cause Open Server to raise a state error.

See also

srv_reginit, srv_regparam