summaryrefslogtreecommitdiff
path: root/daemon/utils.h
blob: de4dea19a6985e4cc66a88aa999cf67baa79958c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 *  DA manager
 *
 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact:
 *
 * Jaewon Lim <jaewon81.lim@samsung.com>
 * Woojin Jung <woojin2.jung@samsung.com>
 * Juyoung Kim <j0.kim@samsung.com>
 * Cherepanov Vitaliy <v.cherepanov@samsung.com>
 * Nikita Kalyazin    <n.kalyazin@samsung.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Contributors:
 * - S-Core Co., Ltd
 * - Samsung RnD Institute Russia
 *
 */

#include <stdint.h>
#include <sys/types.h>

#ifndef _UTILS_H_
#define _UTILS_H_

#ifdef __cplusplus
extern "C" {
#endif

#define LAUNCH_APP_PATH			"/usr/bin/launch_app"
#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"
#define WRT_LAUNCHER_START		"-s"
#define WRT_LAUNCHER_KILL		"-k"
#define LAUNCH_APP_SDK			"__AUL_SDK__"
#define DA_PRELOAD_EXEC			"DYNAMIC_ANALYSIS"
#define DA_PRELOAD(AppType)		AppType ? DA_PRELOAD_OSP : DA_PRELOAD_TIZEN
#define DA_PRELOAD_TIZEN		"LD_PRELOAD=/usr/lib/da_probe_tizen.so"
#define DA_PRELOAD_OSP			"LD_PRELOAD=/usr/lib/da_probe_osp.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);

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
}
#endif

#endif