MDEV-28884: include kernel information in crashing signal handler
Recent adventures in liburing and btrfs have shown up some kernel version dependent bugs. Having a bug report of accurace kernel version can start to correlate these errors sooner. On Linux, /proc/version contains the kernel version. FreeBSD has kern.version (per man 8 sysctl), so include that too. Example output: Max nice priority 0 0 Max realtime priority 0 0 Max realtime timeout unlimited unlimited us Core pattern: |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h Kernel version: Linux version 5.19.0-0.rc2.21.fc37.x86_64 (mockbuild@bkernel01.iad2.fedoraproject.org) (gcc (GCC) 12.1.1 20220507 (Red Hat 12.1.1-1), GNU ld version 2.38-14.fc37) #1 SMP PREEMPT_DYNAMIC Mon Jun 13 15:27:24 UTC 2022 Segmentation fault (core dumped)
This commit is contained in:
parent
f299351e1c
commit
d4539426bc
@ -81,6 +81,12 @@ static inline void output_core_info()
|
||||
my_safe_printf_stderr("Core pattern: %.*s\n", (int) len, buff);
|
||||
my_close(fd, MYF(0));
|
||||
}
|
||||
if ((fd= my_open("/proc/version", O_RDONLY, MYF(0))) >= 0)
|
||||
{
|
||||
len= my_read(fd, (uchar*)buff, sizeof(buff), MYF(0));
|
||||
my_safe_printf_stderr("Kernel version: %.*s\n", (int) len, buff);
|
||||
my_close(fd, MYF(0));
|
||||
}
|
||||
#endif
|
||||
#elif defined(__APPLE__) || defined(__FreeBSD__)
|
||||
char buff[PATH_MAX];
|
||||
@ -89,6 +95,10 @@ static inline void output_core_info()
|
||||
{
|
||||
my_safe_printf_stderr("Core pattern: %.*s\n", (int) len, buff);
|
||||
}
|
||||
if (sysctlbyname("kern.version", buff, &len, NULL, 0) == 0)
|
||||
{
|
||||
my_safe_printf_stderr("Kernel version: %.*s\n", (int) len, buff);
|
||||
}
|
||||
#else
|
||||
char buff[80];
|
||||
my_getwd(buff, sizeof(buff), 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user