Commit d4e2e8b5 authored by Shane Snyder's avatar Shane Snyder
Browse files

Merge branch 'carns/dev-289-pwritev' into 'master'

add wrappers for preadv, pwritev, preadv2, pwritev2, and their explicit 64 bit variants

Closes #289

See merge request darshan/darshan!69
parents 583afaa1 8b1a7a09
......@@ -2,6 +2,11 @@
Darshan Release Change Log
--------------------------
Darshan-3.2.2
=============
* add wrappers for preadv, preadv2, pwritev, and pwritev2 (improves profiling
of ompio)
Darshan-3.2.1
=============
* fixed bug causing corruption of Darshan common access
......
......@@ -1825,6 +1825,73 @@ $as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $2 innocuous_$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $2 (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $2
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $2 ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$2 || defined __stub___$2
choke me
#endif
int
main ()
{
return $2 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
......@@ -4924,6 +4991,51 @@ $as_echo "#define HAVE_FSCANF_REDIRECT 1" >>confdefs.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# look for glibc-specific functions
for ac_func in pwritev
do :
ac_fn_c_check_func "$LINENO" "pwritev" "ac_cv_func_pwritev"
if test "x$ac_cv_func_pwritev" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PWRITEV 1
_ACEOF
fi
done
for ac_func in preadv
do :
ac_fn_c_check_func "$LINENO" "preadv" "ac_cv_func_preadv"
if test "x$ac_cv_func_preadv" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PREADV 1
_ACEOF
fi
done
for ac_func in pwritev2
do :
ac_fn_c_check_func "$LINENO" "pwritev2" "ac_cv_func_pwritev2"
if test "x$ac_cv_func_pwritev2" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PWRITEV2 1
_ACEOF
fi
done
for ac_func in preadv2
do :
ac_fn_c_check_func "$LINENO" "preadv2" "ac_cv_func_preadv2"
if test "x$ac_cv_func_preadv2" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PREADV2 1
_ACEOF
fi
done
DARSHAN_VERSION="3.2.1"
......
......@@ -495,6 +495,11 @@ AC_TRY_COMPILE(
DARSHAN_STDIO_ADD_FSCANF_LD_OPTS=""
)
# look for glibc-specific functions
AC_CHECK_FUNCS([pwritev],[],[])
AC_CHECK_FUNCS([preadv],[],[])
AC_CHECK_FUNCS([pwritev2],[],[])
AC_CHECK_FUNCS([preadv2],[],[])
DARSHAN_VERSION="AC_PACKAGE_VERSION"
AC_SUBST(darshan_lib_path)
......
......@@ -39,6 +39,18 @@
/* Define if off64_t type is defined */
#undef HAVE_OFF64_T
/* Define to 1 if you have the `preadv' function. */
#undef HAVE_PREADV
/* Define to 1 if you have the `preadv2' function. */
#undef HAVE_PREADV2
/* Define to 1 if you have the `pwritev' function. */
#undef HAVE_PWRITEV
/* Define to 1 if you have the `pwritev2' function. */
#undef HAVE_PWRITEV2
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
......
......@@ -62,7 +62,23 @@ DARSHAN_FORWARD_DECL(pwrite, ssize_t, (int fd, const void *buf, size_t count, of
DARSHAN_FORWARD_DECL(pread64, ssize_t, (int fd, void *buf, size_t count, off64_t offset));
DARSHAN_FORWARD_DECL(pwrite64, ssize_t, (int fd, const void *buf, size_t count, off64_t offset));
DARSHAN_FORWARD_DECL(readv, ssize_t, (int fd, const struct iovec *iov, int iovcnt));
#ifdef HAVE_PREADV
DARSHAN_FORWARD_DECL(preadv, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset));
DARSHAN_FORWARD_DECL(preadv64, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off64_t offset));
#endif
#ifdef HAVE_PREADV2
DARSHAN_FORWARD_DECL(preadv2, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags));
DARSHAN_FORWARD_DECL(preadv64v2, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off64_t offset, int flags));
#endif
DARSHAN_FORWARD_DECL(writev, ssize_t, (int fd, const struct iovec *iov, int iovcnt));
#ifdef HAVE_PWRITEV
DARSHAN_FORWARD_DECL(pwritev, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset));
DARSHAN_FORWARD_DECL(pwritev64, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off64_t offset));
#endif
#ifdef HAVE_PWRITEV2
DARSHAN_FORWARD_DECL(pwritev2, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags));
DARSHAN_FORWARD_DECL(pwritev64v2, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off64_t offset, int flags));
#endif
DARSHAN_FORWARD_DECL(lseek, off_t, (int fd, off_t offset, int whence));
DARSHAN_FORWARD_DECL(lseek64, off64_t, (int fd, off64_t offset, int whence));
DARSHAN_FORWARD_DECL(__xstat, int, (int vers, const char* path, struct stat *buf));
......@@ -991,6 +1007,115 @@ ssize_t DARSHAN_DECL(readv)(int fd, const struct iovec *iov, int iovcnt)
return(ret);
}
#ifdef HAVE_PREADV
ssize_t DARSHAN_DECL(preadv)(int fd, const struct iovec *iov, int iovcnt, off_t offset)
{
ssize_t ret;
int aligned_flag = 1;
int i;
double tm1, tm2;
MAP_OR_FAIL(preadv);
for(i=0; i<iovcnt; i++)
{
if(((unsigned long)iov[i].iov_base % darshan_mem_alignment) != 0)
aligned_flag = 0;
}
tm1 = darshan_core_wtime();
ret = __real_preadv(fd, iov, iovcnt, offset);
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_READ(ret, fd, 1, offset, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
}
ssize_t DARSHAN_DECL(preadv64)(int fd, const struct iovec *iov, int iovcnt, off64_t offset)
{
ssize_t ret;
int aligned_flag = 1;
int i;
double tm1, tm2;
MAP_OR_FAIL(preadv64);
for(i=0; i<iovcnt; i++)
{
if(((unsigned long)iov[i].iov_base % darshan_mem_alignment) != 0)
aligned_flag = 0;
}
tm1 = darshan_core_wtime();
ret = __real_preadv64(fd, iov, iovcnt, offset);
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_READ(ret, fd, 1, offset, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
}
#endif /* HAVE_PREADV */
#ifdef HAVE_PREADV2
ssize_t DARSHAN_DECL(preadv2)(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags)
{
ssize_t ret;
int aligned_flag = 1;
int i;
double tm1, tm2;
MAP_OR_FAIL(preadv2);
for(i=0; i<iovcnt; i++)
{
if(((unsigned long)iov[i].iov_base % darshan_mem_alignment) != 0)
aligned_flag = 0;
}
tm1 = darshan_core_wtime();
ret = __real_preadv2(fd, iov, iovcnt, offset, flags);
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_READ(ret, fd, 1, offset, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
}
ssize_t DARSHAN_DECL(preadv64v2)(int fd, const struct iovec *iov, int iovcnt, off64_t offset, int flags)
{
ssize_t ret;
int aligned_flag = 1;
int i;
double tm1, tm2;
MAP_OR_FAIL(preadv64v2);
for(i=0; i<iovcnt; i++)
{
if(((unsigned long)iov[i].iov_base % darshan_mem_alignment) != 0)
aligned_flag = 0;
}
tm1 = darshan_core_wtime();
ret = __real_preadv64v2(fd, iov, iovcnt, offset, flags);
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_READ(ret, fd, 1, offset, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
}
#endif /* HAVE_PREADV2 */
ssize_t DARSHAN_DECL(writev)(int fd, const struct iovec *iov, int iovcnt)
{
ssize_t ret;
......@@ -1017,6 +1142,115 @@ ssize_t DARSHAN_DECL(writev)(int fd, const struct iovec *iov, int iovcnt)
return(ret);
}
#ifdef HAVE_PWRITEV
ssize_t DARSHAN_DECL(pwritev)(int fd, const struct iovec *iov, int iovcnt, off_t offset)
{
ssize_t ret;
int aligned_flag = 1;
int i;
double tm1, tm2;
MAP_OR_FAIL(pwritev);
for(i=0; i<iovcnt; i++)
{
if(((unsigned long)iov[i].iov_base % darshan_mem_alignment) != 0)
aligned_flag = 0;
}
tm1 = darshan_core_wtime();
ret = __real_pwritev(fd, iov, iovcnt, offset);
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_WRITE(ret, fd, 1, offset, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
}
ssize_t DARSHAN_DECL(pwritev64)(int fd, const struct iovec *iov, int iovcnt, off64_t offset)
{
ssize_t ret;
int aligned_flag = 1;
int i;
double tm1, tm2;
MAP_OR_FAIL(pwritev64);
for(i=0; i<iovcnt; i++)
{
if(((unsigned long)iov[i].iov_base % darshan_mem_alignment) != 0)
aligned_flag = 0;
}
tm1 = darshan_core_wtime();
ret = __real_pwritev64(fd, iov, iovcnt, offset);
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_WRITE(ret, fd, 1, offset, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
}
#endif /* HAVE_PWRITEV */
#ifdef HAVE_PWRITEV2
ssize_t DARSHAN_DECL(pwritev2)(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags)
{
ssize_t ret;
int aligned_flag = 1;
int i;
double tm1, tm2;
MAP_OR_FAIL(pwritev2);
for(i=0; i<iovcnt; i++)
{
if(((unsigned long)iov[i].iov_base % darshan_mem_alignment) != 0)
aligned_flag = 0;
}
tm1 = darshan_core_wtime();
ret = __real_pwritev2(fd, iov, iovcnt, offset, flags);
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_WRITE(ret, fd, 1, offset, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
}
ssize_t DARSHAN_DECL(pwritev64v2)(int fd, const struct iovec *iov, int iovcnt, off64_t offset, int flags)
{
ssize_t ret;
int aligned_flag = 1;
int i;
double tm1, tm2;
MAP_OR_FAIL(pwritev64v2);
for(i=0; i<iovcnt; i++)
{
if(((unsigned long)iov[i].iov_base % darshan_mem_alignment) != 0)
aligned_flag = 0;
}
tm1 = darshan_core_wtime();
ret = __real_pwritev64v2(fd, iov, iovcnt, offset, flags);
tm2 = darshan_core_wtime();
POSIX_PRE_RECORD();
POSIX_RECORD_WRITE(ret, fd, 1, offset, aligned_flag, tm1, tm2);
POSIX_POST_RECORD();
return(ret);
}
#endif
off_t DARSHAN_DECL(lseek)(int fd, off_t offset, int whence)
{
off_t ret;
......
......@@ -19,7 +19,15 @@
--wrap=pread64
--wrap=pwrite64
--wrap=readv
--wrap=preadv
--wrap=preadv2
--wrap=preadv64
--wrap=preadv64v2
--wrap=writev
--wrap=pwritev
--wrap=pwritev2
--wrap=pwritev64
--wrap=pwritev64v2
--wrap=lseek
--wrap=lseek64
--wrap=__xstat
......
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