[FEATURE] Implement kernel -> user connection
[platform/core/system/swap-manager.git] / daemon / utils.h
1 /*
2  *  DA manager
3  *
4  * Copyright (c) 2000 - 2013 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  * Cherepanov Vitaliy <v.cherepanov@samsung.com>
12  * Nikita Kalyazin    <n.kalyazin@samsung.com>
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License");
15  * you may not use this file except in compliance with the License.
16  * You may obtain a copy of the License at
17  *
18  * http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS,
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  *
26  * Contributors:
27  * - S-Core Co., Ltd
28  * - Samsung RnD Institute Russia
29  *
30  */
31
32 #include <stdint.h>
33 #include <sys/types.h>
34
35 #ifndef _UTILS_H_
36 #define _UTILS_H_
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 #define LAUNCH_APP_PATH                 "/usr/bin/launch_app"
43 #define KILL_APP_PATH                   "/usr/bin/pkill"
44 #define LAUNCH_APP_NAME                 "launch_app"
45 #define LAUNCH_APP_SDK                  "__AUL_SDK__"
46 #define DA_PRELOAD_EXEC                 "DYNAMIC_ANALYSIS"
47 #define DA_PRELOAD(AppType)             AppType ? DA_PRELOAD_OSP : DA_PRELOAD_TIZEN
48 #define DA_PRELOAD_TIZEN                "LD_PRELOAD=/usr/lib/da_probe_tizen.so"
49 #define DA_PRELOAD_OSP                  "LD_PRELOAD=/usr/lib/da_probe_osp.so"
50 #define BATT_LOG_FILE                   "/home/developer/sdk_tools/da/battery/"
51 #define SHELL_CMD                               "/bin/sh"
52
53 #define DA_INSTALL_PATH         "/home/developer/sdk_tools/da/da_install_path"
54 #define DA_BUILD_OPTION         "/home/developer/sdk_tools/da/da_build_option"
55 #define DA_BASE_ADDRESS         "/home/developer/sdk_tools/da/da_base_address"
56
57 uint64_t        str_to_uint64(char* str);
58 int64_t         str_to_int64(char* str);
59
60 int remove_indir(const char *dirname);
61
62 int kill_app(const char *binary_path);
63
64 pid_t find_pid_from_path(const char* path);
65
66 int get_app_type(char* appPath);
67 int get_executable(char* appPath, char* buf, int buflen);
68 int get_app_install_path(char *strAppInstall, int length);
69 int is_app_built_pie(void);
70 int get_app_base_address(int *baseAddress);
71 int is_same_app_process(char* appPath, int pid);
72
73 int exec_app_tizen(const char *app_id, const char *exec_path);
74 int exec_app_common(const char* exec_path);
75 char *dereference_tizen_exe_path(const char *path, char *resolved);
76 void fd_setup_smack_attributes(int fd);
77 float get_uptime(void);
78 #ifdef __cplusplus
79 }
80 #endif
81
82 #endif