PKG_CHECK_MODULES(LIBXML_DEPS REQUIRED libxml-2.0)
PKG_CHECK_MODULES(PARCEL_DEPS REQUIRED parcel)
PKG_CHECK_MODULES(PKGMGR_INFO_DEPS REQUIRED pkgmgr-info)
-PKG_CHECK_MODULES(PKGMGR_INSTALLER_DEPS REQUIRED pkgmgr-installer)
PKG_CHECK_MODULES(SQLITE3_DEPS REQUIRED sqlite3)
PKG_CHECK_MODULES(TTRACE_DEPS REQUIRED ttrace)
PKG_CHECK_MODULES(UUID_DEPS REQUIRED uuid)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(parcel)
BuildRequires: pkgconfig(pkgmgr-info)
-BuildRequires: pkgconfig(pkgmgr-installer)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(ttrace)
BuildRequires: pkgconfig(uuid)
LIBTZPLATFORM_CONFIG_DEPS
LIBXML_DEPS
PKGMGR_INFO_DEPS
- PKGMGR_INSTALLER_DEPS
)
INSTALL(TARGETS ${TARGET_BOOT_SEQUENCER_PARSER_PLUGIN}
#include "parser_plugin.hh"
+#include <dlfcn.h>
#include <pkgmgr-info.h>
-#include <pkgmgr_installer_info.h>
#include <string.h>
#include <unistd.h>
#include "cert_checker.hh"
#include "log_private.hh"
+#define LIBPKGMGR_INSTALLER LIBDIR "/libpkgmgr_installer.so.0"
+#define GET_TARGET_UID_FUNCTION "pkgmgr_installer_info_get_target_uid"
+
namespace boot_sequencer {
namespace {
}
uid_t GetTargetUid() {
+ static void* handle = nullptr;
+ static int (*dl_func)(uid_t*);
+
+ if (handle == nullptr) {
+ handle = dlopen(LIBPKGMGR_INSTALLER, RTLD_GLOBAL | RTLD_LAZY);
+ if (!handle) {
+ _E("Failed to open library: %s, : %s", LIBPKGMGR_INSTALLER, dlerror());
+ return false;
+ }
+ dl_func = reinterpret_cast<int (*)(uid_t*)>(
+ dlsym(handle, GET_TARGET_UID_FUNCTION));
+ if (dl_func == nullptr) {
+ _E("cannot find %s symbol in %s", GET_TARGET_UID_FUNCTION, LIBPKGMGR_INSTALLER);
+ dlclose(handle);
+ handle = nullptr;
+ return false;
+ }
+ }
+
uid_t target_uid;
- pkgmgr_installer_info_get_target_uid(&target_uid);
+ dl_func(&target_uid);
return target_uid;
}
LIBTZPLATFORM_CONFIG_DEPS
LIBXML_DEPS
PKGMGR_INFO_DEPS
- PKGMGR_INSTALLER_DEPS
SQLITE3_DEPS
)
#include <linux/limits.h>
#include <sqlite3.h>
#include <tzplatform_config.h>
-#include <pkgmgr_installer_info.h>
#include <dlog.h>
#include "component_plugin_parser_db.h"
#include "component_plugin_parser_private.h"
#define LIBCAPI_SYSTEM_INFO LIBDIR"/libcapi-system-info.so.0"
+#define LIBPKGMGR_INSTALLER LIBDIR "/libpkgmgr_installer.so.0"
+#define GET_TARGET_UID_FUNCTION "pkgmgr_installer_info_get_target_uid"
#define BUSY_WAITING_USEC 50000
#define BUSY_WAITING_MAX 40
if (target_uid != (uid_t)-1)
return target_uid;
- ret = pkgmgr_installer_info_get_target_uid(&target_uid);
+ static void* handle = NULL;
+ static int (*dl_func)(uid_t*);
+
+ if (handle == NULL) {
+ handle = dlopen(LIBPKGMGR_INSTALLER, RTLD_GLOBAL | RTLD_LAZY);
+ if (!handle) {
+ LOGE("Failed to open library: %s, : %s", LIBPKGMGR_INSTALLER, dlerror());
+ return false;
+ }
+ dl_func = dlsym(handle, GET_TARGET_UID_FUNCTION);
+ if (dl_func == NULL) {
+ LOGE("cannot find %s symbol in %s", GET_TARGET_UID_FUNCTION, LIBPKGMGR_INSTALLER);
+ dlclose(handle);
+ handle = NULL;
+ return false;
+ }
+ }
+
+ ret = dl_func(&target_uid);
if (ret < 0)
LOGE("Failed to get target uid. error(%d)", ret);
LIBTZPLATFORM_CONFIG_DEPS
LIBXML_DEPS
PKGMGR_INFO_DEPS
- PKGMGR_INSTALLER_DEPS
)
INSTALL(TARGETS ${TARGET_CHECK_EXEC_PLUGIN_PARSER}
* limitations under the License.
*/
+#include <dlfcn.h>
#include <libxml/tree.h>
#include <pkgmgr-info.h>
-#include <pkgmgr_installer_info.h>
#include <unistd.h>
#include <memory>
#include "exec_checker_private.hh"
#include "plugin_manager.hh"
+#define LIBPKGMGR_INSTALLER LIBDIR "/libpkgmgr_installer.so.0"
+#define GET_TARGET_UID_FUNCTION "pkgmgr_installer_info_get_target_uid"
+
namespace plugin {
namespace {
}
int PluginManager::Process() {
+ static void* handle = nullptr;
+ static int (*dl_func)(uid_t*);
xmlNode* root = xmlDocGetRootElement(doc_);
if (root == nullptr) {
LOGE_STD("Failed to get root element");
return -1;
}
+
+ if (handle == nullptr) {
+ handle = dlopen(LIBPKGMGR_INSTALLER, RTLD_GLOBAL | RTLD_LAZY);
+ if (!handle) {
+ LOGE_STD("Failed to open library: %s, : %s", LIBPKGMGR_INSTALLER, dlerror());
+ return false;
+ }
+ dl_func = reinterpret_cast<int (*)(uid_t*)>(
+ dlsym(handle, GET_TARGET_UID_FUNCTION));
+ if (dl_func == nullptr) {
+ LOGE_STD("cannot find %s symbol in %s", GET_TARGET_UID_FUNCTION, LIBPKGMGR_INSTALLER);
+ dlclose(handle);
+ handle = nullptr;
+ return false;
+ }
+ }
+
uid_t uid;
- int ret = pkgmgr_installer_info_get_target_uid(&uid);
+ int ret = dl_func(&uid);
if (ret != PMINFO_R_OK) {
LOGE_STD("Failed to get target uid. (%s)", package_.c_str());
return -1;
GLIB_DEPS
LIBTZPLATFORM_CONFIG_DEPS
LIBXML_DEPS
- PKGMGR_INSTALLER_DEPS
SQLITE3_DEPS
)
GLIB_DEPS
LIBTZPLATFORM_CONFIG_DEPS
LIBXML_DEPS
- PKGMGR_INSTALLER_DEPS
SQLITE3_DEPS
)
* limitations under the License.
*/
+#include <dlfcn.h>
#include <unistd.h>
-#include <pkgmgr_installer_info.h>
#include "common/database.hh"
#include "common/exception.hh"
#include "common/metadata_plugin.hh"
#include "common/metadata_type.hh"
+#define LIBPKGMGR_INSTALLER LIBDIR "/libpkgmgr_installer.so.0"
+#define GET_TARGET_UID_FUNCTION "pkgmgr_installer_info_get_target_uid"
+
namespace plugin {
void MetadataPlugin::AddAppEventArgs(const std::string& pkgid,
}
uid_t MetadataPlugin::GetUid() {
+ static void* handle = nullptr;
+ static int (*dl_func)(uid_t*);
+
+ if (handle == nullptr) {
+ handle = dlopen(LIBPKGMGR_INSTALLER, RTLD_GLOBAL | RTLD_LAZY);
+ if (!handle) {
+ _E("Failed to open library: %s, : %s", LIBPKGMGR_INSTALLER, dlerror());
+ return false;
+ }
+ dl_func = reinterpret_cast<int (*)(uid_t*)>(
+ dlsym(handle, GET_TARGET_UID_FUNCTION));
+ if (dl_func == nullptr) {
+ _E("cannot find %s symbol in %s", GET_TARGET_UID_FUNCTION, LIBPKGMGR_INSTALLER);
+ dlclose(handle);
+ handle = nullptr;
+ return false;
+ }
+ }
+
uid_t target_uid;
- pkgmgr_installer_info_get_target_uid(&target_uid);
+ dl_func(&target_uid);
return target_uid;
}