diff --git a/darshan-runtime/configure.ac b/darshan-runtime/configure.ac index 6e36dfe29..0098b9e54 100644 --- a/darshan-runtime/configure.ac +++ b/darshan-runtime/configure.ac @@ -754,6 +754,18 @@ if test "x$enable_darshan_runtime" = xyes ; then # look for glibc-specific functions AC_CHECK_FUNCS([pwritev preadv pwritev2 preadv2]) + # allow users to opt out of wrapping of _exit as a shutdown hook in + # Darshan's non-MPI mode, in case this functionality is problematic + AC_ARG_ENABLE([exit-wrapper], + [AS_HELP_STRING([--disable-exit-wrapper], + [Disables wrapping of _exit() calls as last ditch shutdown + hook for the Darshan library when used in non-MPI mode.])], + [], [enable_exit_wrapper=yes]) + if test "x$enable_exit_wrapper" = "xyes" ; then + AC_DEFINE([__DARSHAN_ENABLE_EXIT_WRAPPER], 1, + [Define if the Darshan runtime library should wrap _exit() calls]) + fi + DARSHAN_VERSION="AC_PACKAGE_VERSION" AC_SUBST(LDFLAGS) AC_SUBST(__DARSHAN_LOG_PATH) diff --git a/darshan-runtime/doc/darshan-runtime.txt b/darshan-runtime/doc/darshan-runtime.txt index 8f143e6fd..76c2a6ee8 100644 --- a/darshan-runtime/doc/darshan-runtime.txt +++ b/darshan-runtime/doc/darshan-runtime.txt @@ -120,6 +120,8 @@ make install * `--disable-ld-preload`: disables building of the Darshan LD_PRELOAD library * `--enable-group-readable-logs`: sets Darshan log file permissions to allow group read access. +* `--disable-exit-wrapper`: disables wrapping of `_exit()` calls as last ditch + shutdown hook for the Darshan library when used in non-MPI mode. * `CC=`: specifies the C compiler to use for compilation. .Configure arguments for controlling which Darshan modules to use: diff --git a/darshan-runtime/lib/darshan-core-init-finalize.c b/darshan-runtime/lib/darshan-core-init-finalize.c index 05be01b4f..c26eb50eb 100644 --- a/darshan-runtime/lib/darshan-core-init-finalize.c +++ b/darshan-runtime/lib/darshan-core-init-finalize.c @@ -115,7 +115,7 @@ __attribute__((destructor)) void serial_finalize(void) } #endif -#ifdef DARSHAN_PRELOAD +#if defined(DARSHAN_PRELOAD) && defined(__DARSHAN_ENABLE_EXIT_WRAPPER) void (*__real__exit)(int status) __attribute__ ((noreturn)) = NULL; void _exit(int status) {