[Darshan-commits] [Git][darshan/darshan][dev-stdio] freopen64 wrapper
Philip Carns
xgitlab at cels.anl.gov
Mon May 23 22:19:04 CDT 2016
Philip Carns pushed to branch dev-stdio at darshan / darshan
Commits:
0461e398 by Phil Carns at 2016-05-23T23:18:54-04:00
freopen64 wrapper
- - - - -
2 changed files:
- darshan-runtime/lib/darshan-stdio.c
- darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
Changes:
=====================================
darshan-runtime/lib/darshan-stdio.c
=====================================
--- a/darshan-runtime/lib/darshan-stdio.c
+++ b/darshan-runtime/lib/darshan-stdio.c
@@ -27,7 +27,7 @@
* FILE *fopen(const char *, const char *); DONE
* FILE *fopen64(const char *, const char *); DONE
* FILE *freopen(const char *, const char *, FILE *); DONE
- * FILE *freopen64(const char *, const char *, FILE *);
+ * FILE *freopen64(const char *, const char *, FILE *); DONE
*
* functions for closing streams
* --------------
@@ -103,6 +103,7 @@ DARSHAN_FORWARD_DECL(fopen, FILE*, (const char *path, const char *mode));
DARSHAN_FORWARD_DECL(fopen64, FILE*, (const char *path, const char *mode));
DARSHAN_FORWARD_DECL(fdopen, FILE*, (int fd, const char *mode));
DARSHAN_FORWARD_DECL(freopen, FILE*, (const char *path, const char *mode, FILE *stream));
+DARSHAN_FORWARD_DECL(freopen64, FILE*, (const char *path, const char *mode, FILE *stream));
DARSHAN_FORWARD_DECL(fclose, int, (FILE *fp));
DARSHAN_FORWARD_DECL(fflush, int, (FILE *fp));
DARSHAN_FORWARD_DECL(fwrite, size_t, (const void *ptr, size_t size, size_t nmemb, FILE *stream));
@@ -357,6 +358,26 @@ FILE* DARSHAN_DECL(freopen)(const char *path, const char *mode, FILE *stream)
return(ret);
}
+FILE* DARSHAN_DECL(freopen64)(const char *path, const char *mode, FILE *stream)
+{
+ FILE* ret;
+ double tm1, tm2;
+
+ MAP_OR_FAIL(freopen64);
+
+ tm1 = darshan_core_wtime();
+ ret = __real_freopen64(path, mode, stream);
+ tm2 = darshan_core_wtime();
+
+ STDIO_LOCK();
+ stdio_runtime_initialize();
+ STDIO_RECORD_OPEN(ret, path, tm1, tm2);
+ STDIO_UNLOCK();
+
+ return(ret);
+}
+
+
int DARSHAN_DECL(fflush)(FILE *fp)
{
double tm1, tm2;
=====================================
darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
=====================================
--- a/darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
+++ b/darshan-runtime/share/ld-opts/darshan-stdio-ld-opts
@@ -3,6 +3,7 @@
--wrap=fopen64
--wrap=fdopen
--wrap=freopen
+--wrap=freopen64
--wrap=fflush
--wrap=fclose
--wrap=fwrite
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/commit/0461e398916195e67c137eea76f2aa7385beea34
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20160523/2bdd08c6/attachment.html>
More information about the Darshan-commits
mailing list