This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Query typed memory object to obtain the memory amount available
#include <sys/mman.h> int posix_typed_mem_get_info(int fildes, struct posix_typed_mem_info *info);
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The posix_typed_mem_get_info() function queries the typed memory object for obtaining the amount of memory currently available.
The posix_typed_mem_get_info() function allows an application to immediately determine available memory. This is particularly important for typed memory objects that may in some cases be scarce resources. The posix_typed_mem_get_info() function shall return, in the posix_tmi_length field of the posix_typed_mem_info structure pointed to by info, the maximum length that may be successfully allocated by the typed memory object designated by fildes. Note that when a typed memory pool is a shared resource, some form of mutual-exclusion or synchronization may be required while typed memory is being queried and allocated to prevent race conditions.
The posix_typed_mem_get_info() function returns the maximum length which may be successfully allocated by the typed memory object designated by fildes.
The maximum length is dynamic; it's available in the posix_tmi_length field, pointed to by info, of the posix_typed_mem_info structure. The maximum length is valid only while the current mapping of the corresponding typed memory pool remains unchanged.
This maximum length takes into account the flag POSIX_TYPED_MEM_ALLOCATE or POSIX_TYPED_MEM_ALLOCATE_CONTIG specified when the typed memory object represented by fildes is opened.
If fildes represents a typed memory object opened with neither the POSIX_TYPED_MEM_ALLOCATE flag nor the POSIX_TYPED_MEM_ALLOCATE_CONTIG flag specified, the returned value of info->posix_tmi_length is unspecified.
This function was added in the QNX Neutrino Core OS 6.3.2. |
posix_typed_mem_get_info() is POSIX 1003.1-2001
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
posix_mem_offset(), posix_typed_mem_open()