diff options
Diffstat (limited to 'sql/signal_handler.cc')
-rw-r--r-- | sql/signal_handler.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 5439f13b3f4..f27676bee19 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -15,6 +15,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ #include "mariadb.h" +#include "my_dbug.h" #include <signal.h> //#include "sys_vars.h" @@ -30,6 +31,11 @@ #define SIGNAL_FMT "signal %d" #endif + +#if defined(__APPLE__) || defined(__FreeBSD__) +#include <sys/sysctl.h> +#endif + #ifndef PATH_MAX #define PATH_MAX 4096 #endif @@ -51,7 +57,7 @@ extern const char *optimizer_switch_names[]; static inline void output_core_info() { /* proc is optional on some BSDs so it can't hurt to look */ -#ifdef HAVE_READLINK +#if defined(HAVE_READLINK) && !defined(__APPLE__) && !defined(__FreeBSD__) char buff[PATH_MAX]; ssize_t len; int fd; @@ -77,6 +83,13 @@ static inline void output_core_info() my_close(fd, MYF(0)); } #endif +#elif defined(__APPLE__) || defined(__FreeBSD__) + char buff[PATH_MAX]; + size_t len = sizeof(buff); + if (sysctlbyname("kern.corefile", buff, &len, NULL, 0) == 0) + { + my_safe_printf_stderr("Core pattern: %.*s\n", (int) len, buff); + } #else char buff[80]; my_getwd(buff, sizeof(buff), 0); @@ -118,8 +131,8 @@ extern "C" sig_handler handle_fatal_signal(int sig) my_safe_printf_stderr("Fatal " SIGNAL_FMT " while backtracing\n", sig); goto end; } - segfaulted = 1; + DBUG_PRINT("error", ("handling fatal signal")); curr_time= my_time(0); localtime_r(&curr_time, &tm); |