SET_TARGET_PROPERTIES(${TARGET_LIB_AMD} PROPERTIES LINK_FLAGS "-ldl -lpthread")
TARGET_INCLUDE_DIRECTORIES(${TARGET_LIB_AMD} PUBLIC
- ${CMAKE_CURRENT_SOURCE_DIR}/api)
-TARGET_INCLUDE_DIRECTORIES(${TARGET_LIB_AMD} PUBLIC
- ${CMAKE_CURRENT_SOURCE_DIR}/../)
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/../
+ ${CMAKE_CURRENT_SOURCE_DIR}/api
+)
APPLY_PKG_CONFIG(${TARGET_LIB_AMD} PUBLIC
AUL_DEPS
return G_SOURCE_REMOVE;
}, nullptr);
- tizen_core_h core = nullptr;
- int ret = tizen_core_task_create("main", false, &core);
+ tizen_core_task_h task = nullptr;
+ int ret = tizen_core_task_create("main", false, &task);
if (ret != TIZEN_CORE_ERROR_NONE) {
_E("tizen_core_task_create() is failed. error(%d)", ret);
return -1;
}
_W("AMD_LOOP_START");
- tizen_core_task_run(core);
+ tizen_core_task_run(task);
_W("AMD_LOOP_END");
Finalize();
+ tizen_core_task_destroy(task);
tizen_core_shutdown();
return 0;
}
try {
auto app_com_socket = std::make_shared<AppComSocket>(pid, uid, this);
std::string endpoint = GetEndpoint(pid, uid);
- std::filesystem::path path(endpoint);
- if (!std::filesystem::exists(path)) {
- _E("pid(%d) app com endpoint does not exists.", pid);
+ if (access(endpoint.c_str(), F_OK) != 0) {
+ _E("pid(%d) app com endpoint does not exists. errno(%d)", pid, errno);
return nullptr;
}
namespace amd {
namespace {
+constexpr const char kAmdSockReady[] = "/run/aul/daemons/.amd-sock";
+
bool IsTerminationRequest(int cmd) {
if (cmd == APP_TERM_BY_PID ||
cmd == APP_TERM_REQ_BY_PID ||
// TODO(Abstract Socket Issue): file-based socket check
marker = open(kAmdSockReady, O_RDWR | O_CREAT,
S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ if(marker < 0) {
+ _E("Fail to create ready file (%s)", kAmdSockReady);
+ Fini();
+ return false;
+ }
close(marker);
amd_io_ = g_io_channel_unix_new(amd_fd_);
}
void RequestManager::Fini() {
+ unlink(kAmdSockReady);
+
if (amd_wid_) {
g_source_remove(amd_wid_);
amd_wid_ = 0;
ctx = (struct app_group_context_s *)node->data;
group = _app_group_find(ctx->id);
+ if (!group) {
+ _E("Failed to find app group. %s", ctx->id);
+ return NULL;
+ }
+
new_ctx = __create_app_group_context(ctx->pid, ctx->id, ctx->caller_pid,
ctx->caller_id, ctx->launch_mode, ctx->can_shift, true);
if (!new_ctx) {
new_ctx->reroute = true;
new_ctx->can_be_leader = ctx->can_be_leader;
- group = _app_group_find(ctx->id);
group->list = g_list_append(group->list, new_ctx);
return g_list_last(group->list);