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 Export-Side Memory Segment Operations  Previous   Contents   Next 
   
 

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 will be 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 and binds it 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:

  • Unbinding on the segment

  • Rebinding on the segment

  • Passing RSM_ALLOW_REBIND to flags

  • Support of lock operations

  • Passing RSM_LOCK_OPS to flags


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

Memory Segment Publish, Republish, and Unpublish

The publish operation enables the importing of a memory segment by other nodes on the interconnect. An export segment may be published on multiple interconnect adapters.

The segment ID may be specified from within authorized ranges (see below) or specified as zero, in which case a valid segment ID will be generated by the RSMAPI framework and passed back.

The segment access control list is composed of pairs of node ID and access permissions. For each node ID specified in the list, the associated read/write permissions are provided by three octal digits for owner, group and other, as with Solaris file permissions. In the access control list, each octal digit may have the following values:

2

write access

4

read only access

6

read and write access

For example, an access permission value of 0624 specifies:

  • An importer with the same uid as the exporter has read and write access.

  • An importer with the same gid as the exporter has write access only.

  • All other importers have read access only.

When an access control list is provided, nodes not included in the list cannot import the segment. However, if the access list is null, any node may import the segment. The access permissions on all nodes will equal the owner-group-other file creation permissions of the exporting process.


Note - Node applications have the responsibility of managing the assignment of segment identifiers to ensure uniqueness on the exporting node.


Publish Segment

int rsm_memseg_export_publish(rsm_memseg_export_handle_t memseg, rsm_memseg_id_t *segment_id, rsmapi_access_entry_t access_list[], uint_t access_list_length);

typedef struct {
rsm_node_id_t    ae_node;    /* remote node id allowed to access resource */
rsm_permission_t ae_permissions;    /* mode of access allowed */
}rsmapi_access_entry_t;.

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

RSMERR_BAD_SEG_HNDL

Invalid segment handle

RSMERR_SEG_ALREADY_PUBLISHED

Segment already published

RSMERR_BAD_ACL

Invalid access control list

RSMERR_BAD_SEGID

Invalid segment identifier

RSMERR_SEGID_IN_USE

Segment identifier in use

RSMERR_RESERVED_SEGID

Segment identifier reserved

RSMERR_NOT_CREATOR

Not creator of segment

RSMERR_BAD_ADDR

Bad address

RSMERR_INSUFFICIENT_MEM

Insufficient memory

RSMERR_INSUFFICIENT_RESOURCES

Insufficient resources

Authorized Segment ID Ranges:

 
 
 
  Previous   Contents   Next