From: Mathieu Desnoyers Date: Thu, 20 Feb 2014 15:23:45 +0000 (-0500) Subject: Fix: add missing VALGRIND ifdef checks and documentation X-Git-Tag: v2.5.0-rc1~170 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=8f0044bfed9f5ca51eab51478f483f92cc8f84a7;p=lttng-tools.git Fix: add missing VALGRIND ifdef checks and documentation Signed-off-by: Mathieu Desnoyers Signed-off-by: David Goulet --- diff --git a/doc/Makefile.am b/doc/Makefile.am index 6f05d7a78..4ff71ebbf 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -5,4 +5,4 @@ EXTRA_DIST = quickstart.txt streaming-howto.txt python-howto.txt \ dist_doc_DATA = quickstart.txt streaming-howto.txt python-howto.txt \ snapshot-howto.txt calibrate.txt live-reading-howto.txt \ - live-reading-protocol.txt + live-reading-protocol.txt valgrind-howto.txt diff --git a/doc/valgrind-howto.txt b/doc/valgrind-howto.txt new file mode 100644 index 000000000..68dcaba1c --- /dev/null +++ b/doc/valgrind-howto.txt @@ -0,0 +1,4 @@ +Build lttng-tools with "-DVALGRIND" to create executables compatible +with the valgrind tool. The start with e.g.: + +valgrind --leak-check=full lttng-sessiond diff --git a/src/common/hashtable/rculfhash.c b/src/common/hashtable/rculfhash.c index 0ddd21a3b..ee09afd1b 100644 --- a/src/common/hashtable/rculfhash.c +++ b/src/common/hashtable/rculfhash.c @@ -627,7 +627,7 @@ void free_split_items_count(struct cds_lfht *ht) poison_free(ht->split_count); } -#if defined(HAVE_SCHED_GETCPU) +#if defined(HAVE_SCHED_GETCPU) && !defined(VALGRIND) static int ht_get_split_count_index(unsigned long hash) { diff --git a/src/common/runas.c b/src/common/runas.c index 9029f8f74..5ab42717a 100644 --- a/src/common/runas.c +++ b/src/common/runas.c @@ -77,6 +77,20 @@ struct run_as_open_data { mode_t mode; }; +#ifdef VALGRIND +static +int use_clone(void) +{ + return 0; +} +#else +static +int use_clone(void) +{ + return !getenv("LTTNG_DEBUG_NOCLONE"); +} +#endif + /* * Create recursively directory using the FULL path. */ @@ -271,7 +285,7 @@ int run_as_noclone(int (*cmd)(void *data), void *data, uid_t uid, gid_t gid) static int run_as(int (*cmd)(void *data), void *data, uid_t uid, gid_t gid) { - if (!getenv("LTTNG_DEBUG_NOCLONE")) { + if (use_clone()) { int ret; DBG("Using run_as_clone");