Monado OpenXR Runtime
xrt_shmem_handle_t Class Reference

Generic typedef for platform-specific shared memory handle. More...

#include </builds/monado/monado/src/xrt/ipc/shared/ipc_shmem.h>

Public Member Functions

static bool xrt_shmem_is_valid (xrt_shmem_handle_t handle)
 Check whether a shared memory handle is valid. More...
 
xrt_result_t ipc_shmem_create (size_t size, xrt_shmem_handle_t *out_handle, void **out_map)
 Create and map a shared memory region. More...
 
xrt_result_t ipc_shmem_map (xrt_shmem_handle_t handle, size_t size, void **out_map)
 Map a shared memory region. More...
 
void ipc_shmem_unmap (void **map_ptr, size_t size)
 Unmap a shared memory region. More...
 
void ipc_shmem_destroy (xrt_shmem_handle_t *handle_ptr, void **map_ptr, size_t size)
 Destroy a handle to a shared memory region. More...
 

Related Functions

(Note that these are not member functions.)

#define XRT_SHMEM_HANDLE_IS_FD   1
 Defined to allow detection of the underlying type. More...
 
#define XRT_SHMEM_HANDLE_INVALID   (-1)
 An invalid value for a shared memory block. More...
 

Detailed Description

Generic typedef for platform-specific shared memory handle.

Member Function Documentation

◆ ipc_shmem_create()

xrt_result_t ipc_shmem_create ( size_t  size,
xrt_shmem_handle_t out_handle,
void **  out_map 
)

Create and map a shared memory region.

Parameters
[in]sizeDesired size of region
[in,out]out_handlePointer to the handle to populate. Receives the handle if this succeeds, or the invalid value if it fails.
[in,out]out_mapPointer to the pointer to populate with the mapping of this shared memory region. On failure, contents are undefined.

◆ ipc_shmem_destroy()

void ipc_shmem_destroy ( xrt_shmem_handle_t handle_ptr,
void **  map_ptr,
size_t  size 
)

Destroy a handle to a shared memory region.

This probably does not destroy the underlying region, if other references to it (in this process or others) are still open.

Parameters
[in,out]handle_ptrPointer to the handle to destroy - will be checked for validity, destroyed, and cleared.
[in,out]map_ptrPointer to the mapped memory to unmap - will be checked for validity, destroyed, and cleared. It's necessary unmap the region to destroy the shmem.
[in]sizeSize of the mapped region.

References ipc_shmem_unmap().

◆ ipc_shmem_map()

xrt_result_t ipc_shmem_map ( xrt_shmem_handle_t  handle,
size_t  size,
void **  out_map 
)

Map a shared memory region.

Parameters
[in]handleHandle for region
[in]sizeSize of region
[in,out]out_mapPointer to the pointer to populate with the mapping of this shared memory region.

References XRT_ERROR_IPC_FAILURE, and XRT_SUCCESS.

◆ ipc_shmem_unmap()

void ipc_shmem_unmap ( void **  map_ptr,
size_t  size 
)

Unmap a shared memory region.

Parameters
[in]map_ptrpointer to region
[in]sizeSize of region

Referenced by ipc_shmem_destroy().

◆ xrt_shmem_is_valid()

static bool xrt_shmem_is_valid ( xrt_shmem_handle_t  handle)
inline

Check whether a shared memory handle is valid.

Friends And Related Function Documentation

◆ XRT_SHMEM_HANDLE_INVALID

#define XRT_SHMEM_HANDLE_INVALID   (-1)
related

An invalid value for a shared memory block.

Note that there may be more than one value that's invalid - use xrt_shmem_is_valid instead of comparing against this!

Referenced by ipc_client_connection_fini().

◆ XRT_SHMEM_HANDLE_IS_FD

#define XRT_SHMEM_HANDLE_IS_FD   1
related

Defined to allow detection of the underlying type.


The documentation for this class was generated from the following files: