DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

suds_shmat(S-osr5)


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-osr5) 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-osr5)).

[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-osr5).

[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-osr5), exit(S-osr5), fork(S-osr5), Intro(S-osr5), suds_aioinfo(S-osr5)

Standards conformance

suds_shmat is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005