SHMGET(2) | System Calls Manual | SHMGET(2) |
shmget
— get
shared memory area identifier
#include
<sys/shm.h>
int
shmget
(key_t key,
size_t size, int shmflg);
shmget
()
returns the shared memory identifier associated with the key
key.
A shared memory segment is created if either key is equal to IPC_PRIVATE, or key does not have a shared memory segment identifier associated with it, and the IPC_CREAT bit is set in shmflg.
If a new shared memory segment is created, the data structure associated with it (the shmid_ds structure, see shmctl(2)) is initialized as follows:
Upon successful completion a positive shared memory segment identifier is returned. Otherwise, -1 is returned and the global variable errno is set to indicate the error.
The shmget
() system call will fail if:
EACCES
]EEXIST
]EINVAL
]ENOENT
]ENOMEM
]ENOSPC
]#include
<sys/types.h>
#include
<sys/ipc.h>
#include
<sys/shm.h>
int
shmget
(key_t
key, int size, int
shmflg);;
All of these include files are necessary. The type of size has changed.
August 17, 1995 | Mac OS X 12 |