Interaction with other POSIX APIs

Typed memory can interact with other POSIX APIs.

rlimits
The POSIX setrlimit() APIs provide the ability to set limits on the virtual and physical memory that a process can consume. Since typed memory operations may operate on normal RAM (sysram) and will create mappings in the process's address space, they need to be taken into account when doing the rlimit accounting. In particular, the following rules apply:
  • Any mapping created by mmap() for typed memory objects is counted in the process's RLIMIT_VMEM or RLIMIT_AS limit.
  • Typed memory never counts against RLIMIT_DATA.
POSIX file-descriptor functions
You can use the file descriptor that posix_typed_memory_open() returns with selected POSIX fd-based calls, as follows:
  • fstat(fd,..), which fills in the stat structure as it does for a shared memory object. In QNX Neutrino 7.0 or later, the st_size field holds the size of the typed memory object. In earlier releases, it was used internally by the OS.
  • close(fd) closes the file descriptor.
  • dup() and dup2() duplicate the file handle.
  • posix_mem_offset() behaves as documented in the POSIX specification.