AM_PROG_LIBTOOL
+AC_ARG_WITH([valgrind],
+ AC_HELP_STRING([--with-valgrind],
+ [Enable valgrind annotations - default NO]))
+
+if test "$with_valgrind" != "" && test "$with_valgrind" != "no"; then
+ AC_DEFINE([INCLUDE_VALGRIND], 1,
+ [Define to 1 to enable valgrind annotations])
+ if test -d $with_valgrind; then
+ CPPFLAGS="$CPPLFAGS -I$with_valgrind/include"
+ fi
+fi
+
AC_ARG_ENABLE(libcheck, [ --disable-libcheck do not test for presence of ib libraries],
[ if test "$enableval" = "no"; then
disable_libcheck=yes
AC_MSG_ERROR([<infiniband/verbs.h> not found. Is libibverbs installed?]))
AC_CHECK_HEADER(infiniband/marshall.h, [],
AC_MSG_ERROR([<infiniband/marshall.h> not found. Is libibverbs installed?]))
+
+if test "$with_valgrind" != "" && test "$with_valgrind" != "no"; then
+AC_CHECK_HEADER(valgrind/memcheck.h, [],
+ AC_MSG_ERROR([valgrind requested but <valgrind/memcheck.h> not found.]))
+fi
+
fi
AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
#include <infiniband/driver.h>
#include <infiniband/marshall.h>
+#ifdef INCLUDE_VALGRIND
+# include <valgrind/memcheck.h>
+# ifndef VALGRIND_MAKE_MEM_DEFINED
+# warning "Valgrind requested, but VALGRIND_MAKE_MEM_DEFINED undefined"
+# endif
+#endif
+
+#ifndef VALGRIND_MAKE_MEM_DEFINED
+# define VALGRIND_MAKE_MEM_DEFINED(addr,len)
+#endif
+
#define PFX "libibcm: "
static int abi_ver;
if (result != size)
goto err;
+ VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp);
+
cm_id_priv->id.handle = resp->id;
*cm_id = &cm_id_priv->id;
return 0;
if (result != size)
return (result > 0) ? -ENODATA : result;
+ VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp);
+
cm_id_priv = container_of(cm_id, struct cm_id_private, id);
pthread_mutex_lock(&cm_id_priv->mut);
if (result != size)
return (result > 0) ? -ENODATA : result;
+ VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp);
+
param->service_id = resp->service_id;
param->service_mask = resp->service_mask;
param->local_id = resp->local_id;
if (result != size)
return (result > 0) ? -ENODATA : result;
+ VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp);
+
*qp_attr_mask = resp->qp_attr_mask;
ibv_copy_qp_attr_from_kern(qp_attr, resp);
msg = alloca(size);
if (!msg)
return -ENOMEM;
-
+
hdr = msg;
cmd = msg + sizeof(*hdr);
hdr->in = sizeof(*cmd);
hdr->out = sizeof(*resp);
+ memset(cmd, 0, sizeof(*cmd));
+
resp = alloca(sizeof(*resp));
if (!resp)
return -ENOMEM;
result = (result > 0) ? -ENODATA : result;
goto done;
}
+
+ VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp);
+
/*
* decode event.
*/