From: Ben Pfaff Date: Tue, 22 Dec 2009 00:38:58 +0000 (-0800) Subject: Remove "fault" module. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=250382a8fc839cb077b2636983a1c1de0d6b0e17;p=openvswitch Remove "fault" module. 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. --- diff --git a/configure.ac b/configure.ac index a94ff93c..92d5ac03 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/lib/automake.mk b/lib/automake.mk index 0a6beae9..31cab8ab 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -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 index 14e229ed..00000000 --- a/lib/fault.c +++ /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 -#include "fault.h" -#include -#include -#include -#include -#include -#include -#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 index 0d12927d..00000000 --- a/lib/fault.h +++ /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 */ diff --git a/lib/vlog-modules.def b/lib/vlog-modules.def index c9f66768..d1c16a6e 100644 --- a/lib/vlog-modules.def +++ b/lib/vlog-modules.def @@ -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) diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index ceb10732..f9b7e578 100644 --- a/m4/openvswitch.m4 +++ b/m4/openvswitch.m4 @@ -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]) diff --git a/ovsdb/automake.mk b/ovsdb/automake.mk index 4156caba..1596a4b5 100644 --- a/ovsdb/automake.mk +++ b/ovsdb/automake.mk @@ -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 diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 02700df4..17f16b92 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -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); diff --git a/tests/automake.mk b/tests/automake.mk index 0c81f3fc..f964d348 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -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 diff --git a/tests/test-dhcp-client.c b/tests/test-dhcp-client.c index c15f6939..44730959 100644 --- a/tests/test-dhcp-client.c +++ b/tests/test-dhcp-client.c @@ -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); diff --git a/utilities/automake.mk b/utilities/automake.mk index aec78b53..1ae50bf5 100644 --- a/utilities/automake.mk +++ b/utilities/automake.mk @@ -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 diff --git a/utilities/ovs-controller.c b/utilities/ovs-controller.c index 0e453f48..56a53073 100644 --- a/utilities/ovs-controller.c +++ b/utilities/ovs-controller.c @@ -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); diff --git a/utilities/ovs-openflowd.c b/utilities/ovs-openflowd.c index 8307891a..5f4b24bd 100644 --- a/utilities/ovs-openflowd.c +++ b/utilities/ovs-openflowd.c @@ -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); diff --git a/vswitchd/automake.mk b/vswitchd/automake.mk index 29e4034d..694c308a 100644 --- a/vswitchd/automake.mk +++ b/vswitchd/automake.mk @@ -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 \ diff --git a/vswitchd/ovs-brcompatd.c b/vswitchd/ovs-brcompatd.c index 62faaaa5..594d474b 100644 --- a/vswitchd/ovs-brcompatd.c +++ b/vswitchd/ovs-brcompatd.c @@ -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); diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c index 6b7ad4e4..604ee1b5 100644 --- a/vswitchd/ovs-vswitchd.c +++ b/vswitchd/ovs-vswitchd.c @@ -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);