Skip to content

Commit

Permalink
add configure option to disable _exit() wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
shanedsnyder committed Mar 18, 2024
1 parent 3448e85 commit c35da51
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions darshan-runtime/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions darshan-runtime/doc/darshan-runtime.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion darshan-runtime/lib/darshan-core-init-finalize.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit c35da51

Please sign in to comment.