static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context) { union acpi_generic_state *notify_info = (union acpi_generic_state *)context; acpi_notify_handler global_handler = NULL; void *global_context = NULL; union acpi_operand_object *handler_obj; ACPI_FUNCTION_ENTRY(); /* * We will invoke a global notify handler if installed. This is done * _before_ we invoke the per-device handler attached to the device. */ if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { /* Global system notification handler */ if (acpi_gbl_system_notify.handler) { global_handler = acpi_gbl_system_notify.handler; global_context = acpi_gbl_system_notify.context; } } else { /* Global driver notification handler */ if (acpi_gbl_device_notify.handler) { global_handler = acpi_gbl_device_notify.handler; global_context = acpi_gbl_device_notify.context; } } /* Invoke the system handler first, if present */ if (global_handler) { global_handler(notify_info->notify.node, notify_info->notify.value, global_context); } /* Now invoke the per-device handler, if present */ handler_obj = notify_info->notify.handler_obj; if (handler_obj) { struct acpi_object_notify_handler *notifier; notifier = &handler_obj->notify; while (notifier) { notifier->handler(notify_info->notify.node, notify_info->notify.value, notifier->context); notifier = notifier->next; } } /* All done with the info object */ acpi_ut_delete_generic_state(notify_info); }
int sprintf_handler(char *str, int fd, const char *format, ...) { va_list ap; t_printf tab[MY_PRINTF_TAB_SIZE]; init_printf_var(tab); init_prog(fd, IS_SPRINTF); va_start(ap, format); global_handler(str, format, ap, tab); va_end(ap); return (g_prog.i); }