__set_stack_softlimit() — set stack soft limit (C/C++ and XPLINK only)
When Language Environment attempts
to expand the stack and the additional stack segment could cause the
total stack size to exceed the MaximumStackSize,
a SIGSEGV with an si_code
of _SEGV_SOFTLIMIT is
generated. As a result of the SIGSEGV, a signal handler is driven
and is passed information that represents the environment at the
point of stack overflow. This includes register contents, psw contents,
and signal mask contents. The signal handler has the option of using
the passed data to perform a __far_jump()
to a recovery
point. If a signal handler was registered but the SA_SIGINFO flag was not set, the
SIGSEGV signal is delivered but no extra information is passed to
the signal handler.
The initial stack softlimit value that existed before issuing any __set_stack_softlimit()
requests
is the ULONG_MAX value. This disables the softlimit from being reached.
Because this function returns the current softlimit value, the first
time it is invoked, it returns the ULONG_MAX value. The function
always sets the soft limit to the passed MaximumStackSize value
and returns the previous soft limit value.
Syntax
#include <edcwccwi.h>
unsigned long __set_stack_softlimit (unsigned long MaximumStackSize);
- unsigned long MaximumStackSize
- MaximumStackSize is the stack size, in bytes. This is a thread-specific value. It is also a soft limit, which means that the actual stack size can grow beyond this limit. You can specify MaximumStackSize back to the ULONG_MAX value, which disables the softlimit.
The __set_stack_softlimit()
returns the previous
value of the soft limit. This function does not fail and no errors
are defined.
- The SIGSEGV is generated for the thread whose stack has grown beyond the maximum size.
- The SIGSEGV is generated regardless of whether a signal handler function for SIGSEGVs has been registered.
- No attempt is made to guarantee that there is sufficient available stack space to deliver the signal, or that there is a minimum amount of available stack space.
- If a signal handler function for SIGSEGV was registered with the SA_SIGINFO flag and using the sa_sigaction field to identify the handler function, an si_code of, _SEGV_SOFTLIMIT(defined in signal.h), will be reported to the signal handler.
- The soft limit overflow is not detected until a stack extension is requested. Therefore if a stack initial size has been selected that is greater than the soft limit the stack size will grow past the soft limit, and will not be detected until the initial stack size is exceeded.
- The Vendor Interfaces header file, <edcwccwi.h>, is located in member EDCWCCWI of the SCEESAMP data set. In order to include <edcwccwi.h> in an application, the header file must be copied into a PDS or into a directory in the z/OS® UNIX file system where the C/C++ compiler will find it.