preload libosp-compat.so for compat app
authorYoung Ik Cho <youngik.cho@samsung.com>
Wed, 28 Aug 2013 10:12:58 +0000 (19:12 +0900)
committerYoung Ik Cho <youngik.cho@samsung.com>
Wed, 28 Aug 2013 10:12:58 +0000 (19:12 +0900)
Change-Id: Ie4d744b9aa7e54f04bc36f8ecca1ca74b6817dc4
Signed-off-by: Young Ik Cho <youngik.cho@samsung.com>
CMakeLists.txt
osp-env-config.c
packaging/osp-env-config.spec

index 01516e6..eb53734 100644 (file)
@@ -20,7 +20,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
 SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed")
 
-TARGET_LINK_LIBRARIES(${this_target} "-lvconf -ldlog")
+TARGET_LINK_LIBRARIES(${this_target} "-ldl -lvconf -ldlog")
 
 SET_TARGET_PROPERTIES(${this_target}
        PROPERTIES
index f259cdf..b4937f6 100644 (file)
@@ -31,6 +31,7 @@
 #include <sys/prctl.h>
 #include <sys/vfs.h>
 #include <fcntl.h>
+#include <dlfcn.h>
 
 #include <dlog.h>
 #include <vconf.h>
@@ -49,8 +50,9 @@
 #define _SECURE_LOGE(...)
 #endif
 
-static const char* _OSP_COMPAT_SHARED_PATH = "/opt/usr/share/.osp-compat/\0";
-static const char* _EXT_OSP_HOME_PATH = "/opt/storage/sdcard/osp/\0";
+static const char _OSP_COMPAT_SHARED_PATH[] = "/opt/usr/share/.osp-compat/\0";
+static const char _EXT_OSP_HOME_PATH[] = "/opt/storage/sdcard/osp/\0";
+static const char OSP_COMPAT_LIB[] = "/usr/lib/osp/libosp-compat.so.1";
 
 struct _path_info
 {
@@ -575,6 +577,13 @@ do_pre_exe(const char* package_name, const char* bin_path, const char* package_i
        char* app_rootpath = NULL;
        int mmc_mounted = 0;
 
+       // preload libosp-compat.so.1 for compatibility
+       void* handle = dlopen(OSP_COMPAT_LIB, RTLD_GLOBAL);
+       if (handle)
+       {
+               LOGI("%s is preloaded.", OSP_COMPAT_LIB);
+       }
+
        /* e.g., app_rootdir is "/opt/usr/apps/[pkgId] */
        app_rootpath = get_app_rootpath_from_path(bin_path);
 
index d6b37b1..b99438e 100644 (file)
@@ -1,7 +1,7 @@
 Name:          osp-env-config
 Summary:       osp application environment cofiguration serivce
 Version:       1.2.2.1
-Release:       2
+Release:       3
 Group:         System/Libraries
 License:       Apache-2.0
 Source0:       %{name}-%{version}.tar.gz