From 5c3709294117063976a644738de83ef6fb38500c Mon Sep 17 00:00:00 2001 From: MooChang Kim Date: Thu, 10 Oct 2013 14:51:31 +0900 Subject: [PATCH] fix app terminate fail issue in TaskManager cause : when app termiate, TaskManager receives gdbserver pid instead of app pid solution : send app pid instead of gdbserver pid in gdbserver launching case. Change-Id: I46f78d438340b3100ee5f3a001ec118185df43a6 Signed-off-by: MooChang Kim --- src/launchpad.c | 21 +++++++++++++++++++++ src/sigchild.h | 6 ++++++ 2 files changed, 27 insertions(+) diff --git a/src/launchpad.c b/src/launchpad.c index f85437d..b5334df 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -111,6 +111,7 @@ static char *launchpad_cmdline; static int initialized = 0; static int poll_outputfile = 0; +static int is_gdbserver_launched; void __set_oom(); void __set_env(app_info_from_db * menu_info, bundle * kb); @@ -1005,6 +1006,10 @@ int __prepare_fork(bundle *kb, char *appid) } if(str_array == NULL) return 0; + is_gdbserver_launched = 0; + gdbserver_pid = -1; + gdbserver_app_pid = -1; + for (i = 0; i < len; i++) { if(str_array[i] == NULL) break; /* gdbserver */ @@ -1025,6 +1030,7 @@ int __prepare_fork(bundle *kb, char *appid) } __adjust_file_capability(PATH_GDBSERVER); need_to_set_inh_cap_after_fork++; + is_gdbserver_launched++; } /* valgrind */ else if (strncmp(str_array[i], SDK_VALGRIND @@ -1231,6 +1237,21 @@ void __launchpad_main_loop(int main_fd) exit(-1); } + if(is_gdbserver_launched) { + char buf[MAX_LOCAL_BUFSZ]; + + usleep(100 * 1000); /* 100ms sleep */ + snprintf(buf, MAX_LOCAL_BUFSZ, "%s.exe", app_path); + gdbserver_app_pid = __proc_iter_cmdline(NULL, buf); + + if(gdbserver_app_pid == -1) { + _E("faild to get app pid"); + } else { + gdbserver_pid = pid; + pid = gdbserver_app_pid; + } + } + _D("==> real launch pid : %d %s\n", pid, app_path); is_real_launch = 1; diff --git a/src/sigchild.h b/src/sigchild.h index 8aa3238..85824bc 100755 --- a/src/sigchild.h +++ b/src/sigchild.h @@ -26,6 +26,8 @@ static struct sigaction old_sigchild; static DBusConnection *bus = NULL; sigset_t oldmask; +static int gdbserver_pid; +static int gdbserver_app_pid; static inline void __socket_garbage_collector() { @@ -123,6 +125,10 @@ static int __sigchild_action(void *data) if (dead_pid <= 0) goto end; + /* send app pid instead of gdbserver pid */ + if(dead_pid == gdbserver_pid) + dead_pid = gdbserver_app_pid; + __send_app_dead_signal(dead_pid); snprintf(buf, MAX_LOCAL_BUFSZ, "%s/%d", AUL_SOCK_PREFIX, dead_pid); -- 2.7.4