Interaction with other POSIX APIs

Typed memory can interact with other POSIX APIs.

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() fills in the stat structure as it does for a shared memory object, except that the st_size field is used internally by the OS; it doesn't hold the size of the typed memory object.
  • close() closes the file descriptor.
  • dup() and dup2() duplicate the file handle.
  • posix_mem_offset() behaves as documented in the POSIX specification.