mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
8b8cce322b
commit
342259a328
1 changed files with 14 additions and 0 deletions
14
signal.c
14
signal.c
|
@ -23,6 +23,19 @@
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#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)
|
#if defined(__native_client__) && defined(NACL_NEWLIB)
|
||||||
# include "nacl/signal.h"
|
# include "nacl/signal.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -521,6 +534,7 @@ ruby_signal(int signum, sighandler_t handler)
|
||||||
)
|
)
|
||||||
sigact.sa_flags |= SA_ONSTACK;
|
sigact.sa_flags |= SA_ONSTACK;
|
||||||
#endif
|
#endif
|
||||||
|
VALGRIND_MAKE_MEM_DEFINED(&old, sizeof(old));
|
||||||
if (sigaction(signum, &sigact, &old) < 0) {
|
if (sigaction(signum, &sigact, &old) < 0) {
|
||||||
if (errno != 0 && errno != EINVAL) {
|
if (errno != 0 && errno != EINVAL) {
|
||||||
rb_bug_errno("sigaction", errno);
|
rb_bug_errno("sigaction", errno);
|
||||||
|
|
Loading…
Add table
Reference in a new issue