PreviousNext

rpc_sm_allocate(3rpc)

Allocates memory within the RPC stub memory management scheme

Synopsis

#include <rpc.h>

idl_void_p_t rpc_sm_allocate (

unsigned long size,

unsigned32 *status);

Parameters

Input

size
Specifies, in bytes, the size of memory to be allocated.

Output

status
Returns the status code from this routine. This status code indicates whether the routine completed successfully or, if not, why not.

Description
Applications call rpc_sm_allocate to allocate memory within the RPC stub memory management scheme. Before a call to this routine, the stub memory management environment must have been established. For manager code that is called from the 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.

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.

Multiple threads may call rpc_sm_allocate and rpc_sm_free to manage the same memory within the stub memory management environment. To do so, the threads must share the same stub memory management thread handle. Applications pass thread handles from thread to thread by calling rpc_sm_get_thread_handle and rpc_sm_set_thread_handle.

Return Values
A pointer to the allocated memory.

Errors

The following describes a partial list of errors that might be returned. Refer to the OSF DCE Problem Determination Guide for complete descriptions of all error messages.

rpc_s_ok
Success.

Related Information
Functions: rpc_sm_free(3rpc)

rpc_sm_enable_allocate(3rpc)

rpc_sm_disable_allocate(3rpc)

rpc_sm_get_thread_handle(3rpc)

rpc_sm_set_thread_handle(3rpc)