Commit ebbe6421 authored by Philip Carns's avatar Philip Carns

initial skeleton for stdio wrapper lib

- move fopen/fopen64 wrappers to stdio module
- make infrastructure for tracking stream pointers based on similar fd
  infrastructure in posix
- define placeholder record structs
- wrappers don't actually do anything yet
parent 8efca566
......@@ -33,8 +33,8 @@ CFLAGS_SHARED = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I$(srcdir)
LIBS = -lz @LIBBZ2@
DARSHAN_STATIC_MOD_OBJS = lib/darshan-posix.o lib/darshan-mpiio.o lib/darshan-hdf5.o lib/darshan-pnetcdf.o
DARSHAN_DYNAMIC_MOD_OBJS = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-hdf5.po lib/darshan-pnetcdf.po
DARSHAN_STATIC_MOD_OBJS = lib/darshan-posix.o lib/darshan-mpiio.o lib/darshan-hdf5.o lib/darshan-pnetcdf.o lib/darshan-stdio.o
DARSHAN_DYNAMIC_MOD_OBJS = lib/darshan-posix.po lib/darshan-mpiio.po lib/darshan-hdf5.po lib/darshan-pnetcdf.po lib/darshan-stdio.po
ifdef DARSHAN_USE_BGQ
DARSHAN_STATIC_MOD_OBJS += lib/darshan-bgq.o
......@@ -76,6 +76,12 @@ lib/darshan-posix.o: lib/darshan-posix.c darshan.h $(DARSHAN_LOG_FORMAT) $(srcdi
lib/darshan-posix.po: lib/darshan-posix.c darshan.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-posix-log-format.h | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/darshan-stdio.o: lib/darshan-stdio.c darshan.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-stdio-log-format.h | lib
$(CC) $(CFLAGS) -c $< -o $@
lib/darshan-stdio.po: lib/darshan-stdio.c darshan.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-stdio-log-format.h | lib
$(CC) $(CFLAGS_SHARED) -c $< -o $@
lib/darshan-mpiio.o: lib/darshan-mpiio.c darshan.h $(DARSHAN_LOG_FORMAT) $(srcdir)/../darshan-mpiio-log-format.h | lib
$(CC) $(CFLAGS) -c $< -o $@
......@@ -157,6 +163,7 @@ endif
install -m 644 $(srcdir)/share/ld-opts/darshan-posix-ld-opts $(datarootdir)/ld-opts/darshan-posix-ld-opts
install -m 644 $(srcdir)/share/ld-opts/darshan-hdf5-ld-opts $(datarootdir)/ld-opts/darshan-hdf5-ld-opts
install -m 644 $(srcdir)/share/ld-opts/darshan-pnetcdf-ld-opts $(datarootdir)/ld-opts/darshan-pnetcdf-ld-opts
install -m 644 $(srcdir)/share/ld-opts/darshan-stdio-ld-opts $(datarootdir)/ld-opts/darshan-stdio-ld-opts
install -d $(libdir)/pkgconfig
install -m 644 lib/pkgconfig/darshan-runtime.pc $(libdir)/pkgconfig/darshan-runtime.pc
......
......@@ -43,8 +43,6 @@ DARSHAN_FORWARD_DECL(open, int, (const char *path, int flags, ...));
DARSHAN_FORWARD_DECL(open64, int, (const char *path, int flags, ...));
DARSHAN_FORWARD_DECL(creat, int, (const char* path, mode_t mode));
DARSHAN_FORWARD_DECL(creat64, int, (const char* path, mode_t mode));
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(mkstemp, int, (char *template));
DARSHAN_FORWARD_DECL(mkostemp, int, (char *template, int flags));
DARSHAN_FORWARD_DECL(mkstemps, int, (char *template, int suffixlen));
......@@ -465,56 +463,6 @@ int DARSHAN_DECL(creat64)(const char* path, mode_t mode)
return(ret);
}
FILE* DARSHAN_DECL(fopen)(const char *path, const char *mode)
{
FILE* ret;
int fd;
double tm1, tm2;
MAP_OR_FAIL(fopen);
tm1 = darshan_core_wtime();
ret = __real_fopen(path, mode);
tm2 = darshan_core_wtime();
if(ret == NULL)
fd = -1;
else
fd = fileno(ret);
POSIX_LOCK();
posix_runtime_initialize();
POSIX_RECORD_OPEN(fd, path, 0, 1, tm1, tm2);
POSIX_UNLOCK();
return(ret);
}
FILE* DARSHAN_DECL(fopen64)(const char *path, const char *mode)
{
FILE* ret;
int fd;
double tm1, tm2;
MAP_OR_FAIL(fopen64);
tm1 = darshan_core_wtime();
ret = __real_fopen64(path, mode);
tm2 = darshan_core_wtime();
if(ret == NULL)
fd = -1;
else
fd = fileno(ret);
POSIX_LOCK();
posix_runtime_initialize();
POSIX_RECORD_OPEN(fd, path, 0, 1, tm1, tm2);
POSIX_UNLOCK();
return(ret);
}
int DARSHAN_DECL(mkstemp)(char* template)
{
int ret;
......
This diff is collapsed.
......@@ -3,3 +3,4 @@
@@darshan_share_path@/ld-opts/darshan-posix-ld-opts
@@darshan_share_path@/ld-opts/darshan-hdf5-ld-opts
@@darshan_share_path@/ld-opts/darshan-pnetcdf-ld-opts
@@darshan_share_path@/ld-opts/darshan-stdio-ld-opts
......@@ -2,8 +2,6 @@
--wrap=open64
--wrap=creat
--wrap=creat64
--wrap=fopen
--wrap=fopen64
--wrap=mkstemp
--wrap=mkostemp
--wrap=mkstemps
......
......@@ -93,7 +93,7 @@ enum darshan_stdio_f_indices
* - integer I/O counters (operation counts, I/O sizes, etc.)
* - floating point I/O counters (timestamps, cumulative timers, etc.)
*/
struct darshan_stdio_record
struct darshan_stdio_file
{
darshan_record_id f_id;
int64_t rank;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment