Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
2.  Remote Shared Memory API for Solaris Clusters API Library Functions Memory Segment Operations Import-Side Memory Segment Operations  Previous   Contents   Next 
   
 
RSMERR_BAD_SGIO

Invalid scatter-gather structure pointer

RSMERR_BAD_SEG_HNDL

Invalid segment handle

RSMERR_BAD_CTLR_HNDL

Invalid controller handle

RSMERR_BAD_ADDR

Bad address

RSMERR_BAD_OFFSET

Invalid offset

RSMERR_BAD_LENGTH

Invalid length

RSMERR_PERM_DENIED

Permission denied

RSMERR_BARRIER_FAILURE

I/O completion error

RSMERR_CONN_ABORTED

Connection aborted

RSMERR_INSUFFICIENT_RESOURCES

Insufficient resources

RSMERR_INTERRUPTED

Operation interrupted by signal

Get Local Handle

int rsm_create_localmemory_handle(rsmapi_controller_handle_t cntrl_handle, rsm_localmemory_handle_t *local_handle, caddr_t local_vaddr, size_t length);

This function obtains a local handle for use in the I/O vector for subsequent putv or getv calls. Freeing the handle as soon as possible conserves system resources, notably the memory spanned by the local handle, which may be locked down.

Return Values: Returns 0 if successful; returns an error value otherwise.

RSMERR_BAD_CTLR_HNDL

Invalid controller handle

RSMERR_BAD_LOCALMEM_HNDL

Invalid local memory handle

RSMERR_BAD_LENGTH

Invalid length

RSMERR_BAD_ADDR

Invalid address

RSMERR_INSUFFICIENT_MEM

Insufficient memory

Free Local Handle

rsm_free_localmemory_handle(rsmapi_controller_handle_t cntrl_handle, rsm_localmemory_handle_t handle);

This function releases the system resources associated with the local handle. While all handles belonging to a process are freed when the process exits, calling this function conserves system resources.

Return Values: Returns 0 if successful; returns an error value otherwise.

RSMERR_BAD_CTLR_HNDL

Invalid controller handle

RSMERR_BAD_LOCALMEM_HNDL

Invalid local memory handle

The following example demonstrates the definition of primary data structures:


Example 2-1 Primary Data Structures

typedef void *rsm_localmemory_handle_t
typedef struct {
   ulong_t	io_request_count;	number of rsm_iovec_t entries
   ulong_t	io_residual_count;	rsm_iovec_t entries not completed 

   in	flags;      
   rsm_memseg_import_handle_t		remote_handle; opaque handle for
                                                    import segment
   rsm_iovec_t							*iovec;		  pointer to
                                                    array of io_vec_t
} rsm_scat_gath_t;

typedef struct {
   int	io_type;		HANDLE or VA_IMMEDIATE
   union {
        rsm_localmemory_handle_t	handle;			used with HANDLE
        caddr_t						virtual_addr;		used with
                                                         VA_IMMEDIATE
    } local;
   size_t          local_offset;		       offset from handle base vaddr
   size_t          import_segment_offset;    offset from segment base vaddr
   size_t          transfer_length; 
} rsm_iovec_t; 

Segment Mapping

Mapping operations are only available for native architecture interconnects such as Dolphin-SCI or NewLink. Mapping a segment grants CPU memory operations access to that segment, saving the overhead of calling memory access primitives.

Imported Segment Map

int rsm_memseg_import_map(rsm_memseg_import_handle_t im_memseg, void **address, rsm_attribute_t attr, rsm_permission_t perm, off_t offset, size_t length);

This function maps an imported segment into the caller address space. If the attribute RSM_MAP_FIXED is specified, the function maps the segment at the value specified in **address.

typedef enum {
RSM_MAP_NONE = 0x0,   /* system will choose available virtual address */
RSM_MAP_FIXED = 0x1,  /* map segment at specified virtual address */
} rsm_map_attr_t;

Return Values: Returns 0 if successful; returns an error value otherwise.

RSMERR_BAD_SEG_HNDL

Invalid segment handle

RSMERR_BAD_ADDR

Invalid address

RSMERR_BAD_LENGTH

Invalid length

RSMERR_BAD_OFFSET

Invalid offset

RSMERR_BAD_PERMS

Invalid permissions

RSMERR_SEG_ALREADY_MAPPED

Segment already mapped

RSMERR_SEG_NOT_CONNECTED

Segment not connected

RSMERR_CONN_ABORTED

Connection aborted

RSMERR_MAP_FAILED

Error during mapping

RSMERR_BAD_MEM_ALIGNMENT

Address not aligned on page boundary

Unmap segment

int rsm_memseg_import_unmap(rsm_memseg_import_handle_t im_memseg);

This function unmaps an imported segment from user virtual address space.

Return Values: Returns 0 if successful; returns an error value otherwise.

 
 
 
  Previous   Contents   Next