Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] [lttng-tools PATCH 1/2] Fix: add missing VALGRIND ifdef checks and documentation
Date: Thu, 20 Feb 2014 10:23:45 -0500	[thread overview]
Message-ID: <1392909826-4726-1-git-send-email-mathieu.desnoyers@efficios.com> (raw)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 doc/Makefile.am                  |    2 +-
 doc/valgrind-howto.txt           |    4 ++++
 src/common/hashtable/rculfhash.c |    2 +-
 src/common/runas.c               |   16 +++++++++++++++-
 4 files changed, 21 insertions(+), 3 deletions(-)
 create mode 100644 doc/valgrind-howto.txt

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 6f05d7a..4ff71eb 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 0000000..68dcaba
--- /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 0ddd21a..ee09afd 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 9029f8f..5ab4271 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");
-- 
1.7.10.4




             reply	other threads:[~2014-02-20 15:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 15:23 Mathieu Desnoyers [this message]
2014-02-20 15:23 ` [lttng-dev] [lttng-tools PATCH 2/2] Fix: miscellaneous memory handling fixes Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392909826-4726-1-git-send-email-mathieu.desnoyers@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox