Update fault detection code
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 4 Jun 2012 06:02:22 +0000 (15:02 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 4 Jun 2012 07:41:29 +0000 (16:41 +0900)
Update the pause/resume state check code

Change-Id: I599bf00dca69571ed7c256a48a4a47f974a7a67f

debian/changelog
packaging/com.samsung.data-provider-slave.spec
src/fault.c
src/livebox.c

index f53c523..c3eb0a4 100644 (file)
@@ -1,3 +1,12 @@
+data-provider-slave (0.2.1) unstable; urgency=low
+
+  * Git: slp/pkgs/d/data-provider-slave
+  * Tag: data-provider-slave_0.2.0
+
+  Fault(crash) detection code is updated
+
+ -- Sung-jae Park <nicesj.park@samsung.com>  Mon, 04 Jun 2012 15:47:39 +0900
+
 data-provider-slave (0.2.0) unstable; urgency=low
 
   * Git: slp/pkgs/d/data-provider-slave
index dc40e3d..aa2beeb 100644 (file)
@@ -1,6 +1,6 @@
 Name: com.samsung.data-provider-slave
 Summary: Slave data provider
-Version: 0.2.0
+Version: 0.2.1
 Release: 1
 Group: main/app
 License: Samsung Proprietary License
index 5764f8e..5607302 100644 (file)
@@ -1,9 +1,14 @@
 #define _GNU_SOURCE
 #include <stdio.h>
+#include <string.h>
 #include <errno.h>
 #include <dlfcn.h>
 #include <libgen.h>
 #include <sys/time.h>
+#include <execinfo.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 
 #include <glib.h>
 #include <glib-object.h>
@@ -52,6 +57,45 @@ static void signal_handler(int signum, siginfo_t *info, void *unused)
 
                DbgPrint("ALARM: %d.%d (%d)\n",
                                res_tv.tv_sec, res_tv.tv_usec, DEFAULT_LIFE_TIMER);
+       } else {
+               int i;
+               int fd;
+               int *stack;
+               char *ptr; 
+               int len;
+               char log_fname[100];
+
+               snprintf(log_fname, sizeof(log_fname), "/opt/share/live_magazine/log/slave.%d", getpid());
+
+               fd = open(log_fname, O_RDWR|O_CREAT|O_SYNC, 0644);
+               for (stack = &signum, i = 0; i < 100; i++, stack++) {
+                       if (!dladdr((void *)*stack, &dinfo))
+                               continue;
+
+                       len = strlen(dinfo.dli_fname);
+                       while (len > 0 && dinfo.dli_fname[len] != '/')
+                               len--;
+
+                       if (len == 0)
+                               continue;
+
+                       if (dinfo.dli_fname[len] == '/')
+                               len++; /* for skipping '/' */
+
+                       ptr = (char *)dinfo.dli_fname + len;
+
+                       if (strncmp(ptr, "liblive-", strlen("liblive-")))
+                               continue;
+
+                       ErrPrint("[%d] File: %s\n", i, ptr);
+                       if (fd > 0)
+                               write(fd, ptr, strlen(ptr));
+
+                       break;
+               }
+
+               if (fd > 0)
+                       close(fd);
        }
 
        ErrPrint("=====\n");
@@ -73,6 +117,9 @@ int fault_init(void)
 {
        struct sigaction act;
 
+       if (access("/tmp/live.err", F_OK) == 0)
+               ErrPrint("Error log still exists (/tmp/live.err)\n");
+
        act.sa_sigaction = signal_handler;
        act.sa_flags = SA_SIGINFO;
 
index 8d6ac16..b906087 100644 (file)
@@ -62,7 +62,6 @@ static inline void update_monitor_cnt(struct item *item)
         * And handling this heavy updating from the
         * file update callback.
         */
-       DbgPrint("Update interval: %lf\n", interval);
        if (interval >= MINIMUM_UPDATE_INTERVAL)
                item->monitor_cnt++;
        else
@@ -146,9 +145,6 @@ static int file_updated_cb(const char *filename, void *data, int over)
 
        item = data;
 
-//     if (item->inst->item->has_livebox_script)
-//             return EXIT_SUCCESS;
-
        if (so_get_output_info(item->inst, &w, &h, &priority) == DONE) {
                item->inst->w = w;
                item->inst->h = h;
@@ -310,8 +306,7 @@ static inline void update_monitor_del(struct item *item)
        char *tmp;
        int len;
 
-//     if (!item->inst->item->has_livebox_script)
-               update_monitor_del_update_cb(item->inst->filename, file_updated_cb);
+       update_monitor_del_update_cb(item->inst->filename, file_updated_cb);
 
        len = strlen(item->inst->filename) + strlen(".desc") + 1;
        tmp = malloc(len);
@@ -360,8 +355,7 @@ static inline int add_file_update_monitor(struct item *item)
 
 static inline int update_monitor_add(struct item *item)
 {
-//     if (!item->inst->item->has_livebox_script)
-               add_file_update_monitor(item);
+       add_file_update_monitor(item);
        add_desc_update_monitor(item);
        return 0;
 }
@@ -775,9 +769,6 @@ void livebox_pause_all(void)
        Eina_List *l;
        struct item *item;
 
-       if (s_info.paused)
-               return;
-
        s_info.paused = 1;
 
        EINA_LIST_FOREACH(s_info.item_list, l, item) {
@@ -794,9 +785,6 @@ void livebox_resume_all(void)
        Eina_List *l;
        struct item *item;
 
-       if (!s_info.paused)
-               return;
-
        s_info.paused = 0;
 
        EINA_LIST_FOREACH(s_info.item_list, l, item) {