summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMooChang Kim <moochang.kim@samsung.com>2013-10-28 17:53:31 +0900
committerMooChang Kim <moochang.kim@samsung.com>2013-10-28 17:53:31 +0900
commit37ce6a83f76138d691f9f4e6f5f845444888109c (patch)
tree2dd3cc2d2777cb0d4dbecdb51004d2cafadd5a7e
parent42ad5ce010a6a9a697ed057fbdf61bbf66c13d1e (diff)
downloaddebug-launchpad-37ce6a83f76138d691f9f4e6f5f845444888109c.tar.gz
debug-launchpad-37ce6a83f76138d691f9f4e6f5f845444888109c.tar.bz2
debug-launchpad-37ce6a83f76138d691f9f4e6f5f845444888109c.zip
change permission and smack of massif output log file
Change-Id: I80eadf1eea3f77d4adc45286d249f9f3911d811a Signed-off-by: MooChang Kim <moochang.kim@samsung.com>
-rwxr-xr-xinclude/app_signal.h9
-rwxr-xr-xsrc/launchpad.c33
-rwxr-xr-xsrc/sigchild.h28
3 files changed, 38 insertions, 32 deletions
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);