NAME | SYNOPSIS | FEATURES | DESCRIPTION | RETURN VALUE | ERRORS | ATTRIBUTES | SEE ALSO
#include <exec/chExec.h>int svExcHandler(KnCap * actorcap, KnExcHdl routine);
CORE
The svExcHandler function defines an exception handler for the actor whose capability is pointed to by actorcap. If actorcap is K_MYACTOR, the current actor is used. The routine field defines a handler that will be called every time a thread whose execution actor matches the specified actor encounters an exception (see svTrapConnect (2K) for details on execution actors). An exception handler is a function which takes three arguments:
int handler (ctx, excno, ptr) KnThreadCtx* ctx ; int excno ; void* ptr ; |
The ctx pointer is the register context of the faulty thread. It points to a KnThreadCtx structure. The fields of this structure are machine-dependent.
The excno field is a machine-dependent exception number. It can only be used for exception handlers.
The ptr pointer highlight any relevant machine-dependent data that may be needed to process the exception (for example,. the faulty address for a page fault). It may not be used on certain hardware architectures.
The exception handler may modify the faulty thread's register context before returning.
The svAbortHandler function defines a handler to be called each time a thread of the specified actor returns from executing within its home actor environment, while in the ABORTED state. When the handler is called, the thread exits its ABORTED state (just as if threadAborted (2K) were called). An abort handler has the same form as an exception handler, except that the exception number is the K_EABORT constant, and no return value is taken into account.
These calls are restricted to SUPERVISOR threads. Handlers are executed in SUPERVISOR execution mode. The handlers' code and data accessed must be parts of the locked-in-memory regions of a SUPERVISOR actor.
These calls are used by subsystem process managers. The svExcHandler function is used to catch exceptions, and to translate them into subsystem-specific events (for example, . UNIX signals); svAbortHandler is used to force abort requests to be taken into account by controlled threads.
Upon successful completion a value of 0 is returned. Otherwise, a negative error code is returned.
actorcap is an inconsistent actor capability.
actorcap does not specify a local actor.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | FEATURES | DESCRIPTION | RETURN VALUE | ERRORS | ATTRIBUTES | SEE ALSO