Remove "fault" module.
authorBen Pfaff <blp@nicira.com>
Tue, 22 Dec 2009 00:38:58 +0000 (16:38 -0800)
committerBen Pfaff <blp@nicira.com>
Thu, 7 Jan 2010 01:01:56 +0000 (17:01 -0800)
This module, which catches segmentation faults and prints a backtrace
before exiting, was useful for a while, but I believe that it has now
outlived its purpose.  It is altogether better to have a core dump from
which one can extract much more information than a usually-poor backtrace,
and core dumps are much better integrated into a typical Unix system.
In addition, the "fault" module was of course not all that portable.

16 files changed:
configure.ac
lib/automake.mk
lib/fault.c [deleted file]
lib/fault.h [deleted file]
lib/vlog-modules.def
m4/openvswitch.m4
ovsdb/automake.mk
ovsdb/ovsdb-server.c
tests/automake.mk
tests/test-dhcp-client.c
utilities/automake.mk
utilities/ovs-controller.c
utilities/ovs-openflowd.c
vswitchd/automake.mk
vswitchd/ovs-brcompatd.c
vswitchd/ovs-vswitchd.c

index a94ff93..92d5ac0 100644 (file)
@@ -58,7 +58,6 @@ OVS_CHECK_MALLOC_HOOKS
 OVS_CHECK_VALGRIND
 OVS_CHECK_TTY_LOCK_DIR
 OVS_CHECK_SOCKET_LIBS
-OVS_CHECK_FAULT_LIBS
 
 AC_CHECK_FUNCS([strsignal])
 
index 0a6beae..31cab8a 100644 (file)
@@ -43,8 +43,6 @@ lib_libopenvswitch_a_SOURCES = \
        lib/dynamic-string.h \
        lib/fatal-signal.c \
        lib/fatal-signal.h \
-       lib/fault.c \
-       lib/fault.h \
        lib/flow.c \
        lib/flow.h \
        lib/hash.c \
diff --git a/lib/fault.c b/lib/fault.c
deleted file mode 100644 (file)
index 14e229e..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2008, 2009 Nicira Networks.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <config.h>
-#include "fault.h"
-#include <dlfcn.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include "util.h"
-
-#include "vlog.h"
-#define THIS_MODULE VLM_fault
-
-static void
-fault_handler(int sig_nr)
-{
-    VLOG_EMER("Caught signal %d.", sig_nr);
-    log_backtrace();
-    fflush(stdout);
-    fflush(stderr);
-
-    signal(sig_nr, SIG_DFL);
-    raise(sig_nr);
-}
-
-void
-log_backtrace(void)
-{
-    /* During the loop:
-
-       frame[0] points to the next frame.
-       frame[1] points to the return address. */
-    void **frame;
-    for (frame = __builtin_frame_address(0);
-         frame != NULL && frame[0] != NULL;
-         frame = frame[0]) {
-        Dl_info addrinfo;
-        if (!dladdr(frame[1], &addrinfo) || !addrinfo.dli_sname) {
-            fprintf(stderr, "  0x%08"PRIxPTR"\n", (uintptr_t) frame[1]);
-        } else {
-            fprintf(stderr, "  0x%08"PRIxPTR" (%s+0x%tx)\n",
-                    (uintptr_t) frame[1], addrinfo.dli_sname,
-                    (char *) frame[1] - (char *) addrinfo.dli_saddr); 
-        }
-    }
-    fflush(stderr);
-}
-
-void
-register_fault_handlers(void)
-{
-    signal(SIGABRT, fault_handler);
-    signal(SIGBUS, fault_handler);
-    signal(SIGFPE, fault_handler);
-    signal(SIGILL, fault_handler);
-    signal(SIGSEGV, fault_handler);
-}
diff --git a/lib/fault.h b/lib/fault.h
deleted file mode 100644 (file)
index 0d12927..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2008 Nicira Networks.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef FAULT_H
-#define FAULT_H 1
-
-void register_fault_handlers(void);
-void log_backtrace(void);
-
-#endif /* fault.h */
index c9f6676..d1c16a6 100644 (file)
@@ -35,7 +35,6 @@ VLOG_MODULE(dpctl)
 VLOG_MODULE(ezio_term)
 VLOG_MODULE(fail_open)
 VLOG_MODULE(fatal_signal)
