focus-server: Enhancement for session backward compatibility regarding unregistering...
[platform/core/multimedia/libmm-sound.git] / focus_server / mm_sound_focus_server.c
index 2a27365..1080d4e 100644 (file)
 #include <fcntl.h>
 #include <semaphore.h>
 
+#ifdef USE_LWIPC
+#include <lwipc.h>
+#endif
+
+#include <signal.h>
+
 #include "../include/mm_sound_common.h"
 #include "include/mm_sound_mgr_focus.h"
 #include "include/mm_sound_mgr_focus_dbus.h"
@@ -46,13 +52,6 @@ typedef struct {
 static int _get_option(int argc, char **argv, server_arg *arg);
 static int _usage(int argc, char **argv);
 
-static struct sigaction sigint_action;  /* Backup pointer of SIGINT handler */
-static struct sigaction sigabrt_action; /* Backup pointer of SIGABRT signal handler */
-static struct sigaction sigsegv_action; /* Backup pointer of SIGSEGV fault signal handler */
-static struct sigaction sigterm_action; /* Backup pointer of SIGTERM signal handler */
-static struct sigaction sigsys_action;  /* Backup pointer of SIGSYS signal handler */
-static void _exit_handler(int sig);
-
 GMainLoop *g_mainloop;
 
 static void _mainloop_run()
@@ -115,36 +114,6 @@ static int _get_option(int argc, char **argv, server_arg *arg)
        return 0;
 }
 
-//__attribute__ ((destructor))
-static void _exit_handler(int sig)
-{
-       switch (sig) {
-       case SIGINT:
-               sigaction(SIGINT, &sigint_action, NULL);
-               debug_error("signal(SIGINT) error");
-               break;
-       case SIGABRT:
-               sigaction(SIGABRT, &sigabrt_action, NULL);
-               debug_error("signal(SIGABRT) error");
-               break;
-       case SIGSEGV:
-               sigaction(SIGSEGV, &sigsegv_action, NULL);
-               debug_error("signal(SIGSEGV) error");
-               break;
-       case SIGTERM:
-               sigaction(SIGTERM, &sigterm_action, NULL);
-               debug_error("signal(SIGTERM) error");
-               break;
-       case SIGSYS:
-               sigaction(SIGSYS, &sigsys_action, NULL);
-               debug_error("signal(SIGSYS) error");
-               break;
-       default:
-               break;
-       }
-       raise(sig);
-}
-
 static int _usage(int argc, char **argv)
 {
        fprintf(stderr, "Usage: %s [Options]\n", argv[0]);
@@ -158,7 +127,6 @@ int main(int argc, char **argv)
 {
        sem_t* sem = NULL;
        server_arg serveropt;
-       struct sigaction action;
 #if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING)
        int pid;
 #endif
@@ -166,10 +134,6 @@ int main(int argc, char **argv)
        int fd_ss_ready = -1;
 #endif
 
-       action.sa_handler = _exit_handler;
-       action.sa_flags = 0;
-       sigemptyset(&action.sa_mask);
-
        if (_get_option(argc, argv, &serveropt))
                return 1;
 
@@ -204,11 +168,6 @@ int main(int argc, char **argv)
                }
        }
 #endif
-       sigaction(SIGABRT, &action, &sigabrt_action);
-       sigaction(SIGSEGV, &action, &sigsegv_action);
-       sigaction(SIGTERM, &action, &sigterm_action);
-       sigaction(SIGSYS, &action, &sigsys_action);
-
        if (serveropt.startserver) {
                MMSoundMgrFocusDbusInit();
                MMSoundMgrFocusInit();
@@ -234,9 +193,9 @@ int main(int argc, char **argv)
                /* broadcast if we're ready */
 #ifdef USE_LWIPC
                if (LwipcEventDone(SOUND_SERVER_READY) < 0) {
-                               debug_error("cannot create SOUND_SERVER_READY(sound_server_ready)");
+                       debug_error("cannot create SOUND_SERVER_READY(sound_server_ready)");
                } else {
-                               debug_warning("SOUND_SERVER_READY(%s) event was created", SOUND_SERVER_READY);
+                       debug_warning("SOUND_SERVER_READY(%s) event was created", SOUND_SERVER_READY);
                }
 #else
                if ((fd_ss_ready = creat(SOUND_SERVER_READY, 0644)) != -1) {