From: MooChang Kim Date: Mon, 28 Oct 2013 08:53:31 +0000 (+0900) Subject: change permission and smack of massif output log file X-Git-Tag: 2.2.1_release~1 X-Git-Url: http://review.tizen.org/git/?p=framework%2Fappfw%2Fdebug-launchpad.git;a=commitdiff_plain;h=37ce6a83f76138d691f9f4e6f5f845444888109c change permission and smack of massif output log file Change-Id: I80eadf1eea3f77d4adc45286d249f9f3911d811a Signed-off-by: MooChang Kim --- diff --git a/include/app_signal.h b/include/app_signal.h index cad9e17..474def5 100755 --- a/include/app_signal.h +++ b/include/app_signal.h @@ -32,4 +32,13 @@ #define AUL_DBUS_APPDEAD_SIGNAL "app_dead" #define AUL_DBUS_APPLAUNCH_SIGNAL "app_launch" +#define OPT_VALGRIND_LOGFILE "--log-file=" +#define OPT_VALGRIND_LOGFILE_FIXED "--log-file=/tmp/valgrind_result.txt" +#define PATH_VALGRIND_LOGFILE "/tmp/valgrind_result.txt" +#define OPT_VALGRIND_XMLFILE "--xml-file=" +#define OPT_VALGRIND_XMLFILE_FIXED "--xml-file=/tmp/valgrind_result.xml" +#define PATH_VALGRIND_XMLFILE "/tmp/valgrind_result.xml" +#define OPT_VALGRIND_MASSIFFILE "--massif-out-file=" +#define OPT_VALGRIND_MASSIFFILE_FIXED "--massif-out-file=/tmp/valgrind_result.xml" + #endif diff --git a/src/launchpad.c b/src/launchpad.c index aaec35c..feb124f 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -87,15 +87,6 @@ #define PATH_DA_SO "/usr/lib/da_probe_tizen.so" #define PATH_NATIVE_APP "/opt/apps/" -#define OPT_VALGRIND_LOGFILE "--log-file=" -#define OPT_VALGRIND_LOGFILE_FIXED "--log-file=/tmp/valgrind_result.txt" -#define PATH_VALGRIND_LOGFILE "/tmp/valgrind_result.txt" -#define OPT_VALGRIND_XMLFILE "--xml-file=" -#define OPT_VALGRIND_XMLFILE_FIXED "--xml-file=/tmp/valgrind_result.xml" -#define PATH_VALGRIND_XMLFILE "/tmp/valgrind_result.xml" -#define OPT_VALGRIND_MASSIFFILE "--massif-out-file=" -#define OPT_VALGRIND_MASSIFFILE_FIXED "--massif-out-file=/tmp/valgrind_result.xml" - #if (ARCH==arm) #define PATH_MEMCHECK "/opt/home/developer/sdk_tools/valgrind/usr/lib/valgrind/memcheck-arm-linux" #elif (ARCH==x86) @@ -935,7 +926,6 @@ int __prepare_valgrind_outputfile(bundle *kb) , OPT_VALGRIND_MASSIFFILE_FIXED); return -1; }else{ - poll_outputfile |= POLL_VALGRIND_XMLFILE; if(remove(PATH_VALGRIND_XMLFILE)){ _D("cannot remove %s" , PATH_VALGRIND_XMLFILE); @@ -1062,27 +1052,6 @@ int __prepare_fork(bundle *kb, char *appid) return 0; } -/* chmod and chsmack to read file without root privilege */ -void __chmod_chsmack_toread(const char * path) -{ - /* chmod */ - if(dlp_chmod(path, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, 0)) - { - _E("unable to set 644 to %s", path); - }else{ - _D("set 644 to %s", path); - } - - /* chsmack */ - if(smack_setlabel(path, "*", SMACK_LABEL_ACCESS)) - { - _E("failed chsmack -a \"*\" %s", path); - }else{ - _D("chsmack -a \"*\" %s", path); - } - - return; -} /* waiting for creating outputfile by child process */ void __waiting_outputfile() @@ -1104,7 +1073,7 @@ void __waiting_outputfile() __chmod_chsmack_toread(PATH_VALGRIND_XMLFILE); poll_outputfile &= ~POLL_VALGRIND_XMLFILE; } - + if(poll_outputfile) { _D("-- now wait for creating the file --"); usleep(50 * 1000); /* 50ms sleep*/ diff --git a/src/sigchild.h b/src/sigchild.h index 85824bc..c43978e 100755 --- a/src/sigchild.h +++ b/src/sigchild.h @@ -116,6 +116,28 @@ static inline int __send_app_launch_signal(int launch_pid) return 0; } +/* chmod and chsmack to read file without root privilege */ +static void __chmod_chsmack_toread(const char * path) +{ + /* chmod */ + if(dlp_chmod(path, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, 0)) + { + _E("unable to set 644 to %s", path); + }else{ + _D("set 644 to %s", path); + } + + /* chsmack */ + if(smack_setlabel(path, "*", SMACK_LABEL_ACCESS)) + { + _E("failed chsmack -a \"*\" %s", path); + }else{ + _D("chsmack -a \"*\" %s", path); + } + + return; +} + static int __sigchild_action(void *data) { pid_t dead_pid; @@ -129,6 +151,12 @@ static int __sigchild_action(void *data) if(dead_pid == gdbserver_pid) dead_pid = gdbserver_app_pid; + /* valgrind xml file */ + if(access(PATH_VALGRIND_XMLFILE,F_OK)==0) + { + __chmod_chsmack_toread(PATH_VALGRIND_XMLFILE); + } + __send_app_dead_signal(dead_pid); snprintf(buf, MAX_LOCAL_BUFSZ, "%s/%d", AUL_SOCK_PREFIX, dead_pid);