#include <linux/limits.h>
#include <storage.h>
+#include <vconf.h>
#include <app_common.h>
+#include <Ecore.h>
+
#include "injection.h"
#include "utils.h"
#include "log.h"
#if defined (__aarch64__)
#define ARCHITECTURE_IDENTIFIER "arm64"
-const static std::vector<std::string> RID_FALLBACK_GRAPH =
- {"linux-arm64", "linux", "unix-arm64", "unix", "any", "base"};
#elif defined (__arm__)
-#define ARCHITECTURE_IDENTIFIER "arm"
-const static std::vector<std::string> RID_FALLBACK_GRAPH =
- {"tizen.6.0.0-armel", "tizen.6.0.0", "tizen.5.5.0-armel", "tizen.5.5.0", "tizen.5.0.0-armel", "tizen.5.0.0", "tizen.4.0.0-armel", "tizen.4.0.0", "tizen-armel", "tizen", "linux-armel", "linux", "unix-armel", "unix", "any", "base"};
+#define ARCHITECTURE_IDENTIFIER "armel"
#elif defined (__x86_64__)
#define ARCHITECTURE_IDENTIFIER "x64"
-const static std::vector<std::string> RID_FALLBACK_GRAPH =
- {"linux-x64", "linux", "unix-x64", "unix", "any", "base"};
#elif defined (__i386__)
#define ARCHITECTURE_IDENTIFIER "x86"
-const static std::vector<std::string> RID_FALLBACK_GRAPH =
- {"tizen.6.0.0-x86", "tizen.6.0.0", "tizen.5.5.0-x86", "tizen.5.5.0", "tizen.5.0.0-x86", "tizen.5.0.0", "tizen.4.0.0-x86", "tizen.4.0.0", "tizen-x86", "tizen", "linux-x86", "linux", "unix-x86", "unix", "any", "base"};
#else
#error "Unknown target"
#endif
+static const char* __TIZEN_RID_VERSION_KEY = "db/dotnet/tizen_rid_version";
+
+// The sequence of RID_FALLBACK graphs must be:
+// 1. Tizen + Version + Architecture
+// 2. Tizen + Version
+// 3. OS(tizen, linux, unix) + Architecture
+// 4. OS(tizen, linux, unix)
+// 5. any, base
static std::string getExtraNativeLibDirs(const std::string& appRoot)
{
+ std::vector<std::string> RID_FALLBACK_GRAPH;
+ std::vector<std::string> RID_FALLBACK_TIZEN;
+ char* tizen_rid = vconf_get_str(__TIZEN_RID_VERSION_KEY);
+ if (tizen_rid) {
+ std::vector<std::string> version;
+ splitPath(tizen_rid, version);
+ std::reverse(std::begin(version), std::end(version));
+ for (unsigned int i = 0; i < version.size(); i++) {
+ RID_FALLBACK_TIZEN.push_back(std::string("tizen." + version[i] + "-" + ARCHITECTURE_IDENTIFIER));
+ RID_FALLBACK_TIZEN.push_back(std::string("tizen." + version[i]));
+ }
+ free(tizen_rid);
+ }
+
+ std::vector<std::string> RID_FALLBACK_OS = {"tizen", "linux", "unix"};
+ for (unsigned int i = 0; i < RID_FALLBACK_OS.size(); i++) {
+ RID_FALLBACK_GRAPH.push_back(std::string(RID_FALLBACK_OS[i] + "-" + ARCHITECTURE_IDENTIFIER));
+ RID_FALLBACK_GRAPH.push_back(std::string(RID_FALLBACK_OS[i]));
+ }
+ RID_FALLBACK_GRAPH.push_back("any");
+ RID_FALLBACK_GRAPH.push_back("base");
+
std::string candidate;
for (unsigned int i = 0; i < RID_FALLBACK_GRAPH.size(); i++) {
- if(!candidate.empty()) {
+ if (!candidate.empty()) {
candidate += ":";
}
candidate += concatPath(appRoot, "bin/runtimes/" + RID_FALLBACK_GRAPH[i] + "/native");
candidate = candidate + ":" + concatPath(appRoot, "lib/" ARCHITECTURE_IDENTIFIER);
if (!strncmp(ARCHITECTURE_IDENTIFIER, "arm64", 5)) {
candidate = candidate + ":" + concatPath(appRoot, "lib/aarch64");
+ } else if (!strncmp(ARCHITECTURE_IDENTIFIER, "armel", 5)) {
+ candidate = candidate + ":" + concatPath(appRoot, "lib/arm");
}
return candidate;
exit(0);
}
- if (hasException()) {
- ret = write(STDERR_FILENO, "******************************************************\n", 55);
- ret = write(STDERR_FILENO, "Unhandled exception is occured. check application code\n", 55);
- ret = write(STDERR_FILENO, "******************************************************\n", 55);
- }
-
checkOnSigabrt = true;
if (sigaction(SIGABRT, &sig_abrt_old, NULL) == 0) {
if (raise(signum) < 0) {
{
_INFO("Constructor called!!");
+ // Intiailize ecore first (signal handlers, etc.) before runtime init.
+ ecore_init();
+
char *env = nullptr;
env = getenv("CORECLR_ENABLE_PROFILING");
if (env != nullptr && !strcmp(env, "1")) {
if (initializePluginManager(mode) < 0) {
_ERR("Failed to initialize PluginManager");
}
-
- if (pluginHasLogControl()) {
- __enableLogManager = false;
- } else {
- __enableLogManager = true;
- }
}
CoreRuntime::~CoreRuntime()
dispose();
}
-int CoreRuntime::initialize(bool standalone)
+int CoreRuntime::initialize(bool standalone, bool useDlog)
{
// checkInjection checks dotnet-launcher run mode
// At the moment, this mechanism is used only when the Memory Profiler is started.
return -1;
}
- if (__enableLogManager) {
+ if (useDlog && !pluginHasLogControl()) {
if (initializeLogManager() < 0) {
_ERR("Failed to initnialize LogManager");
return -1;
}
-
- if (redirectFD() < 0) {
- _ERR("Failed to redirect FD");
- return -1;
- }
-
- if (runLoggingThread() < 0) {
- _ERR("Failed to create and run logging thread to redicrect log");
- return -1;
- }
}
std::string libCoreclr(concatPath(getRuntimeDir(), "libcoreclr.so"));
return -1;
}
- if (__enableLogManager) {
- // launchpad override stdout and stderr to journalctl before launch application.
- // we have to re-override that to input pipe for logging thread.
- if (redirectFD() < 0) {
- _ERR("Failed to redirect FD");
- return -1;
- }
+ // launchpad override stdout and stderr to journalctl before launch application.
+ // we have to re-override that to input pipe for logging thread.
+ // if LogManager is not initialized, below redirectFD will return 0;
+ if (redirectFD() < 0) {
+ _ERR("Failed to redirect FD");
+ return -1;
+ }
+ // VD has their own signal handler.
+ if (!pluginHasLogControl()) {
registerSigHandler();
}