Programming Interfaces Guide

Memory Segment Creation and Destruction

Establishing a new memory segment with rsm_memseg_export_create enables the association of physical memory with the segment at creation time. The operation returns an export-side memory segment handle to the new memory segment. The segment exists for the lifetime of the creating process or until destroyed with rsm_memseg_export_destroy.


Note –

If destroy operation is performed before an import side disconnect, the disconnect is forced.


Segment Creation

int rsm_memseg_export_create(rsmapi_controller_handle_t controller, rsm_memseg_export_handle_t *memseg, void *vaddr, size_t size, uint_t flags);

This function creates a segment handle. After the segment handle is created, the segment handle is bound to the specified virtual address range [vaddr..vaddr+size]. The range must be valid and aligned on the controller's alignment property. The flags argument is a bitmask, which enables:


Note –

The RSM_LOCK_OPS flag is not included in the initial release of RSMAPI.


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

RSMERR_BAD_CTLR_HNDL

Invalid controller handle

RSMERR_CTLR_NOT_PRESENT

Controller not present

RSMERR_BAD_SEG_HNDL

Invalid segment handle

RSMERR_BAD_LENGTH

Length zero or length exceeds controller limits

RSMERR_BAD_ADDR

Invalid address

RSMERR_PERM_DENIED

Permission denied

RSMERR_INSUFFICIENT_MEM

Insufficient memory

RSMERR_INSUFFICIENT_RESOURCES

Insufficient resources

RSMERR_BAD_MEM_ALIGNMENT

Address not aligned on page boundary

RSMERR_INTERRUPTED

Operation interrupted by signal

Segment Destruction

int rsm_memseg_export_destroy(rsm_memseg_export_handle_t memseg);

This function deallocates segment and its free resources. All importing processes are forcibly disconnected.

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

RSMERR_BAD_SEG_HNDL

Invalid segment handle

RSMERR_POLLFD_IN_USE

pollfd in use