From: taemin.yeom Date: Tue, 16 Feb 2021 07:24:19 +0000 (+0900) Subject: Use libsyscommon for dbus X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5de9b9968dacc2b6c9d1fbc20e9084ceafe7055f;p=platform%2Fcore%2Fapi%2Fruntime-info.git Use libsyscommon for dbus Change-Id: I2779b674d8d45e3e4e76d4e52ea5523027c0c796 Signed-off-by: taemin.yeom Signed-off-by: Youngjae Cho --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ccd525b..9d9779a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) -SET(requires "dlog vconf capi-base-common capi-system-info glib-2.0 gio-2.0") +SET(requires "dlog vconf capi-base-common capi-system-info glib-2.0 gio-2.0 libsyscommon") SET(pc_requires "capi-base-common") INCLUDE(FindPkgConfig) diff --git a/packaging/capi-system-runtime-info.spec b/packaging/capi-system-runtime-info.spec index bab433b..8966c53 100644 --- a/packaging/capi-system-runtime-info.spec +++ b/packaging/capi-system-runtime-info.spec @@ -13,6 +13,7 @@ BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(libsyscommon) Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig diff --git a/src/runtime_info_usage.c b/src/runtime_info_usage.c index 64120d2..647206b 100644 --- a/src/runtime_info_usage.c +++ b/src/runtime_info_usage.c @@ -20,12 +20,12 @@ #include #include +#include #include #include #include -#include #include #define RESOURCED_BUS_NAME "org.tizen.resourced" @@ -83,8 +83,6 @@ static GVariant *runtime_info_append_args(int *args, int size) static GVariant *runtime_info_dbus_request_usage_info(runtime_info_usage_type_e type, int *pid, int size, int *error) { - static GDBusConnection *conn; - GError *err = NULL; GVariant *args_in = NULL; GVariant *args_out = NULL; GVariant *usage; @@ -145,39 +143,17 @@ static GVariant *runtime_info_dbus_request_usage_info(runtime_info_usage_type_e break; } - /* Send message to resourced and receive reply */ - if (!conn) { - conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); - if (!conn) { - //LCOV_EXCL_START : system error - _E("Failed to get dbus connection : %s", - err && err->message ? err->message : NULL); - if (args_in) - g_variant_unref(args_in); - return NULL; - //LCOV_EXCL_STOP - } - } - _D("Process %d: Sending dbus message to resourced for %s info", getpid(), dbus_info[type].caption); - - args_out = g_dbus_connection_call_sync(conn, - RESOURCED_BUS_NAME, + args_out = dbus_handle_method_sync_with_reply_var(RESOURCED_BUS_NAME, RESOURCED_USAGE_OBJECT_NAME, RESOURCED_USAGE_INTERFACE_NAME, dbus_info[type].method_name, - args_in, NULL, G_DBUS_CALL_FLAGS_NONE, DBUS_REPLY_TIMEOUT, NULL, &err); + args_in); + if (!args_out) { //LCOV_EXCL_START : system error - _E("DBUS_METHOD_CALL: not able to send message : %s", - err && err->message ? err->message : NULL); - if (err->code == G_FILE_ERROR_TXTBSY) - *error = RUNTIME_INFO_ERROR_PERMISSION_DENIED; - else - *error = RUNTIME_INFO_ERROR_REMOTE_IO; - if (args_in && !err) - g_variant_unref(args_in); + _E("DBUS_METHOD_CALL: not able to send message"); return NULL; //LCOV_EXCL_STOP }