From dc8a28fe577ae7a7adebd0fe009c7438207ee5b4 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Mon, 4 Jun 2012 15:02:22 +0900 Subject: [PATCH] Update fault detection code Update the pause/resume state check code Change-Id: I599bf00dca69571ed7c256a48a4a47f974a7a67f --- debian/changelog | 9 +++++ packaging/com.samsung.data-provider-slave.spec | 2 +- src/fault.c | 47 ++++++++++++++++++++++++++ src/livebox.c | 16 ++------- 4 files changed, 59 insertions(+), 15 deletions(-) diff --git a/debian/changelog b/debian/changelog index f53c523..c3eb0a4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Mon, 04 Jun 2012 15:47:39 +0900 + data-provider-slave (0.2.0) unstable; urgency=low * Git: slp/pkgs/d/data-provider-slave diff --git a/packaging/com.samsung.data-provider-slave.spec b/packaging/com.samsung.data-provider-slave.spec index dc40e3d..aa2beeb 100644 --- a/packaging/com.samsung.data-provider-slave.spec +++ b/packaging/com.samsung.data-provider-slave.spec @@ -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 diff --git a/src/fault.c b/src/fault.c index 5764f8e..5607302 100644 --- a/src/fault.c +++ b/src/fault.c @@ -1,9 +1,14 @@ #define _GNU_SOURCE #include +#include #include #include #include #include +#include +#include +#include +#include #include #include @@ -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; diff --git a/src/livebox.c b/src/livebox.c index 8d6ac16..b906087 100644 --- a/src/livebox.c +++ b/src/livebox.c @@ -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) { -- 2.7.4