STXIT contingency routines can be freely programmed in C for special requirements that are not covered by the signal()
function. Such requirements typically include the transfer of large amounts of data or additional continuation and control options after the execution of the STXIT contingency routine.
The definition of a freely programmed STXIT contingency routine must be effected by calling the C library function cstxit()
.
The SVC interrupt event class cannot be implemented even if the cstxit
function is used.
When the STXIT contingency routine is started, it is supplied with a structure that is declared in the header file stxit.h
as follows:
struct stxcontp { int *intwghtp; /* pointer to interrupt weight */ jmp_buf *termlabp; /* pointer to termination label */ int *regsp; /* pointer to register save area */ };
Structure of the STXIT contingency routine
In order to use the structure parameter described above, the routine must provide a formal parameter for a structure of type stxcontp
and could be set up something like this:
#include <stxit.h> void stxrout(stxcontpar) struct stxcontp stxcontpar; { /* ... */ }
This routine can be terminated in three different ways:
with the
return
statement, which causes the program to be continued at the point of interruption orby calling the
longjmp()
function that is supplied by thesetjmp
call with a variable of typejmp_buf
, in which case the program is resumed at the position defined by assetjmp()
call orby calling the
longjmp()
function with the termination label passed in thestxcontp
structure.
In the case of event class TERM
, it is not possible to return from the STXIT contingency routine with a longjmp()
call, since the entries for C functions, including the main
function, will have already been cleared from the runtime stack at the time this event (TERM-SVC
) occurs.