This repository was archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 109
Kernel Error Handling
Álvaro Jurado edited this page Jul 15, 2016
·
6 revisions
Error handling is performed by the functions error, waserror, nexterror and poperror
The proc structure, accessed by externup() contains an array of Label structures (errlab), which is used to catch errors called through the error() function.
Use This example shows how these functions are used:
/* Get the Proc structure (must be called 'up') */
Proc *up = externup();
/* save this location as an error handler */
if (waserror()) {
/*
* waserror returns 0 when it's called, and 1 if
* 'returns' again via the Label
*/
... error handling ...
/*
* optionally call the next handler in errlab.
* (not needed if the error is handled here)
*/
nexterror();
}
... code that might call error() ...
/* Remove the local handler */
poperror();