From 4c75b87bbc21e78e864e4df0f0a7483bf9c3854a Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Mon, 10 Apr 2017 18:52:51 +0900 Subject: [PATCH 01/16] [Release] dotnet-launcher 1.1.0-1 Change-Id: I8f1e6b57964b86b59a64dea9943f63ae3519bd5d --- packaging/dotnet-launcher.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/dotnet-launcher.spec b/packaging/dotnet-launcher.spec index 63235b0..c16117a 100755 --- a/packaging/dotnet-launcher.spec +++ b/packaging/dotnet-launcher.spec @@ -1,7 +1,7 @@ Name: dotnet-launcher Summary: Launchpad plugin for dotnet apps -Version: 1.0.1 -Release: 2 +Version: 1.1.0 +Release: 1 Group: Application Framework/Application State Management License: Apache-2.0 Source0: %{name}-%{version}.tar.gz -- 2.7.4 From 3cf211da1beb8cafd4ad8a94f3827caa673a63bf Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Mon, 10 Apr 2017 19:37:33 +0900 Subject: [PATCH 02/16] ExecuteAssembly not permit native image path Change-Id: I76f11eb94bef7574a4495aec12ac864ed986e84c --- NativeLauncher/launcher/dotnet/dotnet_launcher.cc | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc index 15b74c9..4aabf42 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc @@ -275,18 +275,6 @@ int CoreRuntime::Launch(const char* app_id, const char* root, const char* path, return 1; } - std::string cpppath(path); - - if (IsManagedAssembly(cpppath) && !IsNativeImage(cpppath)) - { - size_t extindex = cpppath.size() - 4; - cpppath = cpppath.substr(0, extindex) + ".ni" + cpppath.substr(extindex, 4); - if (!FileNotExist(cpppath)) - { - path = cpppath.c_str(); - } - } - if (FileNotExist(path)) { _ERR("File not exist : %s", path); @@ -315,6 +303,18 @@ int CoreRuntime::Launch(const char* app_id, const char* root, const char* path, bool success = false; if (LaunchFunction != nullptr) { + std::string cpppath(path); + + if (IsManagedAssembly(cpppath) && !IsNativeImage(cpppath)) + { + size_t extindex = cpppath.size() - 4; + cpppath = cpppath.substr(0, extindex) + ".ni" + cpppath.substr(extindex, 4); + if (!FileNotExist(cpppath)) + { + path = cpppath.c_str(); + } + } + success = LaunchFunction(root, path, argc, argv); if (!success) { -- 2.7.4 From 2cb2f43727ac65ecff5a9725feb132c9f9619291 Mon Sep 17 00:00:00 2001 From: Cho Woong Suk Date: Tue, 11 Apr 2017 10:18:16 +0900 Subject: [PATCH 03/16] change smack and owner for generated ni file Change-Id: Ia4c992b2984fe0b87e77bb06b031c67dcbbb8c9c --- NativeLauncher/installer-plugin/common.cc | 37 +++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/NativeLauncher/installer-plugin/common.cc b/NativeLauncher/installer-plugin/common.cc index 5d1306c..d2c9c3f 100644 --- a/NativeLauncher/installer-plugin/common.cc +++ b/NativeLauncher/installer-plugin/common.cc @@ -29,6 +29,11 @@ #include #include +#include +#include +#include +#include + #include "common.h" #ifdef LOG_TAG @@ -58,7 +63,7 @@ static const char* JITPath = __STR(RUNTIME_DIR)"/libclrjit.so"; #undef __XSTR static void crossgen(const char* dll_path, const char* app_path); -static void smack_(const char* dll_path); +static void smack_(const char* dll_path, const char* label); std::string Replace(std::string &str, const std::string& from, const std::string& to) { @@ -79,14 +84,14 @@ void create_ni_platform() if (FileNotExist(nicorlib)) { crossgen(corlib.c_str(), nullptr); - smack_(nicorlib.c_str()); + smack_(nicorlib.c_str(), "_"); } const char* platform_dirs[] = {RuntimeDir, DeviceAPIDir, "/usr/bin"}; const char* ignores[] = {corlib.c_str()}; create_ni_under_dirs(platform_dirs, 3, ignores, 1, [](const char* ni){ - smack_(ni); + smack_(ni, "_"); }); } @@ -98,7 +103,7 @@ void create_ni_select(const char* dll_path) if (FileNotExist(nicorlib)) { crossgen(corlib.c_str(), nullptr); - smack_(nicorlib.c_str()); + smack_(nicorlib.c_str(), "_"); } if (!FileNotExist(dll_path)) @@ -109,11 +114,11 @@ void create_ni_select(const char* dll_path) crossgen(dll_path, nullptr); else printf("Already [%s] file is exist\n", ni_path.c_str()); - smack_(ni_path.c_str()); + smack_(ni_path.c_str(), "_"); } } -static void smack_(const char* dll_path) +static void smack_(const char* dll_path, const char* label) { static const char* CHKSMACK = "/usr/bin/chsmack"; pid_t pid = fork(); @@ -135,7 +140,7 @@ static void smack_(const char* dll_path) { const char* args[] = { CHKSMACK, - "-a", "_", + "-a", label, dll_path, nullptr }; @@ -259,7 +264,8 @@ static int get_root_path(const char *pkgid, std::string& root_path) static bool NIExist(const std::string& path, std::string& ni) { static const char* possible_exts[] = { - ".ni.dll", ".NI.dll", ".NI.DLL", ".ni.DLL" + ".ni.dll", ".NI.dll", ".NI.DLL", ".ni.DLL", + ".ni.exe", ".NI.exe", ".NI.EXE", ".ni.EXE" }; std::string fname = path.substr(0, path.size() - 4); @@ -302,6 +308,14 @@ void create_ni_under_dirs(const char* root_paths[], int count, const char* ignor crossgen(path, app_paths.c_str()); if (NIExist(path, ni)) { + // change owner and groups for generated ni file. + struct stat info; + if (!stat(path, &info)) { + if (chown(ni.c_str(), info.st_uid, info.st_gid) == -1) { + _ERR("Failed to change owner and group name"); + } + } + if (cb != nullptr) { cb(ni.c_str()); @@ -346,7 +360,12 @@ int create_ni_under_pkg_root(const char* pkg_name) bindir.c_str(), libdir.c_str() }; - create_ni_under_dirs(paths, 2); + + // change smack label for generated ni file. + std::string label = "User::Pkg::" + std::string(pkg_name) + "::RO"; + create_ni_under_dirs(paths, 2, [label](const char* ni){ + smack_(ni, label.c_str()); + }); return 0; } -- 2.7.4 From ab3ea98c523da53a674a94684dd3aca3e216ff6f Mon Sep 17 00:00:00 2001 From: Hyungju Lee Date: Wed, 12 Apr 2017 16:57:06 +0900 Subject: [PATCH 04/16] Remove unnecessary executable flag Change-Id: I19365bad8aa330455d69ef0cdde6a35a0261fa2c Signed-off-by: Hyungju Lee --- NativeLauncher/util/utils.cc | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 NativeLauncher/util/utils.cc diff --git a/NativeLauncher/util/utils.cc b/NativeLauncher/util/utils.cc old mode 100755 new mode 100644 -- 2.7.4 From a19b340492caefe190285e142541a920e1e5c9c1 Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Wed, 12 Apr 2017 18:34:56 +0900 Subject: [PATCH 05/16] [SVACE] Modified to initialize class members Change-Id: I284e901bec4adc73cd83fc149e469d13a3fb6ee0 --- NativeLauncher/launcher/launcher.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/NativeLauncher/launcher/launcher.cc b/NativeLauncher/launcher/launcher.cc index 63fd652..fe163ee 100644 --- a/NativeLauncher/launcher/launcher.cc +++ b/NativeLauncher/launcher/launcher.cc @@ -48,7 +48,12 @@ static Evas_Object *__win; class LaunchpadAdapterImpl : public LaunchpadAdapter { public: - LaunchpadAdapterImpl() : isLaunched(false) { } + LaunchpadAdapterImpl() : + callbacks(), + adapter(), + launcher(nullptr), + isLaunched(false) + { } void LoaderMain(int argc, char* argv[]) override; std::map Handlers; -- 2.7.4 From eaa814cf3d9cc7c8fd28a997d2797e7fdbff08ad Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Thu, 13 Apr 2017 09:52:52 +0900 Subject: [PATCH 06/16] Code style refactorting Change-Id: I5a2eb4db8edcdfa3074212c476fecd7506d11e45 --- NativeLauncher/CMakeLists.txt | 86 +-- NativeLauncher/dotnet.launcher | 8 +- NativeLauncher/dotnet.loader | 30 +- NativeLauncher/installer-plugin/common.cc | 6 +- .../installer-plugin/prefer_dotnet_aot_plugin.cc | 46 +- NativeLauncher/launcher/dotnet/dotnet_launcher.cc | 1 - NativeLauncher/launcher/dotnet/scd_launcher.cc | 590 ++++++++++----------- NativeLauncher/launcher/launcher.cc | 35 +- NativeLauncher/launcher/main.cc | 4 +- Tizen.Runtime/Tizen.Runtime.Coreclr.csproj | 96 ++-- Tizen.Runtime/Tizen.Runtime.Coreclr.project.json | 14 +- .../Tizen.Runtime.Coreclr/AssemblyManager.cs | 2 +- Tizen.Runtime/Tizen.Runtime.snk | Bin 596 -> 599 bytes dotnet-launcher.manifest | 6 +- 14 files changed, 464 insertions(+), 460 deletions(-) diff --git a/NativeLauncher/CMakeLists.txt b/NativeLauncher/CMakeLists.txt index f8a1697..4107d05 100755 --- a/NativeLauncher/CMakeLists.txt +++ b/NativeLauncher/CMakeLists.txt @@ -4,51 +4,51 @@ PROJECT("dotnet-tools") MESSAGE("CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") IF(DEFINED NO_TIZEN) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DNO_TIZEN") + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DNO_TIZEN") ELSE(DEFINED NO_TIZEN) - INCLUDE(FindPkgConfig) - PKG_CHECK_MODULES(${PROJECT_NAME} REQUIRED aul pkgmgr-info pkgmgr-installer dlog ecore bundle dlog launchpad elementary glib-2.0 capi-appfw-app-control capi-appfw-service-application) + INCLUDE(FindPkgConfig) + PKG_CHECK_MODULES(${PROJECT_NAME} REQUIRED aul pkgmgr-info pkgmgr-installer dlog ecore bundle dlog launchpad elementary glib-2.0 capi-appfw-app-control capi-appfw-service-application) ENDIF(DEFINED NO_TIZEN) FOREACH(flag ${${PROJECT_NAME}_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) IF(DEFINED LAUNCHER_CONFIG_PATH) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DLAUNCHER_CONFIG_PATH=${LAUNCHER_CONFIG_PATH}") + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DLAUNCHER_CONFIG_PATH=${LAUNCHER_CONFIG_PATH}") ENDIF(DEFINED LAUNCHER_CONFIG_PATH) IF(DEFINED CORECLR_LAUNCHER_ASSEMBLY_PATH) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DCORECLR_LAUNCHER_ASSEMBLY_PATH=${CORECLR_LAUNCHER_ASSEMBLY_PATH}") + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DCORECLR_LAUNCHER_ASSEMBLY_PATH=${CORECLR_LAUNCHER_ASSEMBLY_PATH}") ENDIF(DEFINED CORECLR_LAUNCHER_ASSEMBLY_PATH) IF(DEFINED DEVICE_API_DIR) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DDEVICE_API_DIR=${DEVICE_API_DIR}") + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DDEVICE_API_DIR=${DEVICE_API_DIR}") ENDIF(DEFINED DEVICE_API_DIR) IF(DEFINED RUNTIME_DIR) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DRUNTIME_DIR=${RUNTIME_DIR}") + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DRUNTIME_DIR=${RUNTIME_DIR}") ENDIF(DEFINED RUNTIME_DIR) IF(DEFINED CROSSGEN_PATH) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DCROSSGEN_PATH=${CROSSGEN_PATH}") + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DCROSSGEN_PATH=${CROSSGEN_PATH}") ENDIF(DEFINED CROSSGEN_PATH) IF(DEFINED VERSION) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DVERSION=${VERSION}") + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DVERSION=${VERSION}") ENDIF(DEFINED VERSION) IF(DEFINED NATIVE_LIB_DIR) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DNATIVE_LIB_DIR=${NATIVE_LIB_DIR}") + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DNATIVE_LIB_DIR=${NATIVE_LIB_DIR}") ENDIF(DEFINED NATIVE_LIB_DIR) IF(USE_MANAGED_LAUNCHER STREQUAL "ENABLE") - ADD_DEFINITIONS("-DUSE_MANAGED_LAUNCHER") + ADD_DEFINITIONS("-DUSE_MANAGED_LAUNCHER") ENDIF(USE_MANAGED_LAUNCHER) OPTION(NOT_USE_FUNCTION "Remove build warning" OFF) IF(NOT_USE_FUNCTION) - ADD_DEFINITIONS("-DNOT_USE_FUNCTION") + ADD_DEFINITIONS("-DNOT_USE_FUNCTION") ENDIF(NOT_USE_FUNCTION) @@ -71,77 +71,77 @@ INCLUDE_DIRECTORIES(inc launcher util) SET(DOTNET_LAUNCHER "dotnet-launcher") SET(${DOTNET_LAUNCHER}_SOURCE_FILES - launcher/main.cc - util/utils.cc - launcher/launcher.cc - launcher/dotnet/dotnet_launcher.cc + launcher/main.cc + util/utils.cc + launcher/launcher.cc + launcher/dotnet/dotnet_launcher.cc ) ADD_EXECUTABLE(${DOTNET_LAUNCHER} ${${DOTNET_LAUNCHER}_SOURCE_FILES}) -SET_TARGET_PROPERTIES(${DOTNET_LAUNCHER} PROPERTIES COMPILE_FLAGS "-fPIE") +SET_TARGET_PROPERTIES(${DOTNET_LAUNCHER} PROPERTIES COMPILE_FLAGS "-fPIE") SET(SCD_LAUNCHER "scd-launcher") SET(${SCD_LAUNCHER}_SOURCE_FILES - launcher/dotnet/scd_launcher.cc + launcher/dotnet/scd_launcher.cc ) ADD_EXECUTABLE(${SCD_LAUNCHER} ${${SCD_LAUNCHER}_SOURCE_FILES}) -SET_TARGET_PROPERTIES(${SCD_LAUNCHER} PROPERTIES COMPILE_FLAGS "-fPIE") +SET_TARGET_PROPERTIES(${SCD_LAUNCHER} PROPERTIES COMPILE_FLAGS "-fPIE") IF(NOT DEFINED NO_TIZEN) - TARGET_LINK_LIBRARIES(${SCD_LAUNCHER} capi-appfw-app-control dlog appcore-agent) + TARGET_LINK_LIBRARIES(${SCD_LAUNCHER} capi-appfw-app-control dlog appcore-agent) ENDIF(NOT DEFINED NO_TIZEN) TARGET_LINK_LIBRARIES(${SCD_LAUNCHER} ${${PROJECT_NAME}_LDFLAGS} "-pie -ldl -lpthread") IF(NOT DEFINED NO_TIZEN) - TARGET_LINK_LIBRARIES(${DOTNET_LAUNCHER} aul) + TARGET_LINK_LIBRARIES(${DOTNET_LAUNCHER} aul) ENDIF(NOT DEFINED NO_TIZEN) TARGET_LINK_LIBRARIES(${DOTNET_LAUNCHER} ${${PROJECT_NAME}_LDFLAGS} "-pie -ldl -lpthread") SET_TARGET_PROPERTIES(${DOTNET_LAUNCHER} - PROPERTIES SKIP_BUILD_RPATH TRUE + PROPERTIES SKIP_BUILD_RPATH TRUE ) # remove rpath option that is automatically generated by cmake. SET(NITOOL "nitool") SET(${NITOOL}_SOURCE_FILES - util/utils.cc - installer-plugin/common.cc - installer-plugin/nitool.cc + util/utils.cc + installer-plugin/common.cc + installer-plugin/nitool.cc ) ADD_EXECUTABLE(${NITOOL} ${${NITOOL}_SOURCE_FILES}) -SET_TARGET_PROPERTIES(${NITOOL} PROPERTIES COMPILE_FLAGS "-fPIE") +SET_TARGET_PROPERTIES(${NITOOL} PROPERTIES COMPILE_FLAGS "-fPIE") TARGET_LINK_LIBRARIES(${NITOOL} ${${PROJECT_NAME}_LDFLAGS} "-pie") SET(INSTALLER_PLUGIN "ui-application") SET(${INSTALLER_PLUGIN}_SOURCE_FILES - util/utils.cc - installer-plugin/common.cc - installer-plugin/ui-application.cc + util/utils.cc + installer-plugin/common.cc + installer-plugin/ui-application.cc ) ADD_LIBRARY(${INSTALLER_PLUGIN} SHARED ${${INSTALLER_PLUGIN}_SOURCE_FILES}) -SET_TARGET_PROPERTIES(${INSTALLER_PLUGIN} PROPERTIES COMPILE_FLAGS "-fPIC") +SET_TARGET_PROPERTIES(${INSTALLER_PLUGIN} PROPERTIES COMPILE_FLAGS "-fPIC") TARGET_LINK_LIBRARIES(${INSTALLER_PLUGIN} ${${PROJECT_NAME}_LDFLAGS}) SET(PREFER_DOTNET_AOT_PLUGIN "prefer_dotnet_aot_plugin") SET(${PREFER_DOTNET_AOT_PLUGIN}_SOURCE_FILES - util/utils.cc - installer-plugin/common.cc - installer-plugin/prefer_dotnet_aot_plugin.cc + util/utils.cc + installer-plugin/common.cc + installer-plugin/prefer_dotnet_aot_plugin.cc ) ADD_LIBRARY(${PREFER_DOTNET_AOT_PLUGIN} SHARED ${${PREFER_DOTNET_AOT_PLUGIN}_SOURCE_FILES}) -SET_TARGET_PROPERTIES(${PREFER_DOTNET_AOT_PLUGIN} PROPERTIES COMPILE_FLAGS "-fPIC") +SET_TARGET_PROPERTIES(${PREFER_DOTNET_AOT_PLUGIN} PROPERTIES COMPILE_FLAGS "-fPIC") TARGET_LINK_LIBRARIES(${PREFER_DOTNET_AOT_PLUGIN} ${${PROJECT_NAME}_LDFLAGS}) IF(NOT DEFINED NO_TIZEN) - INSTALL(TARGETS ${DOTNET_LAUNCHER} DESTINATION ${BINDIR}) - INSTALL(TARGETS ${SCD_LAUNCHER} DESTINATION ${BINDIR}) - INSTALL(TARGETS ${NITOOL} DESTINATION ${BINDIR}) - INSTALL(TARGETS ${INSTALLER_PLUGIN} DESTINATION ${INSTALL_PLUGIN_DIR}) - INSTALL(TARGETS ${PREFER_DOTNET_AOT_PLUGIN} DESTINATION ${INSTALL_MDPLUGIN_DIR}) - INSTALL(FILES dotnet.loader DESTINATION ${LOADERDIR}) - INSTALL(FILES dotnet.launcher DESTINATION ${LOADERDIR}) - INSTALL(FILES dotnet.debugger DESTINATION ${LOADERDIR}) + INSTALL(TARGETS ${DOTNET_LAUNCHER} DESTINATION ${BINDIR}) + INSTALL(TARGETS ${SCD_LAUNCHER} DESTINATION ${BINDIR}) + INSTALL(TARGETS ${NITOOL} DESTINATION ${BINDIR}) + INSTALL(TARGETS ${INSTALLER_PLUGIN} DESTINATION ${INSTALL_PLUGIN_DIR}) + INSTALL(TARGETS ${PREFER_DOTNET_AOT_PLUGIN} DESTINATION ${INSTALL_MDPLUGIN_DIR}) + INSTALL(FILES dotnet.loader DESTINATION ${LOADERDIR}) + INSTALL(FILES dotnet.launcher DESTINATION ${LOADERDIR}) + INSTALL(FILES dotnet.debugger DESTINATION ${LOADERDIR}) ENDIF(NOT DEFINED NO_TIZEN) diff --git a/NativeLauncher/dotnet.launcher b/NativeLauncher/dotnet.launcher index 846e372..7a96952 100644 --- a/NativeLauncher/dotnet.launcher +++ b/NativeLauncher/dotnet.launcher @@ -1,6 +1,6 @@ [LAUNCHER] -NAME dotnet-launcher -EXE /usr/bin/dotnet-launcher -APP_TYPE dotnet -EXTRA_ARG --standalone +NAME dotnet-launcher +EXE /usr/bin/dotnet-launcher +APP_TYPE dotnet +EXTRA_ARG --standalone diff --git a/NativeLauncher/dotnet.loader b/NativeLauncher/dotnet.loader index 57b547d..78bb74f 100644 --- a/NativeLauncher/dotnet.loader +++ b/NativeLauncher/dotnet.loader @@ -1,16 +1,16 @@ [LOADER] -NAME dotnet-launcher -EXE /usr/bin/dotnet-launcher -APP_TYPE dotnet -DETECTION_METHOD TIMEOUT|DEMAND -TIMEOUT 5000 -EXTRA_ARRAY preload -EXTRA_ARRAY_VAL /usr/lib/libappcore-efl.so.1 -EXTRA_ARRAY_VAL /usr/lib/libappcore-common.so.1 -EXTRA_ARRAY_VAL /usr/lib/libcapi-appfw-application.so.0 -EXTRA_ARRAY_VAL /usr/lib/ecore_imf/modules/wayland/v-1.16/libwltextinputmodule.so -EXTRA_ARRAY_VAL /usr/lib/libdali-toolkit.so -EXTRA_ARRAY_VAL /usr/lib/libcairo.so.2 -EXTRA_ARRAY_VAL /usr/lib/libefl-assist.so.0 -EXTRA_ARRAY_VAL /usr/lib/libcapi-media-player.so.0 -EXTRA_ARRAY_VAL /usr/lib/libcapi-media-camera.so.0 +NAME dotnet-launcher +EXE /usr/bin/dotnet-launcher +APP_TYPE dotnet +DETECTION_METHOD TIMEOUT|DEMAND +TIMEOUT 5000 +EXTRA_ARRAY preload +EXTRA_ARRAY_VAL /usr/lib/libappcore-efl.so.1 +EXTRA_ARRAY_VAL /usr/lib/libappcore-common.so.1 +EXTRA_ARRAY_VAL /usr/lib/libcapi-appfw-application.so.0 +EXTRA_ARRAY_VAL /usr/lib/ecore_imf/modules/wayland/v-1.16/libwltextinputmodule.so +EXTRA_ARRAY_VAL /usr/lib/libdali-toolkit.so +EXTRA_ARRAY_VAL /usr/lib/libcairo.so.2 +EXTRA_ARRAY_VAL /usr/lib/libefl-assist.so.0 +EXTRA_ARRAY_VAL /usr/lib/libcapi-media-player.so.0 +EXTRA_ARRAY_VAL /usr/lib/libcapi-media-camera.so.0 diff --git a/NativeLauncher/installer-plugin/common.cc b/NativeLauncher/installer-plugin/common.cc index d2c9c3f..6473dc8 100644 --- a/NativeLauncher/installer-plugin/common.cc +++ b/NativeLauncher/installer-plugin/common.cc @@ -310,8 +310,10 @@ void create_ni_under_dirs(const char* root_paths[], int count, const char* ignor { // change owner and groups for generated ni file. struct stat info; - if (!stat(path, &info)) { - if (chown(ni.c_str(), info.st_uid, info.st_gid) == -1) { + if (!stat(path, &info)) + { + if (chown(ni.c_str(), info.st_uid, info.st_gid) == -1) + { _ERR("Failed to change owner and group name"); } } diff --git a/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc b/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc index f180739..a9c940b 100755 --- a/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc +++ b/NativeLauncher/installer-plugin/prefer_dotnet_aot_plugin.cc @@ -37,30 +37,34 @@ const std::string VALUE_TRUE = "true"; const std::string mdKey = "http://tizen.org/metadata/prefer_dotnet_aot"; extern "C" int PKGMGR_MDPARSER_PLUGIN_INSTALL (const char *pkgid, const char *appid, GList *list) { - - GList *tag = NULL; - bool mdValue = false; - Metadata *mdInfo = NULL; - tag = g_list_first(list); - while (tag) { - mdInfo = (Metadata*)tag->data; - if(mdInfo->key == mdKey && mdInfo->value == VALUE_TRUE) { - _DBG("Prefer dotnet application AOT set TRUE"); - mdValue = true; - } - tag = g_list_next(tag); + GList *tag = NULL; + bool mdValue = false; + Metadata *mdInfo = NULL; + tag = g_list_first(list); + while (tag) + { + mdInfo = (Metadata*)tag->data; + if(mdInfo->key == mdKey && mdInfo->value == VALUE_TRUE) + { + _DBG("Prefer dotnet application AOT set TRUE"); + mdValue = true; } + tag = g_list_next(tag); + } - if (mdValue) { - if (create_ni_under_pkg_root(pkgid) != 0) - { - _ERR("Failed to get root path from [%s]", pkgid); - return -1; - } else { - _DBG("Complete make application to native image"); - } + if (mdValue) + { + if (create_ni_under_pkg_root(pkgid) != 0) + { + _ERR("Failed to get root path from [%s]", pkgid); + return -1; + } + else + { + _DBG("Complete make application to native image"); } - return 0; + } + return 0; } extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE (const char *pkgid, const char *appid, GList *list) diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc index 4aabf42..5f40771 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc @@ -73,7 +73,6 @@ CoreRuntime::~CoreRuntime() int CoreRuntime::Initialize(bool standalone) { - if (standalone) { const char *_deviceapi_directory = getenv("DeviceAPIDirectory"); diff --git a/NativeLauncher/launcher/dotnet/scd_launcher.cc b/NativeLauncher/launcher/dotnet/scd_launcher.cc index 2959b19..138d9f4 100644 --- a/NativeLauncher/launcher/dotnet/scd_launcher.cc +++ b/NativeLauncher/launcher/dotnet/scd_launcher.cc @@ -49,7 +49,6 @@ using namespace std; - bool isDebugMode = false; char *coreclr_gdbjit[PATH_MAX]; char *root_path; @@ -73,12 +72,15 @@ void service_app_control(app_control_h app_control, void *data) char* buf[82]; int ret = app_control_get_extra_data(app_control, "_SCD_DEBUG_", buf); - if (ret == APP_CONTROL_ERROR_NONE) { - if(strcmp(*buf, "1") == 0) { + if (ret == APP_CONTROL_ERROR_NONE) + { + if(strcmp(*buf, "1") == 0) + { isDebugMode = true; } } - if (isDebugMode) { + if (isDebugMode) + { ret = app_control_get_extra_data(app_control, "_SCD_CORECLR_GDBJIT_", coreclr_gdbjit); } @@ -116,15 +118,15 @@ bool GetEntrypointExecutableAbsolutePath(std::string& entrypointExecutable) char exe[PATH_MAX]; ssize_t res = readlink(symlinkEntrypointExecutable, exe, PATH_MAX - 1); if (res != -1) - { - exe[res] = '\0'; - entrypointExecutable.assign(exe); - result = true; - } + { + exe[res] = '\0'; + entrypointExecutable.assign(exe); + result = true; + } else - { - result = false; - } + { + result = false; + } return result; } @@ -135,28 +137,26 @@ bool GetAbsolutePath(const char* path, std::string& absolutePath) char realPath[PATH_MAX]; if (realpath(path, realPath) != nullptr && realPath[0] != '\0') - { - absolutePath.assign(realPath); - // realpath should return canonicalized path without the trailing slash - assert(absolutePath.back() != '/'); + { + absolutePath.assign(realPath); + // realpath should return canonicalized path without the trailing slash + assert(absolutePath.back() != '/'); - result = true; - } + result = true; + } return result; } - - bool GetDirectory(const char* absolutePath, std::string& directory) { directory.assign(absolutePath); size_t lastSlash = directory.rfind('/'); if (lastSlash != std::string::npos) - { - directory.erase(lastSlash); - return true; - } + { + directory.erase(lastSlash); + return true; + } return false; } @@ -166,25 +166,25 @@ bool GetClrFilesAbsolutePath(const char* currentExePath, const char* clrFilesPat std::string clrFilesRelativePath; const char* clrFilesPathLocal = clrFilesPath; if (clrFilesPathLocal == nullptr) + { + // There was no CLR files path specified, use the folder of the corerun/coreconsole + if (!GetDirectory(currentExePath, clrFilesRelativePath)) { - // There was no CLR files path specified, use the folder of the corerun/coreconsole - if (!GetDirectory(currentExePath, clrFilesRelativePath)) - { - perror("Failed to get directory from argv[0]"); - return false; - } + perror("Failed to get directory from argv[0]"); + return false; + } - clrFilesPathLocal = clrFilesRelativePath.c_str(); + clrFilesPathLocal = clrFilesRelativePath.c_str(); - // TODO: consider using an env variable (if defined) as a fall-back. - // The windows version of the corerun uses core_root env variable - } + // TODO: consider using an env variable (if defined) as a fall-back. + // The windows version of the corerun uses core_root env variable + } if (!GetAbsolutePath(clrFilesPathLocal, clrFilesAbsolutePath)) - { - perror("Failed to convert CLR files path to absolute path"); - return false; - } + { + perror("Failed to convert CLR files path to absolute path"); + return false; + } return true; } @@ -200,96 +200,93 @@ void AddFilesFromDirectoryToTpaList(const char* directory, std::string& tpaList) DIR* dir = opendir(directory); if (dir == nullptr) - { - return; - } + { + return; + } std::set addedAssemblies; // Walk the directory for each extension separately so that we first get files with .ni.dll extension, // then files with .dll extension, etc. for (unsigned int extIndex = 0; extIndex < sizeof(tpaExtensions) / sizeof(tpaExtensions[0]); extIndex++) - { - const char* ext = tpaExtensions[extIndex]; - int extLength = strlen(ext); + { + const char* ext = tpaExtensions[extIndex]; + int extLength = strlen(ext); + + struct dirent* entry; - struct dirent* entry; + // For all entries in the directory + while ((entry = readdir(dir)) != nullptr) + { + // We are interested in files only + switch (entry->d_type) + { + case DT_REG: + break; - // For all entries in the directory - while ((entry = readdir(dir)) != nullptr) + // Handle symlinks and file systems that do not support d_type + case DT_LNK: + case DT_UNKNOWN: { - // We are interested in files only - switch (entry->d_type) + std::string fullFilename; + + fullFilename.append(directory); + fullFilename.append("/"); + fullFilename.append(entry->d_name); + + struct stat sb; + if (stat(fullFilename.c_str(), &sb) == -1) { - case DT_REG: - break; - - // Handle symlinks and file systems that do not support d_type - case DT_LNK: - case DT_UNKNOWN: - { - std::string fullFilename; - - fullFilename.append(directory); - fullFilename.append("/"); - fullFilename.append(entry->d_name); - - struct stat sb; - if (stat(fullFilename.c_str(), &sb) == -1) - { - continue; - } - - if (!S_ISREG(sb.st_mode)) - { - continue; - } - } - break; - - default: continue; } - std::string filename(entry->d_name); - - // Check if the extension matches the one we are looking for - int extPos = filename.length() - extLength; - if ((extPos <= 0) || (filename.compare(extPos, extLength, ext) != 0)) + if (!S_ISREG(sb.st_mode)) { continue; } + } + break; - std::string filenameWithoutExt(filename.substr(0, extPos)); + default: + continue; + } - // Make sure if we have an assembly with multiple extensions present, - // we insert only one version of it. - if (addedAssemblies.find(filenameWithoutExt) == addedAssemblies.end()) - { - addedAssemblies.insert(filenameWithoutExt); + std::string filename(entry->d_name); - tpaList.append(directory); - tpaList.append("/"); - tpaList.append(filename); - tpaList.append(":"); - } - } + // Check if the extension matches the one we are looking for + int extPos = filename.length() - extLength; + if ((extPos <= 0) || (filename.compare(extPos, extLength, ext) != 0)) + { + continue; + } + + std::string filenameWithoutExt(filename.substr(0, extPos)); - // Rewind the directory stream to be able to iterate over it for the next extension - rewinddir(dir); + // Make sure if we have an assembly with multiple extensions present, + // we insert only one version of it. + if (addedAssemblies.find(filenameWithoutExt) == addedAssemblies.end()) + { + addedAssemblies.insert(filenameWithoutExt); + + tpaList.append(directory); + tpaList.append("/"); + tpaList.append(filename); + tpaList.append(":"); + } } + // Rewind the directory stream to be able to iterate over it for the next extension + rewinddir(dir); + } + closedir(dir); } - - -int ExecuteManagedAssembly( - const char* currentExeAbsolutePath, - const char* clrFilesAbsolutePath, - const char* managedAssemblyAbsolutePath, - int managedAssemblyArgc, - const char** managedAssemblyArgv) +int ExecuteManagedAssembly(const char* currentExeAbsolutePath, + const char* clrFilesAbsolutePath, + const char* managedAssemblyAbsolutePath, + int managedAssemblyArgc, + const char** managedAssemblyArgv) { // Indicates failure int exitCode = -1; @@ -313,10 +310,10 @@ int ExecuteManagedAssembly( coreClrDllPath.append(coreClrDll); if (coreClrDllPath.length() >= PATH_MAX) - { - fprintf(stderr, "Absolute path to libcoreclr.so too long\n"); - return -1; - } + { + fprintf(stderr, "Absolute path to libcoreclr.so too long\n"); + return -1; + } // Get just the path component of the managed assembly path std::string appPath; @@ -327,14 +324,14 @@ int ExecuteManagedAssembly( std::string nativeDllSearchDirs(appPath); char *coreLibraries = getenv("CORE_LIBRARIES"); if (coreLibraries) + { + nativeDllSearchDirs.append(":"); + nativeDllSearchDirs.append(coreLibraries); + if (std::strcmp(coreLibraries, clrFilesAbsolutePath) != 0) { - nativeDllSearchDirs.append(":"); - nativeDllSearchDirs.append(coreLibraries); - if (std::strcmp(coreLibraries, clrFilesAbsolutePath) != 0) - { - AddFilesFromDirectoryToTpaList(coreLibraries, tpaList); - } + AddFilesFromDirectoryToTpaList(coreLibraries, tpaList); } + } nativeDllSearchDirs.append(":"); nativeDllSearchDirs.append(clrFilesAbsolutePath); @@ -342,123 +339,121 @@ int ExecuteManagedAssembly( void* coreclrLib = dlopen(coreClrDllPath.c_str(), RTLD_NOW | RTLD_LOCAL); if (coreclrLib != nullptr) - { - coreclr_initialize_ptr initializeCoreCLR = (coreclr_initialize_ptr)dlsym(coreclrLib, "coreclr_initialize"); - coreclr_execute_assembly_ptr executeAssembly = (coreclr_execute_assembly_ptr)dlsym(coreclrLib, "coreclr_execute_assembly"); - coreclr_shutdown_ptr shutdownCoreCLR = (coreclr_shutdown_ptr)dlsym(coreclrLib, "coreclr_shutdown"); + { + coreclr_initialize_ptr initializeCoreCLR = (coreclr_initialize_ptr)dlsym(coreclrLib, "coreclr_initialize"); + coreclr_execute_assembly_ptr executeAssembly = (coreclr_execute_assembly_ptr)dlsym(coreclrLib, "coreclr_execute_assembly"); + coreclr_shutdown_ptr shutdownCoreCLR = (coreclr_shutdown_ptr)dlsym(coreclrLib, "coreclr_shutdown"); - if (initializeCoreCLR == nullptr) - { - fprintf(stderr, "Function coreclr_initialize not found in the libcoreclr.so\n"); - } - else if (executeAssembly == nullptr) - { - fprintf(stderr, "Function coreclr_execute_assembly not found in the libcoreclr.so\n"); - } - else if (shutdownCoreCLR == nullptr) - { - fprintf(stderr, "Function coreclr_shutdown not found in the libcoreclr.so\n"); - } + if (initializeCoreCLR == nullptr) + { + fprintf(stderr, "Function coreclr_initialize not found in the libcoreclr.so\n"); + } + else if (executeAssembly == nullptr) + { + fprintf(stderr, "Function coreclr_execute_assembly not found in the libcoreclr.so\n"); + } + else if (shutdownCoreCLR == nullptr) + { + fprintf(stderr, "Function coreclr_shutdown not found in the libcoreclr.so\n"); + } + else + { + // Check whether we are enabling server GC (off by default) + const char* useServerGc = std::getenv(serverGcVar); + if (useServerGc == nullptr) + { + useServerGc = "0"; + } + + // CoreCLR expects strings "true" and "false" instead of "1" and "0". + useServerGc = std::strcmp(useServerGc, "1") == 0 ? "true" : "false"; + + // Allowed property names: + // APPBASE + // - The base path of the application from which the exe and other assemblies will be loaded + // + // TRUSTED_PLATFORM_ASSEMBLIES + // - The list of complete paths to each of the fully trusted assemblies + // + // APP_PATHS + // - The list of paths which will be probed by the assembly loader + // + // APP_NI_PATHS + // - The list of additional paths that the assembly loader will probe for ngen images + // + // NATIVE_DLL_SEARCH_DIRECTORIES + // - The list of paths that will be probed for native DLLs called by PInvoke + // + const char *propertyKeys[] = { + "TRUSTED_PLATFORM_ASSEMBLIES", + "APP_PATHS", + "APP_NI_PATHS", + "NATIVE_DLL_SEARCH_DIRECTORIES", + "System.GC.Server", + }; + const char *propertyValues[] = { + // TRUSTED_PLATFORM_ASSEMBLIES + tpaList.c_str(), + // APP_PATHS + appPath.c_str(), + // APP_NI_PATHS + appPath.c_str(), + // NATIVE_DLL_SEARCH_DIRECTORIES + nativeDllSearchDirs.c_str(), + // System.GC.Server + useServerGc, + }; + + void* hostHandle; + unsigned int domainId; + + int st = initializeCoreCLR(currentExeAbsolutePath, + "unixcorerun", + sizeof(propertyKeys) / sizeof(propertyKeys[0]), + propertyKeys, + propertyValues, + &hostHandle, + &domainId); + + if (!SUCCEEDED(st)) + { + fprintf(stderr, "coreclr_initialize failed - status: 0x%08x\n", st); + exitCode = -1; + } else + { + st = executeAssembly(hostHandle, + domainId, + managedAssemblyArgc, + managedAssemblyArgv, + managedAssemblyAbsolutePath, + (unsigned int*)&exitCode); + + if (!SUCCEEDED(st)) { - // Check whether we are enabling server GC (off by default) - const char* useServerGc = std::getenv(serverGcVar); - if (useServerGc == nullptr) - { - useServerGc = "0"; - } - - // CoreCLR expects strings "true" and "false" instead of "1" and "0". - useServerGc = std::strcmp(useServerGc, "1") == 0 ? "true" : "false"; - - // Allowed property names: - // APPBASE - // - The base path of the application from which the exe and other assemblies will be loaded - // - // TRUSTED_PLATFORM_ASSEMBLIES - // - The list of complete paths to each of the fully trusted assemblies - // - // APP_PATHS - // - The list of paths which will be probed by the assembly loader - // - // APP_NI_PATHS - // - The list of additional paths that the assembly loader will probe for ngen images - // - // NATIVE_DLL_SEARCH_DIRECTORIES - // - The list of paths that will be probed for native DLLs called by PInvoke - // - const char *propertyKeys[] = { - "TRUSTED_PLATFORM_ASSEMBLIES", - "APP_PATHS", - "APP_NI_PATHS", - "NATIVE_DLL_SEARCH_DIRECTORIES", - "System.GC.Server", - }; - const char *propertyValues[] = { - // TRUSTED_PLATFORM_ASSEMBLIES - tpaList.c_str(), - // APP_PATHS - appPath.c_str(), - // APP_NI_PATHS - appPath.c_str(), - // NATIVE_DLL_SEARCH_DIRECTORIES - nativeDllSearchDirs.c_str(), - // System.GC.Server - useServerGc, - }; - - void* hostHandle; - unsigned int domainId; - - int st = initializeCoreCLR( - currentExeAbsolutePath, - "unixcorerun", - sizeof(propertyKeys) / sizeof(propertyKeys[0]), - propertyKeys, - propertyValues, - &hostHandle, - &domainId); - - if (!SUCCEEDED(st)) - { - fprintf(stderr, "coreclr_initialize failed - status: 0x%08x\n", st); - exitCode = -1; - } - else - { - st = executeAssembly( - hostHandle, - domainId, - managedAssemblyArgc, - managedAssemblyArgv, - managedAssemblyAbsolutePath, - (unsigned int*)&exitCode); - - if (!SUCCEEDED(st)) - { - fprintf(stderr, "coreclr_execute_assembly failed - status: 0x%08x\n", st); - exitCode = -1; - } - - st = shutdownCoreCLR(hostHandle, domainId); - if (!SUCCEEDED(st)) - { - fprintf(stderr, "coreclr_shutdown failed - status: 0x%08x\n", st); - exitCode = -1; - } - } + fprintf(stderr, "coreclr_execute_assembly failed - status: 0x%08x\n", st); + exitCode = -1; } - if (dlclose(coreclrLib) != 0) + st = shutdownCoreCLR(hostHandle, domainId); + if (!SUCCEEDED(st)) { - fprintf(stderr, "Warning - dlclose failed\n"); + fprintf(stderr, "coreclr_shutdown failed - status: 0x%08x\n", st); + exitCode = -1; } + } } - else + + if (dlclose(coreclrLib) != 0) { - const char* error = dlerror(); - fprintf(stderr, "dlopen failed to open the libcoreclr.so with error %s\n", error); + fprintf(stderr, "Warning - dlclose failed\n"); } + } + else + { + const char* error = dlerror(); + fprintf(stderr, "dlopen failed to open the libcoreclr.so with error %s\n", error); + } return exitCode; } @@ -467,8 +462,7 @@ int ExecuteManagedAssembly( // Display the help text void DisplayUsage() { - fprintf( - stderr, + fprintf(stderr, "Runs executables on CoreCLR\n\n" "Usage: [OPTIONS] [ARGUMENTS]\n" "Runs .dll on CoreCLR.\n\n" @@ -492,52 +486,52 @@ bool ParseArguments( *managedAssemblyArgc = 0; for (int i = 1; i < argc; i++) + { + // Check for options. Options to the Unix coreconsole are prefixed with '-_' to match the convention + // used in the Windows version of coreconsole. + if (strncmp(argv[i], "-_", 2) == 0) { - // Check for options. Options to the Unix coreconsole are prefixed with '-_' to match the convention - // used in the Windows version of coreconsole. - if (strncmp(argv[i], "-_", 2) == 0) + // Path to the libcoreclr.so and the managed CLR assemblies + if (strcmp(argv[i], "-_c") == 0) + { + i++; + if (i < argc) { - // Path to the libcoreclr.so and the managed CLR assemblies - if (strcmp(argv[i], "-_c") == 0) - { - i++; - if (i < argc) - { - *clrFilesPath = argv[i]; - } - else - { - fprintf(stderr, "Option %s: missing path\n", argv[i - 1]); - success = false; - break; - } - } - else if (strcmp(argv[i], "-_h") == 0) - { - DisplayUsage(); - success = false; - break; - } - else - { - fprintf(stderr, "Unknown option %s\n", argv[i]); - success = false; - break; - } + *clrFilesPath = argv[i]; } - else + else { - // We treat everything starting from the first non-option argument as arguments - // to the managed assembly. - *managedAssemblyArgc = argc - i; - if (*managedAssemblyArgc != 0) - { - *managedAssemblyArgv = &argv[i]; - } - + fprintf(stderr, "Option %s: missing path\n", argv[i - 1]); + success = false; break; } + } + else if (strcmp(argv[i], "-_h") == 0) + { + DisplayUsage(); + success = false; + break; + } + else + { + fprintf(stderr, "Unknown option %s\n", argv[i]); + success = false; + break; + } + } + else + { + // We treat everything starting from the first non-option argument as arguments + // to the managed assembly. + *managedAssemblyArgc = argc - i; + if (*managedAssemblyArgc != 0) + { + *managedAssemblyArgv = &argv[i]; + } + + break; } + } return success; } @@ -550,7 +544,8 @@ int main(const int argc, const char* argv[]) // This routine check whether _SCD_DEBUG_ flag is set(1) or not. // In second pass, this routine is skipped. - if (second_pass == NULL) { + if (second_pass == NULL) + { // run service_app routine to extract _SCD_DEBUG_ char ad[50] = {0,}; service_app_lifecycle_callback_s event_callback; @@ -564,7 +559,8 @@ int main(const int argc, const char* argv[]) vector vargs; int status = 0; - if (isDebugMode) { + if (isDebugMode) + { dlog_print(DLOG_INFO,"dotnet","debugmode on\n"); setenv("CORECLR_GDBJIT", *coreclr_gdbjit, 1); @@ -583,37 +579,37 @@ int main(const int argc, const char* argv[]) vargs.push_back(buf); // Pass app argument to lldb-server as it is - for (int i=1; i Handlers; @@ -134,31 +139,31 @@ static void Fd_Remove(void *data, int fd) static void PreloadLibsAndWindow(bundle *extra, int type, void *user_data) { - int elm_init_cnt = 0; + int elm_init_cnt = 0; const char **so_array; int len = 0; int i; void *handle = NULL; // Preload native libraries - if (extra == NULL) { - _DBG("No extra data"); - return; - } + if (extra == NULL) { + _DBG("No extra data"); + return; + } - so_array = bundle_get_str_array(extra, "preload", &len); + so_array = bundle_get_str_array(extra, "preload", &len); - if (!so_array) - return; + if (!so_array) + return; - for (i = 0; i < len; i++) { - handle = dlopen(so_array[i], RTLD_NOW); - _DBG("preload %s# - handle : %x", so_array[i], handle); - } + for (i = 0; i < len; i++) { + handle = dlopen(so_array[i], RTLD_NOW); + _DBG("preload %s# - handle : %x", so_array[i], handle); + } // Precreate window - elm_init_cnt = elm_init(__argc, __argv); - _DBG("[candidate] elm init, returned: %d", elm_init_cnt); + elm_init_cnt = elm_init(__argc, __argv); + _DBG("[candidate] elm init, returned: %d", elm_init_cnt); elm_config_accel_preference_set("hw"); diff --git a/NativeLauncher/launcher/main.cc b/NativeLauncher/launcher/main.cc index 9bd024c..a25eaae 100644 --- a/NativeLauncher/launcher/main.cc +++ b/NativeLauncher/launcher/main.cc @@ -109,8 +109,8 @@ int main(int argc, char *argv[]) char** args = &vargs[0]; if (runtime->Launch(appid, approot.c_str(), standalonePath, args_len, args)) { - _ERR("Failed to launch"); - return 0; + _ERR("Failed to launch"); + return 0; } } else diff --git a/Tizen.Runtime/Tizen.Runtime.Coreclr.csproj b/Tizen.Runtime/Tizen.Runtime.Coreclr.csproj index 6bf5754..c08b73f 100644 --- a/Tizen.Runtime/Tizen.Runtime.Coreclr.csproj +++ b/Tizen.Runtime/Tizen.Runtime.Coreclr.csproj @@ -1,12 +1,12 @@ - - - Debug - AnyCPU - library - Tizen.Runtime.Coreclr - + + + Debug + AnyCPU + library + Tizen.Runtime.Coreclr + .NETStandard @@ -17,47 +17,47 @@ $(NoWarn);1701;1702 - - true - full - bin/ - DEBUG;TRACE - + + true + full + bin/ + DEBUG;TRACE + - - pdbonly - true - bin/ + + pdbonly + true + bin/ TRACE - + - - $(DefineConstants);CLOG - + + $(DefineConstants);CLOG + - - - - - - + + + + + + - - - + + + - + - - - $(DefineConstants);CLOG - - - - - - - - - - - - - - - - - - - - - - - <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory) - <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory) - true - - - - - - <_Parameter1>PreloadPath=$(PreloadPath) - - - - - - - - - diff --git a/Tizen.Runtime/Tizen.Runtime.Coreclr.project.json b/Tizen.Runtime/Tizen.Runtime.Coreclr.project.json deleted file mode 100644 index ff2957d..0000000 --- a/Tizen.Runtime/Tizen.Runtime.Coreclr.project.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dependencies": { - "NETStandard.Library": "1.6.0", - "System.Runtime.Loader": "4.0.0" - }, - "frameworks": { - "netstandard1.5": {} - } -} - diff --git a/Tizen.Runtime/Tizen.Runtime.csproj b/Tizen.Runtime/Tizen.Runtime.csproj new file mode 100644 index 0000000..a232a3a --- /dev/null +++ b/Tizen.Runtime/Tizen.Runtime.csproj @@ -0,0 +1,11 @@ + + + + netstandard1.6 + + + + + + + \ No newline at end of file diff --git a/Tizen.Runtime/Tizen.Runtime.snk b/Tizen.Runtime/Tizen.Runtime.snk deleted file mode 100644 index d09238fad5d4ac1671b141956034cca2ec3ce802..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 599 zcmV-d0;v550ssI2Bme+XQ$aES1ONaL0002(DGq5;*iDNmD`i!-W57Gx1KS<*(EK%3 zW@B-ZpEPiJ0fkn2_41G@5}84M{UB8~_RT4uZL3`+#TA8&{$_d&u>Cb>&i6riJ-$y6 zuB_`PSeaKUOC)MY%xjZE{2`Isnfaoi?2(H)pBE z1Xh7WLmh?%QqZWwun;}Hx8_jq>#heY*CApiQ7I;cFK6G8`TMr8Z3sO>Wwq|_K-Z%s z;P2$CvTD;C!#sg|0ZrX&h=RkOfW+@t$YU^?)jC{*p+dsOx(-o({!dOjgKh^tw<7&{ z^sgy+GVAnmKDer~rk7Zm#LdH!jI)4Kj{d`zc1@zij|;CUgc zs)cT0>q!UX)fhEr+O7o*w=R?B2l~UYrKC^NL#vc1x}(U-r^19lSv0>Kgc^?*0drAG z7}{#(d}nE8Q=U!@B$^Uvm?guBL0Go+c|JBw)sYMoiSvhE_YrZ`zgZ~WT0o17&E=O# zQU}2^(7;Ny6{||(84$e=!b`svpBzxi!5| Date: Tue, 25 Apr 2017 13:10:08 +0900 Subject: [PATCH 11/16] fix standalone crash issue Change-Id: I62c0a302248bdd0f6a304300f6ba535604acf39d --- NativeLauncher/launcher/main.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NativeLauncher/launcher/main.cc b/NativeLauncher/launcher/main.cc index 5754589..2bbda72 100644 --- a/NativeLauncher/launcher/main.cc +++ b/NativeLauncher/launcher/main.cc @@ -83,9 +83,12 @@ int main(int argc, char *argv[]) const char* appRootPath = aul_get_app_root_path(); if (appRootPath != nullptr) appRoot = std::string(appRootPath); + } else { + appId = "dotnet-launcher"; } + if (appRoot.empty()) - appRoot = baseName(standalonePath); + appRoot = baseName(baseName(standalonePath)); if (runtime->initialize(true) != 0) { _ERR("Failed to initialize"); return 1; -- 2.7.4 From 3b7059d73a89354e085156eda18af02892ecc828 Mon Sep 17 00:00:00 2001 From: Inhwan Lee Date: Tue, 25 Apr 2017 13:55:35 +0900 Subject: [PATCH 12/16] set env UNW_ARM_UNWIND_METHOD value on ARM platform Change-Id: Iab10502bc55f5bea33cf553a14838bdb56f6afd2 --- NativeLauncher/launcher/dotnet/dotnet_launcher.cc | 14 ++++++++++++++ NativeLauncher/launcher/dotnet/scd_launcher.cc | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc index d3df80e..c0b5300 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc @@ -73,6 +73,20 @@ CoreRuntime::~CoreRuntime() int CoreRuntime::initialize(bool standalone) { +#ifdef __arm__ + // libunwind library is used to unwind stack frame, but libunwind for ARM + // does not support ARM vfpv3/NEON registers in DWARF format correctly. + // Therefore let's disable stack unwinding using DWARF information + // See https://github.com/dotnet/coreclr/issues/6698 + // + // libunwind use following methods to unwind stack frame. + // UNW_ARM_METHOD_ALL 0xFF + // UNW_ARM_METHOD_DWARF 0x01 + // UNW_ARM_METHOD_FRAME 0x02 + // UNW_ARM_METHOD_EXIDX 0x04 + putenv(const_cast("UNW_ARM_UNWIND_METHOD=6")); +#endif // __arm__ + if (standalone) { const char *deviceApiDirectory = getenv("__deviceAPIDirectory"); const char *runtimeDirectory = getenv("__runtimeDirectory"); diff --git a/NativeLauncher/launcher/dotnet/scd_launcher.cc b/NativeLauncher/launcher/dotnet/scd_launcher.cc index 029e93c..7bbd883 100644 --- a/NativeLauncher/launcher/dotnet/scd_launcher.cc +++ b/NativeLauncher/launcher/dotnet/scd_launcher.cc @@ -266,7 +266,7 @@ int executeManagedAssembly(const char* currentExeAbsolutePath, // Indicates failure int exitCode = -1; -#ifdef _ARM_ +#ifdef __arm__ // libunwind library is used to unwind stack frame, but libunwind for ARM // does not support ARM vfpv3/NEON registers in DWARF format correctly. // Therefore let's disable stack unwinding using DWARF information @@ -278,7 +278,7 @@ int executeManagedAssembly(const char* currentExeAbsolutePath, // UNW_ARM_METHOD_FRAME 0x02 // UNW_ARM_METHOD_EXIDX 0x04 putenv(const_cast("UNW_ARM_UNWIND_METHOD=6")); -#endif // _ARM_ +#endif // __arm__ std::string coreClrDllPath(clrFilesAbsolutePath); coreClrDllPath.append("/"); -- 2.7.4 From 323150bea27f1ebada1399e51ceba0c01b0606ed Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Tue, 25 Apr 2017 17:26:05 +0900 Subject: [PATCH 13/16] Bug fixed for performance_test Change-Id: I7e3e42defbd9cf25da8d605c2d8dc8cc75267a18 --- tools/performance_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/performance_test.sh b/tools/performance_test.sh index 37b7950..43b7962 100755 --- a/tools/performance_test.sh +++ b/tools/performance_test.sh @@ -145,7 +145,7 @@ execute_time_stamp_auto_memory () echo "[>] Start performance test that applciation launching memory" echo "" sdb shell "dlogutil -c" - sdb shell "dlogutil -v time AUL APP_CORE|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|__show_cb.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE & + sdb shell "dlogutil -v time AUL APP_CORE_UI_BASE|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|appcore_ui_base_window_on_show.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE & DLOG_STREAMER_PID=$! #execute timestamp /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & @@ -202,7 +202,7 @@ execute_time_stamp_manual_memory () rm $STREAM_LOG_FILE touch $STREAM_LOG_FILE sdb shell "dlogutil -c" - sdb shell "dlogutil -v time AUL APP_CORE|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|__show_cb.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE & + sdb shell "dlogutil -v time AUL APP_CORE_UI_BASE|grep -E 'app_request_to_launchpad_for_uid.*[SECURE_LOG].*launch.*request|appcore_ui_base_window_on_show.*[EVENT_TEST][EVENT]'" >> $STREAM_LOG_FILE & DLOG_STREAMER_PID=$! #execute timestamp /bin/bash ./timestamp.sh $STREAM_LOG_FILE $RESULT_LOG_FILE & -- 2.7.4 From 7f481bb69fb6d1a11ed2d88461d74bfb0f5d22d6 Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Wed, 26 Apr 2017 08:36:35 +0900 Subject: [PATCH 14/16] crossgen bug fixed Change-Id: Ia8632e7b66cabbfd2d1c780d85db52462e1db38e --- NativeLauncher/installer-plugin/common.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NativeLauncher/installer-plugin/common.cc b/NativeLauncher/installer-plugin/common.cc index e53cff3..9cd2109 100644 --- a/NativeLauncher/installer-plugin/common.cc +++ b/NativeLauncher/installer-plugin/common.cc @@ -175,7 +175,7 @@ static void crossgen(const char* dllPath, const char* appPath) std::vector argv = { __CROSSGEN_PATH, "/Trusted_Platform_Assemblies", tpa.c_str(), - "/__JIT_PATH", __JIT_PATH, + "/JITPath", __JIT_PATH, "/FragileNonVersionable" }; if (appPath != nullptr) { -- 2.7.4 From 9e24b5e89b5022a29abc318b67f31493acd21fcc Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Thu, 27 Apr 2017 13:32:28 +0900 Subject: [PATCH 15/16] Remove the cap_mac_admin for dotnet-launcher Change-Id: I96ac4601185314edeee80e39bb67a512f1816610 --- NativeLauncher/CMakeLists.txt | 20 ++++++++++---------- packaging/dotnet-launcher.spec | 13 ++++++------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/NativeLauncher/CMakeLists.txt b/NativeLauncher/CMakeLists.txt index 4107d05..e453d9a 100755 --- a/NativeLauncher/CMakeLists.txt +++ b/NativeLauncher/CMakeLists.txt @@ -113,15 +113,15 @@ ADD_EXECUTABLE(${NITOOL} ${${NITOOL}_SOURCE_FILES}) SET_TARGET_PROPERTIES(${NITOOL} PROPERTIES COMPILE_FLAGS "-fPIE") TARGET_LINK_LIBRARIES(${NITOOL} ${${PROJECT_NAME}_LDFLAGS} "-pie") -SET(INSTALLER_PLUGIN "ui-application") -SET(${INSTALLER_PLUGIN}_SOURCE_FILES - util/utils.cc - installer-plugin/common.cc - installer-plugin/ui-application.cc -) -ADD_LIBRARY(${INSTALLER_PLUGIN} SHARED ${${INSTALLER_PLUGIN}_SOURCE_FILES}) -SET_TARGET_PROPERTIES(${INSTALLER_PLUGIN} PROPERTIES COMPILE_FLAGS "-fPIC") -TARGET_LINK_LIBRARIES(${INSTALLER_PLUGIN} ${${PROJECT_NAME}_LDFLAGS}) +#SET(INSTALLER_PLUGIN "ui-application") +#SET(${INSTALLER_PLUGIN}_SOURCE_FILES +# util/utils.cc +# installer-plugin/common.cc +# installer-plugin/ui-application.cc +#) +#ADD_LIBRARY(${INSTALLER_PLUGIN} SHARED ${${INSTALLER_PLUGIN}_SOURCE_FILES}) +#SET_TARGET_PROPERTIES(${INSTALLER_PLUGIN} PROPERTIES COMPILE_FLAGS "-fPIC") +#TARGET_LINK_LIBRARIES(${INSTALLER_PLUGIN} ${${PROJECT_NAME}_LDFLAGS}) SET(PREFER_DOTNET_AOT_PLUGIN "prefer_dotnet_aot_plugin") @@ -139,7 +139,7 @@ IF(NOT DEFINED NO_TIZEN) INSTALL(TARGETS ${DOTNET_LAUNCHER} DESTINATION ${BINDIR}) INSTALL(TARGETS ${SCD_LAUNCHER} DESTINATION ${BINDIR}) INSTALL(TARGETS ${NITOOL} DESTINATION ${BINDIR}) - INSTALL(TARGETS ${INSTALLER_PLUGIN} DESTINATION ${INSTALL_PLUGIN_DIR}) +# INSTALL(TARGETS ${INSTALLER_PLUGIN} DESTINATION ${INSTALL_PLUGIN_DIR}) INSTALL(TARGETS ${PREFER_DOTNET_AOT_PLUGIN} DESTINATION ${INSTALL_MDPLUGIN_DIR}) INSTALL(FILES dotnet.loader DESTINATION ${LOADERDIR}) INSTALL(FILES dotnet.launcher DESTINATION ${LOADERDIR}) diff --git a/packaging/dotnet-launcher.spec b/packaging/dotnet-launcher.spec index f82e994..847558a 100755 --- a/packaging/dotnet-launcher.spec +++ b/packaging/dotnet-launcher.spec @@ -26,7 +26,6 @@ BuildRequires: pkgconfig(appcore-agent) BuildRequires: pkgconfig(capi-appfw-app-control) BuildRequires: pkgconfig(capi-appfw-application) BuildRequires: pkgconfig(capi-appfw-service-application) -BuildRequires: pkgconfig(capi-appfw-service-application) Requires: aul @@ -106,13 +105,13 @@ ln -sf %{_libdir}/libsqlite3.so.0 %{buildroot}%{_native_lib_dir}/libsqlite3.so %{_loaderdir}/dotnet.launcher %{_loaderdir}/dotnet.debugger %{_native_lib_dir}/libsqlite3.so -%caps(cap_mac_admin,cap_setgid=ei) %{_bindir}/dotnet-launcher -%caps(cap_mac_admin,cap_setgid=ei) %{_bindir}/nitool -%caps(cap_mac_admin,cap_setgid=ei) %{_install_plugin_dir}/libui-application.so -%caps(cap_mac_admin,cap_setgid=ei) %{_install_mdplugin_dir}/libprefer_dotnet_aot_plugin.so +%{_bindir}/nitool +#%{_install_plugin_dir}/libui-application.so +%{_install_mdplugin_dir}/libprefer_dotnet_aot_plugin.so %if %{use_managed_launcher} -%caps(cap_mac_admin,cap_setgid=ei) %{_bindir}/Tizen.Runtime.dll +%{_bindir}/Tizen.Runtime.dll %endif +%caps(cap_setgid=ei) %{_bindir}/dotnet-launcher %files -n scd-launcher -%caps(cap_mac_admin,cap_setgid=ei) %{_bindir}/scd-launcher +%caps(cap_setgid=ei) %{_bindir}/scd-launcher -- 2.7.4 From 9923c6c1a7c00678b59cc15f2047be7e98be553f Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Thu, 11 May 2017 14:03:17 +0900 Subject: [PATCH 16/16] Add signal handler Change-Id: I46bd2e0867261675c3f04352330df9022526cf20 --- NativeLauncher/CMakeLists.txt | 5 + NativeLauncher/launcher/dotnet_signal_handler.cc | 146 +++++++++++++++++++++++ NativeLauncher/launcher/dotnet_signal_handler.h | 23 ++++ NativeLauncher/launcher/main.cc | 3 + packaging/dotnet-launcher.spec | 6 + 5 files changed, 183 insertions(+) mode change 100755 => 100644 NativeLauncher/CMakeLists.txt create mode 100644 NativeLauncher/launcher/dotnet_signal_handler.cc create mode 100644 NativeLauncher/launcher/dotnet_signal_handler.h mode change 100755 => 100644 packaging/dotnet-launcher.spec diff --git a/NativeLauncher/CMakeLists.txt b/NativeLauncher/CMakeLists.txt old mode 100755 new mode 100644 index e453d9a..abbf4c2 --- a/NativeLauncher/CMakeLists.txt +++ b/NativeLauncher/CMakeLists.txt @@ -46,6 +46,10 @@ IF(USE_MANAGED_LAUNCHER STREQUAL "ENABLE") ADD_DEFINITIONS("-DUSE_MANAGED_LAUNCHER") ENDIF(USE_MANAGED_LAUNCHER) +IF(RAISE_DEFAULT_SIGNAL_HANDLER STREQUAL "ENABLE") + ADD_DEFINITIONS("-DRAISE_DEFAULT_SIGNAL_HANDLER") +ENDIF(RAISE_DEFAULT_SIGNAL_HANDLER) + OPTION(NOT_USE_FUNCTION "Remove build warning" OFF) IF(NOT_USE_FUNCTION) ADD_DEFINITIONS("-DNOT_USE_FUNCTION") @@ -74,6 +78,7 @@ SET(${DOTNET_LAUNCHER}_SOURCE_FILES launcher/main.cc util/utils.cc launcher/launcher.cc + launcher/dotnet_signal_handler.cc launcher/dotnet/dotnet_launcher.cc ) ADD_EXECUTABLE(${DOTNET_LAUNCHER} ${${DOTNET_LAUNCHER}_SOURCE_FILES}) diff --git a/NativeLauncher/launcher/dotnet_signal_handler.cc b/NativeLauncher/launcher/dotnet_signal_handler.cc new file mode 100644 index 0000000..783f6c7 --- /dev/null +++ b/NativeLauncher/launcher/dotnet_signal_handler.cc @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "dotnet_signal_handler.h" + +#include "log.h" + +#include +#include + +#include +#include +#include +#include + +using namespace std; + +#define CALLSTACK_SIZE 30 + +std::vector backtraceStr; +char **backtraceStrings; +int backtracePtrs; + +static void printBacktrace() +{ + if (backtraceStr.size() > 0) { + _ERR("Backtrace returned %d addresses :", backtraceStr.size()); + + for (unsigned int i = 0; i < backtraceStr.size(); i++) { + _ERR("[Backtrace #%d] : %s", i, backtraceStr[i].c_str()); + } + } + + backtraceStr.clear(); +} + +static bool nativeCrashCheck() +{ + int i; + void *buf[CALLSTACK_SIZE + 1]; + + backtracePtrs = backtrace(buf, CALLSTACK_SIZE); + if (backtracePtrs == 0) { + _ERR("No backtrace captured"); + return false; + } + + backtraceStrings = backtrace_symbols(buf, backtracePtrs); + + if (backtraceStrings == NULL) { + _ERR("No backtrace captured"); + return false; + } + + backtraceStr.clear(); + + for (i = backtracePtrs - 1; i >= 0; i--) { + if (strstr(backtraceStrings[i], "__default_rt_sa_restorer") != NULL) + return backtraceStr.size() > 0; + + backtraceStr.push_back(std::string(backtraceStrings[i])); + } + + return true; +} + +static void onSigabrt(int signum) +{ + _ERR("<<< SIGABRT %d >>>", signum); + + backtracePtrs = 0; + backtraceStrings = NULL; + + if (nativeCrashCheck()) { + printBacktrace(); +#ifdef RAISE_DEFAULT_SIGNAL_HANDLER + SIG_DFL(signum); +#endif + } else { + _ERR("Crash from managed code"); + } + + if (backtraceStrings != NULL) { + free(backtraceStrings); + backtraceStrings = NULL; + } + + exit(0); +} + +static void onSigsegv(int signum) +{ + _ERR("<<< SIGSEGV %d >>>", signum); + + backtracePtrs = 0; + backtraceStrings = NULL; + + if (nativeCrashCheck()) { + printBacktrace(); +#ifdef RAISE_DEFAULT_SIGNAL_HANDLER + SIG_DFL(signum); +#endif + } else { + _ERR("Crash from managed code"); + } + + if (backtraceStrings != NULL) { + free(backtraceStrings); + backtraceStrings = NULL; + } + + exit(0); +} + +static void onSigtrap(int signum) +{ + _ERR("<<< SIGTRAP %d >>>", signum); + + exit(0); +} + +void registerSignalHandler() +{ + _DBG("Register signal handler"); + + if (SIG_ERR == signal(SIGABRT, &onSigabrt) || + SIG_ERR == signal(SIGSEGV, &onSigsegv) || + SIG_ERR == signal(SIGTRAP, &onSigtrap)) { + perror("[dotnet-launcher] signal register error\n"); + _ERR("Signal register error"); + } +} diff --git a/NativeLauncher/launcher/dotnet_signal_handler.h b/NativeLauncher/launcher/dotnet_signal_handler.h new file mode 100644 index 0000000..9cbb62e --- /dev/null +++ b/NativeLauncher/launcher/dotnet_signal_handler.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __DOTNET_SIGNAL_HANDLER__ +#define __DOTNET_SIGNAL_HANDLER__ + +void registerSignalHandler(); + +#endif /* __DOTNET_SIGNAL_HANDLER__ */ diff --git a/NativeLauncher/launcher/main.cc b/NativeLauncher/launcher/main.cc index 2bbda72..7063a2d 100644 --- a/NativeLauncher/launcher/main.cc +++ b/NativeLauncher/launcher/main.cc @@ -15,6 +15,7 @@ */ #include "dotnet/dotnet_launcher.h" +#include "dotnet_signal_handler.h" #include "utils.h" #include "log.h" @@ -40,6 +41,8 @@ static std::string StandaloneOption("--standalone"); int main(int argc, char *argv[]) { + registerSignalHandler(); + int i; bool standalone = false; const char* standalonePath = nullptr; diff --git a/packaging/dotnet-launcher.spec b/packaging/dotnet-launcher.spec old mode 100755 new mode 100644 index 847558a..09e3e41 --- a/packaging/dotnet-launcher.spec +++ b/packaging/dotnet-launcher.spec @@ -63,6 +63,11 @@ launching dotnet apps without dotent runtime installed %define USE_MANAGED_LAUNCHER ENABLE %endif +%define raise_default_signal_handler 0 +%if %{raise_default_signal_handler} + %define RAISE_DEFAULT_SIGNAL_HANDLER ENABLE +%endif + %build cmake \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ @@ -82,6 +87,7 @@ cmake \ -DINSTALL_MDPLUGIN_DIR=%{_install_mdplugin_dir} \ -DVERSION=%{version} \ -DUSE_MANAGED_LAUNCHER=%{?USE_MANAGED_LAUNCHER:%USE_MANAGED_LAUNCHER} \ + -DRAISE_DEFAULT_SIGNAL_HANDLER=%{?RAISE_DEFAULT_SIGNAL_HANDLER:%RAISE_DEFAULT_SIGNAL_HANDLER} \ -DNATIVE_LIB_DIR=%{_native_lib_dir} \ NativeLauncher -- 2.7.4