* make backtrace optional.
authorWilfried Göesgens <willi@citadel.org>
Wed, 29 Aug 2007 17:52:08 +0000 (17:52 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 29 Aug 2007 17:52:08 +0000 (17:52 +0000)
citadel/citadel.c
citadel/citserver.c
citadel/commands.c
citadel/configure.ac
citadel/ecrash.c
citadel/server_main.c

index 4330cf7842caaba3cf31716255454b37e540e8f1..d5c0b10590cc8fb1313a120457500ad845425b65 100644 (file)
@@ -1405,12 +1405,14 @@ int main(int argc, char **argv)
        char relhome[PATH_MAX]="";
        char ctdldir[PATH_MAX]=CTDLDIR;
     int lp; 
+#ifdef HAVE_BACKTRACE
        eCrashParameters params;
 //     eCrashSymbolTable symbol_table;
-
+#endif
 
        calc_dirs_n_files(relh, home, relhome, ctdldir);
 
+#ifdef HAVE_BACKTRACE
        bzero(&params, sizeof(params));
        params.filename = file_pid_paniclog;
 //     panic_fd=open(file_pid_paniclog, O_APPEND|O_CREAT|O_DIRECT);
@@ -1426,7 +1428,7 @@ int main(int argc, char **argv)
        params.signals[3]=SIGABRT;
 
        eCrash_Init(&params);
-       
+#endif 
        setIPCDeathHook(screen_delete);
        setIPCErrorPrintf(err_printf);
        setCryptoStatusHook(statusHook);
index a25a2ea2077e69332092e67c537395c807eb7d91..79ebddefa18d789b5cdf04031231ce64b2346eed 100644 (file)
@@ -76,6 +76,7 @@ int panic_fd;
 void cit_backtrace(void)
 {
 #ifdef HAVE_BACKTRACE
+snatoehu
        void *stack_frames[50];
        size_t size, i;
        char **strings;
index fb1b99b9b9ee5c9430a17c51021697e408732bc8..9e2af999138aef30dd88e860e2f22023fa2c02de 100644 (file)
@@ -394,6 +394,7 @@ static int async_ka_enabled = 0;
 
 static void *ka_thread(void *arg)
 {
+#ifdef HAVE_BACKTRACE
        char threadName[256];
 
        // Set up our name
@@ -401,12 +402,14 @@ static void *ka_thread(void *arg)
 
        // Register for tracing
        eCrash_RegisterThread(threadName, 0);
-
+#endif
        really_do_keepalive();
        pthread_detach(ka_thr_handle);
        ka_thr_active = 0;
        
+#ifdef HAVE_BACKTRACE
        eCrash_UnregisterThread();
+#endif
        return NULL;
 }
 
index af09ef2d94cf0fece82f2cbee3541ea0b39abfad..79ce0e2dd30a4c35daa7f0ac0785a5691a03009c 100644 (file)
@@ -294,7 +294,18 @@ dnl Checks for libraries.
 dnl We want to test for the following in libc before checking for their
 dnl respective libraries, because some systems (like Irix) have both, and the
 dnl non-libc versions may be broken.
-AC_CHECK_FUNCS(crypt gethostbyname connect backtrace)
+AC_CHECK_FUNCS(crypt gethostbyname connect )
+
+
+dnl disable backtrace if we don't want it.
+AC_ARG_WITH(backtrace, 
+                   [  --with-backtrace          Disable backtrace dumps in the syslog],
+                       [ if test "x$withval" != "xno" ; then
+                             AC_CHECK_FUNCS(backtrace)
+                         fi
+                       ]
+)
+
 
 if test "$ac_cv_func_gethostbyname" = no; then
        AC_CHECK_LIB(nsl, gethostbyname)
index 2c04fe97e6bdc273af1a617ffed23acb2c71f1ce..f67e6776232243ec0b34bdb7d566476ece301580 100644 (file)
@@ -27,7 +27,7 @@
 #include "ecrash.h"
 
 #define NIY()  printf("%s: Not Implemented Yet!\n", __FUNCTION__)
-
+#ifdef HAVE_BACKTRACE
 static eCrashParameters gbl_params;
 static int gbl_fd=-1;
 
@@ -644,3 +644,4 @@ int eCrash_UnregisterThread( void )
        return removeThreadFromList(pthread_self());
 } /* eCrash_UnregisterThread */
 
+#endif
index bd3c0032116a1e9727991b6bb50ab2c630c0727b..a2bc2b4ef5c325e72e7485148160b6628a90c082 100644 (file)
@@ -89,9 +89,10 @@ int main(int argc, char **argv)
 #ifdef HAVE_RUN_DIR
        struct stat filestats;
 #endif
+#ifdef HAVE_BACKTRACE
        eCrashParameters params;
 //     eCrashSymbolTable symbol_table;
-
+#endif
        /* initialise semaphores here. Patch by Matt and davew
         * its called here as they are needed by lprintf for thread safety
         */
@@ -164,6 +165,7 @@ int main(int argc, char **argv)
                drop_root_perms = 1;
        }
 
+#ifdef HAVE_BACKTRACE
        bzero(&params, sizeof(params));
        params.filename = file_pid_paniclog;
        panic_fd=open(file_pid_paniclog, O_APPEND|O_CREAT|O_DIRECT);
@@ -183,6 +185,7 @@ int main(int argc, char **argv)
        eCrash_RegisterThread("MasterThread", 0);
 
 ///    signal(SIGSEGV, cit_panic_backtrace);
+#endif
        /* Initialize the syslogger.  Yes, we are really using 0 as the
         * facility, because we are going to bitwise-OR the facility to
         * the severity of each message, allowing us to write to other