summaryrefslogtreecommitdiffstats
path: root/booster/src/booster.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-06-29 09:38:29 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-06-29 10:51:16 -0700
commita3ece0caa52ad2eacf8a8691aaca53295cde972f (patch)
tree8bcb7740cc75f36fb499ac1febb3cfa8e2f1c817 /booster/src/booster.c
parent304e4274ca9b0339539581c5413e3339078c1182 (diff)
booster: Fix build problems with various libtool versions
We've been facing a problem on some test systems where the booster.so is built by libtool as an executable rather than a dynamically loadable library. This problem is probably caused by it seeing a _init function in the source. This is the name of the libc initiliazation function so it could be the source of the problem. In any case, ld-preloadable libraries must not have a function called _init, instead they need to have __attribute ((constructor)) as the attribute for any and all functions the library wants executed before the program's main(). Our earlier approach was inherently problematic. This commit also cleans up the booster Makefile for better build behaviour. Credit: Harsha. Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'booster/src/booster.c')
-rw-r--r--booster/src/booster.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c
index 26cf6b6113f..0ed914b1f0d 100644
--- a/booster/src/booster.c
+++ b/booster/src/booster.c
@@ -49,6 +49,11 @@
#define GF_UNIT_KB 1024
#endif
+/* attr constructor registers this function with libc's
+ * _init function as a function that must be called before
+ * the main() of the program.
+ */
+static void booster_lib_init (void) __attribute__((constructor));
extern fd_t *
fd_ref (fd_t *fd);
@@ -2194,7 +2199,7 @@ out:
}
void
-_init (void)
+booster_lib_init (void)
{
RESOLVE (open);