mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
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:
@@ -9,12 +9,14 @@
|
|||||||
* it under the terms of the MIT license. See LICENSE for details.
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <execinfo.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#ifdef __GLIBC__
|
||||||
|
#include <execinfo.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "lib/util_base.h"
|
#include "lib/util_base.h"
|
||||||
#include "lib/util_panic.h"
|
#include "lib/util_panic.h"
|
||||||
@@ -24,6 +26,7 @@
|
|||||||
*
|
*
|
||||||
* To get symbols, link the code with "-rdynamic".
|
* To get symbols, link the code with "-rdynamic".
|
||||||
*/
|
*/
|
||||||
|
#ifdef __GLIBC__
|
||||||
static void print_backtrace(void)
|
static void print_backtrace(void)
|
||||||
{
|
{
|
||||||
void *array[256];
|
void *array[256];
|
||||||
@@ -42,6 +45,9 @@ static void print_backtrace(void)
|
|||||||
|
|
||||||
free(strings);
|
free(strings);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static void print_backtrace(void) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for core ulimit
|
* Check for core ulimit
|
||||||
|
|||||||
@@ -10,7 +10,9 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#ifdef __GLIBC__
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
|
#endif
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -1191,6 +1193,7 @@ void line_free(int argc, char **argv)
|
|||||||
#define BACKTRACE_MAX 32
|
#define BACKTRACE_MAX 32
|
||||||
|
|
||||||
/* Used for debugging. */
|
/* Used for debugging. */
|
||||||
|
#ifdef __GLIBC__
|
||||||
void print_trace(void)
|
void print_trace(void)
|
||||||
{
|
{
|
||||||
void *bt[BACKTRACE_MAX];
|
void *bt[BACKTRACE_MAX];
|
||||||
@@ -1204,6 +1207,9 @@ void print_trace(void)
|
|||||||
fprintf(stderr, "DEBUG: %s\n", bt_sym[i]);
|
fprintf(stderr, "DEBUG: %s\n", bt_sym[i]);
|
||||||
free(bt_sym);
|
free(bt_sym);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
void print_trace(void) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Return a textual representation of @config. */
|
/* Return a textual representation of @config. */
|
||||||
const char *config_to_str(config_t config)
|
const char *config_to_str(config_t config)
|
||||||
|
|||||||
Reference in New Issue
Block a user