[Overview][Constants][Types][Procedures and functions][Index] Reference for unit 'ipc' (#rtl)


Attach a shared memory block.


Source position: ipc.pp line 418

function shmat(

  shmid: cint;

  shmaddr: pointer;

  shmflg: cint



shmat attaches a shared memory block with identified shmid to the current process. The function returns a pointer to the shared memory block.

If shmaddr is Nil, then the system chooses a free unmapped memory region, as high up in memory space as possible.

If shmaddr is non-nil, and SHM_RND is in shmflg, then the returned address is shmaddr, rounded down to SHMLBA. If SHM_RND is not specified, then shmaddr must be a page-aligned address.

The parameter shmflg can be used to control the behaviour of the shmat call. It consists of a ORed combination of the following constants:

The suggested address in shmaddr is rounded down to SHMLBA.
the shared memory is attached for read access only. Otherwise the memory is attached for read-write. The process then needs read-write permissions to access the shared memory.

For an example, see shmctl.


If an error occurs, -1 is returned, and IPCerror is set.

See also



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



Detach shared memory block.



Perform control operations on a shared memory block.

Documentation generated on: May 14 2021