For special requirements that are not covered by the signal function (see section “C libraryfunctions (alarm, raise, signal)”), STXIT contingency routines can be freely programmed in C. Such requirements may include, for example, 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 or _cstxit.
The SVC interrupt event class cannot be implemented even if using the cstxit interface.
When the STXIT contingency routine is started, it is supplied with a structure which is declared in the include 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
returnstatement; the program is continued at the point of interruption orby calling the
lonjmpfunction with ajmp_bufvariable supplied by asetjmpcall; the program is resumed at the position defined with asetjmpcall orby calling the
longjmpfunction with the termination label passed in thestxcontpstructure (see above).
In the case of event class TERM, it is not possible to return from the STXIT contingency routine with a longjmp call, since at the time this event (TERM-SVC) occurs, the entries for C functions (including the main function) have already been cleared from the runtime stack!