Commit 99945d77 authored by David CARLIER's avatar David CARLIER Committed by Robert Bindar

MDEV-25294 signal handler display coredump on mac

parent b771ab24
...@@ -30,6 +30,11 @@ ...@@ -30,6 +30,11 @@
#define SIGNAL_FMT "signal %d" #define SIGNAL_FMT "signal %d"
#endif #endif
#ifdef __APPLE__
#include <sys/sysctl.h>
#endif
#ifndef PATH_MAX #ifndef PATH_MAX
#define PATH_MAX 4096 #define PATH_MAX 4096
#endif #endif
...@@ -51,7 +56,7 @@ extern const char *optimizer_switch_names[]; ...@@ -51,7 +56,7 @@ extern const char *optimizer_switch_names[];
static inline void output_core_info() static inline void output_core_info()
{ {
/* proc is optional on some BSDs so it can't hurt to look */ /* 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]; char buff[PATH_MAX];
ssize_t len; ssize_t len;
int fd; int fd;
...@@ -77,6 +82,13 @@ static inline void output_core_info() ...@@ -77,6 +82,13 @@ static inline void output_core_info()
my_close(fd, MYF(0)); my_close(fd, MYF(0));
} }
#endif #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 #else
char buff[80]; char buff[80];
my_getwd(buff, sizeof(buff), 0); my_getwd(buff, sizeof(buff), 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment