Fix: add missing VALGRIND ifdef checks and documentation
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 20 Feb 2014 15:23:45 +0000 (10:23 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 21 Feb 2014 14:10:23 +0000 (14:10 +0000)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
doc/Makefile.am
doc/valgrind-howto.txt [new file with mode: 0644]
src/common/hashtable/rculfhash.c
src/common/runas.c

index 6f05d7a78de86977d8bcf845910060d6612e764c..4ff71ebbf0cbd53f77ac4668306422aa5a9d8f2e 100644 (file)
@@ -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 (file)
index 0000000..68dcaba
--- /dev/null
@@ -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
index 0ddd21a3b6335ccf3fb2ddb5ea5f1a9dbba1564c..ee09afd1b7201df7c1e6ea4528686cb593e8c96e 100644 (file)
@@ -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)
 {
index 9029f8f74d7802416a97a5f22a0650da9378ce68..5ab42717a9058b4a5083516aa142a3c1efda226d 100644 (file)
@@ -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");
This page took 0.036977 seconds and 4 git commands to generate.