tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgr_client_new failed.");
catch:
- /*
- * Do not close libpkgmgr-client.so.0 to avoid munmap registered callback
- *
- * The lib dependency chain like below
- * amd --> pkgmgr-info -- dlopen --> libpkgmgr-client --> libpkgmgr-installer-client
- *
- * And there is a function in libpkgmgr-installer-client named _on_signal_handle_filter()
- * which will registered to dbus callback in amd though in fact amd doesn't direct depends
- * on libpkgmgr-installer-client.
- *
- * So when the dlcose happen, then libpkgmgr-installer-client been closed too since no one
- * link to it then.
- *
- * However, when the libdbus call into the callback function, it suddenly fond that the
- * function address is gone (unmapped), then we receive a SIGSEGV.
- *
- * I'm not sure why we're using dlopen/dlclose in this case, I think it's much simple and
- * robust if we just link to the well-known lib.
- *
- * See https://bugs.tizen.org/jira/browse/PTREL-591
+ /*
+ * Do not close libpkgmgr-client.so.0 to avoid munmap registered callback
+ *
+ * The lib dependency chain like below
+ * amd --> pkgmgr-info -- dlopen --> libpkgmgr-client --> libpkgmgr-installer-client
+ *
+ * And there is a function in libpkgmgr-installer-client named _on_signal_handle_filter()
+ * which will registered to dbus callback in amd though in fact amd doesn't direct depends
+ * on libpkgmgr-installer-client.
+ *
+ * So when the dlcose happen, then libpkgmgr-installer-client been closed too since no one
+ * link to it then.
+ *
+ * However, when the libdbus call into the callback function, it suddenly fond that the
+ * function address is gone (unmapped), then we receive a SIGSEGV.
+ *
+ * I'm not sure why we're using dlopen/dlclose in this case, I think it's much simple and
+ * robust if we just link to the well-known lib.
+ *
+ * See https://bugs.tizen.org/jira/browse/PTREL-591
dlclose(handle);
- */
+ */
return ret;
}
tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgr_client_new failed.");
catch:
- /* same as pkgmgrinfo_client_new */
+ /* same as pkgmgrinfo_client_new */
return ret;
}
tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgr_client_new failed.");
catch:
- /* same as pkgmgrinfo_client_new */
+ /* same as pkgmgrinfo_client_new */
return ret;
}
-
-static int __get_pkg_location(const char *pkgid)
-{
- retvm_if(pkgid == NULL, PMINFO_R_OK, "pkginfo handle is NULL");
-
- FILE *fp = NULL;
- char pkg_mmc_path[FILENAME_MAX] = { 0, };
- snprintf(pkg_mmc_path, FILENAME_MAX, "%s%s", PKG_SD_PATH, pkgid);
-
- /*check whether application is in external memory or not */
- fp = fopen(pkg_mmc_path, "r");
- if (fp != NULL) {
- fclose(fp);
- fp = NULL;
- return PMINFO_EXTERNAL_STORAGE;
- }
-
- return PMINFO_INTERNAL_STORAGE;
-}
-
-API int pkgmgrinfo_client_request_enable_external_pkg(char *pkgid)
-{
- DBusConnection *bus;
- DBusMessage *message = NULL;
- DBusMessage *reply = NULL;
-
- retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "pkgid is NULL\n");
-
- if(__get_pkg_location(pkgid) != PMINFO_EXTERNAL_STORAGE)
- return PMINFO_R_OK;
-
- bus = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
- retvm_if(bus == NULL, PMINFO_R_EINVAL, "dbus_bus_get() failed.");
-
- message = dbus_message_new_method_call (SERVICE_NAME, PATH_NAME, INTERFACE_NAME, METHOD_NAME);
- trym_if(message == NULL, "dbus_message_new_method_call() failed.");
-
- dbus_message_append_args(message, DBUS_TYPE_STRING, &pkgid, DBUS_TYPE_INVALID);
-
- reply = dbus_connection_send_with_reply_and_block(bus, message, -1, NULL);
- trym_if(reply == NULL, "connection_send dbus fail");
-
-catch:
- dbus_connection_flush(bus);
- if (message)
- dbus_message_unref(message);
- if (reply)
- dbus_message_unref(reply);
-
- return PMINFO_R_OK;
-}