fme.c revision 5f25dc2aa25a1742246574b0899ea47f941f0fbc
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER START
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The contents of this file are subject to the terms of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Common Development and Distribution License (the "License").
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner * You may not use this file except in compliance with the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * See the License for the specific language governing permissions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * and limitations under the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * When distributing Covered Code, include this CDDL HEADER in each
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * If applicable, add the following below this CDDL HEADER, with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * fields enclosed by brackets "[]" replaced with your own identifying
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * information: Portions Copyright [yyyy] [name of copyright owner]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER END
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Use is subject to license terms.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * fme.c -- fault management exercise module
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * this module provides the simulated fault management exercise.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#pragma ident "%Z%%M% %I% %E% SMI"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* imported from eft.c... */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern char *Autoclose;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* fme under construction is global so we can free it on module abort */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic const char *Undiag_reason;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic int Nextid = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* list of fault management exercises underway */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic struct fme {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin unsigned long long ull; /* time when fme was created */
enum fme_state {
} state;
static struct case_list {
static struct fme *
alloc_fme(void)
return (fmep);
static struct fme *
if (EFMElist) {
return (fmep);
static struct fme *
return (NULL);
return (NULL);
return (NULL);
fme_fini(void)
if (Nfmep) {
char *estr;
sizeof (cfglen));
if (cfglen != 0) {
char *sepptr;
char *estr;
int ocnt;
int elen;
if (elen == 0) {
tmpbuf);
if (pkdlen != 0) {
if (ocnt == 0)
goto badcase;
sizeof (size_t));
goto badcase;
if (rawsz > 0) {
goto badcase;
goto badcase;
goto badcase;
goto badcase;
goto badcase;
goto badcase;
goto badcase;
FREE(f);
return (t == N_FAULT);
return (t == N_DEFECT);
return (t == N_UPSET);
static struct node *
char *ptr;
return (ret);
char *serdname;
return (NULL);
if ((nid =
char *suffix;
char *nserdname;
const char *ename;
} *tripped;
nupset = 0;
nupset++;
if (nupset == 0)
ntrip = 0;
ntrip++;
for (i = 0; i < ntrip; i++)
return (ntrip);
const char *eventstring)
int matched = 0;
int prev_verbose;
if (Debug == 0)
Verbose = 0;
matched++;
if (pre_peek_nvp)
if (ffep)
if (matched)
if (ofmep) {
if (ffep)
if (ffep)
if (ffep) {
static int current_indent;
indent_push(const char *s)
indent_set(const char *s)
current_indent = 0;
indent_push(s);
indent_pop(void)
if (current_indent > 0)
indent(void)
if (!Verbose)
for (i = 0; i < current_indent; i++)
static struct node *
if (n == NULL)
static nvlist_t *
char *failure;
int err, i;
return (NULL);
depth++;
return (NULL);
for (i = 0; i < depth; i++)
if (err != 0) {
goto boom;
if (err != 0) {
goto boom;
if (err != 0) {
goto boom;
pa[i++] = p;
if (err == 0) {
for (i = 0; i < depth; i++)
boom:
for (i = 0; i < depth; i++)
nvlist_free(f);
static uint_t
static uint8_t
static struct rsl {
rslcmp(const void *a, const void *b)
int rv;
if (rv != 0)
return (rv);
first++;
(*nprobs)--;
(*nnonf)--;
cr++;
first++;
char *pathstr;
pathstr);
int rpcnt;
rp++;
static char *Istatbuf;
static char *Istatbufptr;
static int Istatsz;
int val;
char *str;
int len;
int val;
if (Istat_need_save == 0)
Istatsz = 0;
if (Istatsz == 0) {
Istat_need_save = 0;
int cnt = 0;
char *sname;
char *snamep;
if (np)
if (np)
istat_fini(void)
struct node *n;
} else if (fr == 0) {
frcnt++;
cert,
&messval) == 0) {
messval);
destroy_fme_bufs(f);
(void *)fmep);
case FME_CREDIBLE:
struct event *s;
if (s->t == N_UPSET) {
if (Hesitate &&
(unsigned long long *)&Hesitate);
case FME_WAIT:
case FME_DISPROVED:
int doclose = 0;
doclose = 0;
if (doclose) {
static void indent(void);
unsigned long long *pdelay);
indent();
indent();
indent();
int count = 0;
unsigned long long my_delay;
int retval = 0;
if (mark == 0) {
indent();
indent();
indent();
indent();
indent();
indent();
&my_delay);
indent();
indent_pop();
indent();
indent();
indent_pop();
return (retval);
static enum fme_state
unsigned long long my_delay;
indent();
&my_delay);
indent();
indent();
indent_pop();
return (return_value);
static enum fme_state
int waiting_events;
int credible_events;
int deferred_events;
unsigned long long arrow_delay;
unsigned long long my_delay;
indent();
return (FME_CREDIBLE);
indent();
return (FME_DISPROVED);
indent();
return (FME_WAIT);
indent();
indent();
switch (return_value) {
case FME_CREDIBLE:
case FME_DISPROVED:
case FME_WAIT:
indent_pop();
return (return_value);
credible_events = 0;
waiting_events = 0;
deferred_events = 0;
indent();
indent();
if (n <= credible_events)
&my_delay)) {
case FME_DEFERRED:
case FME_CREDIBLE:
case FME_DISPROVED:
case FME_WAIT:
indent();
indent();
indent_pop();
return (FME_DISPROVED);
} else if (credible_events < n) {
indent();
indent_pop();
return (return_value);
static enum fme_state
unsigned long long my_delay;
int credible_results = 0;
int waiting_results = 0;
indent();
int do_not_follow = 0;
indent();
if (do_not_follow) {
indent();
&my_delay);
switch (fstate) {
case FME_WAIT:
case FME_CREDIBLE:
case FME_DISPROVED:
indent();
indent_pop();
return (FME_DISPROVED);
if (waiting_results != 0) {
indent();
indent_pop();
return (FME_WAIT);
indent();
indent_pop();
return (FME_CREDIBLE);
static enum fme_state
unsigned long long my_delay;
indent();
indent();
indent_pop();
return (FME_DISPROVED);
indent();
indent_pop();
return (FME_DISPROVED);
indent();
indent_pop();
return (FME_DISPROVED);
indent();
indent_pop();
return (FME_WAIT);
indent();
indent_pop();
return (FME_CREDIBLE);
int sz;
char *sbuf;
char *ptr;
char *sepptr;
int val;
istat_save();