Guardian Programmer's Guide

Table Of Contents
Managing Memory
Guardian Programmer’s Guide 421922-014
17 - 40
Sharing an Extended Data Segment
The process access ID of the group manager for the process access ID of the
process that allocated the extended data segment
The super ID
To specify sharing using the PIN method, your process must call the
SEGMENT_ALLOCATE_ procedure and specify the PIN of the process that allocated
the extended data segment, along with the segment ID known by the process that
allocated the extended data segment. The process that allocated the segment can
determine its own PIN and pass it to the process that calls SEGMENT_ALLOCATE_.
The following example specifies sharing of segment 3 using the PIN method:
SEGMENT^ID := 3;
ERROR := SEGMENT_ALLOCATE_(SEGMENT^ID,
!segment^size!,
!swap^file:name!,
!error^detail!,
PIN);
Note that the segment size must not be specified when sharing by the PIN method.
Using the File-Name Method
Your process can use the file-name method to share the extended data segment of
another process if all the following are true:
Your process is in the same CPU as the process that allocated the extended data
segment.
Your process knows the swap-file name that the process that allocated the
extended data segment assigned to it. (The Kernel-Managed Swap Facility swap
file, the default, cannot be used for this purpose.)
Your process has appropriate Guardian security to access the file. See Managing
Swap Space earlier in this section.
To specify sharing using the file-name method, your process must call the
SEGMENT_ALLOCATE_ procedure and specify the swap-file name of the extended
data segment. You must also set the segment-type parameter to specify sharing by
file name. You can do this using the ZSYS^VAL^SEGALLOCTYPE^DEFFNAME literal
from the ZSYSTAL file.
The following example specifies segment sharing using the file-name method:
SWAP^FILENAME ':=' "$PROGRAM.SWPFILES.MYPROG" -> @S^PTR;
SWAP^FILENAME^LEN := @S^PTR '-' @SWAP^FILENAME;
SEGMENT^TYPE := ZSYS^VAL^SEGALLOCTYPE^DEFFNAME;
ERROR := SEGMENT_ALLOCATE_(SEGMENT^ID,
!segment^size!,
SWAP^FILENAME:SWAP^FILENAME^LEN,
!error^detail!,
!pin!,