From 9d384c329115e8794afb69dbee0b6af2187b61bc Mon Sep 17 00:00:00 2001 From: sangwook lee Date: Thu, 9 Mar 2023 11:42:55 +0900 Subject: [PATCH] Support 64bit plugin Change-Id: I5ebe8c2d0b2da979c5dce6dc054f54d1ee6decb5 Signed-off-by: sangwook lee --- src/plugin.c | 27 ++++++++++++++++++++++----- src/plugin.h | 2 ++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/plugin.c b/src/plugin.c index 2efe7d2..ee14893 100755 --- a/src/plugin.c +++ b/src/plugin.c @@ -91,10 +91,22 @@ static int load_plugin_not_default() plugin_init_proc = NULL; plugin_sync_proc = NULL; plugin_async_proc = NULL; + void* void_pointer; + if ((int)(sizeof(void_pointer)) == 8) { + g_plugin_handle = dlopen ( PLUGIN_PATH64, RTLD_NOW ); + } + else { + g_plugin_handle = dlopen ( PLUGIN_PATH, RTLD_NOW ); + } - g_plugin_handle = dlopen ( PLUGIN_PATH, RTLD_NOW ); + //g_plugin_handle = dlopen ( PLUGIN_PATH, RTLD_NOW ); if ( g_plugin_handle == NULL ) { - E ( "failed to dlopen(%s). error: %s\n", PLUGIN_PATH, dlerror() ); + if ((int)(sizeof(void_pointer)) == 8) { + E ( "failed to dlopen(%s). error: %s\n", PLUGIN_PATH64, dlerror() ); + } + else { + E ( "failed to dlopen(%s). error: %s\n", PLUGIN_PATH, dlerror() ); + } return 0; } @@ -160,6 +172,7 @@ void readxml() { void load_sdbd_plugin() { int ret; + void* void_pointer; plugin_cmd_hashtable = hashtable_create ( ht_size_31 ); @@ -172,8 +185,12 @@ void load_sdbd_plugin() I ( "using default plugin interface.\n" ); } else { - D ( "using sdbd plugin interface.(%s)\n", PLUGIN_PATH ); - + if ((int)(sizeof(void_pointer)) == 8) { + D ( "using sdbd plugin interface.(%s)\n", PLUGIN_PATH64 ); + } + else { + D ( "using sdbd plugin interface.(%s)\n", PLUGIN_PATH ); + } plugin_init_proc ( plugin_event_handler, plugin_register_command ); readxml(); } @@ -736,4 +753,4 @@ int request_extra_capability_to_plugin (char* out_buf, unsigned int out_len ) } return success; -} \ No newline at end of file +} diff --git a/src/plugin.h b/src/plugin.h index 72345c6..29dfde2 100755 --- a/src/plugin.h +++ b/src/plugin.h @@ -20,6 +20,8 @@ #include "sdbd_plugin.h" #define PLUGIN_PATH "/usr/lib/libsdbd_plugin.so" +#define PLUGIN_PATH64 "/usr/lib64/libsdbd_plugin.so" + #define PLUGIN_XML_PATH "/etc/sdbd/commands.xml" extern char* extcmd; -- 2.34.1