1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

New LOG_MESG macro to fix file/line number logging for memory leaks after

LOG_LINENO macro was added.
This commit is contained in:
Alasdair Kergon 2009-07-15 14:18:38 +00:00
parent 9386a68477
commit eac6599c5e
3 changed files with 8 additions and 5 deletions

View File

@ -1,6 +1,7 @@
Version 1.02.34 - 15th July 2009 Version 1.02.34 - 15th July 2009
================================ ================================
Rename plog macro to LOG_LINE and use in dm_dump_memory_debug. Use _exit() not exit() after forking to avoid flushing libc buffers twice.
Rename plog macro to LOG_LINE & add LOG_MESG variant for dm_dump_memory_debug.
Change plog to use dm_log_with_errno unless deprecated dm_log_init was used. Change plog to use dm_log_with_errno unless deprecated dm_log_init was used.
Add dm_log_with_errno and dm_log_with_errno_init, deprecating the old fns. Add dm_log_with_errno and dm_log_with_errno_init, deprecating the old fns.
Fix whitespace in linear target line to fix identical table line detection. Fix whitespace in linear target line to fix identical table line detection.

View File

@ -21,14 +21,16 @@
extern dm_log_fn dm_log; extern dm_log_fn dm_log;
extern dm_log_with_errno_fn dm_log_with_errno; extern dm_log_with_errno_fn dm_log_with_errno;
#define LOG_LINE(l, x...) \ #define LOG_MESG(l, f, ln, x...) \
do { \ do { \
if (dm_log_is_non_default()) \ if (dm_log_is_non_default()) \
dm_log(l, __FILE__, __LINE__, ## x); \ dm_log(l, f, ln, ## x); \
else \ else \
dm_log_with_errno(l, __FILE__, __LINE__, 0, ## x); \ dm_log_with_errno(l, f, ln, 0, ## x); \
} while (0) } while (0)
#define LOG_LINE(l, x...) LOG_MESG(l, __FILE__, __LINE__, ## x)
#include "log.h" #include "log.h"
#endif #endif

View File

@ -205,7 +205,7 @@ int dm_dump_memory_debug(void)
} }
str[sizeof(str) - 1] = '\0'; str[sizeof(str) - 1] = '\0';
LOG_LINE(_LOG_INFO, mb->file, mb->line, LOG_MESG(_LOG_INFO, mb->file, mb->line,
"block %d at %p, size %" PRIsize_t "\t [%s]", "block %d at %p, size %" PRIsize_t "\t [%s]",
mb->id, mb->magic, mb->length, str); mb->id, mb->magic, mb->length, str);
tot += mb->length; tot += mb->length;