From 28fd55525dfaf497222cc3456feb35c10a8cdaca Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 8 Aug 2016 14:46:09 +0900 Subject: [PATCH] Remove checking socket creation Change-Id: I9c84584498a4feae91249f13152f2a06314ebe5d Signed-off-by: Hwankyu Jhun --- include/common.h | 2 -- src/common.c | 52 --------------------------------------------------- src/debug-launchpad.c | 30 +---------------------------- 3 files changed, 1 insertion(+), 83 deletions(-) diff --git a/include/common.h b/include/common.h index 73dada5..d72241c 100644 --- a/include/common.h +++ b/include/common.h @@ -68,8 +68,6 @@ void _appinfo_free(appinfo_t *appinfo); void _modify_bundle(bundle *kb, int caller_pid, appinfo_t *appinfo, int cmd); void _set_env(appinfo_t *app_info, bundle *kb); char **_create_argc_argv(bundle *kb, int *margc, const char *app_path); -int _proc_check_cmdline_bypid(int pid); -void _prepare_listen_sock(void); int _delete_sock_path(int pid, uid_t uid); int _close_all_fds(void); diff --git a/src/common.c b/src/common.c index 343e62d..8912352 100644 --- a/src/common.c +++ b/src/common.c @@ -780,58 +780,6 @@ char **_create_argc_argv(bundle *kb, int *margc, const char *app_path) return argv; } -static int __read_proc(const char *path, char *buf, int size) -{ - int fd; - int ret; - - if (buf == NULL || path == NULL) - return -1; - - fd = open(path, O_RDONLY); - if (fd < 0) - return -1; - - ret = read(fd, buf, size - 1); - if (ret <= 0) { - close(fd); - return -1; - } - - buf[ret] = 0; - close(fd); - - return ret; -} - -int _proc_check_cmdline_bypid(int pid) -{ - char buf[MAX_CMD_BUFSZ]; - int ret; - - snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid); - ret = __read_proc(buf, buf, sizeof(buf)); - if (ret <= 0) - return -1; - - _D("cmdline: %s", buf); - - return 0; -} - -void _prepare_listen_sock(void) -{ - int fd; - char buf[12]; - - fd = __create_server_socket(true); - if (fd < 0) - return; - - snprintf(buf, sizeof(buf), "%d", fd); - setenv("AUL_LISTEN_SOCK", buf, 1); -} - static int __delete_dir(const char *path) { DIR *dp; diff --git a/src/debug-launchpad.c b/src/debug-launchpad.c index f1a872c..c67df3c 100644 --- a/src/debug-launchpad.c +++ b/src/debug-launchpad.c @@ -62,11 +62,7 @@ static int __real_send(int clifd, int ret) static void __send_result_to_caller(int clifd, int ret) { - int res; - int count = 0; - char path[PATH_MAX]; - - _W("Check app launching"); + _W("send result: %d", ret); if (clifd == -1) return; @@ -77,28 +73,6 @@ static void __send_result_to_caller(int clifd, int ret) return; } - snprintf(path, sizeof(path), "/run/aul/apps/%d/%d/.app-sock", - getuid(), ret); - _D("socket path: %s", path); - do { - if (access(path, F_OK) == 0) { - _D("%s exists", path); - break; - } - - _D("-- now wait socket creation --"); - usleep(50 * 1000); - count++; - } while (count < 20); - - res = _proc_check_cmdline_bypid(ret); - if (res < 0) { - _E("The app process might be terminated " - "while we are wating %d", ret); - __real_send(clifd, -1); /* abnormally launched */ - return; - } - if (__real_send(clifd, ret) < 0) { if (kill(ret, SIGKILL) == -1) _E("Failed to send SIGKILL: %d", errno); @@ -147,8 +121,6 @@ static int __prepare_exec(const char *appid, const char *app_path, return -1; } - _prepare_listen_sock(); - memset(process_name, '\0', AUL_PR_NAME); snprintf(process_name, AUL_PR_NAME, "%s", file_name); prctl(PR_SET_NAME, process_name); -- 2.7.4