Programming Interfaces Guide

Event Operations

Event operations enable processes synchronization on memory access events. If a process cannot use the rsm_intr_signal_wait() function, it can multiplex event waiting by obtaining a poll descriptor with rsm_memseg_get_pollfd() and using the poll system call.


Note –

Using the rsm_intr_signal_post() and rsm_intr_signal_wait() operations incurs the need to process of ioctl calls to the kernel.


Post Signal

int rsm_intr_signal_post(void *memseg, uint_t flags);

The void pointer *memseg can be type cast to either an import segment handle or an export segment handle. If *memseg refers to an import handle, this function sends a signal the exporting process. If *memseg refers to an export handle, this function sends a signal to all importers of that segment. Setting the flags argument to RSM_SIGPOST_NO_ACCUMULATE discards this event if an event is already pending for the target segment.

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

RSMERR_BAD_SEG_HNDL

Invalid segment handle

RSMERR_REMOTE_NODE_UNREACHABLE

Remote node not reachable

Wait for Signal

int rsm_intr_signal_wait(void * memseg, int timeout);

The void pointer *memseg can be type cast to either an import segment handle or an export segment handle. The process blocks for up to timeout milliseconds or until an event occurs. If the value is -1, the process blocks until an event occurs or until interrupted.

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

RSMERR_BAD_SEG_HNDL

Invalid segment handle

RSMERR_TIMEOUT

Timer expired

RSMERR_INTERRUPTED

Wait interrupted

Get pollfd

int rsm_memseg_get_pollfd(void *memseg, struct pollfd *pollfd);

This function initializes the specified pollfd structure with a descriptor for the specified segment and the singular fixed event generated by rsm_intr_signal_post(). Use the pollfd structure with the poll system call to wait for the event signalled by rsm_intr_signal_post. If the memory segment is not currently published, the poll system call does not return a valid pollfd. Each successful call increments a pollfd reference count for the specified segment.

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

RSMERR_BAD_SEG_HNDL

Invalid segment handle

Release pollfd

int rsm_memseg_release_pollfd(oid *memseg);

This call decrements the pollfd reference count for the specified segment. If the reference count is nonzero, operations that unpublish, destroy, or unmap the segment fail.

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

RSMERR_BAD_SEG_HNDL

Invalid segment handle