diff options
author | Vyacheslav Cherkashin <v.cherkashin@samsung.com> | 2014-07-11 15:19:41 +0400 |
---|---|---|
committer | Vyacheslav Cherkashin <v.cherkashin@samsung.com> | 2014-09-01 14:05:45 +0400 |
commit | 3dc8e02f304365e22676265597b69ea4ff702b4f (patch) | |
tree | 54bd320688920933a0766bd58fcddd9176a8199b | |
parent | 05d42cf38ebda484f20c315b35122f974c8dec92 (diff) | |
download | swap-manager-3dc8e02f304365e22676265597b69ea4ff702b4f.tar.gz swap-manager-3dc8e02f304365e22676265597b69ea4ff702b4f.tar.bz2 swap-manager-3dc8e02f304365e22676265597b69ea4ff702b4f.zip |
[REFACTOR] remove unused code from utils.*
file:
daemon/utils.c
daemon/utils.h
Change-Id: Icb27639ae33ca407c7e3dd8536ad7648ee540e6b
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
-rw-r--r-- | daemon/utils.c | 152 | ||||
-rw-r--r-- | daemon/utils.h | 14 |
2 files changed, 3 insertions, 163 deletions
diff --git a/daemon/utils.c b/daemon/utils.c index 4151ffa..cb0b833 100644 --- a/daemon/utils.c +++ b/daemon/utils.c @@ -254,7 +254,7 @@ void kill_app_web(const char *app_id) } // find process id from executable binary path -pid_t find_pid_from_path(const char *path) +static pid_t find_pid_from_path(const char *path) { char buf[BUFFER_MAX]; char cmdline[PATH_MAX]; @@ -379,153 +379,7 @@ int kill_app(const char *binary_path) return 0; } -int get_executable(char* appPath, char* buf, int buflen) -{ - int fd; - - sprintf(buf, "%s.exe", appPath); - fd = open(buf, O_RDONLY); - if(fd != -1) - { - close(fd); - } - else - { - strcpy(buf, appPath); - } - return 0; -} - -int get_app_install_path(char *strAppInstall, int length) -{ - FILE *fp; - char buf[BUFFER_MAX]; - char *p; - int i; - - if ((fp = fopen(DA_INSTALL_PATH, "r")) == NULL) - { - LOGE("Failed to open %s\n", DA_INSTALL_PATH); - return -1; - } - - /*ex : <15> DW_AT_comp_dir : (indirect string, offset: 0x25f): /home/yt/workspace/templatetest/Debug-Tizen-Emulator */ - while (fgets(buf, BUFFER_MAX, fp) != NULL) - { - //name - p = buf; - for (i = 0; i < BUFFER_MAX; i++) - { - if (*p == ':') - break; - p++; - } - - if (*p != ':') - break; - else - p++; - - //(...,offset:...) - for (; i < BUFFER_MAX; i++) - { - if (*p == '(') - { - while (*p != ')') - { - p++; - } - } - if (*p == ':') - break; - p++; - } - - //find - if (*p != ':') - break; - for (; i < BUFFER_MAX - 1; i++) - { - if (*p == ':' || *p == ' ' || *p == '\t') - p++; - else - break; - } - - //name - if (strlen(p) <= length) - { - sprintf(strAppInstall, "%s", p); - for (i = 0; i < strlen(p); i++) - { - if (strAppInstall[i] == '\n' || strAppInstall[i] == '\t') - { - strAppInstall[i] = '\0'; - break; - } - } - fclose(fp); - return 1; - } - } - fclose(fp); - return -1; -} - -int is_app_built_pie(void) -{ - int result; - FILE *fp; - char buf[BUFFER_MAX]; - - if((fp = fopen(DA_BUILD_OPTION, "r")) == NULL) - { - LOGE("Failed to open %s\n", DA_BUILD_OPTION); - return -1; - } - - if(fgets(buf, BUFFER_MAX, fp) != NULL) - { - if(strcmp(buf, "DYN\n") == 0) - result = 1; - else if(strcmp(buf, "EXEC\n") == 0) - result = 0; - else - result = -1; - } - else - { - result = -1; - } - fclose(fp); - - return result; -} - -int get_app_base_address(int *baseAddress) -{ - int res; - FILE *fp; - char buf[BUFFER_MAX]; - - if((fp = fopen(DA_BASE_ADDRESS, "r")) == NULL) - { - LOGE("Failed to open %s\n", DA_BASE_ADDRESS); - return -1; - } - - if(fgets(buf, BUFFER_MAX, fp) != NULL) - { - res = sscanf(buf, "%x", baseAddress); - } - else - { - res = -1; - } - fclose(fp); - - return res; -} +static char *dereference_tizen_exe_path(const char *path, char *resolved); int is_same_app_process(char* appPath, int pid) { @@ -575,7 +429,7 @@ int is_same_app_process(char* appPath, int pid) return ret; } -char *dereference_tizen_exe_path(const char *path, char *resolved) +static char *dereference_tizen_exe_path(const char *path, char *resolved) { char *res = NULL; char tmp_path[PATH_MAX]; diff --git a/daemon/utils.h b/daemon/utils.h index b8d3295..c401611 100644 --- a/daemon/utils.h +++ b/daemon/utils.h @@ -41,7 +41,6 @@ extern "C" { #define LAUNCH_APP_PATH "/usr/bin/launch_app" #define DEBUG_LAUNCH_PRELOAD_PATH "/usr/bin/debug_launchpad_preloading_preinitializing_daemon" -#define KILL_APP_PATH "/usr/bin/pkill" #define LAUNCH_APP_NAME "launch_app" #define WRT_LAUNCHER_PATH "/usr/bin/wrt-launcher" #define WRT_LAUNCHER_NAME "wrt-launcher" @@ -50,12 +49,8 @@ extern "C" { #define LAUNCH_APP_SDK "__AUL_SDK__" #define DA_PRELOAD_EXEC "DYNAMIC_ANALYSIS" #define DA_PRELOAD_TIZEN "LD_PRELOAD=/usr/lib/da_probe_tizen.so" -#define BATT_LOG_FILE "/home/developer/sdk_tools/da/battery/" #define SHELL_CMD "/bin/sh" -#define DA_INSTALL_PATH "/home/developer/sdk_tools/da/da_install_path" -#define DA_BUILD_OPTION "/home/developer/sdk_tools/da/da_build_option" -#define DA_BASE_ADDRESS "/home/developer/sdk_tools/da/da_base_address" uint64_t str_to_uint64(char* str); int64_t str_to_int64(char* str); @@ -64,21 +59,12 @@ int remove_indir(const char *dirname); int kill_app(const char *binary_path); -pid_t find_pid_from_path(const char* path); - -int get_app_type(char* appPath); -int get_executable(char* appPath, char* buf, int buflen); -int get_app_install_path(char *strAppInstall, int length); -int is_app_built_pie(void); -int get_app_base_address(int *baseAddress); int is_same_app_process(char* appPath, int pid); int exec_app_tizen(const char *app_id, const char *exec_path); int exec_app_common(const char* exec_path); int exec_app_web(const char *app_id); void kill_app_web(const char *app_id); -char *dereference_tizen_exe_path(const char *path, char *resolved); -void fd_setup_smack_attributes(int fd); float get_uptime(void); #ifdef __cplusplus } |