1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

toolcontext: introduce var for run in valgrind

This commit is contained in:
Zdenek Kabelac 2024-04-30 20:22:09 +02:00
parent 9162ae0a0a
commit 7ec0f69cd1
2 changed files with 7 additions and 7 deletions

View File

@ -47,6 +47,8 @@
#ifdef HAVE_VALGRIND #ifdef HAVE_VALGRIND
#include <valgrind.h> #include <valgrind.h>
#else
#define RUNNING_ON_VALGRIND 0
#endif #endif
#ifdef __linux__ #ifdef __linux__
@ -1702,6 +1704,8 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
cmd->handles_unknown_segments = 0; cmd->handles_unknown_segments = 0;
cmd->hosttags = 0; cmd->hosttags = 0;
cmd->check_devs_used = 1; cmd->check_devs_used = 1;
cmd->running_on_valgrind = RUNNING_ON_VALGRIND;
dm_list_init(&cmd->arg_value_groups); dm_list_init(&cmd->arg_value_groups);
dm_list_init(&cmd->formats); dm_list_init(&cmd->formats);
dm_list_init(&cmd->segtypes); dm_list_init(&cmd->segtypes);
@ -1714,9 +1718,7 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
/* Set in/out stream buffering before glibc */ /* Set in/out stream buffering before glibc */
if (set_buffering if (set_buffering
#ifdef HAVE_VALGRIND && !cmd->running_on_valgrind /* Skipping within valgrind execution. */
&& !RUNNING_ON_VALGRIND /* Skipping within valgrind execution. */
#endif
#ifdef SYS_gettid #ifdef SYS_gettid
/* For threaded programs no changes of streams */ /* For threaded programs no changes of streams */
/* On linux gettid() is implemented only via syscall */ /* On linux gettid() is implemented only via syscall */
@ -2094,10 +2096,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
dm_device_list_destroy(&cmd->cache_dm_devs); dm_device_list_destroy(&cmd->cache_dm_devs);
#ifdef HAVE_VALGRIND if (!cmd->running_on_valgrind && cmd->linebuffer) {
if (!RUNNING_ON_VALGRIND) /* Skipping within valgrind execution. */
#endif
if (cmd->linebuffer) {
int flags; int flags;
/* Reset stream buffering to defaults */ /* Reset stream buffering to defaults */
if (is_valid_fd(STDIN_FILENO) && if (is_valid_fd(STDIN_FILENO) &&

View File

@ -139,6 +139,7 @@ struct cmd_context {
*/ */
unsigned is_long_lived:1; /* optimises persistent_filter handling */ unsigned is_long_lived:1; /* optimises persistent_filter handling */
unsigned is_interactive:1; unsigned is_interactive:1;
unsigned running_on_valgrind:1;
unsigned check_pv_dev_sizes:1; unsigned check_pv_dev_sizes:1;
unsigned handles_missing_pvs:1; unsigned handles_missing_pvs:1;
unsigned handles_unknown_segments:1; unsigned handles_unknown_segments:1;