[FIX] remove build warnings 29/69529/3 tizen_2.4_dev
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Fri, 15 Apr 2016 15:45:50 +0000 (18:45 +0300)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Fri, 13 May 2016 14:58:41 +0000 (07:58 -0700)
Change-Id: I0ce47e4309303e4c74a1ad8e216447a33829ca4f
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
20 files changed:
daemon/Makefile
daemon/cpp/elf/FileElf.cpp
daemon/cpp/features/feature_manager_c.cpp
daemon/da_data.c
daemon/da_inst.c
daemon/da_inst.h
daemon/da_protocol.c
daemon/da_protocol.h
daemon/da_protocol_check.c
daemon/da_protocol_inst.c
daemon/daemon.c
daemon/daemon.h
daemon/input_events.c
daemon/sys_stat.c
daemon/target.c
daemon/threads.c
daemon/threads.h
daemon/utils.c
daemon/utils.h
daemon/wsi.c

index d6e1cba..be470f6 100644 (file)
@@ -1,7 +1,7 @@
 CC := gcc
 CPP := g++
 
-COMM_FLAGS := -Wall -g -O0
+COMM_FLAGS := -Wall -g -O0 -Werror
 
 DEBUG_FLAGS = \
        -DDEBUG \
@@ -16,6 +16,7 @@ DEBUG_FLAGS = \
 
 INCLUDE := \
        -Iinclude/generated \
+       -I. \
        -I/usr/include \
        -I/usr/include/system \
        -I/usr/include/capi-system-info \
@@ -28,6 +29,11 @@ INCLUDE := \
        -I/usr/include/json-c \
        -I/usr/include/eo-1 \
        -I/usr/include/evas-1
+
+INCLUDE_CPP := \
+       -I. \
+       -Icpp
+
 # CALL_MNGR
 ifeq ($(CALL_MNGR),y)
 INCLUDE += -I/usr/include/call-manager/
@@ -61,7 +67,7 @@ endif
 
 # compiler flags
 CFLAGS := $(FLAGS)
-CPPFLAGS := $(FLAGS) -std=c++0x -I. -Icpp
+CPPFLAGS := $(FLAGS) $(INCLUDE_CPP) -std=c++0x
 
 # linker flags
 LDFLAGS := \
index 0dc61e8..167e3a1 100644 (file)
@@ -225,7 +225,7 @@ int FileElf::makeRelocMap(const uint8_t jump_slot)
     strEnd = strBegin + dataStr->size;
 
 
