From 56e1a7cd4904fbfde59adbdfedd5374e5bde2e87 Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Wed, 9 Jan 2013 14:54:47 -0800 Subject: [PATCH] rsockets: Add support for existing UDP apps Support for existing UDP applications is done via the rspreload library. However, when the preload library is loaded, socket calls used by rsockets get intercepted and converted into rsocket calls. The preload library was able to handle this for TCP rsockets by using a per thread variable and checking for recursive calls coming from rsockets back into the preload library. The preload library would direct such calls to the real socket calls. The problem is more complex for UDP rsockets, which can invoke socket calls from an internal rsocket thread. The result is that the preload library intercepts socket calls that originate from the rsocket library which are not recursive. Although, this is really a problem with the preload library, the simplest solution is for rsockets to fully initialize the library when allocating the first rsocket, versus deferring initialization until required. The preload library can then detect the recursive calls. Signed-off-by: Sean Hefty --- src/cma.h | 1 + src/rsocket.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cma.h b/src/cma.h index 7135a612..bdd6a858 100644 --- a/src/cma.h +++ b/src/cma.h @@ -158,6 +158,7 @@ static inline int ERR(int err) } int ucma_init(); +void ucma_ib_init(); extern int af_ib_support; #define RAI_ROUTEONLY 0x01000000 diff --git a/src/rsocket.c b/src/rsocket.c index 7be42cab..9b6c6673 100644 --- a/src/rsocket.c +++ b/src/rsocket.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2012 Intel Corporation. All rights reserved. + * Copyright (c) 2008-2013 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -452,6 +452,10 @@ void rs_configure(void) if (init) goto out; + if (ucma_init()) + goto out; + ucma_ib_init(); + if ((f = fopen(RS_CONF_DIR "/polling_time", "r"))) { (void) fscanf(f, "%u", &polling_time); fclose(f); -- 2.46.0