示例#1
0
文件: main.c 项目: bro/packet-bricks
/**
 * XXX - A rudimentary method to display file contents. This may be revised...
 */
static inline void
status_print(int sig)
{
	TRACE_FUNC_START();
	FILE *f;
	char status_fname[FILENAME_MAX];

	sprintf(status_fname, "/var/run/%s.status", PLATFORM_PROMPT);
	f = fopen(status_fname, "w+");
	if (f == NULL) {
		TRACE_ERR("Failed to create status file!\n");
		TRACE_FUNC_END();
	}
	
	/* only print status if engines are online */
	if (is_pktengine_online((unsigned char *)"any")) {
		pktengines_list_stats(f);
	} else {
		/* Do nothing! */
	}

	fflush(f);
	fclose(f);
	alarm(FILE_PRINT_TIMER);
	
	TRACE_FUNC_END();
	UNUSED(sig);
}
示例#2
0
/*---------------------------------------------------------------------*/
static int
platform_show_stats(lua_State *L)
{
	/* this prints the system-wide statitics */
	TRACE_LUA_FUNC_START();
	pktengines_list_stats(stdout);
	TRACE_LUA_FUNC_END();
	UNUSED(L);
        return 0;
}