-    for (int i = 0; i < relCnt; ++i) {
+    for (size_t i = 0; i < relCnt; ++i) {
         if (ELF32_R_TYPE(rel[i].r_info) == jump_slot) {
             uint32_t offset = rel[i].r_offset;
             uint32_t symId = ELF32_R_SYM(rel[i].r_info);
@@ -276,7 +276,7 @@ int FileElf::doGetAddrPltARM(const char *names[], uint32_t addrs[], size_t cnt)
     uint32_t addr, n0, n1, n2, offset, rorN;
 
 
-    for (int i = 0, step = 0; i < instCnt; ++i) {
+    for (size_t i = 0, step = 0; i < instCnt; ++i) {
         uint32_t p = inst[i] & 0xfffff000;
 
         switch (step) {
@@ -319,7 +319,7 @@ int FileElf::doGetAddrPltARM(const char *names[], uint32_t addrs[], size_t cnt)
     }
 
     // populate addrs
-    for (int i = 0; i < cnt; ++i) {
+    for (size_t i = 0; i < cnt; ++i) {
         FuncMap::const_iterator it = funcMap.find(names[i]);
         addrs[i] = it == funcMap.end() ? 0 : it->second;
     }
index 5d38c66..9ff66d4 100644 (file)
@@ -36,7 +36,7 @@ static std::string u64toString(uint64_t val)
 {
     std::string str;
 
-    for (int i = 0; i < sizeof(uint64_t) * 8; ++i) {
+    for (unsigned int i = 0; i < sizeof(uint64_t) * 8; ++i) {
         str += (val & 0x8000000000000000LLU) ? '1' : '0';
         val <<= 1;
     }
index a794db9..5082ff5 100644 (file)
@@ -35,8 +35,8 @@
 
 int print_sys_info(struct system_info_t * sys_info)
 {
-       int i = 0;
        /* //FOR DEBUG
+       int i = 0;
        sys_info->energy=0x1;
        sys_info->wifi_status=0x2;
        sys_info->bt_status=0x3;
index ad81ac3..562fa38 100644 (file)
@@ -137,7 +137,7 @@ struct lib_list_t *new_lib(void)
        return lib;
 
 exit_fail_free_lib:
-       free_data(lib);
+       free_data((struct data_list_t *)lib);
 exit_fail:
        return NULL;
 }
@@ -169,6 +169,12 @@ exit_fail:
        return NULL;
 }
 
+void free_us_lib_inst(struct us_lib_inst_t *us_lib_inst)
+{
+       free(us_lib_inst->bin_path);
+       free(us_lib_inst);
+}
+
 void free_lib(struct lib_list_t *lib)
 {
        free_us_lib_inst(lib->lib);
@@ -176,10 +182,11 @@ void free_lib(struct lib_list_t *lib)
        free_data((struct data_list_t *)lib);
 }
 
-void free_us_lib_inst(struct us_lib_inst_t *us_lib_inst)
+void free_app_info(struct app_info_t *app_info)
 {
-       free(us_lib_inst->bin_path);
-       free(us_lib_inst);
+       free(app_info->app_id);
+       free(app_info->exe_path);
+       free(app_info);
 }
 
 void free_app(struct app_list_t *app)
@@ -189,13 +196,6 @@ void free_app(struct app_list_t *app)
        free_data((struct data_list_t *)app);
 }
 
-void free_app_info(struct app_info_t *app_info)
-{
-       free(app_info->app_id);
-       free(app_info->exe_path);
-       free(app_info);
-}
-
 struct probe_list_t *new_probe(void)
 {
        struct probe_list_t *probe;
@@ -519,7 +519,7 @@ void app_list_rm_probes_by_addr(struct app_list_t *app_list, uint64_t addr)
 
        while (pr) {
                pr = pr->func->func_addr == addr ?
-                       probe_list_rm_element(app_list, pr) :
+                       probe_list_rm_element((struct data_list_t *)app_list, pr) :
                        pr->next;
        }
 }
@@ -686,7 +686,7 @@ static void unlock_lib_list()
        pthread_mutex_unlock(&lib_maps_message_mutex);
 }
 
-static inline bool is_always_probing_feature(enum feature_code fv)
+static inline bool is_always_probing_feature(enum feature_code_0 fv)
 {
        if ((fv & FL_FILE_API_ALWAYS_PROBING) ||
            (fv & FL_MEMORY_ALLOC_ALWAYS_PROBING) ||
@@ -954,7 +954,7 @@ void msg_swap_free_all_data(struct user_space_inst_t *us_inst)
        LOGI("new_lib_inst_list %p\n", new_lib_inst_list);
        if (new_lib_inst_list != NULL) {
                LOGI("free new_lib_inst_list start\n");
-               free_data_list(&new_lib_inst_list);
+               free_data_list((struct data_list_t **)&new_lib_inst_list);
                new_lib_inst_list = NULL;
                LOGI("free new_lib_inst_list finish\n");
        }
@@ -962,7 +962,7 @@ void msg_swap_free_all_data(struct user_space_inst_t *us_inst)
        LOGI("us_inst->lib_inst_list %p\n", us_inst->lib_inst_list);
        if (us_inst->lib_inst_list != NULL) {
                LOGI("free us_inst->lib_inst_list start\n");
-               free_data_list(&us_inst->lib_inst_list);
+               free_data_list((struct data_list_t **)&us_inst->lib_inst_list);
                us_inst->lib_inst_list = NULL;
                LOGI("free us_isnt->lib_inst_list finish\n");
        }
@@ -970,7 +970,7 @@ void msg_swap_free_all_data(struct user_space_inst_t *us_inst)
        LOGI("us_inst->app_inst_list %p\n", us_inst->app_inst_list);
        if (us_inst->app_inst_list != NULL) {
                LOGI("free us_inst->app_inst_list start\n");
-               free_data_list(&us_inst->app_inst_list);
+               free_data_list((struct data_list_t **)&us_inst->app_inst_list);
                LOGI("free us_inst->app_isnt_list finish\n");
        }
 }
@@ -996,29 +996,32 @@ int ld_add_probes_by_feature(uint64_t to_enable_features_0,
 
        for (i = 0; i != feature_to_data_count; i++) {
                f = feature_to_data[i];
-               LOGI("check feature %016X\n", f.feature_value);
-               if ((f.feature_value & to_enable_features_0) ||
-                   (f.feature_value & to_enable_features_1 << 64)) {
+               LOGI("check feature %016X:%016X\n", f.feature_value_1,
+                    f.feature_value_0);
+               if ((f.feature_value_0 & to_enable_features_0) ||
+                   (f.feature_value_1 & to_enable_features_1)) {
                        buf[0] = '\0';
 
-                       feature_code_str(f.feature_value, f.feature_value, &buf[0],
+                       feature_code_str(f.feature_value_0, f.feature_value_1, &buf[0],
                                         sizeof(buf));
-                       LOGI("Set LD probes for %016LX <%s>\n", f.feature_value, &buf[0]);
+                       LOGI("Set LD probes for %016LX:%016LX <%s>\n",
+                            f.feature_value_1, f.feature_value_0, &buf[0]);
 
                        feature_add_lib_inst_list(f.feature_ld, &ld_lib_inst_list_new_add);
-               } else if (((f.feature_value & to_disable_features_0) &&
-                           !(f.feature_value & ~to_disable_features_0) ||
-                          ((f.feature_value & to_disable_features_1 << 64) &&
-                           !(f.feature_value & ~(to_disable_features_1 << 64))))) {
+               } else if ((((f.feature_value_0 & to_disable_features_0) &&
+                           !(f.feature_value_0 & ~to_disable_features_0)) ||
+                          (((f.feature_value_1 & to_disable_features_1) &&
+                           !(f.feature_value_1 & ~(to_disable_features_1)))))) {
                        /* If
                         *   (feature_value & to_disable) == (feature_value & ~to_disable)
                         * then this is NOFEATURE probe, so, do not remove */
 
                        buf[0] = '\0';
 
-                       feature_code_str(f.feature_value, f.feature_value, &buf[0],
+                       feature_code_str(f.feature_value_0, f.feature_value_1, &buf[0],
                                         sizeof(buf));
-                       LOGI("Remove LD probes for %016LX <%s>\n", f.feature_value, &buf[0]);
+                       LOGI("Remove LD probes for %016LX:%016LX <%s>\n",
+                            f.feature_value_1, f.feature_value_0, &buf[0]);
 
                        feature_add_lib_inst_list(f.feature_ld, &ld_lib_inst_list_new_remove);
                }
index e69efc4..3b29d1c 100644 (file)
@@ -96,4 +96,12 @@ struct app_info_t *app_info_get_next(struct app_list_t **app_list);
 
 struct target; // move
 
+int ld_add_probes_by_feature(uint64_t to_enable_features_0,
+                            uint64_t to_enable_features_1,
+                            uint64_t to_disable_features_0,
+                            uint64_t to_disable_features_1,
+                            struct user_space_inst_t *us_inst,
+                            struct msg_t **msg_reply_add,
+                            struct msg_t **msg_reply_remove);
+
 #endif /* __DA_INST_H__*/
index 094d7e0..4b51b60 100644 (file)
@@ -49,6 +49,7 @@
 #include "md5.h"
 #include "da_data.h"
 #include "wsi.h"
+#include "cpp/features/feature_manager_c.h"
 
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -899,24 +900,31 @@ exit_fail:
 static int process_msg_binary_info(struct msg_buf_t *msg)
 {
        int err;
-       uint32_t i, j, bincount;
+       uint32_t allocated_acks, i, bincount;
        enum ErrorCode error_code = ERR_NO;
 
        printBuf(msg->cur_pos, msg->len);
 
        if (!parse_int32(msg, &bincount)) {
                LOGE("MSG_BINARY_INFO error: No binaries count\n");
-               return -1;
+               goto exit_fail;
        }
 
-       struct binary_ack *acks[bincount];
+       struct binary_ack **acks = NULL;
        struct binary_ack *new;
        size_t total_size = 0;
-       for (i = 0; i != bincount; ++i) {
+
+       acks = (struct binary_ack **)malloc(bincount * sizeof(acks[0]));
+       if (acks == NULL) {
+               LOGE("cannon allocate acks\n");
+               goto exit_fail;
+       }
+
+       for (allocated_acks = 0; allocated_acks != bincount; ++allocated_acks) {
                const char *str = parse_string_inplace(msg);
                if (!str) {
                        LOGE("MSG_BINARY_INFO error: No enough binaries\n");
-                       return -1;
+                       goto exit_fail_free_ack;
                }
                new = binary_ack_alloc(str);
                /* check for errors */
@@ -933,7 +941,7 @@ static int process_msg_binary_info(struct msg_buf_t *msg)
 
                if (new->local_bin_path[0] == '\0')
                        LOGW("section '.debug_str' not found in <%s>\n", str);
-               acks[i] = new;
+               acks[allocated_acks] = new;
                total_size += binary_ack_size(new);
        }
        typedef uint32_t return_id;
@@ -946,7 +954,7 @@ static int process_msg_binary_info(struct msg_buf_t *msg)
                                         + total_size);
        if (msg_reply == NULL) {
                LOGE("Cannot allocates memory for msg_reply\n");
-               return 1;
+               goto exit_fail_free_ack;
        }
        p = msg_reply->payload;
        msg_reply->id = NMSG_BINARY_INFO_ACK;
@@ -961,15 +969,16 @@ static int process_msg_binary_info(struct msg_buf_t *msg)
                binary_ack_free(acks[i]);
        }
 
-       printBuf(msg_reply, msg_reply->len + sizeof(*msg_reply));
+       printBuf((char *)msg_reply, msg_reply->len + sizeof(*msg_reply));
        err = send_reply(msg_reply);
        free(msg_reply);
 
        return err;
 
 exit_fail_free_ack:
-       for (j = 0; j < i; j++)
-               binary_ack_free(acks[j]);
+       for (i = 0; i < allocated_acks; i++)
+               binary_ack_free(acks[i]);
+       free(acks);
 exit_fail:
        return -1;
 }
@@ -1129,14 +1138,12 @@ int recv_msg_from_sock(int sock, struct msg_target_t *msg)
 
 static int process_msg_get_screenshot(struct msg_buf_t *msg_control)
 {
-       uint32_t log_len;
        struct msg_target_t sendlog;
        enum ErrorCode err_code = ERR_UNKNOWN;
 
        // send config message to target process
        sendlog.type = APP_MSG_CAPTURE_SCREEN;
        sendlog.length = 0;
-       log_len = sizeof(sendlog.type) + sizeof(sendlog.length) + sendlog.length;
 
        if (target_send_msg_to_all(&sendlog) == 0)
                err_code = ERR_NO;
@@ -1177,7 +1184,6 @@ static int process_msg_get_process_add_info(struct msg_buf_t *msg)
        char **cmd_line_arr = NULL;
        char *payload = NULL;
        char *p;
-       struct msg_target_t sendlog;
        enum ErrorCode err_code = ERR_UNKNOWN;
 
        /* get pid count */
@@ -1258,7 +1264,7 @@ send_ack:
 
 int process_msg_get_real_path(struct msg_buf_t *msg)
 {
-       char *file_path = NULL;
+       const char *file_path = NULL;
        char *resolved_path= NULL;
        enum ErrorCode err_code = ERR_UNKNOWN;
        uint32_t response_len = 0;
@@ -1282,7 +1288,7 @@ int process_msg_get_real_path(struct msg_buf_t *msg)
        }
 
        response_len = strnlen(resolved_path, PATH_MAX) + 1;
-       if (resolved_path == (PATH_MAX + 1)) {
+       if (response_len == (PATH_MAX + 1)) {
                LOGE("NMSG_GET_REAL_PATH error: cannot resolve path <%s>"
                     "too long path\n", file_path);
                err_code = ERR_WRONG_MESSAGE_DATA;
@@ -1450,7 +1456,6 @@ int host_message_handler(struct msg_t *msg)
        struct conf_t conf;
        enum ErrorCode error_code = ERR_NO;
 
-       int target_index;
        struct msg_target_t sendlog;
 
        LOGI("MY HANDLE %s (%X)\n", msg_ID_str(msg->id), msg->id);
index 658ec90..6de4b19 100644 (file)
@@ -35,6 +35,7 @@
 #include <stdio.h>
 #include <stddef.h>
 #include <linux/input.h>
+#include <assert.h>
 
 #define PROTOCOL_VERSION "4.1"
 
@@ -94,7 +95,7 @@ enum ErrorCode {
 
 #define FL_SYSTEM_ENERGY_OLD (1<<26)
 
-enum feature_code{
+enum feature_code_0 {
        FL_RESERVED1                    = 0x0000000000003ULL, // reserved 0011
 
        FL_FUNCTION_PROFILING           = 0x0000000000004ULL, // 0x4 * 0x10^00 On/Off the UserSpaceInst
@@ -155,6 +156,10 @@ enum feature_code{
 
 };
 
+enum feature_code_1 {
+       FL_ALL_FEATURES_1               = 0x0000000000000ULL, /* all */
+};
+
 enum probe_type {
        SWAP_RETPROBE   = 0, //Common retprobe
        SWAP_FBI_PROBE  = 1, //Function body instrumentation probe
@@ -402,8 +407,11 @@ struct recorded_event_t {
        uint32_t code;
        uint32_t value;
 };
+
+#ifndef static_assert
 #define static_assert(cond) \
        char __attribute__((unused)) __static_assert[(cond) ? 1 : -1];
+#endif
 
 #define pack_int64(to, n) do {                                         \
                static_assert(sizeof(n) == 8);                          \
@@ -432,13 +440,13 @@ struct recorded_event_t {
 #define pack_str(to, n)                                \
        do {                                    \
                memcpy(to, n, strlen(n) + 1);   \
-               to += strlen(n) + 1;            \
+               to = (char *)to + strlen(n) + 1;        \
        } while (0)
 
 static inline void* pack_str_array(void *buffer, const char **strings,
                                   size_t count)
 {
-       int index;
+       size_t index;
        for (index = 0; index != count; ++index)
                pack_str(buffer, strings[index]);
        return buffer;
index e70dbf4..04375df 100644 (file)
@@ -60,7 +60,6 @@ static int is_pid_string_valid(const char *pid_str)
 int check_app_id(uint32_t app_type, char *app_id)
 {
        int res = 0;
-       char *p;
        switch (app_type){
                case APP_TYPE_TIZEN:
                        res = 1;
index eb3b7b1..be7b766 100644 (file)
@@ -132,7 +132,7 @@ static int parse_us_inst_func(struct msg_buf_t *msg, struct probe_list_t **dest)
 
        uint32_t size = 0, tmp_size = 0;
        struct us_func_inst_plane_t *func = NULL;
-       char type;
+       uint8_t type;
        uint64_t addr;
 
        size = sizeof(*func);
@@ -432,14 +432,13 @@ exit_fail_release_app:
        free_app(app);
 exit_fail_clean_list:
        /* TODO free app list */
-       free_data_list(app_list);
+       free_data_list((struct data_list_t **)app_list);
 exit_fail:
        *num = 0;
        app_list = NULL;
        return 0;
 }
 /* ld probes */
-#define NOFEATURE 0x123456
 #include "ld_preload_types.h"
 struct ld_preload_probe_t {
        uint64_t orig_addr;
@@ -579,7 +578,6 @@ int add_preload_probes(struct lib_list_t **lib_list)
            *get_call_type_probe,
            *write_msg_probe;
        int ret = 0;
-       struct us_func_inst_plane_t *func = NULL;
 
        preload_lib = new_lib();
        if (preload_lib == NULL) {
@@ -597,7 +595,8 @@ int add_preload_probes(struct lib_list_t **lib_list)
                goto free_caller_probe;
        }
 
-       preload_lib->lib->bin_path = probe_lib;
+       /* probe_lib generates by swap-probe in swap-probe-devel */
+       preload_lib->lib->bin_path = (char *)probe_lib;
        preload_lib->func_num = 3;
 
        /* Add get_caller probe */
@@ -605,21 +604,21 @@ int add_preload_probes(struct lib_list_t **lib_list)
        if (ret != 0)
                goto free_caller_probe;
 
-       probe_list_append(preload_lib, get_caller_probe);
+       probe_list_append((struct data_list_t *)preload_lib, get_caller_probe);
 
        /* Add get_call_type probe */
        ret = create_preload_probe_func(&get_call_type_probe, get_call_type_addr, 5);
        if (ret != 0)
                goto free_call_type_probe;
 
-       probe_list_append(preload_lib, get_call_type_probe);
+       probe_list_append((struct data_list_t *)preload_lib, get_call_type_probe);
 
        /* Add write_msg probe */
        ret = create_preload_probe_func(&write_msg_probe, write_msg_addr, 6);
        if (ret != 0)
                goto free_write_msg_probe;
 
-       probe_list_append(preload_lib, write_msg_probe);
+       probe_list_append((struct data_list_t *)preload_lib, write_msg_probe);
 
        preload_lib->func_num = 3;
        preload_lib->size += strlen(preload_lib->lib->bin_path) + 1 + sizeof(preload_lib->func_num);
index 53fc9fa..9e6dd61 100644 (file)
@@ -29,6 +29,8 @@
  *
  */
 #define __STDC_FORMAT_MACROS
+#define _GNU_SOURCE /* for accept4 */
+
 #include <stdio.h>
 #include <stdlib.h>            // for realpath
 #include <string.h>            // for strtok, strcpy, strncpy
 #include "da_inst.h"
 #include "da_data.h"
 #include "input_events.h"
+#include "threads.h"
 #include "smack.h"
 #include "swap_debug.h"
 #include "wsi.h"
 #include "ui_viewer.h"
 
+#include "cpp/features/feature_manager_c.h"
+
 #define DA_WORK_DIR                    "/home/developer/sdk_tools/da/"
 #define DA_READELF_PATH                        "/home/developer/sdk_tools/da/readelf"
 #define SCREENSHOT_DIR                 "/tmp/da"
@@ -71,7 +76,6 @@
 #define MAX_APP_LAUNCH_TIME            60
 #define MAX_CONNECT_TIMEOUT_TIME       5*60
 
-
 // =============================================================================
 // start and terminate control functions
 // =============================================================================
@@ -315,6 +319,31 @@ static int exec_app(const struct app_info_t *app_info)
        return res;
 }
 
+/* terminate all profiling applications */
+int terminate_profiling_apps(void)
+{
+       int res = 0;
+       struct app_list_t *app = NULL;
+       const struct app_info_t *app_info = NULL;
+
+       app_info = app_info_get_first(&app);
+       if (app_info == NULL) {
+               LOGE("No app info found\n");
+               return -1;
+       }
+
+       /* all apps */
+       while (app_info != NULL) {
+               if (kill_app_by_info(app_info) != 0) {
+                       LOGE("kill app failed\n");
+                       res = -1;
+               }
+               app_info = app_info_get_next(&app);
+       }
+
+       return res;
+}
+
 // terminate all target and wait for threads
 void terminate_all()
 {
@@ -428,31 +457,6 @@ static int launch_timer_start(void)
        return res;
 }
 
-/* terminate all profiling applications */
-int terminate_profiling_apps(void)
-{
-       int res = 0;
-       struct app_list_t *app = NULL;
-       const struct app_info_t *app_info = NULL;
-
-       app_info = app_info_get_first(&app);
-       if (app_info == NULL) {
-               LOGE("No app info found\n");
-               return -1;
-       }
-
-       /* all apps */
-       while (app_info != NULL) {
-               if (kill_app_by_info(app_info) != 0) {
-                       LOGE("kill app failed\n");
-                       res = -1;
-               }
-               app_info = app_info_get_next(&app);
-       }
-
-       return res;
-}
-
 int prepare_profiling(void)
 {
        /* terminate all profiling applications */
@@ -592,7 +596,7 @@ int reconfigure(struct conf_t conf, struct msg_t **msg_reply, struct msg_t **msg
        return 0;
 }
 
-int is_feature_enabled(enum feature_code fcode)
+int is_feature_enabled(enum feature_code_0 fcode)
 {
        /* TODO: add check use_features1 */
        return (fcode & prof_session.conf.use_features0) ? 1 : 0;
@@ -721,6 +725,8 @@ static int target_event_stop_handler(struct target *target)
                        if (stop_all() != ERR_NO)
                                LOGE("Stop failed\n");
                        return -11;
+               default:
+                       break;
                }
        }
 
@@ -1152,9 +1158,9 @@ int daemonLoop(void)
        ecore_main_loop_begin();
        ecore_shutdown();
 
- END_EFD:
+END_EFD:
        LOGI("close efd\n");
        close(manager.efd);
- END_EVENT:
+
        return return_value;
 }
index dcc6d1a..cc31438 100644 (file)
@@ -158,8 +158,7 @@ int prepare_profiling(void);
 int start_profiling(void);
 void stop_profiling(void);
 int reconfigure(struct conf_t conf, struct msg_t **msg_reply, struct msg_t **msg_reply_additional);
-int is_feature_enabled(enum feature_code fcode);
-int sendACKCodeToHost(enum HostMessageType resp, int msgcode);
+int is_feature_enabled(enum feature_code_0 fcode);
 void terminate_all(void);
 void restart_all(void);
 
index 0e755d2..39ec73d 100644 (file)
@@ -108,7 +108,7 @@ static int check_input(char *inputname, int input_id)
        FILE *cmd_fp = NULL;
        char buffer[BUF_SIZE];
        char command[MAX_FILENAME];
-       char **name_arr;
+       const char **name_arr;
        size_t bytes_count;
 
        if (snprintf(command, sizeof(command), "/sys/class/input/%s/device/name",
index 0884fd3..8a6c50a 100644 (file)
@@ -215,11 +215,12 @@ static int get_max_brightness()
 {
        int maxbrightnessfd = -1;
        static int max_brightness = -1;
-       static char dirent_buffer[ sizeof(struct dirent) + PATH_MAX + 1 ] = {0,};
-       static struct dirent *dirent_r = (struct dirent *)dirent_buffer;
 
        if (__builtin_expect(max_brightness < 0, 0)) {
 #ifdef DEVICE_ONLY
+               static char dirent_buffer[ sizeof(struct dirent) +
+                                          PATH_MAX + 1 ] = {0,};
+               static struct dirent *dirent_r = (struct dirent *)dirent_buffer;
                DIR* dir_info;
                struct dirent* dir_entry;
                char fullpath[PATH_MAX];
@@ -1898,7 +1899,7 @@ static int get_inst_pid_array(pid_t *arr, const int n)
        rewind(manager.fd.inst_tasks);
        fflush(manager.fd.inst_tasks);
 
-       while (fscanf(manager.fd.inst_tasks, "%lu", arr) == 1) {
+       while (fscanf(manager.fd.inst_tasks, "%lu", (long unsigned int *)arr) == 1) {
                LOGI_th_samp("PID scaned %d\n", *arr);
                arr++;
                pid_count++;
index 8f395c8..e730f8e 100644 (file)
@@ -353,7 +353,6 @@ uint64_t target_get_total_alloc(pid_t pid)
                        /* TODO FIXME Split target libraries of different kind */
                }
        }
-unlock:
        target_array_unlock();
 
        return ret;
index 96b3f8d..938569c 100644 (file)
@@ -52,7 +52,7 @@
 #include "buffer.h"
 #include "input_events.h"
 
-static chsmack(const char *filename)
+static int chsmack(const char *filename)
 {
        int res = 1;
        pid_t pid;
@@ -212,10 +212,8 @@ static void* recvThread(void* data)
                        continue;
                } else if (log.type == APP_MSG_GET_UI_HIERARCHY_DATA) {
                        char *file_name = log.data;
-                       FILE * fp;
                        struct msg_data_t *msg_data;
                        const int len = log.length;
-                       char *p = NULL;
 
                        if (len == sizeof(uint32_t)) {
                                enum ErrorCode err_code = *(uint32_t*)log.data;
index ea4a670..4dcc653 100644 (file)
  */
 
 
-#ifndef _UTILS_H_
-#define _UTILS_H_
+#ifndef _THREADS_H_
+#define _THREADS_H_
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 
-struct target;
-
+#include "target.h"
 
 int makeRecvThread(struct target *target);
 
@@ -48,4 +47,4 @@ int makeRecvThread(struct target *target);
 }
 #endif
 
-#endif
+#endif /* _THREADS_H_ */
index 93c3c60..38b134d 100644 (file)
@@ -344,16 +344,15 @@ static int find_alternative_bin_path(const char *binary_path, char *alter_bin_pa
 {
        // alternative path may be /opt/apps/... or /opt/usr/apps/...)
        char *add_fname;
-       char *p;
        if (strncmp(binary_path, APPDIR1, strlen(APPDIR1)) == 0) {
                strncpy(alter_bin_path, APPDIR2, buflen);
                buflen -= strlen(alter_bin_path);
-               add_fname = binary_path + strlen(APPDIR1);
+               add_fname = (char *)binary_path + strlen(APPDIR1);
                strncat(alter_bin_path, add_fname, buflen);
        } else if (strncmp(binary_path, APPDIR2, strlen(APPDIR2)) == 0) {
                strncpy(alter_bin_path, APPDIR1, buflen);
                buflen -= strlen(alter_bin_path);
-               add_fname = binary_path + strlen(APPDIR2);
+               add_fname = (char *)binary_path + strlen(APPDIR2);
                strncat(alter_bin_path, add_fname, buflen);
        } else {
                return 1;
index fa35db4..a520a7e 100644 (file)
@@ -67,6 +67,8 @@ int exec_app_common(const char* exec_path);
 int exec_app_web(const char *app_id);
 void kill_app_web(const char *app_id);
 float get_uptime(void);
+
+void swap_usleep(useconds_t usec);
 #ifdef __cplusplus
 }
 #endif
index 2fc929e..12ecb88 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "wsi.h"
 #include "swap_debug.h"
+#include "daemon.h"
 #include "da_protocol.h"
 #include "ioctl_commands.h"
 #include "smack.h"
@@ -90,7 +91,7 @@ int request_id = 1;
 pthread_t wsi_start_thread = -1;
 pthread_t wsi_handle_thread = -1;
 
-static void wsi_destroy(void);
+/* static void wsi_destroy(void); */
 
 static int set_profile_info(const char *path, const char *info)
 {
@@ -299,8 +300,8 @@ static int profiling_callback(struct libwebsocket_context *context,
                jobjr = json_tokener_parse((char *)in);
 
                /* {"result":{},"id":?} */
-               jobj = json_object_object_get(jobjr, "id");
-               if (json_object_object_get(jobjr, "result") && jobj) {
+               json_object_object_get_ex(jobjr, "id", &jobj);
+               if (json_object_object_get_ex(jobjr, "result", NULL) && jobj) {
                        res_id = json_object_get_int(jobj);
                        if (res_id == request_id - 1) {
                                CLRSTAT(pstate, PSTATE_WAIT_ACK);
@@ -319,16 +320,16 @@ static int profiling_callback(struct libwebsocket_context *context,
                while (1) {
                        const char *s1, s2[] = "Profiler.setRecordingProfile";
 
-                       jobj = json_object_object_get(jobjr, "method");
+                       json_object_object_get_ex(jobjr, "method", &jobj);
                        if (!jobj)
                                break;
                        s1 = json_object_get_string(jobj);
                        if (s1 && strncmp(s1, s2, sizeof(s2)))
                                break;
-                       jobj = json_object_object_get(jobjr, "params");
+                       json_object_object_get_ex(jobjr, "params", &jobj);
                        if (!jobj)
                                break;
-                       jobj = json_object_object_get(jobj, "isProfiling");
+                       json_object_object_get_ex(jobj, "isProfiling", &jobj);
                        if (!jobj)
                                break;
                        if (json_object_get_boolean(jobj)) {
@@ -418,10 +419,10 @@ static int init_wsi_conn(struct libwebsocket_context **context,
 
 static void *handle_ws_responses(void *arg)
 {
-       while (CHKSTAT(pstate, PSTATE_START | PSTATE_PROFILING | PSTATE_WAIT_ACK) &&
-              !CHKSTAT(pstate, PSTATE_DISCONNECT) ||
-              !CHKSTAT(pstate, PSTATE_DISCONNECT) &&
-              CHKSTAT(pstate, PSTATE_INIT_DONE | PSTATE_INIT_START)) {
+       while ((CHKSTAT(pstate, PSTATE_START | PSTATE_PROFILING | PSTATE_WAIT_ACK) &&
+               !CHKSTAT(pstate, PSTATE_DISCONNECT)) ||
+              (!CHKSTAT(pstate, PSTATE_DISCONNECT) &&
+               CHKSTAT(pstate, PSTATE_INIT_DONE | PSTATE_INIT_START))) {
                libwebsocket_service(context, 1000);
        }
 
@@ -468,19 +469,19 @@ exit:
        return res;
 }
 
-static void wsi_destroy(void)
-{
-       if (CHKSTAT(pstate, PSTATE_CONNECTED)) {
-               if (CHKSTAT(pstate, PSTATE_WAIT_ACK)) {
-                       SETSTAT(pstate, PSTATE_DISCONNECT);
-               } else {
-                       LOGI("destroy context\n");
-                       destroy_wsi_conn(context);
-               }
-       } else {
-               LOGW("Try disconnect when web socket not connected\n");
-       }
-}
+/* static void wsi_destroy(void) */
+/* { */
+/*     if (CHKSTAT(pstate, PSTATE_CONNECTED)) { */
+/*             if (CHKSTAT(pstate, PSTATE_WAIT_ACK)) { */
+/*                     SETSTAT(pstate, PSTATE_DISCONNECT); */
+/*             } else { */
+/*                     LOGI("destroy context\n"); */
+/*                     destroy_wsi_conn(context); */
+/*             } */
+/*     } else { */
+/*             LOGW("Try disconnect when web socket not connected\n"); */
+/*     } */
+/* } */
 
 static int wsi_start_profiling(void)
 {