disable signal handler for VD dotnet application, cleanup will be done by external... 63/156363/1 accepted/tizen/unified/20171020.091640 submit/tizen/20171018.063752 submit/tizen/20171019.095903
authorSeungbae Shin <seungbae.shin@samsung.com>
Mon, 16 Oct 2017 13:18:36 +0000 (22:18 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Wed, 18 Oct 2017 07:11:58 +0000 (07:11 +0000)
[Version] 0.2.16
[Issue Type] Product / Dotnet

Change-Id: Ib2567f718b2b7c198c47b59c3e6d180dabd17d19
(cherry picked from commit 21908ce17bb2b36473051ac4ea3e57ed216ff040)

mm_session.c
mm_session.h
packaging/libmm-session.spec

index 1358df0..d605f1c 100644 (file)
@@ -30,6 +30,7 @@
 #include <errno.h>
 #include <pthread.h>
 #include <signal.h>
+#include <stdlib.h>
 
 #define EXPORT_API __attribute__((__visibility__("default")))
 #define MAX_FILE_LENGTH 256
@@ -383,23 +384,15 @@ int _mm_session_util_read_information(int app_pid, int *session_type, int *flags
 
 void __session_signal_handler(int signo, siginfo_t *siginfo, void *context)
 {
-       char filename[MAX_FILE_LENGTH];
-       char str_error[256];
+       sigset_t old_mask, all_mask;
 
-       debug_warning("ENTER, sig.num(%d)", signo);
+       debug_warning("ENTER, signo(%d), siginfo(%p), context(%p)", signo, siginfo, context);
 
        /* signal block -------------- */
-       sigset_t old_mask, all_mask;
        sigfillset(&all_mask);
        sigprocmask(SIG_BLOCK, &all_mask, &old_mask);
 
-       snprintf(filename, sizeof(filename) - 1, "/tmp/mm_session_%d", getpid());
-       if (!remove(filename)) {
-               debug_log(" remove %s success\n", filename);
-       } else {
-               strerror_r(errno, str_error, sizeof(str_error));
-               debug_error(" remove %s failed with %s\n", filename, str_error);
-       }
+       _mm_session_util_delete_information(-1);
 
        sigprocmask(SIG_SETMASK, &old_mask, NULL);
        /* signal unblock ------------ */
@@ -448,15 +441,42 @@ void __session_signal_handler(int signo, siginfo_t *siginfo, void *context)
        debug_warning("LEAVE");
 }
 
+#ifdef TIZEN_TV
+EXPORT_API
+void mm_session_dotnet_cleanup(int signo)
+{
+       debug_warning("dotnet cleanup [%d]", signo);
+       _mm_session_util_delete_information(-1);
+
+}
+static bool _is_dotnet_app(void)
+{
+       char *is_dotnet = NULL;
+
+       is_dotnet = getenv("DOTNET_APP");
+       if (is_dotnet && atoi(is_dotnet) == 1)
+               return true;
+       else
+               return false;
+}
+#endif
+
 __attribute__ ((constructor))
 void __mmsession_initialize(void)
 {
        struct sigaction session_action;
-       session_action.sa_sigaction = __session_signal_handler;
-       session_action.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
 
        debug_fenter();
 
+#ifdef TIZEN_TV
+       if (_is_dotnet_app()) {
+               debug_warning("no signal handler for dotnet!!");
+               return;
+       }
+#endif
+       session_action.sa_sigaction = __session_signal_handler;
+       session_action.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
+
        sigemptyset(&session_action.sa_mask);
 
        sigaction(SIGINT, &session_action, &session_int_old_action);
@@ -476,7 +496,12 @@ void __mmsession_finalize(void)
        debug_fenter();
 
        _mm_session_util_delete_information(-1);
-
+#ifdef TIZEN_TV
+       if (_is_dotnet_app()) {
+               debug_warning("no signal handler for dotnet!!");
+               return;
+       }
+#endif
        sigaction(SIGINT, &session_int_old_action, NULL);
        sigaction(SIGABRT, &session_abrt_old_action, NULL);
        sigaction(SIGSEGV, &session_segv_old_action, NULL);
index 78da3b6..3292397 100644 (file)
@@ -230,6 +230,10 @@ int mm_session_get_current_information(int *session_type, int *session_options);
  */
 int mm_session_update_option(session_update_type_t update_type, int options);
 
+#ifdef TIZEN_TV
+void mm_session_dotnet_cleanup(int signo);
+#endif
+
 /**
        @}
  */
index d862329..e1509e6 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-session
 Summary:    Multimedia Session Library
-Version:    0.2.15
+Version:    0.2.16
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
@@ -26,6 +26,11 @@ cp %{SOURCE1001} .
 
 %build
 CFLAGS="$CFLAGS -Wp,-D_FORTIFY_SOURCE=0"
+
+%if "%{?TIZEN_PRODUCT_TV}" == "1"
+       CFLAGS+=" -DTIZEN_TV";export CFLAGS
+%endif
+
 %reconfigure
 %__make %{?_smp_mflags}