fprintf(stderr, "DBG<" #LVL ">: " FMT, ##ARG); \
} while (0)
-#define BUG() \
- do { \
- fprintf(stderr, "BUG: %s:%d\n", \
- __FILE__, __LINE__); \
- assert(0); \
+#define BUG() \
+ do { \
+ NL_DBG(1, "BUG: %s:%d\n", \
+ __FILE__, __LINE__); \
+ assert(0); \
} while (0)
#define APPBUG(msg) \
do { \
- fprintf(stderr, "APPLICATION BUG: %s:%d:%s: %s\n", \
+ NL_DBG(1, "APPLICATION BUG: %s:%d:%s: %s\n", \
__FILE__, __LINE__, __PRETTY_FUNCTION__, msg); \
assert(0); \
} while(0)
int type = nla_type(nla);
if (type == 0) {
- fprintf(stderr, "Illegal nla->nla_type == 0\n");
+ NL_DBG(1, "Illegal nla->nla_type == 0\n");
continue;
}
}
if (rem > 0)
- fprintf(stderr, "netlink: %d bytes leftover after parsing "
+ NL_DBG(1, "netlink: %d bytes leftover after parsing "
"attributes.\n", rem);
err = 0;
err = nl_cache_pickup(sk, cache);
if (err == -NLE_DUMP_INTR) {
- fprintf(stderr, "dump interrupted, restarting!\n");
+ NL_DBG(1, "dump interrupted, restarting!\n");
goto restart;
} else if (err < 0)
break;
struct nl_cache *cache;
if (!(cache = __nl_cache_mngt_require(name)))
- fprintf(stderr, "Application BUG: Your application must "
- "call nl_cache_mngt_provide() and\nprovide a valid "
- "%s cache to be used for internal lookups.\nSee the "
- " API documentation for more details.\n", name);
+ NL_DBG(1, "Application BUG: Your application must "
+ "call nl_cache_mngt_provide() and\nprovide a valid "
+ "%s cache to be used for internal lookups.\nSee the "
+ " API documentation for more details.\n", name);
return cache;
}
nl_init_list_head(&tbl_name[i]);
if ((err = rtnl_tc_read_classid_file()) < 0)
- fprintf(stderr, "Failed to read classid file: %s\n", nl_geterror(err));
+ NL_DBG(1, "Failed to read classid file: %s\n", nl_geterror(err));
}
static void free_map(void *map) {
if (fscanf(fd, "%08x %08x %08x %08x",
&ns_per_usec, &ns_per_tick, &nom, &denom) != 4) {
- fprintf(stderr, "Fatal error: can not read psched settings from \"%s\". " \
+ NL_DBG(1, "Fatal error: can not read psched settings from \"%s\". " \
"Try to set TICKS_PER_USEC, PROC_NET_PSCHED or PROC_ROOT " \
"environment variables\n", name);
exit(1);