summaryrefslogtreecommitdiff
path: root/sql/signal_handler.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-03-31 08:01:03 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-03-31 08:01:03 +0300
commitd6d3d9ae2ffb1df8eebfe0c922394bbc7b12e4ed (patch)
tree341f053652cf1e93acf89180a0b072f7d43ef1e1 /sql/signal_handler.cc
parent96475b78c55141164ecf2719e000d189e4bcbc3d (diff)
parent99945d77d748470fbb3939be5f7d0e36d24d8097 (diff)
downloadmariadb-git-d6d3d9ae2ffb1df8eebfe0c922394bbc7b12e4ed.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql/signal_handler.cc')
-rw-r--r--sql/signal_handler.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc
index 5439f13b3f4..79fb77e38d2 100644
--- a/sql/signal_handler.cc
+++ b/sql/signal_handler.cc
@@ -30,6 +30,11 @@
#define SIGNAL_FMT "signal %d"
#endif
+
+#ifdef __APPLE__
+#include <sys/sysctl.h>
+#endif
+
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
@@ -51,7 +56,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__)
char buff[PATH_MAX];
ssize_t len;
int fd;
@@ -77,6 +82,13 @@ static inline void output_core_info()
my_close(fd, MYF(0));
}
#endif
+#elif defined(__APPLE__)
+ 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);