PSDK QNX API Guide
Shared Memory Allocator Driver User Header

Files

file  SharedMemoryAllocatorUsr.h
 Shared Memory Allocator Driver User Header.
 

Functions

int SHM_alloc (int size, shm_buf *buf)
 Allocate shared memory block with given size. More...
 
int SHM_alloc_aligned (int size, uint alignment, shm_buf *buf)
 Allocate n-bytes aligned shared memory block with given size. The alignment will be with respect to the physical memory address. More...
 
int SHM_alloc_fromBlock (int size, int blockID, shm_buf *buf)
 Allocate shared memory block with given size and block ID. More...
 
int SHM_alloc_aligned_fromBlock (int size, uint alignment, int blockID, shm_buf *buf)
 Allocate n-bytes aligned shared memory block with given size and block ID. More...
 
int SHM_alloc_aligned_fromBlock_withFlags (int size, uint alignment, int blockID, shm_buf *buf, int prot, int flags)
 Allocate n-bytes aligned shared memory block with given size, block ID, and specified flags. More...
 
int SHM_get_blkInfo (int blockID, shm_buf *buf)
 Retrieves shared memory struct data for specified shared memory block. More...
 
int SHM_release (shm_buf *buf)
 Frees shared memory block. More...
 

Detailed Description

Function Documentation

◆ SHM_alloc()

int SHM_alloc ( int  size,
shm_buf *  buf 
)

Allocate shared memory block with given size.

Parameters
size[in] Size in bytes to allocate.
buf[out] Pointer to shared memory buffer structure.
Returns
Status. Returns 0 for pass, and -1 or -errno for error.

◆ SHM_alloc_aligned()

int SHM_alloc_aligned ( int  size,
uint  alignment,
shm_buf *  buf 
)

Allocate n-bytes aligned shared memory block with given size. The alignment will be with respect to the physical memory address.

Parameters
size[in] Size in bytes to allocate.
alignment[in] Alignment for physical address to be alignment-bytes aligned.
buf[out] Pointer to shared memory buffer structure.
Returns
Status. Returns 0 for pass, and -1 or -errno for error.

◆ SHM_alloc_fromBlock()

int SHM_alloc_fromBlock ( int  size,
int  blockID,
shm_buf *  buf 
)

Allocate shared memory block with given size and block ID.

Parameters
size[in] Size in bytes to allocate.
blockID[in] Block ID in which to allocated.
buf[out] Pointer to shared memory buffer structure.
Returns
Status. Returns 0 for pass, and -1 or -errno for error.

◆ SHM_alloc_aligned_fromBlock()

int SHM_alloc_aligned_fromBlock ( int  size,
uint  alignment,
int  blockID,
shm_buf *  buf 
)

Allocate n-bytes aligned shared memory block with given size and block ID.

Parameters
size[in] Size in bytes to allocate.
alignment[in] Alignment for physical address to be alignment-bytes aligned.
blockID[in] Block ID in which to allocated.
buf[out] Pointer to shared memory buffer structure.
Returns
Status. Returns 0 for pass, and -1 or -errno for error.

◆ SHM_alloc_aligned_fromBlock_withFlags()

int SHM_alloc_aligned_fromBlock_withFlags ( int  size,
uint  alignment,
int  blockID,
shm_buf *  buf,
int  prot,
int  flags 
)

Allocate n-bytes aligned shared memory block with given size, block ID, and specified flags.

Parameters
size[in] Size in bytes to allocate.
alignment[in] Alignment for physical address to be alignment-bytes aligned.
blockID[in] Block ID in which to allocated.
buf[out] Pointer to shared memory buffer structure.
prot[in] Protection bits for virtually mapped addresses. For more information, check mmap() documentation in the "see also" section.
flags[in] Flags for virtually mapped addresses. For more information, check mmap() documentation in the "see also" section.
Returns
Status. Returns 0 for pass, and -1 or -errno for error.
See also
https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/m/mmap.html

◆ SHM_get_blkInfo()

int SHM_get_blkInfo ( int  blockID,
shm_buf *  buf 
)

Retrieves shared memory struct data for specified shared memory block.

Parameters
blockID[in] Block ID for info to be retrieved.
buf[out] Pointer to shared memory buffer structure.
Returns
Status. Returns 0 for pass, and -1 or -errno for error.

◆ SHM_release()

int SHM_release ( shm_buf *  buf)

Frees shared memory block.

Parameters
buf[out] Pointer to shared memory buffer structure.
Returns
Status. Returns 0 for pass, and -1 or -errno for error.