summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-12 07:37:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-12 07:37:31 +0000
commit342259a3280879dd7ca3d6552288ab44ec907d85 (patch)
treebca8ec0710ddbb6db7fb3cfac0ac08f25cd4df51
parent8b8cce322b3ddaa4d2449215224110e8367b1854 (diff)
signal.c: for valgrind
* signal.c (ruby_signal): suppress valgrind error in install_sighandler(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--signal.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/signal.c b/signal.c
index 47c096b24cb..cd96b03e08e 100644
--- a/signal.c
+++ b/signal.c
@@ -23,6 +23,19 @@
# include <unistd.h>
#endif
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+# include <valgrind/memcheck.h>
+# ifndef VALGRIND_MAKE_MEM_DEFINED
+# define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE((p), (n))
+# endif
+# ifndef VALGRIND_MAKE_MEM_UNDEFINED
+# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n))
+# endif
+#else
+# define VALGRIND_MAKE_MEM_DEFINED(p, n) 0
+# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
+#endif
+
#if defined(__native_client__) && defined(NACL_NEWLIB)
# include "nacl/signal.h"
#endif
@@ -521,6 +534,7 @@ ruby_signal(int signum, sighandler_t handler)
)
sigact.sa_flags |= SA_ONSTACK;
#endif
+ VALGRIND_MAKE_MEM_DEFINED(&old, sizeof(old));
if (sigaction(signum, &sigact, &old) < 0) {
if (errno != 0 && errno != EINVAL) {
rb_bug_errno("sigaction", errno);