Use execinfo.h only on glibc

libunwind could also work on musl but that would require more drastic
code changes

Github-ID: https://github.com/ibm-s390-linux/s390-tools/pull/193
Signed-off-by: Sertonix <sertonix@posteo.net>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Sertonix
2025-10-28 17:55:50 +01:00
committed by Jan Höppner
parent 327d132aac
commit 99d7ec51a7
2 changed files with 13 additions and 1 deletions
+7 -1
View File
@@ -9,12 +9,14 @@
* it under the terms of the MIT license. See LICENSE for details.
*/
#include <execinfo.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <sys/time.h>
#ifdef __GLIBC__
#include <execinfo.h>
#endif
#include "lib/util_base.h"
#include "lib/util_panic.h"
@@ -24,6 +26,7 @@
*
* To get symbols, link the code with "-rdynamic".
*/
#ifdef __GLIBC__
static void print_backtrace(void)
{
void *array[256];
@@ -42,6 +45,9 @@ static void print_backtrace(void)
free(strings);
}
#else
static void print_backtrace(void) {}
#endif
/*
* Check for core ulimit