eft.c revision 08f6c0653123b411f597aeaaea73d3547531b429
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <string.h>
#include <libnvpair.h>
#include "out.h"
#include "stats.h"
#include "alloc.h"
#include "stable.h"
#include "literals.h"
#include "lut.h"
#include "esclex.h"
#include "tree.h"
#include "ipath.h"
#include "itree.h"
#include "iexpr.h"
#include "ptree.h"
#include "check.h"
#include "version.h"
#include "fme.h"
#include "eval.h"
#include "config.h"
#include "platform.h"
/*
* eversholt diagnosis engine (eft.so) main entry points
*/
char *Autoclose; /* close cases automatically after solving */
int Dupclose; /* close cases on duplicate diagosis */
int Verbose;
int Estats;
char **Efts;
int Max_fme; /* Maximum number of open FMEs */
/* stuff exported by yacc-generated parsers */
extern void yyparse(void);
extern int yydebug;
extern void literals_init(void);
extern void literals_fini(void);
struct eftsubr {
const char *prefix;
} eftsubrs[] = {
{ "ereport.", fme_receive_external_report },
{ "list.repaired", fme_receive_repair_list },
};
/*ARGSUSED*/
static void
{
break;
sp++;
}
} else {
"eft_recv: event class \"%s\" does not match our "
"subscriptions", class);
}
}
/*ARGSUSED*/
static void
{
return;
}
static void
{
}
static const fmd_prop_t eft_props[] = {
};
static const fmd_hdl_ops_t eft_ops = {
eft_recv, /* fmdo_recv */
eft_timeout, /* fmdo_timeout */
eft_close, /* fmdo_close */
NULL, /* fmdo_stats */
NULL, /* fmdo_gc */
};
#define str(s) #s
static const fmd_hdl_info_t fmd_info = {
"eft diagnosis engine",
};
/*
* ename_strdup -- like strdup but ename comes in and class string goes out
*/
static char *
{
int len;
char *buf;
/* calculate length of buffer required */
len = 0;
buf[0] = '\0';
/* now build the string */
while (np) {
if (np)
}
return (buf);
}
/*ARGSUSED*/
static void
{
}
/*
* Call all of the _fini() routines to clean up the exiting DE
*/
void
call_finis(void)
{
fme_fini();
itree_fini();
ipath_fini();
iexpr_fini();
istat_fini();
lex_free();
check_fini();
tree_fini();
lut_fini();
stable_fini();
stats_fini();
out_fini();
alloc_fini();
}
/*ARGSUSED*/
static void
{
}
void
{
int count;
char *fname;
/* keep handle for routines like out() which need it */
alloc_init();
out_init("eft");
stable_init(0);
lut_init();
tree_init();
ipath_init();
iexpr_init();
check_init();
/*
* If we read no .eft files, we can't do any
* diagnosing, so we just unload ourselves
*/
if (stats_counter_value(Filecount) == 0) {
(void) lex_fini();
call_finis();
return;
}
yyparse();
(void) lex_fini();
tree_report();
if (count = out_errcount())
/* subscribe to events we expect to consume */
/* subscribe to repair events so we can clear state on repair */
/* open dictionaries referenced by all .eft files */
}
(void) setlinebuf(fp);
}
"dupclose %d maxfme %d",
}
}
/*ARGSUSED*/
void
{
call_finis();
}