From: Hwankyu Jhun Date: Fri, 29 Jul 2016 03:46:55 +0000 (+0900) Subject: Wait socket creation for stdout & stderr redirection X-Git-Tag: submit/tizen/20160729.050247~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eb77501ac10aec61f1a9898cc51fd104aa92bf73;p=platform%2Fcore%2Fappfw%2Fdebug-launchpad.git Wait socket creation for stdout & stderr redirection Change-Id: I18ec250046dca0a64446ca5828649f699277d1c0 Signed-off-by: Hwankyu Jhun --- diff --git a/src/debug-launchpad.c b/src/debug-launchpad.c index 30d5385..f1a872c 100644 --- a/src/debug-launchpad.c +++ b/src/debug-launchpad.c @@ -63,6 +63,8 @@ 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"); @@ -75,6 +77,20 @@ 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 " @@ -264,15 +280,15 @@ static int __start_process(const char *appid, const char *app_path, PERF("fork done"); _D("lock up test log(no error): fork done"); + if (__stdout_stderr_redirection(__get_caller_pid(kb))) + _E("__stdout_stderr_redirection() failed"); + _signal_unblock_sigchld(); _signal_fini(); _close_all_fds(); _delete_sock_path(getpid(), getuid()); - if (__stdout_stderr_redirection(__get_caller_pid(kb))) - _E("__stdout_stderr_redirection() failed"); - PERF("prepare exec - fisrt done"); _D("lock up test log(no error): prepare exec - first done");