srv_regcreate

Description

Complete the registration of a registered procedure.

Syntax

CS_RETCODE srv_regcreate(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-90 describes the possible values returned in *infop if srv_regcreate returns CS_FAIL:

Table 3-90: Values for infop (srv_regcreate)

Value

Description

SRV_I_PEXISTS

The procedure is al&ready registered.

SRV_I_UNKNOWN

Some other error occurred.

Returns

Table 3-91: Return values (srv_regcreate)

Returns

To indicate

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Examples

Example 1

#include  <ospublic.h>

/*
** Local Prototype.
*/
CS_INT    ex_srv_regcreate PROTOTYPE((
SRV_PROC  *sproc
));

/*
** EX_SRV_REGCREATE
**    An example routine that completes the registration of a
**    registered procedure using srv_regcreate.
**
** Arguments:
**    sproc  A pointer to an internal thread control structure.
**
** Returns:
**    CS_SUCCEED   If the procedure was registered successfully.
**    CS_FAIL      If the supplied internal control structure is
 **                NULL.
**    SRV_I_EXIST       If the procedure is al&ready registered.
**    SRV_I_UNKNOWN     If some other error occurred.
*/
CS_INT    ex_srv_regcreate(sproc)
SRV_PROC  *sproc;
{
      CS_INT    info;     /* The reason for failure */

      /*
      ** Check whether the internal control structure is NULL.
      */
      if ( sproc == (SRV_PROC *)NULL )
      {
           return((CS_INT)CS_FAIL);
      }

      /*
      ** Now register the procedure al&ready defined by
      ** srv_regdefine and(or) srv_regparam. If an error  
      ** occurred, return the cause of error.
      */
      if ( srv_regcreate(sproc, &info) == CS_FAIL )
      {
             return(info);
      }

      /* The procedure is registered. */
      return((CS_INT)CS_SUCCEED);
}

Usage

See also

srv_regdefine, srv_regdrop, srv_reglist, srv_regparam