Patch from Brooks Davis for some BSD compatibility issues.
This commit was SVN r7751.
Этот коммит содержится в:
родитель
f5d16419b2
Коммит
9a25554559
31
configure.ac
31
configure.ac
@ -1043,7 +1043,7 @@ AC_CACHE_SAVE
|
||||
ompi_show_title "Header file tests"
|
||||
|
||||
AC_CHECK_HEADERS([alloca.h aio.h arpa/inet.h dirent.h \
|
||||
dlfcn.h execinfo.h err.h fcntl.h inttypes.h libgen.h \
|
||||
dlfcn.h execinfo.h err.h fcntl.h inttypes.h libgen.h libutil.h \
|
||||
net/if.h netdb.h netinet/in.h netinet/tcp.h \
|
||||
poll.h pthread.h pty.h pwd.h sched.h stdint.h \
|
||||
string.h strings.h stropts.h sys/fcntl.h sys/ipc.h \
|
||||
@ -1201,6 +1201,35 @@ AC_MSG_RESULT([$MSG])
|
||||
# so will check in -lrt if we decided we needed it above
|
||||
AC_CHECK_FUNCS([sched_yield])
|
||||
|
||||
#
|
||||
# FreeBSD has backtrace in -lexecinfo. Can't use a simple AC_CHECK_LIB,
|
||||
# though, because Linux has backtrace in glic (so linking in libexecinfo
|
||||
# will "find" backtrace, even though it would have been found anyway
|
||||
# -- so -lexecinfo would be useless [and potentially harmful?] in this
|
||||
# case).
|
||||
#
|
||||
|
||||
AC_MSG_CHECKING([if we need -lexecinfo for backtrace])
|
||||
AC_LINK_IFELSE(AC_LANG_PROGRAM([[extern char *backtrace;]],
|
||||
[[char *bar = backtrace;]]),
|
||||
[MSG=no],[MSG=not_found])
|
||||
if test "$MSG" = "not_found"; then
|
||||
LIBS_save="$LIBS"
|
||||
LIBS="$LIBS -lexecinfo"
|
||||
AC_LINK_IFELSE(AC_LANG_PROGRAM([[extern char *backtrace;]],
|
||||
[[char *bar = backtrace;]]),
|
||||
[MSG=yes],[MSG=not_found])
|
||||
if test "$MSG" = "not_found"; then
|
||||
LIBS="$LIBS_save"
|
||||
fi
|
||||
fi
|
||||
AC_MSG_RESULT([$MSG])
|
||||
|
||||
# see if we actually have backtrace. Use AC_CHECK_FUNCS so that it
|
||||
# does the glibs "not implemented" check. Will use the current LIBS,
|
||||
# so will check in -lexecinfo if we decided we needed it above
|
||||
AC_CHECK_FUNCS([backtrace])
|
||||
|
||||
#
|
||||
# See if we need the math library explicitly linked in
|
||||
#
|
||||
|
@ -46,6 +46,8 @@
|
||||
* to a user-specified signal (e.g. SIGFPE or SIGSEGV).
|
||||
* For Linux/Glibc, it then uses backtrace and backtrace_symbols
|
||||
* to figure the current stack and then prints that out to stdout.
|
||||
* Where available, the BSD libexecinfo is used to provide Linux/Glibc
|
||||
* compatable backtrace and backtrace_symbols functions.
|
||||
* Yes, printf and malloc are not signal-safe per se, but should be
|
||||
* on Linux?
|
||||
*
|
||||
@ -58,7 +60,7 @@
|
||||
#if OMPI_WANT_PRETTY_PRINT_STACKTRACE && ! defined(WIN32)
|
||||
static void opal_show_stackframe (int signo, siginfo_t * info, void * p)
|
||||
{
|
||||
#ifdef __GLIBC__
|
||||
#if HAVE_BACKTRACE
|
||||
int i;
|
||||
int trace_size;
|
||||
void * trace[32];
|
||||
@ -87,15 +89,21 @@ static void opal_show_stackframe (int signo, siginfo_t * info, void * p)
|
||||
case SIGILL:
|
||||
switch (info->si_code)
|
||||
{
|
||||
#ifdef ILL_ILLOPC
|
||||
case ILL_ILLOPC: str = "ILL_ILLOPC"; break;
|
||||
#endif
|
||||
#ifdef ILL_ILLOPN
|
||||
case ILL_ILLOPN: str = "ILL_ILLOPN"; break;
|
||||
#endif
|
||||
#ifdef ILL_ILLADR
|
||||
case ILL_ILLADR: str = "ILL_ILLADR"; break;
|
||||
#endif
|
||||
#ifdef ILL_ILLTRP
|
||||
case ILL_ILLTRP: str = "ILL_ILLTRP"; break;
|
||||
#endif
|
||||
#ifdef ILL_PRVOPC
|
||||
case ILL_PRVOPC: str = "ILL_PRVOPC"; break;
|
||||
#endif
|
||||
#ifdef ILL_PRVREG
|
||||
case ILL_PRVREG: str = "ILL_PRVREG"; break;
|
||||
#endif
|
||||
@ -129,14 +137,20 @@ static void opal_show_stackframe (int signo, siginfo_t * info, void * p)
|
||||
case SIGSEGV:
|
||||
switch (info->si_code)
|
||||
{
|
||||
#ifdef SEGV_MAPERR
|
||||
case SEGV_MAPERR: str = "SEGV_MAPERR"; break;
|
||||
#endif
|
||||
#ifdef SEGV_ACCERR
|
||||
case SEGV_ACCERR: str = "SEGV_ACCERR"; break;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case SIGBUS:
|
||||
switch (info->si_code)
|
||||
{
|
||||
#ifdef BUS_ADRALN
|
||||
case BUS_ADRALN: str = "BUS_ADRALN"; break;
|
||||
#endif
|
||||
#ifdef BUSADRERR
|
||||
case BUS_ADRERR: str = "BUS_ADRERR"; break;
|
||||
#endif
|
||||
@ -159,12 +173,24 @@ static void opal_show_stackframe (int signo, siginfo_t * info, void * p)
|
||||
case SIGCHLD:
|
||||
switch (info->si_code)
|
||||
{
|
||||
#ifdef CLD_EXITED
|
||||
case CLD_EXITED: str = "CLD_EXITED"; break;
|
||||
#endif
|
||||
#ifdef CLD_KILLED
|
||||
case CLD_KILLED: str = "CLD_KILLED"; break;
|
||||
#endif
|
||||
#ifdef CLD_DUMPED
|
||||
case CLD_DUMPED: str = "CLD_DUMPED"; break;
|
||||
#endif
|
||||
#ifdef CLD_WTRAPPED
|
||||
case CLD_TRAPPED: str = "CLD_TRAPPED"; break;
|
||||
#endif
|
||||
#ifdef CLD_STOPPED
|
||||
case CLD_STOPPED: str = "CLD_STOPPED"; break;
|
||||
#endif
|
||||
#ifdef CLD_CONTINUED
|
||||
case CLD_CONTINUED: str = "CLD_CONTINUED"; break;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
#ifdef SIGPOLL
|
||||
@ -196,6 +222,9 @@ static void opal_show_stackframe (int signo, siginfo_t * info, void * p)
|
||||
case SI_USER: str = "SI_USER"; break;
|
||||
#ifdef SI_KERNEL
|
||||
case SI_KERNEL: str = "SI_KERNEL"; break;
|
||||
#endif
|
||||
#ifdef SI_UNDEFINED
|
||||
case SI_UNDEFINED: str = "SI_UNDEFINED"; break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -245,7 +274,7 @@ static void opal_show_stackframe (int signo, siginfo_t * info, void * p)
|
||||
write(1, print_buffer, size);
|
||||
fflush(stderr);
|
||||
|
||||
#ifdef __GLIBC__
|
||||
#ifdef HAVE_BACKTRACE
|
||||
trace_size = backtrace (trace, 32);
|
||||
messages = backtrace_symbols (trace, trace_size);
|
||||
|
||||
|
@ -47,6 +47,9 @@
|
||||
# include <termio.h>
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_LIBUTIL_H
|
||||
#include <libutil.h>
|
||||
#endif
|
||||
|
||||
#include "mca/iof/base/iof_base_setup.h"
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user