Beispiel #1
0
u08 eth_init( void )
{
	struct iface_info_t { u08 id; char const * name; } iface_infos[] = 
	{
		{ IFACE_WAN, "wan" },
		{ IFACE_LAN0, "lan0" },
		{ IFACE_LAN1, "lan1" },
		{ IFACE_LAN2, "lan2" },
		{ IFACE_LAN3, "lan3" },
		{ 0, 0 }
	};

	struct iface_info_t const * p = iface_infos;
	while( p->name )
	{
		if (!__eth_init_interface( p->id, p->name ))
			break;
		++p;
	}

	in_packet_counter = stats_new_counter("Total Incoming Packets");
	out_packet_counter = stats_new_counter("Total Outgoing Packets");

	return 1;
}
Beispiel #2
0
/*ARGSUSED*/
void
lex_init(char **av, const char *cppargs, int lexecho)
{
    int i;
#ifdef	ESC
    const char *ptr;
#endif	/* ESC */

    Lexecho = lexecho;
    Tokcount = stats_new_counter("lex.tokens", "total tokens in", 1);
    Filecount = stats_new_counter("lex.files", "total files read", 0);
    Lexelapse = stats_new_elapse("lex.time", "elapsed lex/parse time", 1);

#ifdef	ESC
    Cppargs = cppargs;

    /* allow user to tell us where cpp is if it is some weird place */
    if (ptr = getenv("_ESC_CPP"))
        Cpp = ptr;

    /* and in case it takes some special stdargs */
    if (ptr = getenv("_ESC_CPP_STDARGS"))
        Cppstdargs = ptr;

    /* verify we can find cpp */
    if (access(Cpp, X_OK) < 0) {
        Cpp = "/usr/lib/cpp";
        if (access(Cpp, X_OK) < 0)
            out(O_DIE, "can't locate cpp");
    }
#endif	/* ESC */

    Files = av;

    /* verify we can find all the input files */
    while (*av) {
        if (strlen(*av) >= MAXTOK - strlen(Cpp) - 3)
            out(O_DIE, "filename too long: %.100s...", *av);
        if (access(*av, R_OK) < 0)
            out(O_DIE|O_SYS, "%s", *av);
        av++;
        stats_counter_bump(Filecount);
    }

    /* put reserved words into the string table & a lookup table */
    for (i = 0; i < sizeof (Rwords) / sizeof (*Rwords); i++)
        Rwordslut = lex_s2i_lut_add(Rwordslut,
                                    stable(Rwords[i].word), Rwords[i].val);

    /* initialize table of timeval suffixes */
    for (i = 0; i < sizeof (Timesuffix) / sizeof (*Timesuffix); i++) {
        Timesuffixlut = lex_s2ullp_lut_add(Timesuffixlut,
                                           stable(Timesuffix[i].suffix), &Timesuffix[i].nsec);
    }

    /* record start time */
    stats_elapse_start(Lexelapse);
}
Beispiel #3
0
/*
 * iexpr_init -- initialize the iexpr module
 */
void
iexpr_init(void)
{
	Niexpr = stats_new_counter("iexpr.niexpr", "iexpr cache entries", 1);
}
Beispiel #4
0
/*
 * ipath_init -- initialize the ipath module
 */
void
ipath_init(void)
{
	Nipath = stats_new_counter("ievent.nipath", "ipath cache entries", 1);
	Nbytes = stats_new_counter("ievent.nbytes", "total cache size", 1);
}