[Darshan-commits] [Git][darshan/darshan][dev-stdio] fputs wrapper

Philip Carns xgitlab at cels.anl.gov
Mon May 23 21:54:44 CDT 2016


Philip Carns pushed to branch dev-stdio at darshan / darshan


Commits:
3b4bef1d by Phil Carns at 2016-05-23T22:54:37-04:00
fputs 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
@@ -50,7 +50,7 @@
  * int      fprintf(FILE *, const char *, ...);             DONE
  * int      vfprintf(FILE *, const char *, va_list);        DONE
  * int      fputc(int, FILE *);                             DONE
- * int      fputs(const char *, FILE *);
+ * int      fputs(const char *, FILE *);                    DONE
  * size_t   fwrite(const void *, size_t, size_t, FILE *);   DONE
  * int      putc(int, FILE *);
  * int      putw(int, FILE *);
@@ -103,6 +103,7 @@ 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));
 DARSHAN_FORWARD_DECL(fputc, int, (int c, FILE *stream));
+DARSHAN_FORWARD_DECL(fputs, int, (const char *s, FILE *stream));
 DARSHAN_FORWARD_DECL(fprintf, int, (FILE *stream, const char *format, ...));
 DARSHAN_FORWARD_DECL(vfprintf, int, (FILE *stream, const char *format, va_list));
 DARSHAN_FORWARD_DECL(fread, size_t, (void *ptr, size_t size, size_t nmemb, FILE *stream));
@@ -441,6 +442,27 @@ int DARSHAN_DECL(fputc)(int c, FILE *stream)
     return(ret);
 }
 
+
+int DARSHAN_DECL(fputs)(const char *s, FILE *stream)
+{
+    int ret;
+    double tm1, tm2;
+
+    MAP_OR_FAIL(fputs);
+
+    tm1 = darshan_core_wtime();
+    ret = __real_fputs(s, stream);
+    tm2 = darshan_core_wtime();
+
+    STDIO_LOCK();
+    stdio_runtime_initialize();
+    if(ret != EOF && ret > 0)
+        STDIO_RECORD_WRITE(stream, strlen(s), tm1, tm2, 0);
+    STDIO_UNLOCK();
+
+    return(ret);
+}
+
 int DARSHAN_DECL(vfprintf)(FILE *stream, const char *format, va_list ap)
 {
     int ret;


=====================================
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
@@ -17,3 +17,4 @@
 --wrap=fprintf
 --wrap=vfprintf
 --wrap=fputc
+--wrap=fputs



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/commit/3b4bef1d3eb23d74a7e20c9dbcb1fad9e1632d5a
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20160523/d657dc69/attachment.html>


More information about the Darshan-commits mailing list