Build: Static constructors for built-in providers

Change how internal and external providers are built to fix static
build issues.  External providers are now required to export a
well known API that is invoked by the libfabric framework.  This
replaces the fi_register call that libfabric exported.

Update the build configuration to better handle building in-tree
providers as separate DLLs (for testing purposes).  When building
an in-tree provider as a separate DLL, it now needs to export
the required fi_prov_ini function.

Signed-off-by: pmmccorm <patrick.m.mccormick@intel.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Fixed a bug to give correct iov buf length in usdf prefix_recv implementation

Signed-off-by: Xuyang Wang <xuywang@cisco.com>
Merge pull request #408 from xuywang/pr/prefix_recv

Fixed a bug to give correct iov buf length in usdf prefix_recv implement...
Makefile.am: updates on linkback scheme
Several changes:

* Change the definition of $(linkback) to link to libfabric.la in the
  build tree (i.e., let Libtool figure out what the right directory
  is)
* Move $(linkback) and other -l libraries to provider DL LIBADD lines
  -- they do not belong in LDFLAGS
* Add $(linkback) to provider DL DEPENDENCIES to guarantee that
  libfabric is built before the provider DLs (e.g., in a parallel
  build)

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Merge pull request #399 from shefty/master

Build: Static constructors for built-in providers
fabric: Rename FI_WAIT_MUT_COND to FI_WAIT_MUTEX_COND

Align name better with pthread names.
fabric: Defined fi_mut_cond structure

Define structure for use with FI_GETWAIT when a mutex-cond
pair are used as wait objects.

Signed-off-by: Jithin Jose <jithin.jose@intel.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
fabric: Remove fi_control from defined wait set interface

The primary function of a wait set is to allow multiple underlying
objects to share a single wait object.  However, a wait set is
defined such that it could be implemented with multiple wait
objects, which are visible to the application.  Rather than
defining a wait set in this way, limit the definition to the
intended use case.  Any use of multiple wait objects then becomes
an implementation specific problem.

The use of multiple wait objects is exposed through the wait
set control FI_GETWAIT operation.  Remove this functionality from
the defined interfaces.

This also fixes an issue where the wait set lacks an interface
to reset a signaled wait object that has been exposed to an app.
For example, if a wait set were implemented using a FD, and an
app obtained that FD, it can wait until the FD has been signaled
using select or poll, but no interface is defined for clearing
such a signal from the FD.

This above mentioned functionality and control operation is
deferred until a future time when it can be more fully defined
with a clearer usage model.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
fabric: Clarify which buffers FI_OPT_MIN_MULTI_RECV apply to

Improve documentation regarding the expected behavior when an
app modifies the MIN_MULTI_RECV endpoint option.

Recommend that the option be set before an endpoint is enabled,
in order to support the broadest array of implementations, and
that it only applies to buffers posted after the value has been
set.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
prov/psm: fix the return code of fi_cq_read for error completions

When an error entry is created from PSM status, the function returned 1
incorrectly. The correct way is to continue to the CQ dequeue step, where
the error entry will be discovered and the proper value will be returned.

Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>
man: remove references to fi_sync

Remove references to fi_sync in the manpages since it
has been removed from the API.

Applications can use counters directly to wait until issued
ops are completed.

The comment about lazy deregistration on fi_close(mr) was
also removed. Asynchronous registration is now handled using
domain events.

(Currently, it is not clear what event is caused during lazy
deregistration).

Signed-off-by: Sayantan Sur <sayantan.sur@intel.com>
Merge pull request #207 from jsquyres/pr/provider-helper-functions

Fix parallel build/linkback scheme
Clean up spec file.

Include missing psm_am.h header in dist tarball.
Don't define %{buildroot}: this is only needed on RPM <= 4.6.
Use bz2 tarball.
Fix other minor rpmlint errors (currently only a few on RHEL7, RHEL6.4).

Allow --with options to be specified on rpmbuild command line like:

rpmbuild --with valgrind -ba ...  # build with valgrind
rpmbuild --without dlopen -ba ... # build without dlopen -ldl

Allow RPM installation under specified prefix (works like DESTDIR):

rpm --prefix=$HOME/local -ivh ...

Signed-off-by: pmmccorm <patrick.m.mccormick@intel.com>
Merge pull request #410 from shefty/master

Simplify wait set and update man pages
Merge pull request #411 from j-xiong/master

prov/psm: fix the return code of fi_cq_read for error completions
Merge pull request #412 from sayantansur/pr-fi-sync-remove

man: remove references to fi_sync
Updated nroff-generated man pages
man: clarification when both cntr and CQ attached

When both counter and CQ are attached to the endpoint it
makes sense to just update the counter on success and
generate completion entries for errors.

Signed-off-by: Sayantan Sur <sayantan.sur@intel.com>
Merge pull request #338 from pmmccorm/rpm

Clean up spec file.
prov/psm: remove FI_EP_MSG from supported ep types

Originally there was a type FID_MSG for reliable message based
transport, which was similar to RDM and was marked as one of the
supported types of the PSM provider. Later the transport types
were redefined. The new type FI_EP_MSG, although named similarly,
has totally different meaning (it means RC).

Signed-off-by: Jianxin Xiong <jianxin.xiong@intel.com>