[Title] apply runtime config and new protocol
[platform/core/system/swap-manager.git] / daemon / utils.h
1 /*
2 *  DA manager
3 *
4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5 *
6 * Contact: 
7 *
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
11
12  * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 * Contributors:
25 * - S-Core Co., Ltd
26 *
27 */ 
28
29 #include <stdint.h>
30 #include <sys/types.h>
31
32 #ifndef _UTILS_H_
33 #define _UTILS_H_
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #define LAUNCH_APP_PATH                 "/usr/bin/launch_app"
40 #define KILL_APP_PATH                   "/usr/bin/pkill"
41 #define LAUNCH_APP_NAME                 "launch_app"
42 #define DA_PRELOAD_EXEC                 "__AUL_SDK_DYNAMIC_ANALYSIS"
43 #define DA_PRELOAD(AppType)             AppType ? DA_PRELOAD_OSP : DA_PRELOAD_TIZEN
44 #define DA_PRELOAD_TIZEN                "LD_PRELOAD=/usr/lib/da_probe_tizen.so"
45 #define DA_PRELOAD_OSP                  "LD_PRELOAD=/usr/lib/da_probe_osp.so"
46 #define BATT_LOG_FILE                   "/home/developer/sdk_tools/da/battery/"
47 #define SHELL_CMD                               "/bin/sh"
48
49 #define DA_INSTALL_PATH         "/home/developer/sdk_tools/da/da_install_path"
50 #define DA_BUILD_OPTION         "/home/developer/sdk_tools/da/da_build_option"
51 #define DA_BASE_ADDRESS         "/home/developer/sdk_tools/da/da_base_address"
52
53 enum ApplicationType
54 {
55         APP_TYPE_TIZEN = 0,
56         APP_TYPE_OSP = 1
57 };
58
59 uint64_t        str_to_uint64(char* str);
60 int64_t         str_to_int64(char* str);
61
62 int remove_indir(const char *dirname);
63
64 char* get_app_name(char* binary_path);
65
66 int exec_app(const char* exec_path, int app_type);
67
68 void kill_app(const char* binary_path);
69
70 pid_t find_pid_from_path(const char* path);
71
72 int get_app_type(char* appPath);
73 int get_executable(char* appPath, char* buf, int buflen);
74 int get_app_install_path(char *strAppInstall, int length);
75 int is_app_built_pie(void);
76 int get_app_base_address(int *baseAddress);
77 int is_same_app_process(char* appPath, int pid);
78
79 #ifdef __cplusplus
80 }
81 #endif
82
83 #endif