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

Philip Carns xgitlab at cels.anl.gov
Mon May 23 20:26:57 CDT 2016


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


Commits:
d4fc0944 by Phil Carns at 2016-05-23T21:26:48-04:00
getw 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
@@ -43,7 +43,7 @@
  * int      fscanf(FILE *, const char *, ...);              DONE
  * int      vfscanf(FILE *, const char *, va_list);         DONE
  * int      getc(FILE *);                                   DONE
- * int      getw(FILE *);
+ * int      getw(FILE *);                                   DONE
  *
  * functions for writing data
  * --------------
@@ -104,6 +104,7 @@ 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(fread, size_t, (void *ptr, size_t size, size_t nmemb, FILE *stream));
 DARSHAN_FORWARD_DECL(fgetc, int, (FILE *stream));
+DARSHAN_FORWARD_DECL(getw, int, (FILE *stream));
 DARSHAN_FORWARD_DECL(_IO_getc, int, (FILE *stream));
 DARSHAN_FORWARD_DECL(fscanf, int, (FILE *stream, const char *format, ...));
 DARSHAN_FORWARD_DECL(vfscanf, int, (FILE *stream, const char *format, va_list ap));
@@ -477,6 +478,27 @@ size_t DARSHAN_DECL(_IO_getc)(FILE *stream)
     return(ret);
 }
 
+size_t DARSHAN_DECL(getw)(FILE *stream)
+{
+    int ret;
+    double tm1, tm2;
+
+    MAP_OR_FAIL(getw);
+
+    tm1 = darshan_core_wtime();
+    ret = __real_getw(stream);
+    tm2 = darshan_core_wtime();
+
+    STDIO_LOCK();
+    stdio_runtime_initialize();
+    if(ret != EOF || ferror(stream) == 0)
+        STDIO_RECORD_READ(stream, sizeof(int), tm1, tm2);
+    STDIO_UNLOCK();
+
+    return(ret);
+}
+
+
 int DARSHAN_DECL(fscanf)(FILE *stream, const char *format, ...)
 {
     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
@@ -11,5 +11,6 @@
 --wrap=fscanf
 --wrap=vfscanf
 --wrap=_IO_getc
+--wrap=getw
 --wrap=fgets
 --wrap=fseek



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


More information about the Darshan-commits mailing list