diff --git a/include/libtesla.h b/include/libtesla.h index 58d6a8e..83ee1ca 100644 --- a/include/libtesla.h +++ b/include/libtesla.h @@ -278,8 +278,9 @@ int tesla_set_event_handlers(struct tesla_event_metahandler *); #ifdef _KERNEL #define TESLA_KERN_PRINTF_EV 0x1 -#define TESLA_KERN_DTRACE_EV 0x2 -#define TESLA_KERN_PANIC_EV 0x4 +#define TESLA_KERN_PRINTERR_EV 0x2 +#define TESLA_KERN_DTRACE_EV 0x4 +#define TESLA_KERN_PANIC_EV 0x8 #endif /** @} */ diff --git a/libtesla/src/tesla_notification.c b/libtesla/src/tesla_notification.c index 45f0d36..6b6e736 100644 --- a/libtesla/src/tesla_notification.c +++ b/libtesla/src/tesla_notification.c @@ -308,6 +308,16 @@ static const struct tesla_event_handlers printf_handlers = { .teh_ignored = print_ignored, }; +static const struct tesla_event_handlers printf_on_failure = { + .teh_init = ev_noop, + .teh_transition = ev_noop, + .teh_clone = ev_noop, + .teh_fail_no_instance = print_no_instance, + .teh_bad_transition = print_bad_transition, + .teh_err = print_error, + .teh_accept = ev_noop, + .teh_ignored = ev_noop, +}; /* * Wrappers that panic on failure: @@ -347,6 +357,7 @@ static const struct tesla_event_handlers failstop_handlers = { */ const static struct tesla_event_handlers* const default_handlers[] = { &printf_handlers, + &printf_on_failure, #if defined(_KERNEL) && defined(KDTRACE_HOOKS) &dtrace_handlers, #endif @@ -356,9 +367,9 @@ const static struct tesla_event_handlers* const default_handlers[] = { static struct tesla_event_metahandler default_event_handlers = { .tem_length = sizeof(default_handlers) / sizeof(*default_handlers), #if defined(_KERNEL) && defined(KDTRACE_HOOKS) - .tem_mask = 0x2, + .tem_mask = TESLA_KERN_DTRACE_EV, #else - .tem_mask = 0x3, + .tem_mask = 0x5, #endif .tem_handlers = default_handlers, };