remove unused trace function
authorArt Cancro <ajc@citadel.org>
Mon, 11 Jun 2018 03:28:40 +0000 (23:28 -0400)
committerArt Cancro <ajc@citadel.org>
Mon, 11 Jun 2018 03:28:40 +0000 (23:28 -0400)
14 files changed:
citadel/Makefile.in
citadel/citserver.c
citadel/citserver.h
citadel/context.c
citadel/database.c
citadel/ecrash.c [deleted file]
citadel/ecrash.h [deleted file]
citadel/modules/smtp/serv_smtp.c
citadel/msgbase.c
citadel/server_main.c
citadel/sysdep.c
citadel/user_ops.h
citadel/utils/ctdlmigrate.c
citadel/utils/setup.c

index ccbf0d2acb2a4302434b9b54e9c08cdc452e2be4..2546f52e0b9568a4c624b4beffbdb383f9642535 100644 (file)
@@ -77,7 +77,7 @@ SOURCES=utils/citmail.c \
        utillib/citadel_dirs.c \
        citserver.c clientsocket.c config.c control.c $(DATABASE) \
        domain.c serv_extensions.c genstamp.c \
-       housekeeping.c ical_dezonify.c internet_addressing.c ecrash.c \
+       housekeeping.c ical_dezonify.c internet_addressing.c \
        locate_host.c auth.c msgbase.c parsedate.c \
        room_ops.c euidindex.c server_main.c ldap.c \
        support.c sysdep.c user_ops.c journaling.c threads.c \
@@ -134,7 +134,7 @@ SERV_OBJS = server_main.o utillib/citadel_dirs.o \
        msgbase.o euidindex.o \
        locate_host.o housekeeping.o ical_dezonify.o \
        internet_addressing.o journaling.o \
-       parsedate.o genstamp.o ecrash.o threads.o context.o \
+       parsedate.o genstamp.o threads.o context.o \
        clientsocket.o modules_init.o modules_upgrade.o $(SERV_MODULES) \
        svn_revision.o ldap.o netconfig.o md5.o
 
index 3ac69266d64099991dff643937446517b03d6a15..06b31b94429e9ba96c41b49b71120570dcb3d2c8 100644 (file)
@@ -18,9 +18,6 @@
 #include <sys/stat.h>
 #include "sysdep.h"
 #include <time.h>
-#if HAVE_BACKTRACE
-#include <execinfo.h>
-#endif
 #include <libcitadel.h>
 
 #include "ctdl_module.h"
@@ -37,84 +34,6 @@ time_t server_startup_time;
 int panic_fd;
 int openid_level_supported = 0;
 
-/*
- * print the actual stack frame.
- */
-void cit_backtrace(void)
-{
-#ifdef HAVE_BACKTRACE
-       void *stack_frames[50];
-       size_t size, i;
-       char **strings;
-
-       const char *p = IOSTR;
-       if (p == NULL) p = "";
-       size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
-       strings = backtrace_symbols(stack_frames, size);
-       for (i = 0; i < size; i++) {
-               if (strings != NULL) {
-                       syslog(LOG_DEBUG, "citserver: %s %s", p, strings[i]);
-               }
-               else {
-                       syslog(LOG_DEBUG, "citserver: %s %p", p, stack_frames[i]);
-               }
-       }
-       free(strings);
-#endif
-}
-
-void cit_oneline_backtrace(void)
-{
-#ifdef HAVE_BACKTRACE
-       void *stack_frames[50];
-       size_t size, i;
-       char **strings;
-       StrBuf *Buf;
-
-       size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
-       strings = backtrace_symbols(stack_frames, size);
-       if (size > 0)
-       {
-               Buf = NewStrBuf();
-               for (i = 1; i < size; i++) {
-                       if (strings != NULL)
-                               StrBufAppendPrintf(Buf, "%s : ", strings[i]);
-                       else
-                               StrBufAppendPrintf(Buf, "%p : ", stack_frames[i]);
-               }
-               free(strings);
-               syslog(LOG_DEBUG, "citserver: %s %s", IOSTR, ChrPtr(Buf));
-               FreeStrBuf(&Buf);
-       }
-#endif
-}
-
-
-/*
- * print the actual stack frame.
- */
-void cit_panic_backtrace(int SigNum)
-{
-#ifdef HAVE_BACKTRACE
-       void *stack_frames[10];
-       size_t size, i;
-       char **strings;
-
-       printf("caught signal 11\n");
-       size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
-       strings = backtrace_symbols(stack_frames, size);
-       for (i = 0; i < size; i++) {
-               if (strings != NULL) {
-                       syslog(LOG_DEBUG, "%s", strings[i]);
-               }
-               else {
-                       syslog(LOG_DEBUG, "%p", stack_frames[i]);
-               }
-       }
-       free(strings);
-#endif
-       exit(-1);
-}
 
 /*
  * Various things that need to be initialized at startup
index cce5c51a232f6f9f31bf22869f0ce57e765bfb74..5e7dfa31c67a524dabea30fc58fc1896e9023c1a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2018 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 3.
@@ -35,9 +35,6 @@ struct UserProcList {
 
 #define CTDLUSERIP      (IsEmptyStr(CC->cs_addr) ?  CC->cs_clientinfo: CC->cs_addr)
 
-void cit_backtrace(void);
-void cit_oneline_backtrace(void);
-void cit_panic_backtrace(int SigNum);
 void master_startup (void);
 int master_cleanup (int exitcode);
 void set_wtmpsupp (char *newtext);
index 47da2679f5fec868fe972e7f1937e1b9b4954c68..fd8b43ac20a97501ce57cdffc727a9bf87d1722f 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "ctdl_module.h"
 #include "serv_extensions.h"
-#include "ecrash.h"
 #include "citserver.h"
 #include "user_ops.h"
 #include "locate_host.h"
@@ -72,9 +71,9 @@ int CtdlIsSingleUser(void)
        {
                /* check for only one context here */
                if (num_sessions == 1)
