Exemple #1
0
/**
 * 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);
}
Exemple #2
0
/*---------------------------------------------------------------------*/
static int
platform_print_status(lua_State *L)
{
	/* this prints the system's current status */
	TRACE_LUA_FUNC_START();
	uint8_t rc = 0;

	rc = is_pktengine_online((unsigned char *)"any");
	if (rc == 0)
		fprintf(stdout, PLATFORM_NAME" is offline.\n");
	else 
		fprintf(stdout, PLATFORM_NAME" is online.\n");

	TRACE_LUA_FUNC_END();
	UNUSED(L);
        return 0;
}