Skip to content

shmget

Return the ID of a shared memory block, possibly creating it

Declaration

Source position: ipc.pp line 417

  function shmget(key: TKey; size: size_t; flag: cint) : cint;

Description

shmget returns the ID of a shared memory block, described by key. Depending on the flags in flag, a new memory block is created.

flag can have one or more of the following values (combined by ORs):

IPC_CREAT
The queue is created if it doesn't already exist.
IPC_EXCL
If used in combination with IPC_CREAT, causes the call to fail if the queue already exists. It cannot be used by itself.

Optionally, the flags can be ORed with a permission mode, which is the same mode that can be used in the file system.

if a new memory block is created, then it will have size Size bytes in it.

Errors

On error, -1 is returned, and IPCError is set.