RTI Connext Micro C API Version 4.2.0
|
Allow access to a shared memory segment (memory block) so that multiple processes can read-and write a common memory area. More...
Data Structures | |
struct | OSAPI_SharedMemorySegmentHeader |
struct | OSAPI_SharedMemorySegmentHandle |
Functions | |
RTI_UINT64 | OSAPI_SharedMemorySegment_get_max_size (void) |
Get maximum size of a shared memory segment on the current platform. | |
RTI_BOOL | OSAPI_SharedMemorySegment_is_owner_alive (struct OSAPI_SharedMemorySegmentHandle *handle, RTI_BOOL *alive) |
Check if the process which created the shared memory segment is still alive. | |
NETIOPSLDllExport RTI_SIZE_T | OSAPI_SharedMemorySegmentHandle_get_size (OSAPI_SHMEM_MODE mode) |
Get the amount of memory required to store a OSAPI_SharedMemorySegmentHandle on the current platform for a given mode. | |
NETIOPSLDllExport RTI_SIZE_T | OSAPI_SharedMemorySegmentHeader_get_size (OSAPI_SHMEM_MODE mode) |
Get the amount of memory, aligned to the maximum alignment, required to store a OSAPI_SharedMemorySegmentHeader on the current platform for a given mode. | |
NETIOPSLDllExport RTI_BOOL | OSAPI_SharedMemorySegment_create_impl (struct OSAPI_SharedMemorySegmentHandle *handle, const char *name, RTI_UINT64 size, OSAPI_SHMEM_MODE mode, RTI_BOOL *exists) |
Creates a new shared memory segment with the provided key and initialize a handle to it. | |
NETIOPSLDllExport RTI_BOOL | OSAPI_SharedMemorySegment_delete_impl (struct OSAPI_SharedMemorySegmentHandle *handle) |
Delete a shared memory segment. | |
NETIOPSLDllExport RTI_BOOL | OSAPI_SharedMemorySegment_attach_impl (struct OSAPI_SharedMemorySegmentHandle *handle, const char *name, OSAPI_SHMEM_MODE mode, OSAPI_SHMEM_ATTACH_STATUS *status_out) |
Attach to the shared memory and initialize a handle to it. | |
NETIOPSLDllExport RTI_BOOL | OSAPI_SharedMemorySegment_detach_impl (struct OSAPI_SharedMemorySegmentHandle *handle) |
detach the shared memory segment. | |
NETIOPSLDllExport RTI_BOOL | OSAPI_SharedMemorySegment_lock_impl (struct OSAPI_SharedMemorySegmentHandle *handle, OSAPI_SHMEM_STATUS *status_out) |
Lock a shared memory segment. | |
NETIOPSLDllExport RTI_BOOL | OSAPI_SharedMemorySegment_unlock_impl (struct OSAPI_SharedMemorySegmentHandle *handle) |
Unlock a shared memory segment previously locked with OSAPI_SharedMemorySegment_lock_impl. | |
NETIOPSLDllExport RTI_BOOL | OSAPI_SharedMemorySegment_mark_consistent_impl (struct OSAPI_SharedMemorySegmentHandle *handle) |
Mark a shared memory segment as consistent. This function can only be called if a previous call to OSAPI_SharedMemorySegment_lock_impl returned OSAPI_SHMEM_FAIL_REASON_OWNER_DEAD. | |
NETIOPSLDllExport RTI_BOOL | OSAPI_SharedMemory_is_robust_mutex_supported (void) |
Checks wether robust mutex is supported or not . | |
Allow access to a shared memory segment (memory block) so that multiple processes can read-and write a common memory area.
enum OSAPI_SHMEM_MODE |
Mode used to create or attach to a shared memory segment. Each mode defines specific capabilities of the segment.
Enumerator | |
---|---|
OSAPI_SHMEM_MODE_UNKNOWN | Invalid mode |
OSAPI_SHMEM_MODE_READ | Read permission |
OSAPI_SHMEM_MODE_WRITE | Write permission, implies OSAPI_SHMEM_MODE_READ |
OSAPI_SHMEM_MODE_LOCKABLE | Locking capability, implies OSAPI_SHMEM_MODE_WRITE |
OSAPI_SHMEM_MODE_ROBUST | Robust locking capability, implies OSAPI_SHMEM_MODE_LOCKABLE |
enum OSAPI_SHMEM_STATUS |
RTI_UINT64 OSAPI_SharedMemorySegment_get_max_size | ( | void | ) |
Get maximum size of a shared memory segment on the current platform.
RTI_BOOL OSAPI_SharedMemorySegment_is_owner_alive | ( | struct OSAPI_SharedMemorySegmentHandle * | handle, |
RTI_BOOL * | alive ) |
Check if the process which created the shared memory segment is still alive.
[in] | handle | The shared memory segment handle identifying the segment. |
[out] | alive | If the process is alive. |
The behavior or this function is undefined if the segment is not currently attached.
NETIOPSLDllExport RTI_SIZE_T OSAPI_SharedMemorySegmentHandle_get_size | ( | OSAPI_SHMEM_MODE | mode | ) |
Get the amount of memory required to store a OSAPI_SharedMemorySegmentHandle on the current platform for a given mode.
[in] | mode | The creation or attachment mode of the handle. |
NETIOPSLDllExport RTI_SIZE_T OSAPI_SharedMemorySegmentHeader_get_size | ( | OSAPI_SHMEM_MODE | mode | ) |
Get the amount of memory, aligned to the maximum alignment, required to store a OSAPI_SharedMemorySegmentHeader on the current platform for a given mode.
[in] | mode | The creation mode of the segment containing the header. |
The number of bytes returned by this function shall be aligned to the maximum alignment of the platform.
NETIOPSLDllExport RTI_BOOL OSAPI_SharedMemorySegment_create_impl | ( | struct OSAPI_SharedMemorySegmentHandle * | handle, |
const char * | name, | ||
RTI_UINT64 | size, | ||
OSAPI_SHMEM_MODE | mode, | ||
RTI_BOOL * | exists ) |
Creates a new shared memory segment with the provided key and initialize a handle to it.
[in,out] | handle | Handle to be initialized. |
[in] | name | Name to identify the shared memory segment. |
[in] | size | Size of memory to be allocated. |
[in] | mode | Mode used to create the shared memory segment. The mode determines the capabilities of the segment. The mode must be >= OSAPI_SHMEM_MODE_WRITE. |
[out] | exists | If the segment already exists |
The new shared memory segment shall be initialized with null bytes ('\0').
References RTI_UINT64.
NETIOPSLDllExport RTI_BOOL OSAPI_SharedMemorySegment_delete_impl | ( | struct OSAPI_SharedMemorySegmentHandle * | handle | ) |
Delete a shared memory segment.
[in] | handle | The shared memory segment handle identifying the segment to delete. |
Once this function is called (even if it returns RTI_FALSE) you can no longer use this shared memory segment.
NETIOPSLDllExport RTI_BOOL OSAPI_SharedMemorySegment_attach_impl | ( | struct OSAPI_SharedMemorySegmentHandle * | handle, |
const char * | name, | ||
OSAPI_SHMEM_MODE | mode, | ||
OSAPI_SHMEM_ATTACH_STATUS * | status_out ) |
Attach to the shared memory and initialize a handle to it.
[in,out] | handle | Handle to be initialized. |
[in] | name | Name to identify the shared memory segment. |
[in] | mode | Mode used to attach the shared memory segment. |
[out] | status_out | If successful, the attachment status of the shared memory segment. |
NETIOPSLDllExport RTI_BOOL OSAPI_SharedMemorySegment_detach_impl | ( | struct OSAPI_SharedMemorySegmentHandle * | handle | ) |
detach the shared memory segment.
[in] | handle | The shared memory segment handle identifying the segment to detach. |
Once this function is called (even if it returns RTI_FALSE) you can no longer use this shared memory segment handle.
NETIOPSLDllExport RTI_BOOL OSAPI_SharedMemorySegment_lock_impl | ( | struct OSAPI_SharedMemorySegmentHandle * | handle, |
OSAPI_SHMEM_STATUS * | status_out ) |
Lock a shared memory segment.
[in] | handle | The shared memory segment handle identifying the segment to lock. |
[out] | status_out | Success or failure reason of acquiring the lock. |
NETIOPSLDllExport RTI_BOOL OSAPI_SharedMemorySegment_unlock_impl | ( | struct OSAPI_SharedMemorySegmentHandle * | handle | ) |
Unlock a shared memory segment previously locked with OSAPI_SharedMemorySegment_lock_impl.
[in] | handle | The shared memory segment handle identifying the segment to unlock. |
The behavior of this method is undefined if the calling process has not previously acquired the lock with OSAPI_SharedMemorySegment_lock_impl.
NETIOPSLDllExport RTI_BOOL OSAPI_SharedMemorySegment_mark_consistent_impl | ( | struct OSAPI_SharedMemorySegmentHandle * | handle | ) |
Mark a shared memory segment as consistent. This function can only be called if a previous call to OSAPI_SharedMemorySegment_lock_impl returned OSAPI_SHMEM_FAIL_REASON_OWNER_DEAD.
[in] | handle | The shared memory segment handle identifying the segment to mark consistent. |
NETIOPSLDllExport RTI_BOOL OSAPI_SharedMemory_is_robust_mutex_supported | ( | void | ) |
Checks wether robust mutex is supported or not .