util: Add --disable-fault-handling.
authorIra Cooper <ira@samba.org>
Wed, 14 Mar 2012 16:56:02 +0000 (12:56 -0400)
committerIra Cooper <ira@samba.org>
Thu, 15 Mar 2012 04:55:03 +0000 (05:55 +0100)
On some platforms you can not debug coredumps after the default signal handler
gets done dumping core.  This allows waf to have an option to disable our
default signal handler.

lib/util/fault.c
lib/util/wscript [new file with mode: 0644]
lib/util/wscript_configure
source3/configure.in
wscript

index 7fe081d28558cb1f1de397b431e674295e4227c9..b3527bb22e695e6402cea3076f0b47271b88e3a9 100644 (file)
@@ -96,6 +96,7 @@ void fault_setup(void)
        if (fault_state.disabled) {
                return;
        }
+#if !defined(HAVE_DISABLE_FAULT_HANDLING)
 #ifdef SIGSEGV
        CatchSignal(SIGSEGV, sig_fault);
 #endif
@@ -105,6 +106,7 @@ void fault_setup(void)
 #ifdef SIGABRT
        CatchSignal(SIGABRT, sig_fault);
 #endif
+#endif
 }
 
 _PUBLIC_ const char *panic_action = NULL;
diff --git a/lib/util/wscript b/lib/util/wscript
new file mode 100644 (file)
index 0000000..d296e75
--- /dev/null
@@ -0,0 +1,3 @@
+def set_options(opt):
+    ''' This is a bit strange, but disable is the flag, not enable. '''
+    opt.add_option('--disable-fault-handling', action='store_true', dest='disable_fault_handling', help=('disable the fault handlers'), default=False)
index fdaf67acb3fd3f179bde32188e47a3f1f4c34819..ad55476c7d80871b224e7204491377f71d2db350 100644 (file)
@@ -1,5 +1,8 @@
 #!/usr/bin/env python
+import Options
 
+if Options.options.disable_fault_handling:
+    conf.DEFINE('HAVE_DISABLE_FAULT_HANDLING',1)
 
 # backtrace could be in libexecinfo or in libc
 conf.CHECK_FUNCS_IN('backtrace backtrace_symbols', 'execinfo', checklibc=True, headers='execinfo.h')
index 611e1d8fb619ca7e1bfe35afaf7f067f8951a479..51e163dfb1cc89fd692a6e907515574ed6ae916f 100644 (file)
@@ -6799,6 +6799,7 @@ if test x"$enable_pthreadpool" = x"yes" -a x"$samba_cv_HAVE_PTHREAD" = x"yes"; t
     fi
 fi
 
+
 #################################################
 # Check to see if we should use the included iniparser
 
@@ -6834,6 +6835,12 @@ AC_SUBST(BUILD_INIPARSER)
 AC_SUBST(INIPARSERLIBS)
 AC_SUBST(FLAGS1)
 
+AC_ARG_ENABLE(fault-handler,[AS_HELP_STRING([--disable-fault-handler], [Disable the default handler])])
+
+if test x"$enable_fault_handler" = x"no"; then
+       AC_DEFINE(HAVE_DISABLE_FAULT_HANDLER, 1, [Disable the default signal handler])
+fi
+
 ###################################################
 # Check for different/missing (set|get|end)netgrent prototypes
 CFLAGS_SAVE=$CFLAGS
diff --git a/wscript b/wscript
index e1fe95363e818ca8c48f3726132fae966f43eccc..e64e50902a233f6641cecc4ab5d9e6ab8960a03a 100755 (executable)
--- a/wscript
+++ b/wscript
@@ -30,6 +30,7 @@ def set_options(opt):
     opt.RECURSE('lib/uid_wrapper')
     opt.RECURSE('pidl')
     opt.RECURSE('source3')
+    opt.RECURSE('lib/util')
 
     gr = opt.option_group('developer options')
     gr.add_option('--enable-build-farm',