Previous section.

CDE 1.1: Remote Procedure Call
Copyright © 1997 The Open Group

NAME

rpc_sm_allocate-allocates memory within the RPC stub memory management scheme

SYNOPSIS

#include <rpc.h>

idl_void_p_t rpc_sm_allocate( unsigned32 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. The status code indicates whether the routine completed successfully, or if not, why not.

Possible status codes and their meanings include:

rpc_s_ok
Success.

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. (See Introduction to the RPC API for a description of stub memory management and an explanation of the conditions under which the stub establishes the necessary memory management 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 VALUE

A pointer to the allocated memory.

SEE ALSO


rpc_sm_free()
rpc_sm_enable_allocate()
rpc_sm_disable_allocate()
rpc_sm_get_thread_handle()
rpc_sm_set_thread_handle().

Please note that the html version of this specification may contain formatting aberrations. The definitive version is available as an electronic publication on CD-ROM from The Open Group.

Contents Next section Index