From 90de4de4177cd8327c6c91acd640004ced776675 Mon Sep 17 00:00:00 2001 From: Phil Carns Date: Fri, 3 Feb 2017 20:56:46 +0000 Subject: [PATCH] disable mmap wrapper for dynamic linking see #223 --- ChangeLog | 5 ++++- darshan-runtime/Makefile.in | 2 +- darshan-runtime/lib/darshan-posix.c | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e58c74..9f4a8ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,7 +16,10 @@ Darshan-3.1.3-pre1 applications (contributed by Cristian Simarro) * skip instrumentation attempts for anonymous mmap() calls; this avoids a potentential deadlock condition when used with hugepages on Cray systems. - Reported by Glenn Lockwood and Cristian Simarro. + Reported by Glenn Lockwood for static linking case. +* disable instrumentation for mmap when dynamically linking; this avoids a + potential deadlock condition on Cray systems using dynamically linked + executabes. Reported by Cristian Simarro for dynamic linking case. * fix segmentation fault in statistics collection for applications that issue operations with a large number of distince access sizes or strides on the same file. Reported by Glenn Lockwood. diff --git a/darshan-runtime/Makefile.in b/darshan-runtime/Makefile.in index 1ab87a0..43fe4ae 100644 --- a/darshan-runtime/Makefile.in +++ b/darshan-runtime/Makefile.in @@ -87,7 +87,7 @@ lib/darshan-null.po: lib/darshan-null.c darshan.h darshan-dynamic.h darshan-comm $(CC) $(CFLAGS_SHARED) -c $< -o $@ lib/darshan-posix.o: lib/darshan-posix.c darshan.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-posix-log-format.h | lib - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) -DDARSHAN_WRAP_MMAP -c $< -o $@ lib/darshan-posix.po: lib/darshan-posix.c darshan.h darshan-dynamic.h darshan-common.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-posix-log-format.h | lib $(CC) $(CFLAGS_SHARED) -c $< -o $@ diff --git a/darshan-runtime/lib/darshan-posix.c b/darshan-runtime/lib/darshan-posix.c index 625637f..0f47bd8 100644 --- a/darshan-runtime/lib/darshan-posix.c +++ b/darshan-runtime/lib/darshan-posix.c @@ -62,8 +62,10 @@ DARSHAN_FORWARD_DECL(__lxstat, int, (int vers, const char* path, struct stat *bu DARSHAN_FORWARD_DECL(__lxstat64, int, (int vers, const char* path, struct stat64 *buf)); DARSHAN_FORWARD_DECL(__fxstat, int, (int vers, int fd, struct stat *buf)); DARSHAN_FORWARD_DECL(__fxstat64, int, (int vers, int fd, struct stat64 *buf)); +#ifdef DARSHAN_WRAP_MMAP DARSHAN_FORWARD_DECL(mmap, void*, (void *addr, size_t length, int prot, int flags, int fd, off_t offset)); DARSHAN_FORWARD_DECL(mmap64, void*, (void *addr, size_t length, int prot, int flags, int fd, off64_t offset)); +#endif /* DARSHAN_WRAP_MMAP */ DARSHAN_FORWARD_DECL(fsync, int, (int fd)); DARSHAN_FORWARD_DECL(fdatasync, int, (int fd)); DARSHAN_FORWARD_DECL(close, int, (int fd)); @@ -917,6 +919,7 @@ int DARSHAN_DECL(__fxstat64)(int vers, int fd, struct stat64 *buf) return(ret); } +#ifdef DARSHAN_WRAP_MMAP void* DARSHAN_DECL(mmap)(void *addr, size_t length, int prot, int flags, int fd, off_t offset) { @@ -947,7 +950,9 @@ void* DARSHAN_DECL(mmap)(void *addr, size_t length, int prot, int flags, return(ret); } +#endif /* DARSHAN_WRAP_MMAP */ +#ifdef DARSHAN_WRAP_MMAP void* DARSHAN_DECL(mmap64)(void *addr, size_t length, int prot, int flags, int fd, off64_t offset) { @@ -978,6 +983,7 @@ void* DARSHAN_DECL(mmap64)(void *addr, size_t length, int prot, int flags, return(ret); } +#endif /* DARSHAN_WRAP_MMAP */ int DARSHAN_DECL(fsync)(int fd) { -- 2.26.2