#include <DML_shmem.h>
int
variable or a shared double
. The three
basic functions provide a way to create a shared memory object (or connect to
one that already exists), disconnect from a shared memory object, and completely
destroy a shared memory object. The two other functions provide a way to split
the creation process up into two parts, so as to get access to the file-descriptor.
It is unlikely that you'll need to do this.
void * create_shm( const char *, size_t, int oflag )
void close_shm( const char * )
void destroy_shm( const char * )
int open_shm_fd( const char *, size_t, int oflag )
void * map_shm( int fd, size_t, int oflag )
ShMem template class, shm_open, shm_close, shm_create in the QNX help files
#include <DML_shmem.h> void * create_shm( const char * filename, size_t sz, int oflag )
#include <DML_shmem.h> void close_shm( const char * )
#include <DML_shmem.h> void destroy_shm( const char * )
#include <DML_shmem.h> int open_shm_fd( const char *, size_t, int oflag )
There are two steps to creating shared memory: opening up the file-system for the shared memory, which will keep track of it, and mapping the shared memory into local memory. This function takes care of the first of those two tasks. Specifically, it goes to the file system and requests a file descriptor for the new shared memory 'file'. It then checks to see if the 'file' already exists, and if it does, it opens up the existing 'file' (memory location). If not, it creates a new 'file'. The file descriptor is used in the mapping process.
Currently the only supported oflags are O_RDWR and O_RDONLY.
#include <DML_shmem.h> void * map_shm( int fd, size_t, int oflag )