Unit 'ipc' Package
[Overview][Constants][Types][Procedures and functions][Index] [#rtl]

shmat

Attach a shared memory block.

Declaration

Source position: ipc.pp line 427

function shmat(

  shmid: cint;

  shmaddr: pointer;

  shmflg: cint

):pointer;

Description

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:

SHM_RND
The suggested address in shmaddr is rounded down to SHMLBA.
SHM_RDONLY
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.

Errors

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

See also

shmget

  

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

shmdt

  

Detach shared memory block.

shmctl

  

Perform control operations on a shared memory block.


Documentation generated on: Oct 27 2024