- shm-open:procedure
shm-open is a wrapper around shm_open, which analogous to the UNIX system call open(2).
Argument PATH specifies the shared memory object to be created or opened. For portable use, name should have an initial slash (/) and contain no embedded slashes.
OFLAGS is a list of bit masks from the posix unit which will be ORed together and passed to shm_open. It must contains exactly one of open/rdonly or open/rdwr and any of the other flags listed here:
- open/creat
- Creates the shared memory object if it does not exist. The user and group ownership of the object are taken from the corresponding effective IDs of the calling process, and the object's permission bits are set according to the low-order 9 bits of mode, except that those bits set in the process file mode creation mask (see umask(2)) are cleared for the new object. A new shared memory object initially has zero length. The size of the object can be set using file-truncate. The newly allocated bytes of a shared memory object are automatically initialised to 0.
- open/excl
- If open/create was also specified, and a shared memory object with the given name already exists, returns an error.
- open/trunc
- If the shared memory object already exists, truncate it to zero bytes.
MODE should be a bitmask composed of one or more permission values like perm/irusr and is only relevant when a new file is created. The default mode is perm/irwxu | perm/irgrp | perm/iroth.
On successful completion shm-open returns a new file descriptor referring to the shared memory object.