/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <limits.h>
#include <fmd_alloc.h>
#include <fmd_subr.h>
#include <fmd_event.h>
#include <fmd_string.h>
#include <fmd_module.h>
#include <fmd_case.h>
#include <fmd_log.h>
#include <fmd_time.h>
#include <fmd_topo.h>
#include <fmd_ctl.h>
#include <fmd.h>
static void
{
}
static void
{
uint_t n;
}
else
}
{
/*
* If we're not restoring from a log, the event is marked volatile. If
* we are restoring from a log, then hold the log pointer and increment
* the pending count. If we're using a log but no offset and data len
* are specified, it's a checkpoint event: don't replay or set pending.
*/
else {
}
/*
* Sample a (TOD, hrtime) pair from the current system clocks and then
* compute ev_hrt by taking the delta between this TOD and ev_time.
*/
return ((fmd_event_t *)ep);
}
{
const char *p;
/*
* Sample TOD and then set ev_time to the earlier TOD corresponding to
* the input hrtime value. This needs to be improved later: hrestime
* should be sampled by the transport and passed as an input parameter.
*/
if (hrt == FMD_HRT_NOW)
/*
* If this is an FMA protocol event of class "ereport.*" that contains
* valid ENA, we can compute a more precise bound on the event time.
*/
return ((fmd_event_t *)ep);
}
void
{
/*
* If the current state is RECEIVED (i.e. no module has accepted the
* event) and the event was logged, then change the state to DISCARDED.
*/
/*
* If the current state is DISCARDED, ACCEPTED, or DIAGNOSED and the
* event has not yet been commited, then attempt to commit it now.
*/
}
/*
* Perform any event type-specific cleanup activities, and then free
* the name-value pair list and underlying event data structure.
*/
case FMD_EVT_TIMEOUT:
break;
case FMD_EVT_CLOSE:
case FMD_EVT_PUBLISH:
break;
case FMD_EVT_CTL:
break;
case FMD_EVT_TOPO:
break;
}
}
void
{
}
void
{
else
}
/*
* Transition event from its current state to the specified state. The states
* for events are defined in fmd_event.h and work according to the diagram:
*
* ------------- ------------- State Description
* ( RECEIVED =1 )-->( ACCEPTED =2 ) ---------- ---------------------------
* -----+-------\ ------+------ DISCARDED No active references in fmd
* | \ | RECEIVED Active refs in fmd, no case
* -----v------- \ ------v------ ACCEPTED Active refs, case assigned
* ( DISCARDED=0 ) v( DIAGNOSED=3 ) DIAGNOSED Active refs, case solved
* ------------- -------------
*
* Since events are reference counted on behalf of multiple subscribers, any
* attempt to transition an event to an "earlier" or "equal" state (as defined
* by the numeric state values shown in the diagram) is silently ignored.
* An event begins life in the RECEIVED state, so the RECEIVED -> DISCARDED
* transition is handled by fmd_event_destroy() when no references remain.
*/
void
{
return; /* no state change necessary */
}
}
/*
* If the specified event is DISCARDED, ACCEPTED, OR DIAGNOSED and it has been
* written to a log but is still marked for replay, attempt to commit it to the
* log so that it will not be replayed. If fmd_log_commit() is successful, it
* will clear the FMD_EVF_REPLAY flag on the event for us.
*/
void
{
}
/*
* Compute the delta between events in nanoseconds. To account for very old
* events which are replayed, we must handle the case where ev_hrt is negative.
* We convert the hrtime_t's to unsigned 64-bit integers and then handle the
* case where 'old' is greater than 'new' (i.e. high-res time has wrapped).
*/
{
}
{
}
int
{
return (0);
if (type == FMD_EVT_PROTOCOL)
else if (type == FMD_EVT_TIMEOUT)
else
}
int
{
}