Programming Interfaces Guide

Memory Segment Connection and Disconnection

Connect to Segment

int rsm_memseg_import_connect(rsmapi_controller_handle_t controller, rsm_node_id_t node_id, rsm_memseg_id_t segment_id, rsm_permission_t perm, rsm_memseg_import_handle_t *im_memseg);

This function connects to segment segment_id on remote node node_id by using the specified permission perm. The function returns a segment handle after connecting to the segment.

The argument perm specifies the access mode requested by the importer for this connection. To establish the connection, the access permissions specified by the exporter are compared to the access mode, user ID, and group ID used by the importer. If the request mode is not valid, the connection request is denied. The perm argument is limited to the following octal values:

0400

Read mode

0200

Write mode

0600

Read/write mode

The specified controller must have a physical connection to the controller that is used in the export of the segment.

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_PERM_DENIED

Permission denied

RSMERR_SEG_NOT_PUBLISHED_TO_NODE

Segment not published to node

RSMERR_SEG_NOT_PUBLISHED

No such segment published

RSMERR_REMOTE_NODE_UNREACHABLE

Remote node not reachable

RSMERR_INTERRUPTED

Connection interrupted

RSMERR_INSUFFICIENT_MEM

Insufficient memory

RSMERR_INSUFFICIENT_RESOURCES

Insufficient resources

RSMERR_BAD_ADDR

Bad address

Disconnect from Segment

int rsm_memseg_import_disconnect(rsm_memseg_import_handle_t im_memseg);

This function disconnects a segment. This function frees a segment's resources after disconnecting a segment. All existing mappings to the disconnected segment are removed. The handle im_memseg is freed.

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

RSMERR_BAD_SEG_HNDL

Invalid segment handle

RSMERR_SEG_STILL_MAPPED

Segment still mapped

RSMERR_POLLFD_IN_USE

pollfd in use