-                       return TRUE;
+                       return 1;
        }
-       return FALSE;
+       return 0;
 }
 
 
@@ -293,7 +292,6 @@ void RemoveContext (CitContext *con)
                c = "WTF?";
        }
        syslog(LOG_DEBUG, "context: RemoveContext(%s) session %d", c, con->cs_pid);
-///    cit_backtrace();
 
        /* Run any cleanup routines registered by loadable modules.
         * Note: We have to "become_session()" because the cleanup functions
index 4bd685d66f6d6d752c531f73eb31a815f5f4c132..71eccbf78541163fb87eec138bf7fc6ccdacf78e 100644 (file)
@@ -63,7 +63,6 @@ void cdb_abort(void) {
                geteuid(),
                getegid()
        );
-       cit_backtrace();
        exit(CTDLEXIT_DB);
 }
 
@@ -73,7 +72,6 @@ void cdb_verbose_log(const DB_ENV *dbenv, const char *msg)
 {
        if (!IsEmptyStr(msg)) {
                syslog(LOG_DEBUG, "db: %s", msg);
-               cit_backtrace();
        }
 }
 
@@ -83,7 +81,6 @@ void cdb_verbose_err(const DB_ENV *dbenv, const char *errpfx, const char *msg)
 {
        int *FOO = NULL;
        syslog(LOG_ERR, "db: %s", msg);
-       cit_backtrace();
        *FOO = 1;
 }
 
@@ -130,7 +127,6 @@ static void txbegin(DB_TXN ** tid)
 static void dbpanic(DB_ENV * env, int errval)
 {
        syslog(LOG_ERR, "db: PANIC: %s", db_strerror(errval));
-       cit_backtrace();
 }
 
 static void cclose(DBC * cursor)
diff --git a/citadel/ecrash.c b/citadel/ecrash.c
deleted file mode 100644 (file)
index ec91a02..0000000
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- * author: David Frascone
- * 
- * eCrash Implementation
- *
- * eCrash will allow you to capture stack traces in the
- * event of a crash, and write those traces to disk, stdout,
- * or any other file handle.
- *
- * modified to integrate closer into citadel by Wilfried Goesgens
- *
- * vim: ts=4
- *
- * This program is open source software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include "sysdep.h"
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <fcntl.h>
-#include <syslog.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <pthread.h>
-#include <libcitadel.h>
-#include "server.h"
-#include "sysdep_decls.h"
-#include "support.h"
-#include "config.h"
-#include "citserver.h"
-#include "ecrash.h"
-
-#define NIY()  printf("function not implemented yet!\n");
-#ifdef HAVE_BACKTRACE
-#include <execinfo.h>
-static eCrashParameters gbl_params;
-
-static int    gbl_backtraceEntries;
-static void **gbl_backtraceBuffer;
-static char **gbl_backtraceSymbols;
-static int    gbl_backtraceDoneFlag = 0;
-
-static void *stack_frames[50];
-static size_t size, NThread;
-static char **strings;
-
-/* 
- * Private structures for our thread list
- */
-typedef struct thread_list_node{
-       char *threadName;
-       pthread_t thread;
-       int backtraceSignal;
-       sighandler_t oldHandler;
-       struct thread_list_node *Next;
-} ThreadListNode;
-
-static pthread_mutex_t ThreadListMutex = PTHREAD_MUTEX_INITIALIZER;
-static ThreadListNode *ThreadList = NULL;
-
-/*********************************************************************
- *********************************************************************
- **     P  R  I  V  A  T  E      F  U  N  C  T  I  O  N  S
- *********************************************************************
- ********************************************************************/
-
-
-/*!
- * Insert a node into our threadList
- *
- * @param name   Text string indicating our thread
- * @param thread Our Thread Id
- * @param signo  Signal to create backtrace with
- * @param old_handler Our old handler for signo
- *
- * @returns zero on success
- */
-static int addThreadToList(char *name, pthread_t thread,int signo,
-                                          sighandler_t old_handler)
-{
-       ThreadListNode *node;
-
-       node = malloc(sizeof(ThreadListNode));
-       if (!node) return -1;
-
-       DPRINTF(ECRASH_DEBUG_VERBOSE,
-                                       "Adding thread 0x%08x (%s)\n", (unsigned int)thread, name);
-       node->threadName = strdup(name);
-       node->thread = thread;
-       node->backtraceSignal = signo;
-       node->oldHandler = old_handler;
-
-       /* And, add it to the list */
-       pthread_mutex_lock(&ThreadListMutex);
-       node->Next = ThreadList;
-       ThreadList = node;
-       pthread_mutex_unlock(&ThreadListMutex);
-       
-       return 0;
-
-} // addThreadToList
-
-/*!
- * Remove a node from our threadList
- *
- * @param thread Our Thread Id
- *
- * @returns zero on success
- */
-static int removeThreadFromList(pthread_t thread)
-{
-       ThreadListNode *Probe, *Prev=NULL;
-       ThreadListNode *Removed = NULL;
-
-       DPRINTF(ECRASH_DEBUG_VERBOSE,
-                                       "Removing thread 0x%08x from list . . .\n", (unsigned int)thread);
-       pthread_mutex_lock(&ThreadListMutex);
-       for (Probe=ThreadList;Probe != NULL; Probe = Probe->Next) {
-               if (Probe->thread == thread) {
-                       // We found it!  Unlink it and move on!
-                       Removed = Probe;
-                       if (Prev == NULL) { // head of list
-                               ThreadList = Probe->Next;
-                       } else {
-                               // Prev != null, so we need to link around ourselves.
-                               Prev->Next = Probe->Next;
-                       }
-                       Removed->Next = NULL;
-                       break;
-               }
-
-               Prev = Probe;
-       }
-       pthread_mutex_unlock(&ThreadListMutex);
-
-       // Now, if something is in Removed, free it, and return success
-       if (Removed) {
-           DPRINTF(ECRASH_DEBUG_VERBOSE,
-                                               "   Found %s -- removing\n", Removed->threadName);
-               // Reset the signal handler
-               signal(Removed->backtraceSignal, Removed->oldHandler);
-
-               // And free the allocated memory
-               free (Removed->threadName);
-               free (Removed);
-
-               return 0;
-       } else {
-           DPRINTF(ECRASH_DEBUG_VERBOSE,
-                                               "   Not Found\n");
-               return -1; // Not Found
-       }
-} // removeThreadFromList
-
-/*!
- * Print out a line of output to all our destinations
- *
- * One by one, output a line of text to all of our output destinations.
- *
- * Return failure if we fail to output to any of them.
- *
- * @param format   Normal printf style vararg format
- *
- * @returns nothing// bytes written, or error on failure.
- */
-static void outputPrintf(char *format, ...)
-{
-       va_list ap;
-
-       va_start(ap, format);
-
-       vsyslog(LOG_CRIT|LOG_NDELAY|LOG_MAIL, format, ap);
-} // outputPrintf
-
-
-
-/*!
- * Dump our backtrace into a global location
- *
- * This function will dump out our backtrace into our
- * global holding area.
- *
- */
-static void createGlobalBacktrace( void )
-{
-
-       size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
-       for (NThread = 0; NThread < size; NThread++) 
-       {
-               syslog(LOG_CRIT|LOG_NDELAY|LOG_MAIL, "RAW: %p  ", stack_frames[NThread]);
-       }
-       strings = backtrace_symbols(stack_frames, size);
-       for (NThread = 0; NThread < size; NThread++) {
-               if (strings != NULL) {
-                       syslog(LOG_CRIT|LOG_NDELAY|LOG_MAIL, "RAW: %p  ", strings[NThread]);
-               }
-       }
-} /* createGlobalBacktrace */
-static void outputRawtrace( void )
-{
-
-       size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
-       for (NThread = 0; NThread < size; NThread++) 
-       {
-               syslog(LOG_CRIT|LOG_NDELAY|LOG_MAIL, "RAW: %p  ", stack_frames[NThread]);
-       }
-} /* createGlobalBacktrace */
-
-/*!
- * Print out (to all the fds, etc), or global backtrace
- */
-static void outputGlobalBacktrace ( void )
-{
-       int i;
-
-       for (i=0; i < gbl_backtraceEntries; i++) {
-               if (gbl_backtraceSymbols != FALSE) {
-                       outputPrintf("*      Frame %02x: %s\n",
-                                    i, gbl_backtraceSymbols[i]);
-               } else {
-                       outputPrintf("*      Frame %02x: %p\n", i,
-                                    gbl_backtraceBuffer[i]);
-               }
-       }
-} // outputGlobalBacktrace
-
-/*!
- * Output our current stack's backtrace
- */
-static void outputBacktrace( void )
-{
-       createGlobalBacktrace();
-       outputGlobalBacktrace();
-} /* outputBacktrace */
-
-static void outputBacktraceThreads( void )
-{
-       ThreadListNode *probe;
-       int i;
-
-       // When we're backtracing, don't worry about the mutex . . hopefully
-       // we're in a safe place.
-
-       for (probe=ThreadList; probe; probe=probe->Next) {
-               gbl_backtraceDoneFlag = 0;
-               pthread_kill(probe->thread, probe->backtraceSignal);
-               for (i=0; i < gbl_params.threadWaitTime; i++) {
-                       if (gbl_backtraceDoneFlag)
-                               break;
-                       sleep(1);
-               }
-               if (gbl_backtraceDoneFlag) {
-                       outputPrintf("*  Backtrace of \"%s\" (0x%08x)\n", 
-                                                probe->threadName, (unsigned int)probe->thread);
-                       outputGlobalBacktrace();
-               } else {
-                       outputPrintf("*  Error: unable to get backtrace of \"%s\" (0x%08x)\n", 
-                                                probe->threadName, (unsigned int)probe->thread);
-               }
-               outputPrintf("*\n");
-       }
-} // outputBacktraceThreads
-
-
-/*!
- * Handle signals (crash signals)
- *
- * This function will catch all crash signals, and will output the
- * crash dump.  
- *
- * It will physically write (and sync) the current thread's information
- * before it attempts to send signals to other threads.
- * 
- * @param signum Signal received.
- */
-static void crash_handler(int signo)
-{
-       outputRawtrace();
-       outputPrintf("*********************************************************\n");
-       outputPrintf("*               eCrash Crash Handler\n");
-       outputPrintf("*********************************************************\n");
-       outputPrintf("*\n");
-       outputPrintf("*  Got a crash! signo=%d\n", signo);
-       outputPrintf("*\n");
-       outputPrintf("*  Offending Thread's Backtrace:\n");
-       outputPrintf("*\n");
-       outputBacktrace();
-       outputPrintf("*\n");
-
-       if (gbl_params.dumpAllThreads != FALSE) {
-               outputBacktraceThreads();
-       }
-
-       outputPrintf("*\n");
-       outputPrintf("*********************************************************\n");
-       outputPrintf("*               eCrash Crash Handler\n");
-       outputPrintf("*********************************************************\n");
-
-       exit(signo);
-} // crash_handler
-
-/*!
- * Handle signals (bt signals)
- *
- * This function shoudl be called to generate a crashdump into our
- * global area.  Once the dump has been completed, this function will
- * return after tickling a global.  Since mutexes are not async
- * signal safe, the main thread, after signaling us to generate our
- * own backtrace, will sleep for a few seconds waiting for us to complete.
- *
- * @param signum Signal received.
- */
-static void bt_handler(int signo)
-{
-       createGlobalBacktrace();
-       gbl_backtraceDoneFlag=1;
-} // bt_handler
-
-/*!
- * Validate a passed-in symbol table
- *
- * For now, just print it out (if verbose), and make sure it's
- * sorted and none of the pointers are zero.
- */
-static int ValidateSymbolTable( void )
-{
-       int i;
-       int rc=0;
-       unsigned long lastAddress =0;
-
-       // Get out of here if the table is empty
-       if (!gbl_params.symbolTable) return 0;
-
-       // Dump it in verbose mode
-       DPRINTF(ECRASH_DEBUG_VERBOSE,
-                                       "Symbol Table Provided with %d symbols\n",
-                                       gbl_params.symbolTable->numSymbols);
-       for (i=0; i < gbl_params.symbolTable->numSymbols; i++){
-               // Dump it in verbose mode
-               DPRINTF(ECRASH_DEBUG_VERBOSE, 
-                               "%-30s %p\n",
-                               gbl_params.symbolTable->symbols[i].function,
-                               gbl_params.symbolTable->symbols[i].address);
-               if (lastAddress >
-                   (unsigned long)gbl_params.symbolTable->symbols[i].address) {
-                       DPRINTF(ECRASH_DEBUG_ERROR,
-                                       "Error: symbol table is not sorted (last=%p, current=%p)\n",
-                                       (void *)lastAddress,
-                                       gbl_params.symbolTable->symbols[i].address);
-                       rc = -1;
-               }
-
-       } // for
-
-       return rc;
-       
-} // ValidateSymbolTable
-
-/*********************************************************************
- *********************************************************************
- **      P  U  B  L  I  C      F  U  N  C  T  I  O  N  S
- *********************************************************************
- ********************************************************************/
-
-/*!
- * Initialize eCrash.
- * 
- * This function must be called before calling any other eCrash
- * functions.  It sets up the global behavior of the system, and
- * registers the calling thread for crash dumps.
- *
- * @param params Our input parameters.  The passed in structure will be copied.
- *
- * @return Zero on success.
- */
-int eCrash_Init(eCrashParameters *params)
-{
-       int sigIndex;
-       int ret = 0;
-#ifdef DO_SIGNALS_RIGHT
-       sigset_t blocked;
-       struct sigaction act;
-#endif
-
-       DPRINTF(ECRASH_DEBUG_VERY_VERBOSE,"Init Starting params = %p\n", params);
-
-       if (params == NULL) return -1;
-       // Allocate our backtrace area
-       gbl_backtraceBuffer = malloc(sizeof(void *) * (params->maxStackDepth+5));
-
-#ifdef DO_SIGNALS_RIGHT
-       sigemptyset(&blocked);
-       act.sa_sigaction = crash_handler;
-       act.sa_mask = blocked;
-       act.sa_flags = SA_SIGINFO;
-#endif
-
-       if (params != NULL) {
-               // Make ourselves a global copy of params.
-               gbl_params = *params;
-               gbl_params.filename = strdup(params->filename);
-
-               // Set our defaults, if they weren't specified
-               if (gbl_params.maxStackDepth == 0 )
-                       gbl_params.maxStackDepth = ECRASH_DEFAULT_STACK_DEPTH;
-
-               if (gbl_params.defaultBacktraceSignal == 0 )
-                       gbl_params.defaultBacktraceSignal = ECRASH_DEFAULT_BACKTRACE_SIGNAL;
-
-               if (gbl_params.threadWaitTime == 0 )
-                       gbl_params.threadWaitTime = ECRASH_DEFAULT_THREAD_WAIT_TIME;
-
-               if (gbl_params.debugLevel == 0 )
-                       gbl_params.debugLevel = ECRASH_DEBUG_DEFAULT;
-
-               // Copy our symbol table
-               if (gbl_params.symbolTable) {
-                   DPRINTF(ECRASH_DEBUG_VERBOSE,
-                                                       "symbolTable @ %p -- %d symbols\n", gbl_params.symbolTable,
-                                               gbl_params.symbolTable->numSymbols);
-                       // Make a copy of our symbol table
-                       gbl_params.symbolTable = malloc(sizeof(eCrashSymbolTable));
-                       memcpy(gbl_params.symbolTable, params->symbolTable,
-                                  sizeof(eCrashSymbolTable));
-
-                       // Now allocate / copy the actual table.
-                       gbl_params.symbolTable->symbols = malloc(sizeof(eCrashSymbol) *
-                                                                    gbl_params.symbolTable->numSymbols);
-                       memcpy(gbl_params.symbolTable->symbols,
-                                  params->symbolTable->symbols,
-                                  sizeof(eCrashSymbol) * gbl_params.symbolTable->numSymbols);
-
-                       ValidateSymbolTable();
-               }
-       
-               // And, finally, register for our signals
-               for (sigIndex=0; gbl_params.signals[sigIndex] != 0; sigIndex++) {
-                       DPRINTF(ECRASH_DEBUG_VERY_VERBOSE,
-                                                       "   Catching signal[%d] %d\n", sigIndex,
-                                       gbl_params.signals[sigIndex]);
-
-                       // I know there's a better way to catch signals with pthreads.
-                       // I'll do it later TODO
-                       signal(gbl_params.signals[sigIndex], crash_handler);
-               }
-       } else {
-               DPRINTF(ECRASH_DEBUG_ERROR, "   Error:  Null Params!\n");
-               ret = -1;
-       }
-       DPRINTF(ECRASH_DEBUG_VERY_VERBOSE, "Init Complete ret=%d\n", ret);
-       return ret;
-} /* eCrash_Init */
-
-/*!
- * UnInitialize eCrash.
- * 
- * This function may be called to de-activate eCrash, release the
- * signal handlers, and free any memory allocated by eCrash.
- *
- * @return Zero on success.
- */
-int eCrash_Uninit( void )
-{
-       NIY();
-
-       return 0;
-} /* eCrash_Uninit */
-
-/*!
- * Register a thread for backtracing on crash.
- * 
- * This function must be called by any thread wanting it's stack
- * dumped in the event of a crash.  The thread my specify what 
- * signal should be used, or the default, SIGUSR1 will be used.
- *
- * @param signo Signal to use to generate dump (default: SIGUSR1)
- *
- * @return Zero on success.
- */
-int eCrash_RegisterThread(char *name, int signo)
-{
-       sighandler_t old_handler;
-
-       // Register for our signal
-       if (signo == 0) {
-               signo = gbl_params.defaultBacktraceSignal;
-       }
-
-       old_handler = signal(signo, bt_handler);
-       return addThreadToList(name, pthread_self(), signo, old_handler);
-
-} /* eCrash_RegisterThread */
-
-/*!
- * Un-register a thread for stack dumps.
- * 
- * This function may be called to un-register any previously 
- * registered thread.
- *
- * @return Zero on success.
- */
-int eCrash_UnregisterThread( void )
-{
-       return removeThreadFromList(pthread_self());
-} /* eCrash_UnregisterThread */
-
-#endif
diff --git a/citadel/ecrash.h b/citadel/ecrash.h
deleted file mode 100644 (file)
index e9fae96..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * eCrash.h
- * David Frascone
- * 
- * eCrash types and prototypes.
- *
- * vim: ts=4
- */
-
-#ifndef _ECRASH_H_
-#define _ECRASH_H_
-
-#include <stdio.h>
-#include <signal.h>
-
-typedef void (*sighandler_t)(int);
-
-typedef long BOOL;
-
-#define MAX_LINE_LEN 256
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#define BOOL int
-#endif
-
-#define ECRASH_DEFAULT_STACK_DEPTH 10
-#define ECRASH_DEFAULT_BACKTRACE_SIGNAL SIGUSR2
-#define ECRASH_DEFAULT_THREAD_WAIT_TIME 10
-#define ECRASH_MAX_NUM_SIGNALS 30
-
-/** \struct eCrashSymbol
- *  \brief Function Name / Address pair
- *
- *  This is used in conjunction with eCrashSymbolTable to
- *  provide an alternative to backtrace_symbols.
- */
-typedef struct {
-       char          *function;
-       void          *address;
-} eCrashSymbol;
-/** \struct eCrashSymbolTable
- *  \brief Symbol table used to avoid backtrace_symbols()
- *
- *  This structure is used to provide a alternative to 
- *  backtrace_symbols which is not async signal safe.
- *
- *  The symbol table should be sorted by address (it will 
- *  be either binary or linearly searched)
- */
-typedef struct {
-       int           numSymbols;
-       eCrashSymbol *symbols;
-} eCrashSymbolTable;
-
-
-
-#define ECRASH_DEBUG_ENABLE  /* undef to turn off debug */
-
-#ifdef ECRASH_DEBUG_ENABLE
-# define ECRASH_DEBUG_VERY_VERBOSE 1
-# define ECRASH_DEBUG_VERBOSE      2
-# define ECRASH_DEBUG_INFO         3
-# define ECRASH_DEBUG_WARN         4
-# define ECRASH_DEBUG_ERROR        5
-# define ECRASH_DEBUG_OFF          6
-# define ECRASH_DEBUG_DEFAULT    (ECRASH_DEBUG_ERROR)
-# define DPRINTF(level, fmt...) \
-               if (level >= gbl_params.debugLevel) { printf(fmt); fflush(stdout); }
-#else /* ECRASH_DEBUG_ENABLE */
-# define DPRINTF(level, fmt...) 
-#endif /* ECRASH_DEBUG_ENABLE */
-
-
-/** \struct eCrashParameters
- *  \brief eCrash Initialization Parameters
- *  
- *  This structure contains all the global initialization functions
- *  for eCrash.
- * 
- *  @see eCrash_Init
- */
-typedef struct {
-
-
-       /*  OUTPUT OPTIONS */
-               /** Filename to output to, or NULL */
-       char *filename;                 
-               /** FILE * to output to or NULL */
-       FILE *filep;
-               /** fd to output to or -1 */
-       int     fd;
-
-       int debugLevel;
-
-               /** If true, all registered threads will
-                *   be dumped
-         */
-       BOOL dumpAllThreads;
-
-               /** How far to backtrace each stack */
-       unsigned int maxStackDepth;
-
-               /** Default signal to use to tell a thread to drop it's
-                *  stack.
-                */
-       int defaultBacktraceSignal;
-
-               /** How long to wait for a threads
-                *  dump
-                */     
-       unsigned int threadWaitTime;
-
-               /** If this is non-zero, the dangerous function, backtrace_symbols
-                 * will be used.  That function does a malloc(), so is not async
-                 * signal safe, and could cause deadlocks.
-                 */
-       BOOL useBacktraceSymbols; 
-
-               /** To avoid the issues with backtrace_symbols (see comments above)
-                 * the caller can supply it's own symbol table, containing function
-                 * names and start addresses.  This table can be created using 
-                 * a script, or a static table.
-                 *
-                 * If this variable is not null, it will be used, instead of 
-                 * backtrace_symbols, reguardless of the setting
-                 * of useBacktraceSymbols.
-                 */
-       eCrashSymbolTable *symbolTable;
-
-               /** Array of crash signals to catch,
-                *  ending in 0  I would have left it a [] array, but I
-                *  do a static copy, so I needed a set size.
-         */
-       int signals[ECRASH_MAX_NUM_SIGNALS];
-
-} eCrashParameters;
-
-/*!
- * Initialize eCrash.
- * 
- * This function must be called before calling any other eCrash
- * functions.  It sets up the global behavior of the system.
- *
- * @param params Our input parameters.  The passed in structure will be copied.
- *
- * @return Zero on success.
- */
-int eCrash_Init(eCrashParameters *params);
-/*!
- * UnInitialize eCrash.
- * 
- * This function may be called to de-activate eCrash, release the
- * signal handlers, and free any memory allocated by eCrash.
- *
- * @return Zero on success.
- */
-int eCrash_Uninit( void );
-
-/*!
- * Register a thread for backtracing on crash.
- * 
- * This function must be called by any thread wanting it's stack
- * dumped in the event of a crash.  The thread my specify what 
- * signal should be used, or the default, SIGUSR1 will be used.
- *
- * @param name String used to refer to us in crash dumps
- * @param signo Signal to use to generate dump (default: SIGUSR1)
- *
- * @return Zero on success.
- */
-int eCrash_RegisterThread(char *name, int signo);
-
-/*!
- * Un-register a thread for stack dumps.
- * 
- * This function may be called to un-register any previously 
- * registered thread.
- *
- * @return Zero on success.
- */
-int eCrash_UnregisterThread( void );
-
-#endif /* _E_CRASH_H_ */
index e22881fa50e19a1f24eaa7660a666a43ae5383b0..c8cd7017328d3eb017cd52111f8b70441c8d1233 100644 (file)
@@ -116,7 +116,9 @@ void registerSmtpCMD(const char *First, long FLen,
        smtp_handler_hook *h;
 
        if (FLen >= MaxSMTPCmdLen)
-               cit_panic_backtrace (0);
+       {
+               abort();
+       }
 
        h = (smtp_handler_hook*) malloc(sizeof(smtp_handler_hook));
        memset(h, 0, sizeof(smtp_handler_hook));
@@ -1022,7 +1024,7 @@ void smtp_command_loop(void)
 
        if (sSMTP == NULL) {
                syslog(LOG_EMERG, "Session SMTP data is null.  WTF?  We will crash now.");
-               return cit_panic_backtrace (0);
+               abort();
        }
 
        time(&CCC->lastcmd);
index ec136d06c412810f06ce5f52edb5205a463ba141..6db04f8a1b326ecc919d57e4f7bf40ca4e312ec0 100644 (file)
@@ -2093,7 +2093,6 @@ int CtdlOutputPreLoadedMsg(
 
        if (!CM_IsValidMsg(TheMessage)) {
                syslog(LOG_ERR, "msgbase: error; invalid preloaded message for output");
-               cit_backtrace ();
                return(om_no_such_msg);
        }
 
index 536612ad7bea3f0e8f7559c5202e588737225291..f24a69edcc55dc91bea02a9aadad455ce88cd972 100644 (file)
@@ -28,7 +28,6 @@
 #include "serv_extensions.h"
 #include "citadel_dirs.h"
 #include "user_ops.h"
-#include "ecrash.h"
 
 uid_t ctdluid = 0;
 const char *CitadelServiceUDS="citadel-UDS";
@@ -87,10 +86,6 @@ int main(int argc, char **argv)
        struct passwd *p = NULL;
 #ifdef HAVE_RUN_DIR
        struct stat filestats;
-#endif
-#ifdef HAVE_BACKTRACE
-       eCrashParameters params;
-//     eCrashSymbolTable symbol_table;
 #endif
 
        /* initialize the master context */
index d17e2bf1521db56730f309a97dafd96f37834aa0..ec320eeef2a873043a0734394424febf74a14214 100644 (file)
@@ -376,7 +376,6 @@ int client_write(const char *buf, int nbytes)
                fd = fopen(fn, "a+");
                if (fd == NULL) {
                        syslog(LOG_ERR, "%s: %m", fn);
-                       cit_backtrace();
                        exit(1);
                }
                fprintf(fd, "Sending: BufSize: %d BufContent: [", nbytes);
@@ -419,7 +418,6 @@ int client_write(const char *buf, int nbytes)
                                        }
                                } else {
                                        syslog(LOG_ERR, "sysdep: client_write(%d bytes) select failed: %m", nbytes - bytes_written);
-                                       cit_backtrace();
                                        client_close();
                                        Ctx->kill_me = KILLME_SELECT_FAILED;
                                        return -1;
@@ -430,7 +428,6 @@ int client_write(const char *buf, int nbytes)
                retval = write(Ctx->client_socket, &buf[bytes_written], nbytes - bytes_written);
                if (retval < 1) {
                        syslog(LOG_ERR, "sysdep: client_write(%d bytes) failed: %m", nbytes - bytes_written);
-                       cit_backtrace();
                        client_close();
                        Ctx->kill_me = KILLME_WRITE_FAILED;
                        return -1;
@@ -492,7 +489,6 @@ int client_read_blob(StrBuf *Target, int bytes, int timeout)
                fd = fopen(fn, "a+");
                if (fd == NULL) {
                        syslog(LOG_ERR, "%s: %m", fn);
-                       cit_backtrace();
                        exit(1);
                }
                fprintf(fd, "Reading BLOB: BufSize: %d ", bytes);
@@ -512,7 +508,6 @@ int client_read_blob(StrBuf *Target, int bytes, int timeout)
                fd = fopen(fn, "a+");
                if (fd == NULL) {
                        syslog(LOG_ERR, "%s: %m", fn);
-                       cit_backtrace();
                        exit(1);
                }
                fprintf(fd, "Read: %d BufContent: [", StrLength(Target));
@@ -534,7 +529,6 @@ int client_read_blob(StrBuf *Target, int bytes, int timeout)
                fd = fopen(fn, "a+");
                if (fd == NULL) {
                        syslog(LOG_ERR, "%s: %m", fn);
-                       cit_backtrace();
                        exit(1);
                }
                fprintf(fd, "Reading BLOB: BufSize: %d ",
@@ -563,7 +557,6 @@ int client_read_blob(StrBuf *Target, int bytes, int timeout)
                fd = fopen(fn, "a+");
                if (fd == NULL) {
                        syslog(LOG_ERR, "%s: %m", fn);
-                       cit_backtrace();
                        exit(1);
                }
                fprintf(fd, "Read: %d BufContent: [",
@@ -622,7 +615,6 @@ int client_read_random_blob(StrBuf *Target, int timeout)
                                fd = fopen(fn, "a+");
                                if (fd == NULL) {
                                        syslog(LOG_ERR, "%s: %m", fn);
-                                       cit_backtrace();
                                        exit(1);
                                }
                                fprintf(fd, "Read: BufSize: %d BufContent: [",
@@ -707,7 +699,6 @@ int CtdlClientGetLine(StrBuf *Target)
                fd = fopen(fn, "a+");
                if (fd == NULL) {
                        syslog(LOG_ERR, "%s: %m", fn);
-                       cit_backtrace();
                        exit(1);
                }
                pch = ChrPtr(CCC->RecvBuf.Buf);
@@ -765,7 +756,6 @@ int CtdlClientGetLine(StrBuf *Target)
                fd = fopen(fn, "a+");
                if (fd == NULL) {
                        syslog(LOG_ERR, "%s: %m", fn);
-                       cit_backtrace();
                        exit(1);
                }
                pch = ChrPtr(CCC->RecvBuf.Buf);
@@ -941,9 +931,6 @@ void sysdep_master_cleanup(void) {
        CtdlDestroyServiceHook();
        CtdlDestroyRoomHooks();
        CtdlDestroySearchHooks();
-       #ifdef HAVE_BACKTRACE
-///    eCrash_Uninit();
-       #endif
 }
 
 
index 44cf771e6337cf4efc05cb98335b8b0d9c590221..697554f13ffa61e1fcaa025965ffdd8b0d64dd3e 100644 (file)
@@ -66,7 +66,6 @@ static INLINE long cutuserkey(char *username) {
        if (len >= USERNAME_SIZE)
        {
                syslog(LOG_INFO, "Username too long: %s", username);
-               cit_backtrace ();
                len = USERNAME_SIZE - 1; 
                username[len]='\0';
        }
@@ -84,7 +83,6 @@ static INLINE void makeuserkey(char *key, const char *username, long len) {
        if (len >= USERNAME_SIZE)
        {
                syslog(LOG_INFO, "Username too long: %s", username);
-               cit_backtrace ();
                len = USERNAME_SIZE - 1; 
        }
        for (i=0; i<=len; ++i) {
index 8fdfa3336c86d68ca84da16d0bcb8175194a891e..2a9a2d817bcc3e0893da4231bfb81de64fe16e33 100644 (file)
@@ -5,7 +5,7 @@
  * The scope of this program isn't wide enough to make a difference.  If you don't like
  * it you can rewrite it.
  *
- * Copyright (c) 2009-2016 citadel.org
+ * Copyright (c) 2009-2018 citadel.org
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 3.
@@ -41,9 +41,6 @@
 #include "sysdep.h"
 #include "config.h"
 #include "citadel_dirs.h"
-#if HAVE_BACKTRACE
-#include <execinfo.h>
-#endif
 
 
 
index 2508712a2ae0108121ec9c81ee8592109785379d..27174c69b7598d5127279b42fc782ee43f9e6e6d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Citadel setup utility
  *
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2018 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License version 3.
@@ -36,9 +36,6 @@
 #include "axdefs.h"
 #include "sysdep.h"
 #include "citadel_dirs.h"
-#if HAVE_BACKTRACE
-#include <execinfo.h>
-#endif
 
 #ifdef ENABLE_NLS
 #ifdef HAVE_XLOCALE_H