A device driver performs the following tasks to log events:
Allocate memory for the attribute list using nvlist_alloc(9F)
Add name-value pairs to the attribute list
Use the ddi_log_sysevent(9F) function to log the event in the sysevent queue
Call nvlist_free(9F) when the attribute list is no longer needed
The following example demonstrates how to use ddi_log_sysevent().
char *vendor_name = "DDI_VENDOR_JGJG"
char *my_class = "JGJG_event";
char *my_subclass = "JGJG_alert";
nvlist_t *nvl;
/* ... */
nvlist_alloc(&nvl, nvflag, kmflag);
/* ... */
(void) nvlist_add_byte_array(nvl, propname, (uchar_t *)propval, proplen + 1);
/* ... */
if (ddi_log_sysevent(dip, vendor_name, my_class,
my_subclass, nvl, NULL, DDI_SLEEP)!= DDI_SUCCESS)
cmn_err(CE_WARN, "error logging system event");
nvlist_free(nvl);