Guardian Procedure Calls Reference Manual (G06.25+)

Guardian Procedure Calls (G)
Guardian Procedure Calls Reference Manual522629-013
6-14
GETPOOL Procedure
(Superseded by POOL_* Procedures)
pool-head input, output
INT .EXT:ref:19
is the pool head previously defined by a call to DEFINEPOOL.
block-size input
INT(32):value
is the size, in bytes, of the memory obtained from the pool. This number cannot be
greater than %377770D. To check data structures without getting any memory
from the pool, set
block-size to zero.
Condition Code Settings
< (CCL) indicates that block-size is out of range, or that the data structures are
invalid; -1D is returned.
= (CCE) indicates that the operation is successful; extended address of block is
returned if
block-size is greater than zero, or -1D is returned if
block-size is equal to 0.
> (CCG) indicates that insufficient memory is available; -1D is returned.
Considerations
For performance reasons in the operating system, GETPOOL and PUTPOOL do
not check pool data structures on each call. A process that destroys data
structures or uses an incorrect address for a parameter can terminate on a call to
GETPOOL or PUTPOOL: a TNS Guardian process can get an instruction failure
trap (trap 1) or illegal address trap (trap 0); an OSS or native process can receive a
SIGILL or SIGSEGV signal.
In the native environment, GETPOOL verifies that all data blocks returned from the
pool are aligned on a 16-byte boundary. HP suggests that code running in the
TNS environment also allocate data blocks in 16-byte chunks.
Example
@PBLOCK := GETPOOL ( POOL^HEAD , $UDBL( $LEN( PBLOCK ) ) );
! get pool block size of PBLOCK in bytes.
Related Programming Manual
For programming information about the GETPOOL memory-management procedure,
refer to the
Guardian Programmer’s Guide.