10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
53323Scindi * Common Development and Distribution License (the "License").
63323Scindi * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
211193Smws
220Sstevel@tonic-gate /*
23*6081Scy152378 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
240Sstevel@tonic-gate * Use is subject to license terms.
250Sstevel@tonic-gate */
260Sstevel@tonic-gate
270Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
280Sstevel@tonic-gate
290Sstevel@tonic-gate #include <sys/fm/protocol.h>
300Sstevel@tonic-gate #include <limits.h>
310Sstevel@tonic-gate
320Sstevel@tonic-gate #include <fmd_alloc.h>
330Sstevel@tonic-gate #include <fmd_subr.h>
340Sstevel@tonic-gate #include <fmd_event.h>
350Sstevel@tonic-gate #include <fmd_string.h>
361193Smws #include <fmd_module.h>
370Sstevel@tonic-gate #include <fmd_case.h>
380Sstevel@tonic-gate #include <fmd_log.h>
390Sstevel@tonic-gate #include <fmd_time.h>
404198Seschrock #include <fmd_topo.h>
410Sstevel@tonic-gate #include <fmd_ctl.h>
420Sstevel@tonic-gate
430Sstevel@tonic-gate #include <fmd.h>
440Sstevel@tonic-gate
451193Smws static void
fmd_event_nvwrap(fmd_event_impl_t * ep)461193Smws fmd_event_nvwrap(fmd_event_impl_t *ep)
471193Smws {
481193Smws (void) nvlist_remove_all(ep->ev_nvl, FMD_EVN_TTL);
491193Smws (void) nvlist_remove_all(ep->ev_nvl, FMD_EVN_TOD);
501193Smws
511193Smws (void) nvlist_add_uint8(ep->ev_nvl,
521193Smws FMD_EVN_TTL, ep->ev_ttl);
531193Smws (void) nvlist_add_uint64_array(ep->ev_nvl,
541193Smws FMD_EVN_TOD, (uint64_t *)&ep->ev_time, 2);
551193Smws }
561193Smws
571193Smws static void
fmd_event_nvunwrap(fmd_event_impl_t * ep,const fmd_timeval_t * tp)581193Smws fmd_event_nvunwrap(fmd_event_impl_t *ep, const fmd_timeval_t *tp)
591193Smws {
601193Smws uint64_t *tod;
611193Smws uint_t n;
621193Smws
631193Smws if (nvlist_lookup_uint8(ep->ev_nvl, FMD_EVN_TTL, &ep->ev_ttl) != 0) {
641193Smws ep->ev_flags |= FMD_EVF_LOCAL;
651193Smws ep->ev_ttl = (uint8_t)fmd.d_xprt_ttl;
661193Smws }
671193Smws
681193Smws if (tp != NULL)
691193Smws ep->ev_time = *tp;
701193Smws else if (nvlist_lookup_uint64_array(ep->ev_nvl,
711193Smws FMD_EVN_TOD, &tod, &n) == 0 && n >= 2)
721193Smws ep->ev_time = *(const fmd_timeval_t *)tod;
731193Smws else
741193Smws fmd_time_sync(&ep->ev_time, &ep->ev_hrt, 1);
751193Smws }
761193Smws
770Sstevel@tonic-gate fmd_event_t *
fmd_event_recreate(uint_t type,const fmd_timeval_t * tp,nvlist_t * nvl,void * data,fmd_log_t * lp,off64_t off,size_t len)780Sstevel@tonic-gate fmd_event_recreate(uint_t type, const fmd_timeval_t *tp,
790Sstevel@tonic-gate nvlist_t *nvl, void *data, fmd_log_t *lp, off64_t off, size_t len)
800Sstevel@tonic-gate {
810Sstevel@tonic-gate fmd_event_impl_t *ep = fmd_alloc(sizeof (fmd_event_impl_t), FMD_SLEEP);
820Sstevel@tonic-gate
830Sstevel@tonic-gate fmd_timeval_t tod;
840Sstevel@tonic-gate hrtime_t hr0;
850Sstevel@tonic-gate
860Sstevel@tonic-gate (void) pthread_mutex_init(&ep->ev_lock, NULL);
870Sstevel@tonic-gate ep->ev_refs = 0;
880Sstevel@tonic-gate ASSERT(type < FMD_EVT_NTYPES);
891193Smws ep->ev_type = (uint8_t)type;
900Sstevel@tonic-gate ep->ev_state = FMD_EVS_RECEIVED;
910Sstevel@tonic-gate ep->ev_flags = FMD_EVF_REPLAY;
920Sstevel@tonic-gate ep->ev_nvl = nvl;
930Sstevel@tonic-gate ep->ev_data = data;
940Sstevel@tonic-gate ep->ev_log = lp;
950Sstevel@tonic-gate ep->ev_off = off;
960Sstevel@tonic-gate ep->ev_len = len;
970Sstevel@tonic-gate
981193Smws fmd_event_nvunwrap(ep, tp);
991193Smws
1000Sstevel@tonic-gate /*
1010Sstevel@tonic-gate * If we're not restoring from a log, the event is marked volatile. If
1020Sstevel@tonic-gate * we are restoring from a log, then hold the log pointer and increment
1030Sstevel@tonic-gate * the pending count. If we're using a log but no offset and data len
1040Sstevel@tonic-gate * are specified, it's a checkpoint event: don't replay or set pending.
1050Sstevel@tonic-gate */
1060Sstevel@tonic-gate if (lp == NULL)
1070Sstevel@tonic-gate ep->ev_flags |= FMD_EVF_VOLATILE;
1080Sstevel@tonic-gate else if (off != 0 && len != 0)
1090Sstevel@tonic-gate fmd_log_hold_pending(lp);
1100Sstevel@tonic-gate else {
1110Sstevel@tonic-gate ep->ev_flags &= ~FMD_EVF_REPLAY;
1120Sstevel@tonic-gate fmd_log_hold(lp);
1130Sstevel@tonic-gate }
1140Sstevel@tonic-gate
1150Sstevel@tonic-gate /*
1160Sstevel@tonic-gate * Sample a (TOD, hrtime) pair from the current system clocks and then
1171193Smws * compute ev_hrt by taking the delta between this TOD and ev_time.
1180Sstevel@tonic-gate */
1190Sstevel@tonic-gate fmd_time_sync(&tod, &hr0, 1);
1201193Smws fmd_time_tod2hrt(hr0, &tod, &ep->ev_time, &ep->ev_hrt);
1210Sstevel@tonic-gate
1221193Smws fmd_event_nvwrap(ep);
1230Sstevel@tonic-gate return ((fmd_event_t *)ep);
1240Sstevel@tonic-gate }
1250Sstevel@tonic-gate
1260Sstevel@tonic-gate fmd_event_t *
fmd_event_create(uint_t type,hrtime_t hrt,nvlist_t * nvl,void * data)1270Sstevel@tonic-gate fmd_event_create(uint_t type, hrtime_t hrt, nvlist_t *nvl, void *data)
1280Sstevel@tonic-gate {
1290Sstevel@tonic-gate fmd_event_impl_t *ep = fmd_alloc(sizeof (fmd_event_impl_t), FMD_SLEEP);
1300Sstevel@tonic-gate
1310Sstevel@tonic-gate fmd_timeval_t tod;
1320Sstevel@tonic-gate hrtime_t hr0;
1330Sstevel@tonic-gate const char *p;
1340Sstevel@tonic-gate uint64_t ena;
1350Sstevel@tonic-gate
1360Sstevel@tonic-gate (void) pthread_mutex_init(&ep->ev_lock, NULL);
1370Sstevel@tonic-gate ep->ev_refs = 0;
1380Sstevel@tonic-gate ASSERT(type < FMD_EVT_NTYPES);
1391193Smws ep->ev_type = (uint8_t)type;
1400Sstevel@tonic-gate ep->ev_state = FMD_EVS_RECEIVED;
1411193Smws ep->ev_flags = FMD_EVF_VOLATILE | FMD_EVF_REPLAY | FMD_EVF_LOCAL;
1421193Smws ep->ev_ttl = (uint8_t)fmd.d_xprt_ttl;
1430Sstevel@tonic-gate ep->ev_nvl = nvl;
1440Sstevel@tonic-gate ep->ev_data = data;
1450Sstevel@tonic-gate ep->ev_log = NULL;
1460Sstevel@tonic-gate ep->ev_off = 0;
1470Sstevel@tonic-gate ep->ev_len = 0;
1480Sstevel@tonic-gate
1490Sstevel@tonic-gate /*
1500Sstevel@tonic-gate * Sample TOD and then set ev_time to the earlier TOD corresponding to
1510Sstevel@tonic-gate * the input hrtime value. This needs to be improved later: hrestime
1520Sstevel@tonic-gate * should be sampled by the transport and passed as an input parameter.
1530Sstevel@tonic-gate */
1540Sstevel@tonic-gate fmd_time_sync(&tod, &hr0, 1);
1550Sstevel@tonic-gate
1560Sstevel@tonic-gate if (hrt == FMD_HRT_NOW)
1570Sstevel@tonic-gate hrt = hr0; /* use hrtime sampled by fmd_time_sync() */
1580Sstevel@tonic-gate
1590Sstevel@tonic-gate /*
1600Sstevel@tonic-gate * If this is an FMA protocol event of class "ereport.*" that contains
1610Sstevel@tonic-gate * valid ENA, we can compute a more precise bound on the event time.
1620Sstevel@tonic-gate */
1630Sstevel@tonic-gate if (type == FMD_EVT_PROTOCOL && (p = strchr(data, '.')) != NULL &&
1640Sstevel@tonic-gate strncmp(data, FM_EREPORT_CLASS, (size_t)(p - (char *)data)) == 0 &&
1650Sstevel@tonic-gate nvlist_lookup_uint64(nvl, FM_EREPORT_ENA, &ena) == 0 &&
1660Sstevel@tonic-gate fmd.d_clockops == &fmd_timeops_native)
1670Sstevel@tonic-gate hrt = fmd_time_ena2hrt(hrt, ena);
1680Sstevel@tonic-gate
1690Sstevel@tonic-gate fmd_time_hrt2tod(hr0, &tod, hrt, &ep->ev_time);
1700Sstevel@tonic-gate ep->ev_hrt = hrt;
1710Sstevel@tonic-gate
1721193Smws fmd_event_nvwrap(ep);
1730Sstevel@tonic-gate return ((fmd_event_t *)ep);
1740Sstevel@tonic-gate }
1750Sstevel@tonic-gate
1760Sstevel@tonic-gate void
fmd_event_destroy(fmd_event_t * e)1770Sstevel@tonic-gate fmd_event_destroy(fmd_event_t *e)
1780Sstevel@tonic-gate {
1790Sstevel@tonic-gate fmd_event_impl_t *ep = (fmd_event_impl_t *)e;
1800Sstevel@tonic-gate
1810Sstevel@tonic-gate ASSERT(MUTEX_HELD(&ep->ev_lock));
1820Sstevel@tonic-gate ASSERT(ep->ev_refs == 0);
1830Sstevel@tonic-gate
1840Sstevel@tonic-gate /*
1850Sstevel@tonic-gate * If the current state is RECEIVED (i.e. no module has accepted the
1860Sstevel@tonic-gate * event) and the event was logged, then change the state to DISCARDED.
1870Sstevel@tonic-gate */
1880Sstevel@tonic-gate if (ep->ev_state == FMD_EVS_RECEIVED)
1890Sstevel@tonic-gate ep->ev_state = FMD_EVS_DISCARDED;
1900Sstevel@tonic-gate
1910Sstevel@tonic-gate /*
1920Sstevel@tonic-gate * If the current state is DISCARDED, ACCEPTED, or DIAGNOSED and the
1930Sstevel@tonic-gate * event has not yet been commited, then attempt to commit it now.
1940Sstevel@tonic-gate */
1950Sstevel@tonic-gate if (ep->ev_state != FMD_EVS_RECEIVED && (ep->ev_flags & (
1960Sstevel@tonic-gate FMD_EVF_VOLATILE | FMD_EVF_REPLAY)) == FMD_EVF_REPLAY)
1970Sstevel@tonic-gate fmd_log_commit(ep->ev_log, e);
1980Sstevel@tonic-gate
1990Sstevel@tonic-gate if (ep->ev_log != NULL) {
2000Sstevel@tonic-gate if (ep->ev_flags & FMD_EVF_REPLAY)
2010Sstevel@tonic-gate fmd_log_decommit(ep->ev_log, e);
2020Sstevel@tonic-gate fmd_log_rele(ep->ev_log);
2030Sstevel@tonic-gate }
2040Sstevel@tonic-gate
2050Sstevel@tonic-gate /*
2060Sstevel@tonic-gate * Perform any event type-specific cleanup activities, and then free
2070Sstevel@tonic-gate * the name-value pair list and underlying event data structure.
2080Sstevel@tonic-gate */
2090Sstevel@tonic-gate switch (ep->ev_type) {
2101193Smws case FMD_EVT_TIMEOUT:
2111193Smws fmd_free(ep->ev_data, sizeof (fmd_modtimer_t));
2121193Smws break;
2130Sstevel@tonic-gate case FMD_EVT_CLOSE:
2141193Smws case FMD_EVT_PUBLISH:
2150Sstevel@tonic-gate fmd_case_rele(ep->ev_data);
2160Sstevel@tonic-gate break;
2170Sstevel@tonic-gate case FMD_EVT_CTL:
2180Sstevel@tonic-gate fmd_ctl_fini(ep->ev_data);
2190Sstevel@tonic-gate break;
2204198Seschrock case FMD_EVT_TOPO:
2214198Seschrock fmd_topo_rele(ep->ev_data);
2224198Seschrock break;
2230Sstevel@tonic-gate }
2240Sstevel@tonic-gate
2250Sstevel@tonic-gate if (ep->ev_nvl != NULL)
2260Sstevel@tonic-gate nvlist_free(ep->ev_nvl);
2270Sstevel@tonic-gate
2280Sstevel@tonic-gate fmd_free(ep, sizeof (fmd_event_impl_t));
2290Sstevel@tonic-gate }
2300Sstevel@tonic-gate
2310Sstevel@tonic-gate void
fmd_event_hold(fmd_event_t * e)2320Sstevel@tonic-gate fmd_event_hold(fmd_event_t *e)
2330Sstevel@tonic-gate {
2340Sstevel@tonic-gate fmd_event_impl_t *ep = (fmd_event_impl_t *)e;
2350Sstevel@tonic-gate
2360Sstevel@tonic-gate (void) pthread_mutex_lock(&ep->ev_lock);
2370Sstevel@tonic-gate ep->ev_refs++;
2380Sstevel@tonic-gate ASSERT(ep->ev_refs != 0);
2390Sstevel@tonic-gate (void) pthread_mutex_unlock(&ep->ev_lock);
2400Sstevel@tonic-gate
2410Sstevel@tonic-gate if (ep->ev_type == FMD_EVT_CTL)
2420Sstevel@tonic-gate fmd_ctl_hold(ep->ev_data);
2430Sstevel@tonic-gate }
2440Sstevel@tonic-gate
2450Sstevel@tonic-gate void
fmd_event_rele(fmd_event_t * e)2460Sstevel@tonic-gate fmd_event_rele(fmd_event_t *e)
2470Sstevel@tonic-gate {
2480Sstevel@tonic-gate fmd_event_impl_t *ep = (fmd_event_impl_t *)e;
2490Sstevel@tonic-gate
2500Sstevel@tonic-gate if (ep->ev_type == FMD_EVT_CTL)
2510Sstevel@tonic-gate fmd_ctl_rele(ep->ev_data);
2520Sstevel@tonic-gate
2530Sstevel@tonic-gate (void) pthread_mutex_lock(&ep->ev_lock);
2540Sstevel@tonic-gate ASSERT(ep->ev_refs != 0);
2550Sstevel@tonic-gate
2560Sstevel@tonic-gate if (--ep->ev_refs == 0)
2570Sstevel@tonic-gate fmd_event_destroy(e);
2580Sstevel@tonic-gate else
2590Sstevel@tonic-gate (void) pthread_mutex_unlock(&ep->ev_lock);
2600Sstevel@tonic-gate }
2610Sstevel@tonic-gate
2620Sstevel@tonic-gate /*
2630Sstevel@tonic-gate * Transition event from its current state to the specified state. The states
2640Sstevel@tonic-gate * for events are defined in fmd_event.h and work according to the diagram:
2650Sstevel@tonic-gate *
2660Sstevel@tonic-gate * ------------- ------------- State Description
2670Sstevel@tonic-gate * ( RECEIVED =1 )-->( ACCEPTED =2 ) ---------- ---------------------------
2680Sstevel@tonic-gate * -----+-------\ ------+------ DISCARDED No active references in fmd
2690Sstevel@tonic-gate * | \ | RECEIVED Active refs in fmd, no case
2700Sstevel@tonic-gate * -----v------- \ ------v------ ACCEPTED Active refs, case assigned
2710Sstevel@tonic-gate * ( DISCARDED=0 ) v( DIAGNOSED=3 ) DIAGNOSED Active refs, case solved
2720Sstevel@tonic-gate * ------------- -------------
2730Sstevel@tonic-gate *
2740Sstevel@tonic-gate * Since events are reference counted on behalf of multiple subscribers, any
2750Sstevel@tonic-gate * attempt to transition an event to an "earlier" or "equal" state (as defined
2760Sstevel@tonic-gate * by the numeric state values shown in the diagram) is silently ignored.
2770Sstevel@tonic-gate * An event begins life in the RECEIVED state, so the RECEIVED -> DISCARDED
2780Sstevel@tonic-gate * transition is handled by fmd_event_destroy() when no references remain.
2790Sstevel@tonic-gate */
2800Sstevel@tonic-gate void
fmd_event_transition(fmd_event_t * e,uint_t state)2810Sstevel@tonic-gate fmd_event_transition(fmd_event_t *e, uint_t state)
2820Sstevel@tonic-gate {
2830Sstevel@tonic-gate fmd_event_impl_t *ep = (fmd_event_impl_t *)e;
2840Sstevel@tonic-gate
2850Sstevel@tonic-gate (void) pthread_mutex_lock(&ep->ev_lock);
2860Sstevel@tonic-gate
2870Sstevel@tonic-gate TRACE((FMD_DBG_EVT, "event %p transition %u -> %u",
2880Sstevel@tonic-gate (void *)ep, ep->ev_state, state));
2890Sstevel@tonic-gate
2900Sstevel@tonic-gate if (state <= ep->ev_state) {
2910Sstevel@tonic-gate (void) pthread_mutex_unlock(&ep->ev_lock);
2920Sstevel@tonic-gate return; /* no state change necessary */
2930Sstevel@tonic-gate }
2940Sstevel@tonic-gate
2950Sstevel@tonic-gate if (ep->ev_state < FMD_EVS_RECEIVED || ep->ev_state > FMD_EVS_DIAGNOSED)
2960Sstevel@tonic-gate fmd_panic("illegal transition %u -> %u\n", ep->ev_state, state);
2970Sstevel@tonic-gate
2980Sstevel@tonic-gate ep->ev_state = state;
2990Sstevel@tonic-gate (void) pthread_mutex_unlock(&ep->ev_lock);
3000Sstevel@tonic-gate }
3010Sstevel@tonic-gate
3020Sstevel@tonic-gate /*
3030Sstevel@tonic-gate * If the specified event is DISCARDED, ACCEPTED, OR DIAGNOSED and it has been
3040Sstevel@tonic-gate * written to a log but is still marked for replay, attempt to commit it to the
3050Sstevel@tonic-gate * log so that it will not be replayed. If fmd_log_commit() is successful, it
3060Sstevel@tonic-gate * will clear the FMD_EVF_REPLAY flag on the event for us.
3070Sstevel@tonic-gate */
3080Sstevel@tonic-gate void
fmd_event_commit(fmd_event_t * e)3090Sstevel@tonic-gate fmd_event_commit(fmd_event_t *e)
3100Sstevel@tonic-gate {
3110Sstevel@tonic-gate fmd_event_impl_t *ep = (fmd_event_impl_t *)e;
3120Sstevel@tonic-gate
3130Sstevel@tonic-gate (void) pthread_mutex_lock(&ep->ev_lock);
3140Sstevel@tonic-gate
3150Sstevel@tonic-gate if (ep->ev_state != FMD_EVS_RECEIVED && (ep->ev_flags & (
3160Sstevel@tonic-gate FMD_EVF_VOLATILE | FMD_EVF_REPLAY)) == FMD_EVF_REPLAY)
3170Sstevel@tonic-gate fmd_log_commit(ep->ev_log, e);
3180Sstevel@tonic-gate
3190Sstevel@tonic-gate (void) pthread_mutex_unlock(&ep->ev_lock);
3200Sstevel@tonic-gate }
3210Sstevel@tonic-gate
3220Sstevel@tonic-gate /*
3230Sstevel@tonic-gate * Compute the delta between events in nanoseconds. To account for very old
3240Sstevel@tonic-gate * events which are replayed, we must handle the case where ev_hrt is negative.
3250Sstevel@tonic-gate * We convert the hrtime_t's to unsigned 64-bit integers and then handle the
3260Sstevel@tonic-gate * case where 'old' is greater than 'new' (i.e. high-res time has wrapped).
3270Sstevel@tonic-gate */
3280Sstevel@tonic-gate hrtime_t
fmd_event_delta(fmd_event_t * e1,fmd_event_t * e2)3290Sstevel@tonic-gate fmd_event_delta(fmd_event_t *e1, fmd_event_t *e2)
3300Sstevel@tonic-gate {
3310Sstevel@tonic-gate uint64_t old = ((fmd_event_impl_t *)e1)->ev_hrt;
3320Sstevel@tonic-gate uint64_t new = ((fmd_event_impl_t *)e2)->ev_hrt;
3330Sstevel@tonic-gate
3340Sstevel@tonic-gate return (new >= old ? new - old : (UINT64_MAX - old) + new + 1);
3350Sstevel@tonic-gate }
3360Sstevel@tonic-gate
3370Sstevel@tonic-gate hrtime_t
fmd_event_hrtime(fmd_event_t * ep)3380Sstevel@tonic-gate fmd_event_hrtime(fmd_event_t *ep)
3390Sstevel@tonic-gate {
3400Sstevel@tonic-gate return (((fmd_event_impl_t *)ep)->ev_hrt);
3410Sstevel@tonic-gate }
3420Sstevel@tonic-gate
3430Sstevel@tonic-gate int
fmd_event_match(fmd_event_t * e,uint_t type,const void * data)3441193Smws fmd_event_match(fmd_event_t *e, uint_t type, const void *data)
3450Sstevel@tonic-gate {
3460Sstevel@tonic-gate fmd_event_impl_t *ep = (fmd_event_impl_t *)e;
3470Sstevel@tonic-gate
348*6081Scy152378 if (ep->ev_type != type)
349*6081Scy152378 return (0);
350*6081Scy152378
3510Sstevel@tonic-gate if (type == FMD_EVT_PROTOCOL)
352*6081Scy152378 return (fmd_strmatch(ep->ev_data, data));
3533323Scindi else if (type == FMD_EVT_TIMEOUT)
3543323Scindi return ((id_t)data == ((fmd_modtimer_t *)ep->ev_data)->mt_id);
3550Sstevel@tonic-gate else
356*6081Scy152378 return (ep->ev_data == data);
3570Sstevel@tonic-gate }
3580Sstevel@tonic-gate
3590Sstevel@tonic-gate int
fmd_event_equal(fmd_event_t * e1,fmd_event_t * e2)3600Sstevel@tonic-gate fmd_event_equal(fmd_event_t *e1, fmd_event_t *e2)
3610Sstevel@tonic-gate {
3620Sstevel@tonic-gate fmd_event_impl_t *ep1 = (fmd_event_impl_t *)e1;
3630Sstevel@tonic-gate fmd_event_impl_t *ep2 = (fmd_event_impl_t *)e2;
3640Sstevel@tonic-gate
3650Sstevel@tonic-gate return (ep1->ev_log != NULL &&
3660Sstevel@tonic-gate ep1->ev_log == ep2->ev_log && ep1->ev_off == ep2->ev_off);
3670Sstevel@tonic-gate }
368