Exemple #1
0
static int
opensm_dump_to_file(osm_opensm_t * p_osm, const char *file_name,
		    void (*dump_func) (osm_opensm_t * p_osm, FILE * file))
{
	char path[1024];
	FILE *file;

	snprintf(path, sizeof(path), "%s/%s",
		 p_osm->subn.opt.dump_files_dir, file_name);

	file = fopen(path, "w");
	if (!file) {
		OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR 4C01: "
			"cannot open file \'%s\': %s\n",
			file_name, strerror(errno));
		return -1;
	}

	chmod(path, S_IRUSR | S_IWUSR);

	dump_func(p_osm, file);

	fclose(file);
	return 0;
}
Exemple #2
0
void dump_llist(struct llist *list, void (*dump_func)(void *))
{
	struct list_elem *el;

	printf ("Dump of list at %p (length %d):\n", list, list->count);
	for (el = list->head; NULL != el; el = el->next)
		dump_func(el->data);
}
Exemple #3
0
static void
dump_walker(const void *nodep, const VISIT which, const int depth)
{
    const KEYWORD *const p = *(KEYWORD * const *) nodep;
    (void) depth;
    if (which == postorder || which == leaf)
	dump_func(p);
}
Exemple #4
0
static int timeout_func(void *vp)
{
	return (dump_func("*", 1, vp));
}