added missing #include to dtnquery and added a segfault handler to the bundle daemon (still need to test this)
authoraidan
Wed, 22 Jun 2011 13:58:21 +0100
changeset 13 841ab1482c9c
parent 12 7463e4bb80e4
child 14 06512deddac4
added missing #include to dtnquery and added a segfault handler to the bundle daemon (still need to test this)
apps/dtnquery/dtnquery.c
servlib/bundling/BundleDaemon.cc
servlib/bundling/BundleDaemon.h
--- a/apps/dtnquery/dtnquery.c	Wed Jun 22 13:07:38 2011 +0100
+++ b/apps/dtnquery/dtnquery.c	Wed Jun 22 13:58:21 2011 +0100
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <sys/time.h>
+#include <sys/stat.h>
 #include <fcntl.h>
 #include "dtn_api.h"
 #include "sdnv-c.h"
--- a/servlib/bundling/BundleDaemon.cc	Wed Jun 22 13:07:38 2011 +0100
+++ b/servlib/bundling/BundleDaemon.cc	Wed Jun 22 13:58:21 2011 +0100
@@ -2858,6 +2858,22 @@
 
 //----------------------------------------------------------------------
 void
+handle_sigsegv(int sig)
+{
+    void *array[10];
+    size_t size;
+
+    // get void*'s for all entries on the stack
+    size = backtrace(array, 10);
+
+    // print out all the frames to stderr
+    fprintf(stderr, "Error: signal %d:\n", sig);
+    backtrace_symbols_fd(array, size, 2);
+    exit(1);
+}
+
+//----------------------------------------------------------------------
+void
 BundleDaemon::run()
 {
     static const char* LOOP_LOG = "/dtn/bundle/daemon/loop";
--- a/servlib/bundling/BundleDaemon.h	Wed Jun 22 13:07:38 2011 +0100
+++ b/servlib/bundling/BundleDaemon.h	Wed Jun 22 13:58:21 2011 +0100
@@ -35,6 +35,9 @@
 #include "BundleStatusReport.h"
 #include "BPQBlock.h"
 
+#include <execinfo.h>
+#include <signal.h>
+
 namespace dtn {
 
 class AdminRegistration;
@@ -306,6 +309,11 @@
     void run();
 
     /**
+     *
+     */
+    void handle_sigsegv(int sig);
+
+    /**
      * Main event handling function.
      */
     void handle_event(BundleEvent* event);