FreeBSD/sys/cddl/contrib/opensolaris/uts/common/os/fm.c
/*
 * Post an error report (ereport) to the sysevent error channel.  The error
 * channel must be established with a prior call to sysevent_evc_create()
 * before publication may occur.
 */
Post an error report (ereport) to the sysevent error channel.  The error
channel must be established with a prior call to sysevent_evc_create()
before publication may occur.
Post an error report ( ereport ) to the sysevent error channel . The error channel must be established with a prior call to sysevent_evc_create () before publication may occur .
void
fm_ereport_post(nvlist_t *ereport, int evc_flag)
{
	size_t nvl_size = 0;
	evchan_t *error_chan;
	sysevent_id_t eid;
	(void) nvlist_size(ereport, &nvl_size, NV_ENCODE_NATIVE);
	if (nvl_size > ERPT_DATA_SZ || nvl_size == 0) {
		atomic_inc_64(&erpt_kstat_data.erpt_dropped.value.ui64);
		return;
	}
#ifdef illumos
	if (sysevent_evc_bind(FM_ERROR_CHAN, &error_chan,
	    EVCH_CREAT|EVCH_HOLD_PEND) != 0) {
		atomic_inc_64(&erpt_kstat_data.erpt_dropped.value.ui64);
		return;
	}
	if (sysevent_evc_publish(error_chan, EC_FM, ESC_FM_ERROR,
	    SUNW_VENDOR, FM_PUB, ereport, evc_flag) != 0) {
		atomic_inc_64(&erpt_kstat_data.erpt_dropped.value.ui64);
		(void) sysevent_evc_unbind(error_chan);
		return;
	}
	(void) sysevent_evc_unbind(error_chan);
#else
	(void) ddi_log_sysevent(NULL, SUNW_VENDOR, EC_DEV_STATUS,
	    ESC_DEV_DLE, ereport, &eid, DDI_SLEEP);
#endif
}
void fm_ereport_post ( nvlist_t * ereport , int evc_flag ) { size_t nvl_size = 0 ; evchan_t * error_chan ; sysevent_id_t eid ; ( void ) nvlist_size ( ereport , & nvl_size , NV_ENCODE_NATIVE ) ; if ( nvl_size > ERPT_DATA_SZ || nvl_size == 0 ) { atomic_inc_64 ( & erpt_kstat_data . erpt_dropped . value . ui64 ) ; return ; } #ifdef illumos if ( sysevent_evc_bind ( FM_ERROR_CHAN , & error_chan , EVCH_CREAT | EVCH_HOLD_PEND ) != 0 ) { atomic_inc_64 ( & erpt_kstat_data . erpt_dropped . value . ui64 ) ; return ; } if ( sysevent_evc_publish ( error_chan , EC_FM , ESC_FM_ERROR , SUNW_VENDOR , FM_PUB , ereport , evc_flag ) != 0 ) { atomic_inc_64 ( & erpt_kstat_data . erpt_dropped . value . ui64 ) ; ( void ) sysevent_evc_unbind ( error_chan ) ; return ; } ( void ) sysevent_evc_unbind ( error_chan ) ; #else ( void ) ddi_log_sysevent ( NULL , SUNW_VENDOR , EC_DEV_STATUS , ESC_DEV_DLE , ereport , & eid , DDI_SLEEP ) ; #endif }
Post an error report (ereport) to the sysevent error channel.
Post an error report ( ereport ) to the sysevent error channel .