DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

suds_shmat(S)


suds_shmat -- shared memory operations

Syntax

cc . . . -lsuds
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>

char *suds_shmat(int shmid, char *shmaddr, int shmflg);

Description

The suds_shmat(S) function attaches the shared memory segment associated with the shared memory identifier specified by shmid to the data segment of the calling process. The memory allocated by the function is suitable for use with the asynchronous I/O functions. The kernel attempts to optimize memory allocation for asynchronous I/O. When memory cannot be optimally allocated, the following message is displayed:
   WARNING: shared memory could not be directly allocated.
Memory is most likely to be optimally allocated when suds_shmat is called shortly after the system has booted.

The memory segment is attached at the address specified by one of the following criteria:

Note that the user must explicitly remove shared memory segments after the last reference to them has been removed.

Return values

The function suds_shmat returns the data segment start address of the attached shared memory segment. Otherwise, -1 is returned and errno is set to indicate the error.

Diagnostics

For each of the following conditions, the suds_shmat function returns -1 and sets errno to the corresponding value:

[EACCES]
Operation permission is denied to the calling process (see Intro(S)).

[EAGAIN]
The memory that was allocated could not be locked down. The amount that could not be locked can be discovered using suds_aioinfo(S).

[EINVAL]
shmid is not a valid shared memory identifier; shmaddr is not 0, and (shmflg&SHM_RND) is ``false'' and the value of shmaddr is an illegal address; or shmaddr is not 0, and (shmaddr-(shmaddr mod SHMLBA)) is an illegal address.

[EMFILE]
The number of shared memory segments attached to the calling process would exceed the system-imposed limit.

[ENOMEM]
The available data space is not large enough the accommodate the shared memory segment.

See also

exec(S), exit(S), fork(S), Intro(S), suds_aioinfo(S)

Standards conformance

suds_shmat is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003