Open System Services System Calls Reference Manual (G06.25+, H06.03+)

shmat(2) OSS System Calls Reference Manual
Shared Segment Memory Alignment
A shared memory segment must be aligned on a region boundary. A region is 32 megabytes
(MB) of virtual memory.
If the function call requests rounding, the value returned for shmaddr is rounded down to the
closest multiple of 32 MB. The SHMLBA constant, which traditionally represents the number
of bytes in a page of memory, represents the number of bytes in a region in the OSS implementa-
tion. SHMLBA is always 32 MB in the OSS implementation.
Number of Shared Segments
A process can attach no more than 13 segments at one time. If an attached segment is larger than
a region, the maximum number of attached segments is reduced.
Propagation During Process Creation
Segments attached to a parent process are also attached to a child process created by the fork()
or tdm_fork() function. Segments cannot be shared when a child process is created in a
different processor than that used by the parent.
Segments attached to a parent process are detached during the processing of a call to:
Any of the exec or tdm_exec sets of functions
Any of the tdm_spawn set of functions
The resulting child process has no attached shared memory segments.
Use From the Guardian Environment
If called from a Guardian process, the function call fails and errno is set to the value of [ENO-
TOSS].
NOTES
The shared memory identier, shmid, is not the Guardian environment segid value or segment
identier.
Programs should not be written to depend upon the maximum number of attached shared seg-
ments. This limit is subject to change.
The maximum number of attached segments decreases when the size of any attached segment
exceeds SHMLBA.
Programs should not be written to depend upon the region size. The region size is subject to
change.
Refer to the SEGMENT_ALLOCATE_ procedure description in the Guardian Procedure Calls
Reference Manual for more information about segment limits.
RETURN VALUES
Upon successful completion, the shmat() function increments the value of the shm_nattch eld
in the structure associated with the shared memory identier of the attached shared memory seg-
ment. The starting address for the attached segment is returned.
Otherwise, the value -1 is returned and errno is set to indicate the error.
ERRORS
If any of the following conditions occurs, the shmat() function sets errno to the corresponding
value and does not attach the shared memory segment:
[EACCES] The calling process does not have access permission for the requested operation.
746 Hewlett-Packard Company 527186-003