From: manish.r Date: Thu, 4 Feb 2021 02:06:01 +0000 (+0530) Subject: Platfrom Architecture Capability Support X-Git-Tag: submit/tizen/20210205.045834^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3058a6f8bf2de7dcda559fa0e38f674603c29e2;p=sdk%2Ftarget%2Fsdbd.git Platfrom Architecture Capability Support Change-Id: I0aa9f3d3375d5721c104821cb4ea317ab3007a46 Signed-off-by: manish.r --- diff --git a/src/sdb.c b/src/sdb.c index 504382c..c92bf11 100755 --- a/src/sdb.c +++ b/src/sdb.c @@ -179,6 +179,17 @@ int is_netcoredbg_supported(void) { return 0; } +const char* get_platfrom_architecture(void) { + void* void_pointer; + D("void pointer size: %zu", sizeof(void_pointer)); + // in 32 bit sizeof void* is 4 and in 64 bit its 8 + if((int)(sizeof(void_pointer)) == 4) + return BIT32; + if((int)(sizeof(void_pointer)) == 8) + return BIT64; + return UNKNOWN; +} + int is_container_enabled(void) { bool value; int ret; @@ -1977,6 +1988,10 @@ static void init_capabilities(void) { snprintf(g_capabilities.netcoredbg_support, sizeof(g_capabilities.netcoredbg_support), "%s", ret == 1 ? ENABLED : DISABLED); + // architecture support + snprintf(g_capabilities.architecture, sizeof(g_capabilities.architecture), + "%s", get_platfrom_architecture()); + // Capability version snprintf(g_capabilities.sdbd_cap_version, sizeof(g_capabilities.sdbd_cap_version), "%d.%d", SDBD_CAP_VERSION_MAJOR, SDBD_CAP_VERSION_MINOR); @@ -2254,4 +2269,4 @@ int handle_host_request(char *service, transport_type ttype, char* serial, int r return 0; } return -1; -} \ No newline at end of file +} diff --git a/src/sdb.h b/src/sdb.h index 129b5fc..b3c7820 100644 --- a/src/sdb.h +++ b/src/sdb.h @@ -245,6 +245,8 @@ struct alistener adisconnect disconnect; }; +#define BIT32 "32" +#define BIT64 "64" #define UNKNOWN "unknown" #define INFOBUF_MAXLEN 64 #define INFO_VERSION "2.2.0" @@ -292,6 +294,7 @@ typedef struct platform_capabilities char can_launch[CAPBUF_L_ITEMSIZE]; // target name char device_name[CAPBUF_ITEMSIZE]; // device name char netcoredbg_support[CAPBUF_ITEMSIZE]; // enabled or disabled + char architecture[CAPBUF_ITEMSIZE]; // 32 or 64 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 e0cec14..0ef738c 100755 --- a/src/services.c +++ b/src/services.c @@ -1334,10 +1334,13 @@ 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 + // netcore bebugger support offset += put_key_value_string(cap_buffer, offset, CAPBUF_SIZE, "netcoredbg_support", g_capabilities.netcoredbg_support); + // netcore bebugger support + offset += put_key_value_string(cap_buffer, offset, CAPBUF_SIZE, + "architecture", g_capabilities.architecture); offset++; // for '\0' character writex(fd, &offset, sizeof(uint16_t));