Use NL_DBG() instead of printing warnings and errors to stderr

Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
Thomas Graf 2012-11-16 00:42:34 +01:00
parent 235aa7ff17
commit 23c4ef67c7
6 changed files with 15 additions and 15 deletions

View file

@ -86,16 +86,16 @@ struct trans_list {
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)

View file

@ -253,7 +253,7 @@ int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head, int len,
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;
}
@ -269,7 +269,7 @@ int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head, int len,
}
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;

View file

@ -925,7 +925,7 @@ restart:
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;

View file

@ -404,10 +404,10 @@ struct nl_cache *nl_cache_mngt_require(const char *name)
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;
}

View file

@ -441,7 +441,7 @@ static void __init classid_init(void)
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) {

View file

@ -426,7 +426,7 @@ static void __init get_psched_settings(void)
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);