-VLOG_MODULE(fault)
 VLOG_MODULE(flow)
 VLOG_MODULE(in_band)
 VLOG_MODULE(jsonrpc)
index ceb1073..f9b7e57 100644 (file)
@@ -98,11 +98,6 @@ AC_DEFUN([OVS_CHECK_OPENSSL],
       AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if OpenSSL is installed.])
    fi])
 
-dnl Checks for libraries needed by lib/fault.c.
-AC_DEFUN([OVS_CHECK_FAULT_LIBS],
-  [AC_CHECK_LIB([dl], [dladdr], [FAULT_LIBS=-ldl])
-   AC_SUBST([FAULT_LIBS])])
-
 dnl Checks for libraries needed by lib/socket-util.c.
 AC_DEFUN([OVS_CHECK_SOCKET_LIBS],
   [AC_CHECK_LIB([socket], [connect])
index 4156cab..1596a4b 100644 (file)
@@ -52,11 +52,7 @@ EXTRA_DIST += ovsdb/ovsdb-client.1.in
 # ovsdb-server
 sbin_PROGRAMS += ovsdb/ovsdb-server
 ovsdb_ovsdb_server_SOURCES = ovsdb/ovsdb-server.c
-ovsdb_ovsdb_server_LDADD = \
-       ovsdb/libovsdb.a \
-       lib/libopenvswitch.a \
-       $(FAULT_LIBS) \
-       $(SSL_LIBS)
+ovsdb_ovsdb_server_LDADD = ovsdb/libovsdb.a lib/libopenvswitch.a $(SSL_LIBS)
 # ovsdb-server.1
 man_MANS += ovsdb/ovsdb-server.1
 DISTCLEANFILES += ovsdb/ovsdb-server.1
index 02700df..17f16b9 100644 (file)
@@ -25,7 +25,6 @@
 #include "column.h"
 #include "command-line.h"
 #include "daemon.h"
-#include "fault.h"
 #include "file.h"
 #include "json.h"
 #include "jsonrpc.h"
@@ -73,7 +72,6 @@ main(int argc, char *argv[])
     int retval;
 
     set_program_name(argv[0]);
-    register_fault_handlers();
     time_init();
     vlog_init();
     signal(SIGPIPE, SIG_IGN);
index 0c81f3f..f964d34 100644 (file)
@@ -135,7 +135,7 @@ tests_test_type_props_SOURCES = tests/test-type-props.c
 
 noinst_PROGRAMS += tests/test-dhcp-client
 tests_test_dhcp_client_SOURCES = tests/test-dhcp-client.c
-tests_test_dhcp_client_LDADD = lib/libopenvswitch.a $(FAULT_LIBS)
+tests_test_dhcp_client_LDADD = lib/libopenvswitch.a
 
 noinst_PROGRAMS += tests/test-stp
 tests_test_stp_SOURCES = tests/test-stp.c
index c15f693..4473095 100644 (file)
@@ -23,7 +23,6 @@
 #include "command-line.h"
 #include "dhcp.h"
 #include "fatal-signal.h"
-#include "fault.h"
 #include "poll-loop.h"
 #include "util.h"
 #include "vlog.h"
@@ -51,7 +50,6 @@ main(int argc, char *argv[])
     int error;
 
     set_program_name(argv[0]);
-    register_fault_handlers();
     vlog_init();
     parse_options(argc, argv);
 
index aec78b5..1ae50bf 100644 (file)
@@ -55,29 +55,28 @@ utilities_ovs_appctl_SOURCES = utilities/ovs-appctl.c
 utilities_ovs_appctl_LDADD = lib/libopenvswitch.a
 
 utilities_ovs_controller_SOURCES = utilities/ovs-controller.c
-utilities_ovs_controller_LDADD = lib/libopenvswitch.a $(FAULT_LIBS) $(SSL_LIBS)
+utilities_ovs_controller_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
 
 utilities_ovs_discover_SOURCES = utilities/ovs-discover.c
 utilities_ovs_discover_LDADD = lib/libopenvswitch.a
 
 utilities_ovs_dpctl_SOURCES = utilities/ovs-dpctl.c
-utilities_ovs_dpctl_LDADD = lib/libopenvswitch.a $(FAULT_LIBS)
+utilities_ovs_dpctl_LDADD = lib/libopenvswitch.a
 
 utilities_ovs_kill_SOURCES = utilities/ovs-kill.c
 utilities_ovs_kill_LDADD = lib/libopenvswitch.a
 
 utilities_ovs_ofctl_SOURCES = utilities/ovs-ofctl.c
-utilities_ovs_ofctl_LDADD = lib/libopenvswitch.a $(FAULT_LIBS) $(SSL_LIBS)
+utilities_ovs_ofctl_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
 
 utilities_ovs_openflowd_SOURCES = utilities/ovs-openflowd.c
 utilities_ovs_openflowd_LDADD = \
        ofproto/libofproto.a \
        lib/libopenvswitch.a \
-       $(FAULT_LIBS) \
        $(SSL_LIBS)
 
 utilities_ovs_vsctl_SOURCES = utilities/ovs-vsctl.c vswitchd/vswitch-idl.c
-utilities_ovs_vsctl_LDADD = lib/libopenvswitch.a $(FAULT_LIBS)
+utilities_ovs_vsctl_LDADD = lib/libopenvswitch.a
 
 utilities_ovs_wdt_SOURCES = utilities/ovs-wdt.c
 
index 0e453f4..56a5307 100644 (file)
@@ -26,7 +26,6 @@
 #include "command-line.h"
 #include "compiler.h"
 #include "daemon.h"
-#include "fault.h"
 #include "learning-switch.h"
 #include "ofpbuf.h"
 #include "openflow/openflow.h"
@@ -84,7 +83,6 @@ main(int argc, char *argv[])
     int i;
 
     set_program_name(argv[0]);
-    register_fault_handlers();
     time_init();
     vlog_init();
     parse_options(argc, argv);
index 8307891..5f4b24b 100644 (file)
@@ -29,7 +29,6 @@
 #include "daemon.h"
 #include "dirs.h"
 #include "dpif.h"
-#include "fault.h"
 #include "leak-checker.h"
 #include "list.h"
 #include "netdev.h"
@@ -114,7 +113,6 @@ main(int argc, char *argv[])
     struct netflow_options nf_options;
 
     set_program_name(argv[0]);
-    register_fault_handlers();
     time_init();
     vlog_init();
     parse_options(argc, argv, &s);
index 29e4034..694c308 100644 (file)
@@ -19,7 +19,6 @@ vswitchd_ovs_vswitchd_SOURCES = \
 vswitchd_ovs_vswitchd_LDADD = \
        ofproto/libofproto.a \
        lib/libopenvswitch.a \
-       $(FAULT_LIBS) \
        $(SSL_LIBS)
 
 vswitchd_ovs_brcompatd_SOURCES = \
@@ -27,9 +26,7 @@ vswitchd_ovs_brcompatd_SOURCES = \
        vswitchd/vswitch-idl.c \
        vswitchd/vswitch-idl.h
 
-vswitchd_ovs_brcompatd_LDADD = \
-       lib/libopenvswitch.a \
-       $(FAULT_LIBS) 
+vswitchd_ovs_brcompatd_LDADD = lib/libopenvswitch.a
 
 EXTRA_DIST += \
        vswitchd/ovs-vswitchd.8.in \
index 62faaaa..594d474 100644 (file)
@@ -39,7 +39,6 @@
 #include "dirs.h"
 #include "dynamic-string.h"
 #include "fatal-signal.h"
-#include "fault.h"
 #include "leak-checker.h"
 #include "netdev.h"
 #include "netlink.h"
@@ -1147,7 +1146,6 @@ main(int argc, char *argv[])
     int retval;
 
     set_program_name(argv[0]);
-    register_fault_handlers();
     time_init();
     vlog_init();
     vlog_set_levels(VLM_ANY_MODULE, VLF_CONSOLE, VLL_WARN);
index 6b7ad4e..604ee1b 100644 (file)
@@ -28,7 +28,6 @@
 #include "compiler.h"
 #include "daemon.h"
 #include "dpif.h"
-#include "fault.h"
 #include "leak-checker.h"
 #include "netdev.h"
 #include "ovsdb-idl.h"
@@ -64,7 +63,6 @@ main(int argc, char *argv[])
     int retval;
 
     set_program_name(argv[0]);
-    register_fault_handlers();
     time_init();
     vlog_init();
     remote = parse_options(argc, argv);