int shm_open(const char *name, int oflag, mode_t mode);
The file status flags and file access modes of the open file description are set according to the value of oflag. The oflag argument is the bitwise-inclusive OR of the following flags defined in the <fcntl.h> header. Applications specify exactly one of the first two values (access modes) below in the value of oflag:
Any combination of the remaining flags may be specified in the value of oflag:
When the shared memory object exists, this flag has no effect, except as noted under O_EXCL below. Otherwise, the shared memory object is created; the user ID of the shared memory object is set to the effective user ID of the process; the group ID of the shared memory object is set to a system default group ID or to the effective group ID of the process. The permission bits of the shared memory object are set to the value of the mode argument except those set in the file mode creation mask of the process. The mode argument does not affect whether the shared memory object is opened for reading, for writing, or for both. The shared memory object has a size of zero.
When O_EXCL and O_CREAT are set,
shm_open()fails if the shared memory object exists. The check for the existence of the shared memory object and the creation of the object if it does not exist is atomic with respect to other processes executing shm_open()naming the same shared memory object with O_EXCL and O_CREAT set.
When the shared memory object exists, and it is successfully opened O_RDWR, the object is truncated to zero length and the mode and owner is unchanged by this function call.
When a shared memory object is created, the state of the shared memory object, including all data associated with the shared memory object, persists until the shared memory object is unlinked and all other references are gone.
Specifies the values to be set for the permission bits of the created shared memory object.
Points to the name to be assigned to the created shared memory object.
Specifies the file status flags and file access modes to be used with the open file description .
On success, the
The shared memory object exists and the permissions specified by oflag are denied, or the shared memory object does not exist and permission to create the shared memory object is denied, or O_TRUNC is specified and write permission is denied.
O_CREAT and O_EXCL are set and the named shared memory object already exists.
shm_open()operation was interrupted by a signal.
shm_open()operation is not supported for the given name.
Too many file descriptors are currently in use by this process.
The name argument is too long.
Too many shared memory objects are currently open in the system.
O_CREAT is not set and the named shared memory object does not exist.
There is insufficient space for the creation of the new shared memory object.
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
close(), dup(), exec(), fcntl(), mmap(), shm_unlink(), shmat(), shmctl(), shmdt(), umask()
PTC MKS Toolkit 10.3 Documentation Build 39.