BEA Logo BEA Tuxedo Release 7.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   Tuxedo Doc Home   |   Reference   |   Topic List   |   Previous   |   Next   |   Contents

   BEA Tuxedo C Function Reference

rpc_sm_allocate, rpc_ss_allocate(3c)

Name

rpc_sm_allocate(), rpc_ss_allocate() - allocates memory within the RPC stub memory management scheme

Synopsis

#include <rpc/rpc.h> 
idl_void_p_t rpc_sm_allocate(unsigned32 size, unsigned32 *status)
idl_void_p_t rpc_ss_allocate(unsigned32 size)

Description

Applications call rpc_sm_allocat3() to allocate memory within the RPC stub memory management scheme. The input parameter, size, specifies in bytes, the size of memory to be allocated. Before a call to this routine, the stub memory management environment must have been established. For service code that is called from the server stub, the stub itself normally establishes the necessary environment. When rpc_sm_allocate() is used by code that is not called from the stub, the application must establish the required memory management environment by calling rpc_sm_enable_allocate().

Specifically, if the parameters of a server stub include any pointers other than those used for passing parameters by reference or the [enable_allocate] attribute is specified for the operation in the ACS file, then the environment is automatically set up. Otherwise, the environment must be set up by the application by calling rpc_sm_enable_allocate().

When the stub establishes the memory management environment, the stub itself frees any memory allocated by rpc_sm_allocate(). The application can free such memory before returning to the calling stub by calling rpc_sm_free().

When the application establishes the memory management environment, it must free any memory allocated, either by calling rpc_sm_free() or by calling rpc_sm_disable_allocate().

The output parameter, status, returns the status code from this routine. This status code indicates whether the routine completed successfully or, if not, why not. Possible status codes and their meanings include:

rpc_s_ok

Always returned. The return value is used to determine failure.

rpc_ss_allocate() is the exception-returning version of this function and has no status output parameter. No exceptions are raised.

A thread in a multithreaded application may issue a call to rpc_sm_allocate() or rpc_ss_allocate() while running in any context state, including TPINVALIDCONTEXT.

Return Values

Upon success, the routines return a pointer to the allocated memory. Note that in the ISO standard C environments, idl_void_p_t is defined as void * and in other environments it is defined as char *.

If there is insufficient memory, the routines return a NULL pointer.

See Also

rpc_sm_disable_allocate, rpc_ss_disable_allocate(3c), rpc_sm_enable_allocate, rpc_ss_enable_allocate(3c), rpc_sm_free, rpc_ss_free(3c)

Programming a BEA Tuxedo Application Using TxRPC