gtpc2m4b | C/C++ Language Support User's Guide |
This function allocates storage from the system heap.
Format
#include <sysapi.h> void *gsysc(int frames, char *token);
Normal Return
The system virtual memory (SVM) address of the storage requested is returned.
Error Return
If the request cannot be satisfied because the maximum size of the heap has been reached or there is not enough contiguous space available, 0 is returned.
If the system does not have enough real frames to satisfy the request, a catastrophic dump is taken and the system is IPLed again.
Programming Considerations
Examples
The following example allocates and releases 12 KB of system heap storage.
#include <sysapi.h> #include <stdio.h>
·
·
·
{ /******************************************************************/ /* Allocate 12 KB of storage for a table used by many different */ /* ECBs. */ /******************************************************************/ int frames, rc; char * token = "TABLE40 "; struct table { char *name; int code; } *tbl_ptr; frames = 3; tbl_ptr = gsysc(frames, token); if (tbl_ptr == 0) { serrc_op(SERRC_EXIT, 0x1111, "Error allocating table.", NULL); }
·
·
·
rc = rsysc((void *)tbl_ptr, frames, token); if (rc == RSYSC_ERROR) { serrc_op(SERRC_EXIT, 0x2222, "Error releasing storage.", NULL); } }
Related Information