[Darshan-commits] [Git][darshan/darshan][carns/dev-289-pwritev] 2 commits: autoconf test for presence of p{read|write}v fns
Philip Carns
xgitlab at cels.anl.gov
Tue Dec 1 12:29:45 CST 2020
Philip Carns pushed to branch carns/dev-289-pwritev at darshan / darshan
Commits:
ff93a0df by Phil Carns at 2020-12-01T13:25:09-05:00
autoconf test for presence of p{read|write}v fns
- - - - -
0a1d1f4d by Phil Carns at 2020-12-01T13:29:27-05:00
add static wrapper flags for preadv/pwritev fns
- - - - -
5 changed files:
- darshan-runtime/configure
- darshan-runtime/configure.in
- darshan-runtime/darshan-runtime-config.h.in
- darshan-runtime/lib/darshan-posix.c
- darshan-runtime/share/ld-opts/darshan-posix-ld-opts
Changes:
=====================================
darshan-runtime/configure
=====================================
@@ -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"
=====================================
darshan-runtime/configure.in
=====================================
@@ -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)
=====================================
darshan-runtime/darshan-runtime-config.h.in
=====================================
@@ -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
=====================================
darshan-runtime/lib/darshan-posix.c
=====================================
@@ -62,11 +62,19 @@ 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));
-DARSHAN_FORWARD_DECL(preadv, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset));
-DARSHAN_FORWARD_DECL(preadv2, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags));
+#ifdef HAVE_PREADV
+ DARSHAN_FORWARD_DECL(preadv, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_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));
+#endif
DARSHAN_FORWARD_DECL(writev, ssize_t, (int fd, const struct iovec *iov, int iovcnt));
-DARSHAN_FORWARD_DECL(pwritev, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset));
-DARSHAN_FORWARD_DECL(pwritev2, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags));
+#ifdef HAVE_PWRITEV
+ DARSHAN_FORWARD_DECL(pwritev, ssize_t, (int fd, const struct iovec *iov, int iovcnt, off_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));
+#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));
@@ -995,6 +1003,7 @@ 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;
@@ -1020,7 +1029,9 @@ ssize_t DARSHAN_DECL(preadv)(int fd, const struct iovec *iov, int iovcnt, off_t
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;
@@ -1046,6 +1057,7 @@ ssize_t DARSHAN_DECL(preadv2)(int fd, const struct iovec *iov, int iovcnt, off_t
return(ret);
}
+#endif /* HAVE_PREADV2 */
ssize_t DARSHAN_DECL(writev)(int fd, const struct iovec *iov, int iovcnt)
{
@@ -1073,6 +1085,7 @@ 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;
@@ -1098,7 +1111,9 @@ ssize_t DARSHAN_DECL(pwritev)(int fd, const struct iovec *iov, int iovcnt, off_t
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;
@@ -1124,6 +1139,7 @@ ssize_t DARSHAN_DECL(pwritev2)(int fd, const struct iovec *iov, int iovcnt, off_
return(ret);
}
+#endif
off_t DARSHAN_DECL(lseek)(int fd, off_t offset, int whence)
{
=====================================
darshan-runtime/share/ld-opts/darshan-posix-ld-opts
=====================================
@@ -19,7 +19,11 @@
--wrap=pread64
--wrap=pwrite64
--wrap=readv
+--wrap=preadv
+--wrap=preadv2
--wrap=writev
+--wrap=pwritev
+--wrap=pwritev2
--wrap=lseek
--wrap=lseek64
--wrap=__xstat
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/compare/8b3d0b163452b76b6b24f7f2abe64be386e8fb2a...0a1d1f4d0cc9e4b6dc0deb51bbfbd580d6eaec6d
--
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/compare/8b3d0b163452b76b6b24f7f2abe64be386e8fb2a...0a1d1f4d0cc9e4b6dc0deb51bbfbd580d6eaec6d
You're receiving this email because of your account on xgitlab.cels.anl.gov.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20201201/2835f523/attachment-0001.html>
More information about the Darshan-commits
mailing list