From: Gourav Mittal Date: Thu, 21 Jun 2018 12:00:30 +0000 (+0530) Subject: Added capability netcoredbg_support X-Git-Tag: submit/tizen/20180622.064840^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=205e6db1a90074806afe5642cbc2183a8d0ff434;p=sdk%2Ftarget%2Fsdbd.git Added capability netcoredbg_support Change-Id: Ie72b3603e78cd1942c4be51663cf2382af842d47 Signed-off-by: Gourav Mittal --- diff --git a/src/sdb.c b/src/sdb.c index 7272099..df2b6ef 100644 --- a/src/sdb.c +++ b/src/sdb.c @@ -153,6 +153,29 @@ int is_appid2pid_supported(void) { return 0; } +int is_netcoredbg_supported(void) { + + FILE *fp = fopen(NETCOREDBG_LOCATION, "r"); + if (fp) { + size_t len; + ssize_t num; + char *line = NULL; + + while ((num = getline(&line, &len, fp)) != -1) { + if (strstr(line, "NETCOREDBG") != NULL) { + snprintf(g_capabilities.netcoredbg_support, sizeof(g_capabilities.netcoredbg_support), + "%s", ENABLED); + free(line); + return 1; + } + free(line); + line = NULL; + } + fclose(fp); + } + return 0; +} + int is_container_enabled(void) { bool value; int ret; @@ -1969,6 +1992,11 @@ static void init_capabilities(void) { "%s", ENABLED); } + // netcore debugger support + ret = is_netcoredbg_supported(); + snprintf(g_capabilities.netcoredbg_support, sizeof(g_capabilities.netcoredbg_support), + "%s", ret == 1 ? ENABLED : DISABLED); + // Capability version snprintf(g_capabilities.sdbd_cap_version, sizeof(g_capabilities.sdbd_cap_version), "%d.%d", SDBD_CAP_VERSION_MAJOR, SDBD_CAP_VERSION_MINOR); diff --git a/src/sdb.h b/src/sdb.h index a603692..e96518d 100644 --- a/src/sdb.h +++ b/src/sdb.h @@ -259,6 +259,7 @@ typedef struct platform_info { #define ENABLED "enabled" #define DISABLED "disabled" +#define NETCOREDBG_LOCATION "/usr/share/aul/dotnet.debugger" #define CAPBUF_SIZE 4096 #define CAPBUF_ITEMSIZE 32 #define CAPBUF_L_ITEMSIZE 256 @@ -291,6 +292,7 @@ typedef struct platform_capabilities char sdk_toolpath[CAPBUF_L_ITEMSIZE]; // sdk tool path char can_launch[CAPBUF_L_ITEMSIZE]; // target name char device_name[CAPBUF_ITEMSIZE]; // device name + char netcoredbg_support[CAPBUF_ITEMSIZE]; // enabled or disabled char platform_version[CAPBUF_ITEMSIZE]; // platform version (ex. 2.3.0) char product_version[CAPBUF_ITEMSIZE]; // product version (ex. 1.0) diff --git a/src/services.c b/src/services.c index 064ccf6..b71d7a9 100644 --- a/src/services.c +++ b/src/services.c @@ -1104,6 +1104,10 @@ static void get_capability(int fd, void *cookie) { offset += put_key_value_string(cap_buffer, offset, CAPBUF_SIZE, "pkgcmd_debugmode", g_capabilities.pkgcmd_debugmode); + // pkgcmd debug mode support + offset += put_key_value_string(cap_buffer, offset, CAPBUF_SIZE, + "netcoredbg_support", g_capabilities.netcoredbg_support); + offset++; // for '\0' character writex(fd, &offset, sizeof(uint16_t));