#include "conf.h"
static struct info {
- Ecore_Timer *ping_timer;
+ Ecore_Timer *ping_timer;
} s_info = {
- .ping_timer = NULL,
+ .ping_timer = NULL,
};
static int method_new(struct dynamicbox_event_arg *arg, int *width, int *height, double *priority, void *data)
{
- int ret;
- struct dbox_create_arg _arg;
- DbgPrint("Create: pkgname[%s], id[%s], content[%s], timeout[%d], has_script[%d], period[%lf], cluster[%s], category[%s], skip[%d], abi[%s], size: %dx%d\n",
- arg->pkgname,
- arg->id,
- arg->info.dbox_create.content,
- arg->info.dbox_create.timeout,
- arg->info.dbox_create.has_script,
- arg->info.dbox_create.period,
- arg->info.dbox_create.cluster, arg->info.dbox_create.category,
- arg->info.dbox_create.skip_need_to_create,
- arg->info.dbox_create.abi,
- arg->info.dbox_create.width,
- arg->info.dbox_create.height);
-
- if (!arg->info.dbox_create.content || !strlen(arg->info.dbox_create.content)) {
- DbgPrint("Use default content: \"%s\"\n", DYNAMICBOX_CONF_DEFAULT_CONTENT);
- arg->info.dbox_create.content = DYNAMICBOX_CONF_DEFAULT_CONTENT;
- }
-
- _arg.content = arg->info.dbox_create.content;
- _arg.timeout = arg->info.dbox_create.timeout;
- _arg.has_dynamicbox_script = arg->info.dbox_create.has_script;
- _arg.period = arg->info.dbox_create.period;
- _arg.cluster = arg->info.dbox_create.cluster;
- _arg.category = arg->info.dbox_create.category;
- _arg.abi = arg->info.dbox_create.abi;
- _arg.skip_need_to_create = arg->info.dbox_create.skip_need_to_create;
- _arg.direct_addr = arg->info.dbox_create.direct_addr;
-
- ret = dbox_create(arg->pkgname, arg->id,
- &_arg,
- width, height, priority,
- &arg->info.dbox_create.out_content,
- &arg->info.dbox_create.out_title);
-
- if (ret == 0) {
- if (arg->info.dbox_create.width > 0 && arg->info.dbox_create.height > 0) {
- DbgPrint("Create size: %dx%d (created: %dx%d)\n", arg->info.dbox_create.width, arg->info.dbox_create.height, *width, *height);
- if (*width != arg->info.dbox_create.width || *height != arg->info.dbox_create.height) {
- int tmp;
- tmp = dbox_resize(arg->pkgname, arg->id, arg->info.dbox_create.width, arg->info.dbox_create.height);
- DbgPrint("dbox_resize returns: %d\n", tmp);
- if (tmp == (int)DBOX_STATUS_ERROR_NONE) {
- /*!
- * \note
- * Just returns resized canvas size.
- * Even if it is not ready to render contents.
- * Provider will allocate render buffer using this size.
- */
- *width = arg->info.dbox_create.width;
- *height = arg->info.dbox_create.height;
- }
- }
+ int ret;
+ struct dbox_create_arg _arg;
+ DbgPrint("Create: pkgname[%s], id[%s], content[%s], timeout[%d], has_script[%d], period[%lf], cluster[%s], category[%s], skip[%d], abi[%s], size: %dx%d\n",
+ arg->pkgname,
+ arg->id,
+ arg->info.dbox_create.content,
+ arg->info.dbox_create.timeout,
+ arg->info.dbox_create.has_script,
+ arg->info.dbox_create.period,
+ arg->info.dbox_create.cluster, arg->info.dbox_create.category,
+ arg->info.dbox_create.skip_need_to_create,
+ arg->info.dbox_create.abi,
+ arg->info.dbox_create.width,
+ arg->info.dbox_create.height);
+
+ if (!arg->info.dbox_create.content || !strlen(arg->info.dbox_create.content)) {
+ DbgPrint("Use default content: \"%s\"\n", DYNAMICBOX_CONF_DEFAULT_CONTENT);
+ arg->info.dbox_create.content = DYNAMICBOX_CONF_DEFAULT_CONTENT;
+ }
+
+ _arg.content = arg->info.dbox_create.content;
+ _arg.timeout = arg->info.dbox_create.timeout;
+ _arg.has_dynamicbox_script = arg->info.dbox_create.has_script;
+ _arg.period = arg->info.dbox_create.period;
+ _arg.cluster = arg->info.dbox_create.cluster;
+ _arg.category = arg->info.dbox_create.category;
+ _arg.abi = arg->info.dbox_create.abi;
+ _arg.skip_need_to_create = arg->info.dbox_create.skip_need_to_create;
+ _arg.direct_addr = arg->info.dbox_create.direct_addr;
+
+ ret = dbox_create(arg->pkgname, arg->id,
+ &_arg,
+ width, height, priority,
+ &arg->info.dbox_create.out_content,
+ &arg->info.dbox_create.out_title);
+
+ if (ret == 0) {
+ if (arg->info.dbox_create.width > 0 && arg->info.dbox_create.height > 0) {
+ DbgPrint("Create size: %dx%d (created: %dx%d)\n", arg->info.dbox_create.width, arg->info.dbox_create.height, *width, *height);
+ if (*width != arg->info.dbox_create.width || *height != arg->info.dbox_create.height) {
+ int tmp;
+ tmp = dbox_resize(arg->pkgname, arg->id, arg->info.dbox_create.width, arg->info.dbox_create.height);
+ DbgPrint("dbox_resize returns: %d\n", tmp);
+ if (tmp == (int)DBOX_STATUS_ERROR_NONE) {
+ /*!
+ * \note
+ * Just returns resized canvas size.
+ * Even if it is not ready to render contents.
+ * Provider will allocate render buffer using this size.
+ */
+ *width = arg->info.dbox_create.width;
+ *height = arg->info.dbox_create.height;
}
-
- arg->info.dbox_create.out_is_pinned_up = (dbox_is_pinned_up(arg->pkgname, arg->id) == 1);
- } else {
- ErrPrint("dbox_create returns %d\n", ret);
+ }
}
- if (dbox_is_all_paused()) {
- DbgPrint("Box is paused\n");
- (void)dbox_system_event(arg->pkgname, arg->id, DBOX_SYS_EVENT_PAUSED);
- }
+ arg->info.dbox_create.out_is_pinned_up = (dbox_is_pinned_up(arg->pkgname, arg->id) == 1);
+ } else {
+ ErrPrint("dbox_create returns %d\n", ret);
+ }
+
+ if (dbox_is_all_paused()) {
+ DbgPrint("Box is paused\n");
+ (void)dbox_system_event(arg->pkgname, arg->id, DBOX_SYS_EVENT_PAUSED);
+ }
- return ret;
+ return ret;
}
static int method_renew(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
- int w;
- int h;
- double priority;
- struct dbox_create_arg _arg;
-
- DbgPrint("Re-create: pkgname[%s], id[%s], content[%s], timeout[%d], has_script[%d], period[%lf], cluster[%s], category[%s], abi[%s]\n",
- arg->pkgname, arg->id,
- arg->info.dbox_recreate.content,
- arg->info.dbox_recreate.timeout,
- arg->info.dbox_recreate.has_script,
- arg->info.dbox_recreate.period,
- arg->info.dbox_recreate.cluster,
- arg->info.dbox_recreate.category,
- arg->info.dbox_recreate.abi);
-
- if (!arg->info.dbox_recreate.content || !strlen(arg->info.dbox_recreate.content)) {
- DbgPrint("Use default content: \"%s\"\n", DYNAMICBOX_CONF_DEFAULT_CONTENT);
- arg->info.dbox_recreate.content = DYNAMICBOX_CONF_DEFAULT_CONTENT;
- }
-
- _arg.content = arg->info.dbox_recreate.content;
- _arg.timeout = arg->info.dbox_recreate.timeout;
- _arg.has_dynamicbox_script = arg->info.dbox_recreate.has_script;
- _arg.period = arg->info.dbox_recreate.period;
- _arg.cluster = arg->info.dbox_recreate.cluster;
- _arg.category = arg->info.dbox_recreate.category;
- _arg.abi = arg->info.dbox_recreate.abi;
- _arg.skip_need_to_create = 1;
- _arg.direct_addr = arg->info.dbox_recreate.direct_addr;
-
- ret = dbox_create(arg->pkgname, arg->id,
- &_arg,
- &w, &h, &priority,
- &arg->info.dbox_recreate.out_content,
- &arg->info.dbox_recreate.out_title);
- if (ret == 0) {
- if (w != arg->info.dbox_recreate.width || h != arg->info.dbox_recreate.height) {
- int tmp;
- tmp = dbox_resize(arg->pkgname, arg->id, arg->info.dbox_recreate.width, arg->info.dbox_recreate.height);
- if (tmp < 0) {
- DbgPrint("Resize[%dx%d] returns: %d\n", arg->info.dbox_recreate.width, arg->info.dbox_recreate.height, tmp);
- }
- } else {
- DbgPrint("No need to change the size: %dx%d\n", w, h);
- }
-
- arg->info.dbox_recreate.out_is_pinned_up = (dbox_is_pinned_up(arg->pkgname, arg->id) == 1);
+ int ret;
+ int w;
+ int h;
+ double priority;
+ struct dbox_create_arg _arg;
+
+ DbgPrint("Re-create: pkgname[%s], id[%s], content[%s], timeout[%d], has_script[%d], period[%lf], cluster[%s], category[%s], abi[%s]\n",
+ arg->pkgname, arg->id,
+ arg->info.dbox_recreate.content,
+ arg->info.dbox_recreate.timeout,
+ arg->info.dbox_recreate.has_script,
+ arg->info.dbox_recreate.period,
+ arg->info.dbox_recreate.cluster,
+ arg->info.dbox_recreate.category,
+ arg->info.dbox_recreate.abi);
+
+ if (!arg->info.dbox_recreate.content || !strlen(arg->info.dbox_recreate.content)) {
+ DbgPrint("Use default content: \"%s\"\n", DYNAMICBOX_CONF_DEFAULT_CONTENT);
+ arg->info.dbox_recreate.content = DYNAMICBOX_CONF_DEFAULT_CONTENT;
+ }
+
+ _arg.content = arg->info.dbox_recreate.content;
+ _arg.timeout = arg->info.dbox_recreate.timeout;
+ _arg.has_dynamicbox_script = arg->info.dbox_recreate.has_script;
+ _arg.period = arg->info.dbox_recreate.period;
+ _arg.cluster = arg->info.dbox_recreate.cluster;
+ _arg.category = arg->info.dbox_recreate.category;
+ _arg.abi = arg->info.dbox_recreate.abi;
+ _arg.skip_need_to_create = 1;
+ _arg.direct_addr = arg->info.dbox_recreate.direct_addr;
+
+ ret = dbox_create(arg->pkgname, arg->id,
+ &_arg,
+ &w, &h, &priority,
+ &arg->info.dbox_recreate.out_content,
+ &arg->info.dbox_recreate.out_title);
+ if (ret == 0) {
+ if (w != arg->info.dbox_recreate.width || h != arg->info.dbox_recreate.height) {
+ int tmp;
+ tmp = dbox_resize(arg->pkgname, arg->id, arg->info.dbox_recreate.width, arg->info.dbox_recreate.height);
+ if (tmp < 0) {
+ DbgPrint("Resize[%dx%d] returns: %d\n", arg->info.dbox_recreate.width, arg->info.dbox_recreate.height, tmp);
+ }
} else {
- ErrPrint("dbox_create returns %d\n", ret);
+ DbgPrint("No need to change the size: %dx%d\n", w, h);
}
- if (dbox_is_all_paused()) {
- DbgPrint("Box is paused\n");
- (void)dbox_system_event(arg->pkgname, arg->id, DBOX_SYS_EVENT_PAUSED);
- }
+ arg->info.dbox_recreate.out_is_pinned_up = (dbox_is_pinned_up(arg->pkgname, arg->id) == 1);
+ } else {
+ ErrPrint("dbox_create returns %d\n", ret);
+ }
+
+ if (dbox_is_all_paused()) {
+ DbgPrint("Box is paused\n");
+ (void)dbox_system_event(arg->pkgname, arg->id, DBOX_SYS_EVENT_PAUSED);
+ }
- return ret;
+ return ret;
}
static int method_delete(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
+ int ret;
- DbgPrint("pkgname[%s] id[%s]\n", arg->pkgname, arg->id);
+ DbgPrint("pkgname[%s] id[%s]\n", arg->pkgname, arg->id);
- if (arg->info.dbox_destroy.type == DBOX_DESTROY_TYPE_DEFAULT || arg->info.dbox_destroy.type == DBOX_DESTROY_TYPE_UNINSTALL) {
- DbgPrint("Box is deleted from the viewer\n");
- (void)dbox_system_event(arg->pkgname, arg->id, DBOX_SYS_EVENT_DELETED);
- }
+ if (arg->info.dbox_destroy.type == DBOX_DESTROY_TYPE_DEFAULT || arg->info.dbox_destroy.type == DBOX_DESTROY_TYPE_UNINSTALL) {
+ DbgPrint("Box is deleted from the viewer\n");
+ (void)dbox_system_event(arg->pkgname, arg->id, DBOX_SYS_EVENT_DELETED);
+ }
- ret = dbox_destroy(arg->pkgname, arg->id, 0);
- return ret;
+ ret = dbox_destroy(arg->pkgname, arg->id, 0);
+ return ret;
}
static int method_content_event(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
- struct dynamicbox_event_info info;
+ int ret;
+ struct dynamicbox_event_info info;
- info = arg->info.content_event.info;
+ info = arg->info.content_event.info;
- ret = dbox_script_event(arg->pkgname, arg->id,
- arg->info.content_event.emission, arg->info.content_event.source,
- &info);
- return ret;
+ ret = dbox_script_event(arg->pkgname, arg->id,
+ arg->info.content_event.emission, arg->info.content_event.source,
+ &info);
+ return ret;
}
static int method_clicked(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
+ int ret;
- DbgPrint("pkgname[%s] id[%s] event[%s] timestamp[%lf] x[%lf] y[%lf]\n",
- arg->pkgname, arg->id,
- arg->info.clicked.event, arg->info.clicked.timestamp,
- arg->info.clicked.x, arg->info.clicked.y);
- ret = dbox_clicked(arg->pkgname, arg->id,
- arg->info.clicked.event,
- arg->info.clicked.timestamp, arg->info.clicked.x, arg->info.clicked.y);
+ DbgPrint("pkgname[%s] id[%s] event[%s] timestamp[%lf] x[%lf] y[%lf]\n",
+ arg->pkgname, arg->id,
+ arg->info.clicked.event, arg->info.clicked.timestamp,
+ arg->info.clicked.x, arg->info.clicked.y);
+ ret = dbox_clicked(arg->pkgname, arg->id,
+ arg->info.clicked.event,
+ arg->info.clicked.timestamp, arg->info.clicked.x, arg->info.clicked.y);
- return ret;
+ return ret;
}
static int method_text_signal(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
- struct dynamicbox_event_info info;
+ int ret;
+ struct dynamicbox_event_info info;
- info = arg->info.text_signal.info;
+ info = arg->info.text_signal.info;
- DbgPrint("pkgname[%s] id[%s] emission[%s] source[%s]\n", arg->pkgname, arg->id, arg->info.text_signal.emission, arg->info.text_signal.source);
- ret = dbox_script_event(arg->pkgname, arg->id,
- arg->info.text_signal.emission, arg->info.text_signal.source,
- &info);
+ DbgPrint("pkgname[%s] id[%s] emission[%s] source[%s]\n", arg->pkgname, arg->id, arg->info.text_signal.emission, arg->info.text_signal.source);
+ ret = dbox_script_event(arg->pkgname, arg->id,
+ arg->info.text_signal.emission, arg->info.text_signal.source,
+ &info);
- return ret;
+ return ret;
}
static int method_resize(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
+ int ret;
- DbgPrint("pkgname[%s] id[%s] w[%d] h[%d]\n", arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
- ret = dbox_resize(arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
+ DbgPrint("pkgname[%s] id[%s] w[%d] h[%d]\n", arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
+ ret = dbox_resize(arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
- return ret;
+ return ret;
}
static int method_set_period(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
- DbgPrint("pkgname[%s] id[%s] period[%lf]\n", arg->pkgname, arg->id, arg->info.set_period.period);
- ret = dbox_set_period(arg->pkgname, arg->id, arg->info.set_period.period);
- return ret;
+ int ret;
+ DbgPrint("pkgname[%s] id[%s] period[%lf]\n", arg->pkgname, arg->id, arg->info.set_period.period);
+ ret = dbox_set_period(arg->pkgname, arg->id, arg->info.set_period.period);
+ return ret;
}
static int method_change_group(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
- DbgPrint("pkgname[%s] id[%s] cluster[%s] category[%s]\n", arg->pkgname, arg->id, arg->info.change_group.cluster, arg->info.change_group.category);
- ret = dbox_change_group(arg->pkgname, arg->id, arg->info.change_group.cluster, arg->info.change_group.category);
- return ret;
+ int ret;
+ DbgPrint("pkgname[%s] id[%s] cluster[%s] category[%s]\n", arg->pkgname, arg->id, arg->info.change_group.cluster, arg->info.change_group.category);
+ ret = dbox_change_group(arg->pkgname, arg->id, arg->info.change_group.cluster, arg->info.change_group.category);
+ return ret;
}
static int method_pinup(struct dynamicbox_event_arg *arg, void *data)
{
- DbgPrint("pkgname[%s] id[%s] state[%d]\n", arg->pkgname, arg->id, arg->info.pinup.state);
- arg->info.pinup.content_info = dbox_pinup(arg->pkgname, arg->id, arg->info.pinup.state);
- return arg->info.pinup.content_info ? DBOX_STATUS_ERROR_NONE : DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ DbgPrint("pkgname[%s] id[%s] state[%d]\n", arg->pkgname, arg->id, arg->info.pinup.state);
+ arg->info.pinup.content_info = dbox_pinup(arg->pkgname, arg->id, arg->info.pinup.state);
+ return arg->info.pinup.content_info ? DBOX_STATUS_ERROR_NONE : DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
}
static int method_update_content(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
-
- if (!arg->id || !strlen(arg->id)) {
- if (arg->info.update_content.content && strlen(arg->info.update_content.content)) {
- DbgPrint("pkgname[%s] content[%s]\n", arg->pkgname, arg->info.update_content.content);
- ret = dbox_set_content_info_all(arg->pkgname, arg->info.update_content.content);
- } else {
- DbgPrint("pkgname[%s] cluster[%s] category[%s]\n", arg->pkgname, arg->info.update_content.cluster, arg->info.update_content.category);
- ret = dbox_update_all(arg->pkgname, arg->info.update_content.cluster, arg->info.update_content.category, arg->info.update_content.force);
- }
+ int ret;
+
+ if (!arg->id || !strlen(arg->id)) {
+ if (arg->info.update_content.content && strlen(arg->info.update_content.content)) {
+ DbgPrint("pkgname[%s] content[%s]\n", arg->pkgname, arg->info.update_content.content);
+ ret = dbox_set_content_info_all(arg->pkgname, arg->info.update_content.content);
} else {
- if (arg->info.update_content.content && strlen(arg->info.update_content.content)) {
- DbgPrint("id[%s] content[%s]\n", arg->id, arg->info.update_content.content);
- ret = dbox_set_content_info(arg->pkgname, arg->id, arg->info.update_content.content);
- } else {
- DbgPrint("Update [%s]\n", arg->id);
- ret = dbox_update(arg->pkgname, arg->id, arg->info.update_content.force);
- }
+ DbgPrint("pkgname[%s] cluster[%s] category[%s]\n", arg->pkgname, arg->info.update_content.cluster, arg->info.update_content.category);
+ ret = dbox_update_all(arg->pkgname, arg->info.update_content.cluster, arg->info.update_content.category, arg->info.update_content.force);
}
+ } else {
+ if (arg->info.update_content.content && strlen(arg->info.update_content.content)) {
+ DbgPrint("id[%s] content[%s]\n", arg->id, arg->info.update_content.content);
+ ret = dbox_set_content_info(arg->pkgname, arg->id, arg->info.update_content.content);
+ } else {
+ DbgPrint("Update [%s]\n", arg->id);
+ ret = dbox_update(arg->pkgname, arg->id, arg->info.update_content.force);
+ }
+ }
- return ret;
+ return ret;
}
static int method_pause(struct dynamicbox_event_arg *arg, void *data)
{
- dbox_pause_all();
- if (s_info.ping_timer) {
- ecore_timer_freeze(s_info.ping_timer);
- }
+ dbox_pause_all();
+ if (s_info.ping_timer) {
+ ecore_timer_freeze(s_info.ping_timer);
+ }
- sqlite3_release_memory(DYNAMICBOX_CONF_SQLITE_FLUSH_MAX);
- elm_cache_all_flush();
- malloc_trim(0);
+ sqlite3_release_memory(DYNAMICBOX_CONF_SQLITE_FLUSH_MAX);
+ elm_cache_all_flush();
+ malloc_trim(0);
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
static int method_resume(struct dynamicbox_event_arg *arg, void *data)
{
- dbox_resume_all();
- if (s_info.ping_timer) {
- ecore_timer_thaw(s_info.ping_timer);
- }
- return DBOX_STATUS_ERROR_NONE;
+ dbox_resume_all();
+ if (s_info.ping_timer) {
+ ecore_timer_thaw(s_info.ping_timer);
+ }
+ return DBOX_STATUS_ERROR_NONE;
}
static Eina_Bool send_ping_cb(void *data)
{
- dynamicbox_provider_send_ping();
- return ECORE_CALLBACK_RENEW;
+ dynamicbox_provider_send_ping();
+ return ECORE_CALLBACK_RENEW;
}
static int method_disconnected(struct dynamicbox_event_arg *arg, void *data)
{
- if (s_info.ping_timer) {
- ecore_timer_del(s_info.ping_timer);
- s_info.ping_timer = NULL;
- }
+ if (s_info.ping_timer) {
+ ecore_timer_del(s_info.ping_timer);
+ s_info.ping_timer = NULL;
+ }
- ui_app_exit();
- return DBOX_STATUS_ERROR_NONE;
+ ui_app_exit();
+ return DBOX_STATUS_ERROR_NONE;
}
static int method_connected(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
- ret = dynamicbox_provider_send_hello();
- if (ret == 0) {
- s_info.ping_timer = ecore_timer_add(DYNAMICBOX_CONF_DEFAULT_PING_TIME, send_ping_cb, NULL);
- if (!s_info.ping_timer) {
- ErrPrint("Failed to add a ping timer\n");
- }
+ int ret;
+ ret = dynamicbox_provider_send_hello();
+ if (ret == 0) {
+ double ping_interval;
+
+ ping_interval = DYNAMICBOX_CONF_DEFAULT_PING_TIME / 2.0f;
+ DbgPrint("Ping Timer: %lf\n", ping_interval);
+
+ s_info.ping_timer = ecore_timer_add(ping_interval, send_ping_cb, NULL);
+ if (!s_info.ping_timer) {
+ ErrPrint("Failed to add a ping timer\n");
}
+ }
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
static int method_gbar_created(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
+ int ret;
- ret = dbox_open_gbar(arg->pkgname, arg->id);
- if (ret < 0) {
- DbgPrint("%s Open PD: %d\n", arg->id, ret);
- }
+ ret = dbox_open_gbar(arg->pkgname, arg->id);
+ if (ret < 0) {
+ DbgPrint("%s Open PD: %d\n", arg->id, ret);
+ }
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
static int method_gbar_destroyed(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
+ int ret;
- ret = dbox_close_gbar(arg->pkgname, arg->id);
- if (ret < 0) {
- DbgPrint("%s Close PD: %d\n", arg->id, ret);
- }
+ ret = dbox_close_gbar(arg->pkgname, arg->id);
+ if (ret < 0) {
+ DbgPrint("%s Close PD: %d\n", arg->id, ret);
+ }
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
static int method_gbar_moved(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
- struct dynamicbox_event_info info;
+ int ret;
+ struct dynamicbox_event_info info;
- memset(&info, 0, sizeof(info));
- info.pointer.x = arg->info.gbar_move.x;
- info.pointer.y = arg->info.gbar_move.y;
- info.pointer.down = 0;
+ memset(&info, 0, sizeof(info));
+ info.pointer.x = arg->info.gbar_move.x;
+ info.pointer.y = arg->info.gbar_move.y;
+ info.pointer.down = 0;
- ret = dbox_script_event(arg->pkgname, arg->id,
- "gbar,move", util_uri_to_path(arg->id), &info);
- return ret;
+ ret = dbox_script_event(arg->pkgname, arg->id,
+ "gbar,move", util_uri_to_path(arg->id), &info);
+ return ret;
}
static int method_dbox_pause(struct dynamicbox_event_arg *arg, void *data)
{
- int ret;
+ int ret;
- ret = dbox_pause(arg->pkgname, arg->id);
+ ret = dbox_pause(arg->pkgname, arg->id);
- sqlite3_release_memory(DYNAMICBOX_CONF_SQLITE_FLUSH_MAX);
- elm_cache_all_flush();
- malloc_trim(0);
+ sqlite3_release_memory(DYNAMICBOX_CONF_SQLITE_FLUSH_MAX);
+ elm_cache_all_flush();
+ malloc_trim(0);
- return ret;
+ return ret;
}
static int method_dbox_resume(struct dynamicbox_event_arg *arg, void *data)
{
- return dbox_resume(arg->pkgname, arg->id);
+ return dbox_resume(arg->pkgname, arg->id);
}
HAPI int client_init(const char *name)
{
- struct dynamicbox_event_table table = {
- .dbox_create = method_new,
- .dbox_recreate = method_renew,
- .dbox_destroy = method_delete,
- .content_event = method_content_event,
- .clicked = method_clicked,
- .text_signal = method_text_signal,
- .resize = method_resize,
- .set_period = method_set_period,
- .change_group = method_change_group,
- .pinup = method_pinup,
- .update_content = method_update_content,
- .pause = method_pause,
- .resume = method_resume,
- .disconnected = method_disconnected,
- .connected = method_connected,
- .gbar_create = method_gbar_created,
- .gbar_destroy = method_gbar_destroyed,
- .gbar_move = method_gbar_moved,
- .dbox_pause = method_dbox_pause,
- .dbox_resume = method_dbox_resume,
- };
-
- return dynamicbox_provider_init(util_screen_get(), name, &table, NULL, 1, 1);
+ struct dynamicbox_event_table table = {
+ .dbox_create = method_new,
+ .dbox_recreate = method_renew,
+ .dbox_destroy = method_delete,
+ .content_event = method_content_event,
+ .clicked = method_clicked,
+ .text_signal = method_text_signal,
+ .resize = method_resize,
+ .set_period = method_set_period,
+ .change_group = method_change_group,
+ .pinup = method_pinup,
+ .update_content = method_update_content,
+ .pause = method_pause,
+ .resume = method_resume,
+ .disconnected = method_disconnected,
+ .connected = method_connected,
+ .gbar_create = method_gbar_created,
+ .gbar_destroy = method_gbar_destroyed,
+ .gbar_move = method_gbar_moved,
+ .dbox_pause = method_dbox_pause,
+ .dbox_resume = method_dbox_resume,
+ };
+
+ return dynamicbox_provider_init(util_screen_get(), name, &table, NULL, 1, 1);
}
HAPI int client_fini(void)
{
- (void)dynamicbox_provider_fini();
- return DBOX_STATUS_ERROR_NONE;
+ (void)dynamicbox_provider_fini();
+ return DBOX_STATUS_ERROR_NONE;
}
/* End of a file */
#include "connection.h"
static struct info {
- Eina_List *connection_list;
- Eina_List *connected_list;
- Eina_List *disconnected_list;
-
- enum {
- IDLE = 0x00,
- DISCONNECTION = 0x01,
- CONNECTION = 0x02,
- } process;
+ Eina_List *connection_list;
+ Eina_List *connected_list;
+ Eina_List *disconnected_list;
+
+ enum {
+ IDLE = 0x00,
+ DISCONNECTION = 0x01,
+ CONNECTION = 0x02,
+ } process;
} s_info = {
- .connection_list = NULL,
- .connected_list = NULL,
- .disconnected_list = NULL,
- .process = IDLE,
+ .connection_list = NULL,
+ .connected_list = NULL,
+ .disconnected_list = NULL,
+ .process = IDLE,
};
int errno;
struct event_item {
- int (*event_cb)(int handle, void *data);
- void *data;
- int deleted;
+ int (*event_cb)(int handle, void *data);
+ void *data;
+ int deleted;
};
struct connection {
- char *addr;
- int fd;
- int refcnt;
+ char *addr;
+ int fd;
+ int refcnt;
};
/**
*/
static int connected_cb(int handle, void *data)
{
- Eina_List *l;
- Eina_List *n;
- struct event_item *item;
-
- EINA_LIST_FOREACH_SAFE(s_info.connected_list, l, n, item) {
- s_info.process = DISCONNECTION;
- if (item->deleted || item->event_cb(handle, item->data) < 0 || item->deleted) {
- s_info.connected_list = eina_list_remove(s_info.connected_list, item);
- free(item);
- }
- s_info.process = IDLE;
+ Eina_List *l;
+ Eina_List *n;
+ struct event_item *item;
+
+ EINA_LIST_FOREACH_SAFE(s_info.connected_list, l, n, item) {
+ s_info.process = DISCONNECTION;
+ if (item->deleted || item->event_cb(handle, item->data) < 0 || item->deleted) {
+ s_info.connected_list = eina_list_remove(s_info.connected_list, item);
+ free(item);
}
+ s_info.process = IDLE;
+ }
- return 0;
+ return 0;
}
static int disconnected_cb(int handle, void *data)
{
- Eina_List *l;
- Eina_List *n;
- struct event_item *item;
-
- EINA_LIST_FOREACH_SAFE(s_info.disconnected_list, l, n, item) {
- s_info.process = DISCONNECTION;
- if (item->deleted || item->event_cb(handle, item->data) < 0 || item->deleted) {
- s_info.disconnected_list = eina_list_remove(s_info.disconnected_list, item);
- free(item);
- }
- s_info.process = IDLE;
+ Eina_List *l;
+ Eina_List *n;
+ struct event_item *item;
+
+ EINA_LIST_FOREACH_SAFE(s_info.disconnected_list, l, n, item) {
+ s_info.process = DISCONNECTION;
+ if (item->deleted || item->event_cb(handle, item->data) < 0 || item->deleted) {
+ s_info.disconnected_list = eina_list_remove(s_info.disconnected_list, item);
+ free(item);
}
+ s_info.process = IDLE;
+ }
- return 0;
+ return 0;
}
int connection_init(void)
{
- if (com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL) < 0) {
- ErrPrint("Unable to register the disconnected callback\n");
- }
+ if (com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL) < 0) {
+ ErrPrint("Unable to register the disconnected callback\n");
+ }
- if (com_core_add_event_callback(CONNECTOR_CONNECTED, connected_cb, NULL) < 0) {
- ErrPrint("Unable to register the disconnected callback\n");
- }
+ if (com_core_add_event_callback(CONNECTOR_CONNECTED, connected_cb, NULL) < 0) {
+ ErrPrint("Unable to register the disconnected callback\n");
+ }
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
int connection_fini(void)
{
- (void)com_core_del_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL);
- (void)com_core_del_event_callback(CONNECTOR_CONNECTED, connected_cb, NULL);
+ (void)com_core_del_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL);
+ (void)com_core_del_event_callback(CONNECTOR_CONNECTED, connected_cb, NULL);
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
struct connection *connection_create(const char *addr, void *table)
{
- struct connection *handle;
+ struct connection *handle;
- handle = calloc(1, sizeof(*handle));
- if (!handle) {
- ErrPrint("calloc: %s\n", strerror(errno));
- return NULL;
- }
+ handle = calloc(1, sizeof(*handle));
+ if (!handle) {
+ ErrPrint("calloc: %s\n", strerror(errno));
+ return NULL;
+ }
- handle->addr = strdup(addr);
- if (!handle->addr) {
- ErrPrint("strdup: %s (%s)\n", strerror(errno), addr);
- free(handle);
- return NULL;
- }
+ handle->addr = strdup(addr);
+ if (!handle->addr) {
+ ErrPrint("strdup: %s (%s)\n", strerror(errno), addr);
+ free(handle);
+ return NULL;
+ }
- handle->fd = com_core_packet_client_init(handle->addr, 0, table);
- if (handle->fd < 0) {
- ErrPrint("Unable to make a connection %s\n", handle->addr);
- free(handle->addr);
- free(handle);
- return NULL;
- }
+ handle->fd = com_core_packet_client_init(handle->addr, 0, table);
+ if (handle->fd < 0) {
+ ErrPrint("Unable to make a connection %s\n", handle->addr);
+ free(handle->addr);
+ free(handle);
+ return NULL;
+ }
- handle->refcnt = 1;
+ handle->refcnt = 1;
- s_info.connection_list = eina_list_append(s_info.connection_list, handle);
- return handle;
+ s_info.connection_list = eina_list_append(s_info.connection_list, handle);
+ return handle;
}
struct connection *connection_ref(struct connection *handle)
{
- if (!handle) {
- return NULL;
- }
+ if (!handle) {
+ return NULL;
+ }
- handle->refcnt++;
- return handle;
+ handle->refcnt++;
+ return handle;
}
struct connection *connection_unref(struct connection *handle)
{
- if (!handle) {
- return NULL;
- }
+ if (!handle) {
+ return NULL;
+ }
- handle->refcnt--;
- if (handle->refcnt > 0) {
- return handle;
- }
+ handle->refcnt--;
+ if (handle->refcnt > 0) {
+ return handle;
+ }
- s_info.connection_list = eina_list_remove(s_info.connection_list, handle);
+ s_info.connection_list = eina_list_remove(s_info.connection_list, handle);
- if (handle->fd >= 0) {
- com_core_packet_client_fini(handle->fd);
- }
+ if (handle->fd >= 0) {
+ com_core_packet_client_fini(handle->fd);
+ }
- free(handle->addr);
- free(handle);
- return NULL;
+ free(handle->addr);
+ free(handle);
+ return NULL;
}
struct connection *connection_find_by_addr(const char *addr)
{
- Eina_List *l;
- struct connection *handle;
+ Eina_List *l;
+ struct connection *handle;
- if (!addr) {
- return NULL;
- }
+ if (!addr) {
+ return NULL;
+ }
- EINA_LIST_FOREACH(s_info.connection_list, l, handle) {
- if (handle->addr && !strcmp(handle->addr, addr)) {
- return handle;
- }
+ EINA_LIST_FOREACH(s_info.connection_list, l, handle) {
+ if (handle->addr && !strcmp(handle->addr, addr)) {
+ return handle;
}
+ }
- return NULL;
+ return NULL;
}
struct connection *connection_find_by_fd(int fd)
{
- Eina_List *l;
- struct connection *handle;
+ Eina_List *l;
+ struct connection *handle;
- if (fd < 0) {
- return NULL;
- }
+ if (fd < 0) {
+ return NULL;
+ }
- EINA_LIST_FOREACH(s_info.connection_list, l, handle) {
- if (handle->fd == fd) {
- return handle;
- }
+ EINA_LIST_FOREACH(s_info.connection_list, l, handle) {
+ if (handle->fd == fd) {
+ return handle;
}
+ }
- return NULL;
+ return NULL;
}
int connection_add_event_handler(enum connection_event_type type, int (*event_cb)(int handle, void *data), void *data)
{
- struct event_item *item;
+ struct event_item *item;
- item = malloc(sizeof(*item));
- if (!item) {
- ErrPrint("malloc: %s\n", strerror(errno));
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
+ item = malloc(sizeof(*item));
+ if (!item) {
+ ErrPrint("malloc: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
- item->event_cb = event_cb;
- item->data = data;
+ item->event_cb = event_cb;
+ item->data = data;
- switch (type) {
+ switch (type) {
case CONNECTION_EVENT_TYPE_CONNECTED:
- s_info.connected_list = eina_list_append(s_info.connected_list, item);
- break;
+ s_info.connected_list = eina_list_append(s_info.connected_list, item);
+ break;
case CONNECTION_EVENT_TYPE_DISCONNECTED:
- s_info.disconnected_list = eina_list_append(s_info.disconnected_list, item);
- break;
+ s_info.disconnected_list = eina_list_append(s_info.disconnected_list, item);
+ break;
default:
- free(item);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ free(item);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
void *connection_del_event_handler(enum connection_event_type type, int (*event_cb)(int handle, void *data))
{
- Eina_List *l;
- Eina_List *n;
- struct event_item *item;
- void *ret = NULL;
+ Eina_List *l;
+ Eina_List *n;
+ struct event_item *item;
+ void *ret = NULL;
- switch (type) {
+ switch (type) {
case CONNECTION_EVENT_TYPE_CONNECTED:
- EINA_LIST_FOREACH_SAFE(s_info.connected_list, l, n, item) {
- if (item->event_cb == event_cb) {
- if (s_info.process == CONNECTION) {
- item->deleted = 1;
- ret = item->data;
- } else {
- s_info.connected_list = eina_list_remove(s_info.connected_list, item);
- ret = item->data;
- free(item);
- }
- break;
- }
+ EINA_LIST_FOREACH_SAFE(s_info.connected_list, l, n, item) {
+ if (item->event_cb == event_cb) {
+ if (s_info.process == CONNECTION) {
+ item->deleted = 1;
+ ret = item->data;
+ } else {
+ s_info.connected_list = eina_list_remove(s_info.connected_list, item);
+ ret = item->data;
+ free(item);
+ }
+ break;
}
- break;
+ }
+ break;
case CONNECTION_EVENT_TYPE_DISCONNECTED:
- EINA_LIST_FOREACH_SAFE(s_info.disconnected_list, l, n, item) {
- if (item->event_cb == event_cb) {
- if (s_info.process == DISCONNECTION) {
- item->deleted = 1;
- ret = item->data;
- } else {
- s_info.disconnected_list = eina_list_remove(s_info.disconnected_list, item);
- ret = item->data;
- free(item);
- }
- break;
- }
+ EINA_LIST_FOREACH_SAFE(s_info.disconnected_list, l, n, item) {
+ if (item->event_cb == event_cb) {
+ if (s_info.process == DISCONNECTION) {
+ item->deleted = 1;
+ ret = item->data;
+ } else {
+ s_info.disconnected_list = eina_list_remove(s_info.disconnected_list, item);
+ ret = item->data;
+ free(item);
+ }
+ break;
}
- break;
+ }
+ break;
default:
- break;
- }
+ break;
+ }
- return ret;
+ return ret;
}
int connection_handle(struct connection *connection)
{
- return connection->fd;
+ return connection->fd;
}
const char *connection_addr(struct connection *connection)
{
- return connection->addr;
+ return connection->addr;
}
/* End of a file */
#include "conf.h"
static struct {
- FILE *fp;
- int file_id;
- int nr_of_lines;
- char *filename;
+ FILE *fp;
+ int file_id;
+ int nr_of_lines;
+ char *filename;
} s_info = {
- .fp = NULL,
- .file_id = 0,
- .nr_of_lines = 0,
- .filename = NULL,
+ .fp = NULL,
+ .file_id = 0,
+ .nr_of_lines = 0,
+ .filename = NULL,
};
static inline void rotate_log(void)
{
- char *filename;
- int namelen;
+ char *filename;
+ int namelen;
- if (s_info.nr_of_lines < DYNAMICBOX_CONF_MAX_LOG_LINE) {
- return;
- }
-
- s_info.file_id = (s_info.file_id + 1) % DYNAMICBOX_CONF_MAX_LOG_FILE;
+ if (s_info.nr_of_lines < DYNAMICBOX_CONF_MAX_LOG_LINE) {
+ return;
+ }
- namelen = strlen(s_info.filename) + strlen(DYNAMICBOX_CONF_LOG_PATH) + 30;
- filename = malloc(namelen);
- if (filename) {
- snprintf(filename, namelen, "%s/%d_%s.%d", DYNAMICBOX_CONF_LOG_PATH, s_info.file_id, s_info.filename, getpid());
+ s_info.file_id = (s_info.file_id + 1) % DYNAMICBOX_CONF_MAX_LOG_FILE;
- if (s_info.fp) {
- if (fclose(s_info.fp) != 0) {
- ErrPrint("fclose: %s\n", strerror(errno));
- }
- }
+ namelen = strlen(s_info.filename) + strlen(DYNAMICBOX_CONF_LOG_PATH) + 30;
+ filename = malloc(namelen);
+ if (filename) {
+ snprintf(filename, namelen, "%s/%d_%s.%d", DYNAMICBOX_CONF_LOG_PATH, s_info.file_id, s_info.filename, getpid());
- s_info.fp = fopen(filename, "w+");
- if (!s_info.fp) {
- ErrPrint("Failed to open a file: %s\n", filename);
- }
+ if (s_info.fp) {
+ if (fclose(s_info.fp) != 0) {
+ ErrPrint("fclose: %s\n", strerror(errno));
+ }
+ }
- DbgFree(filename);
+ s_info.fp = fopen(filename, "w+");
+ if (!s_info.fp) {
+ ErrPrint("Failed to open a file: %s\n", filename);
}
- s_info.nr_of_lines = 0;
+ DbgFree(filename);
+ }
+
+ s_info.nr_of_lines = 0;
}
HAPI int critical_log(const char *func, int line, const char *fmt, ...)
{
- va_list ap;
- int ret;
+ va_list ap;
+ int ret;
- if (!s_info.fp) {
- return DBOX_STATUS_ERROR_IO_ERROR;
- }
+ if (!s_info.fp) {
+ return DBOX_STATUS_ERROR_IO_ERROR;
+ }
- fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), util_basename((char *)func), line);
+ fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), util_basename((char *)func), line);
- va_start(ap, fmt);
- ret = vfprintf(s_info.fp, fmt, ap);
- va_end(ap);
+ va_start(ap, fmt);
+ ret = vfprintf(s_info.fp, fmt, ap);
+ va_end(ap);
- if (fflush(s_info.fp) != 0) {
- ErrPrint("fflush: %s\n", strerror(errno));
- }
+ if (fflush(s_info.fp) != 0) {
+ ErrPrint("fflush: %s\n", strerror(errno));
+ }
- s_info.nr_of_lines++;
- rotate_log();
- return ret;
+ s_info.nr_of_lines++;
+ rotate_log();
+ return ret;
}
HAPI int critical_log_init(const char *name)
{
- int namelen;
- char *filename;
-
- if (s_info.fp) {
- return DBOX_STATUS_ERROR_NONE;
- }
-
- s_info.filename = strdup(name);
- if (!s_info.filename) {
- ErrPrint("Failed to create a log file\n");
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
+ int namelen;
+ char *filename;
- namelen = strlen(name) + strlen(DYNAMICBOX_CONF_LOG_PATH) + 30;
-
- filename = malloc(namelen);
- if (!filename) {
- ErrPrint("Failed to create a log file\n");
- free(s_info.filename);
- s_info.filename = NULL;
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
-
- snprintf(filename, namelen, "%s/%d_%s.%d", DYNAMICBOX_CONF_LOG_PATH, s_info.file_id, name, getpid());
-
- s_info.fp = fopen(filename, "w+");
- if (!s_info.fp) {
- ErrPrint("Failed to open log: %s\n", strerror(errno));
- free(s_info.filename);
- s_info.filename = NULL;
- free(filename);
- return DBOX_STATUS_ERROR_IO_ERROR;
- }
-
- free(filename);
+ if (s_info.fp) {
return DBOX_STATUS_ERROR_NONE;
+ }
+
+ s_info.filename = strdup(name);
+ if (!s_info.filename) {
+ ErrPrint("Failed to create a log file\n");
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+
+ namelen = strlen(name) + strlen(DYNAMICBOX_CONF_LOG_PATH) + 30;
+
+ filename = malloc(namelen);
+ if (!filename) {
+ ErrPrint("Failed to create a log file\n");
+ free(s_info.filename);
+ s_info.filename = NULL;
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+
+ snprintf(filename, namelen, "%s/%d_%s.%d", DYNAMICBOX_CONF_LOG_PATH, s_info.file_id, name, getpid());
+
+ s_info.fp = fopen(filename, "w+");
+ if (!s_info.fp) {
+ ErrPrint("Failed to open log: %s\n", strerror(errno));
+ free(s_info.filename);
+ s_info.filename = NULL;
+ free(filename);
+ return DBOX_STATUS_ERROR_IO_ERROR;
+ }
+
+ free(filename);
+ return DBOX_STATUS_ERROR_NONE;
}
HAPI int critical_log_fini(void)
{
- if (s_info.filename) {
- free(s_info.filename);
- s_info.filename = NULL;
+ if (s_info.filename) {
+ free(s_info.filename);
+ s_info.filename = NULL;
+ }
+
+ if (s_info.fp) {
+ if (fclose(s_info.fp) != 0) {
+ ErrPrint("fclose: %s\n", strerror(errno));
}
+ s_info.fp = NULL;
+ }
- if (s_info.fp) {
- if (fclose(s_info.fp) != 0) {
- ErrPrint("fclose: %s\n", strerror(errno));
- }
- s_info.fp = NULL;
- }
-
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
static struct info {
#if defined(_USE_ECORE_TIME_GET)
- double alarm_tv;
+ double alarm_tv;
#else
- struct timeval alarm_tv;
+ struct timeval alarm_tv;
#endif
- int marked;
- int disable_checker;
- struct sigaction SEGV_act;
- struct sigaction ILL_act;
- struct sigaction ALRM_act;
- struct sigaction USR1_act;
- struct sigaction ABRT_act;
- char **argv;
+ int marked;
+ int disable_checker;
+ struct sigaction SEGV_act;
+ struct sigaction ILL_act;
+ struct sigaction ALRM_act;
+ struct sigaction USR1_act;
+ struct sigaction ABRT_act;
+ char **argv;
} s_info = {
- .marked = 0,
- .disable_checker = 0,
- .argv = NULL,
+ .marked = 0,
+ .disable_checker = 0,
+ .argv = NULL,
};
static void signal_handler(int signum, siginfo_t *info, void *unused)
{
- char *so_fname;
- char *symbol = NULL;
+ char *so_fname;
+ char *symbol = NULL;
- so_fname = util_get_current_module(&symbol);
+ so_fname = util_get_current_module(&symbol);
- if (info->si_signo == SIGALRM) {
- if (!s_info.marked) {
- DbgPrint("Ignore false alarm signal [false]\n");
- return;
- }
+ if (info->si_signo == SIGALRM) {
+ if (!s_info.marked) {
+ DbgPrint("Ignore false alarm signal [false]\n");
+ return;
+ }
#if defined(_USE_ECORE_TIME_GET)
- double tv;
- tv = ecore_time_get();
- if (tv - s_info.alarm_tv < DEFAULT_LIFE_TIMER) {
- DbgPrint("Ignore false alarm signal [%lf]\n", tv - s_info.alarm_tv);
- return;
- }
-
- CRITICAL_LOG("ALARM: %lf (%d, %d)\n", tv - s_info.alarm_tv, DEFAULT_LIFE_TIMER, DEFAULT_LOAD_TIMER);
-#else
- struct timeval tv;
- struct timeval res_tv;
-
- if (gettimeofday(&tv, NULL) < 0) {
- ErrPrint("gettimeofday: %s\n", strerror(errno));
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- }
-
- timersub(&tv, &s_info.alarm_tv, &res_tv);
-
- /*!
- * \note
- * GAP: 1 sec
- */
- if (res_tv.tv_sec < DEFAULT_LIFE_TIMER) {
- DbgPrint("Ignore false alarm signal [%d]\n", res_tv.tv_sec);
- return;
- }
-
- CRITICAL_LOG("ALARM: %d.%d (%d, %d)\n",
- res_tv.tv_sec, res_tv.tv_usec, DEFAULT_LIFE_TIMER, DEFAULT_LOAD_TIMER);
-#endif
- } else if (so_fname) {
- int fd;
- char log_fname[256];
-
- snprintf(log_fname, sizeof(log_fname), "%s/slave.%d", DYNAMICBOX_CONF_LOG_PATH, getpid());
- fd = open(log_fname, O_WRONLY|O_CREAT|O_SYNC, 0644);
- if (fd >= 0) {
- if (write(fd, so_fname, strlen(so_fname)) != strlen(so_fname)) {
- ErrPrint("Failed to recording the fault SO filename (%s)\n", so_fname);
- }
- if (close(fd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
- }
- }
+ double tv;
+ tv = ecore_time_get();
+ if (tv - s_info.alarm_tv < DEFAULT_LIFE_TIMER) {
+ DbgPrint("Ignore false alarm signal [%lf]\n", tv - s_info.alarm_tv);
+ return;
}
- CRITICAL_LOG("SIGNAL> Received from PID[%d]\n", info->si_pid);
- CRITICAL_LOG("SIGNAL> Signal: %d (%d)\n", signum, info->si_signo);
- CRITICAL_LOG("SIGNAL> Error code: %d\n", info->si_code);
- CRITICAL_LOG("SIGNAL> Address: %p\n", info->si_addr);
- CRITICAL_LOG("Package: [%s] Symbol[%s]\n", so_fname, symbol);
-
- if (so_fname) {
- int len = strlen(s_info.argv[0]);
- memset(s_info.argv[0], 0, len);
- strncpy(s_info.argv[0], util_basename(so_fname), len - 1);
- free(so_fname);
- } else {
- CRITICAL_LOG("Unable to find a so_fname (%s)\n", symbol);
+ CRITICAL_LOG("ALARM: %lf (%d, %d)\n", tv - s_info.alarm_tv, DEFAULT_LIFE_TIMER, DEFAULT_LOAD_TIMER);
+#else
+ struct timeval tv;
+ struct timeval res_tv;
+
+ if (gettimeofday(&tv, NULL) < 0) {
+ ErrPrint("gettimeofday: %s\n", strerror(errno));
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
}
- free(symbol);
+ timersub(&tv, &s_info.alarm_tv, &res_tv);
+
+ /*!
+ * \note
+ * GAP: 1 sec
+ */
+ if (res_tv.tv_sec < DEFAULT_LIFE_TIMER) {
+ DbgPrint("Ignore false alarm signal [%d]\n", res_tv.tv_sec);
+ return;
+ }
- switch (signum) {
+ CRITICAL_LOG("ALARM: %d.%d (%d, %d)\n",
+ res_tv.tv_sec, res_tv.tv_usec, DEFAULT_LIFE_TIMER, DEFAULT_LOAD_TIMER);
+#endif
+ } else if (so_fname) {
+ int fd;
+ char log_fname[256];
+
+ snprintf(log_fname, sizeof(log_fname), "%s/slave.%d", DYNAMICBOX_CONF_LOG_PATH, getpid());
+ fd = open(log_fname, O_WRONLY|O_CREAT|O_SYNC, 0644);
+ if (fd >= 0) {
+ if (write(fd, so_fname, strlen(so_fname)) != strlen(so_fname)) {
+ ErrPrint("Failed to recording the fault SO filename (%s)\n", so_fname);
+ }
+ if (close(fd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
+ }
+ }
+ }
+
+ CRITICAL_LOG("SIGNAL> Received from PID[%d]\n", info->si_pid);
+ CRITICAL_LOG("SIGNAL> Signal: %d (%d)\n", signum, info->si_signo);
+ CRITICAL_LOG("SIGNAL> Error code: %d\n", info->si_code);
+ CRITICAL_LOG("SIGNAL> Address: %p\n", info->si_addr);
+ CRITICAL_LOG("Package: [%s] Symbol[%s]\n", so_fname, symbol);
+
+ if (so_fname) {
+ int len = strlen(s_info.argv[0]);
+ memset(s_info.argv[0], 0, len);
+ strncpy(s_info.argv[0], util_basename(so_fname), len - 1);
+ free(so_fname);
+ } else {
+ CRITICAL_LOG("Unable to find a so_fname (%s)\n", symbol);
+ }
+
+ free(symbol);
+
+ switch (signum) {
case SIGSEGV:
- s_info.SEGV_act.sa_sigaction(signum, info, unused);
- break;
+ s_info.SEGV_act.sa_sigaction(signum, info, unused);
+ break;
case SIGALRM:
- s_info.ALRM_act.sa_sigaction(signum, info, unused);
- break;
+ s_info.ALRM_act.sa_sigaction(signum, info, unused);
+ break;
case SIGABRT:
- s_info.ABRT_act.sa_sigaction(signum, info, unused);
- break;
+ s_info.ABRT_act.sa_sigaction(signum, info, unused);
+ break;
case SIGILL:
- s_info.ILL_act.sa_sigaction(signum, info, unused);
- break;
+ s_info.ILL_act.sa_sigaction(signum, info, unused);
+ break;
case SIGUSR1:
- s_info.USR1_act.sa_sigaction(signum, info, unused);
- break;
+ s_info.USR1_act.sa_sigaction(signum, info, unused);
+ break;
default:
- ErrPrint("Unhandled signal\n");
- break;
- }
+ ErrPrint("Unhandled signal\n");
+ break;
+ }
}
HAPI int fault_init(char **argv)
{
- struct sigaction act;
- char *ecore_abort;
+ struct sigaction act;
+ char *ecore_abort;
- s_info.argv = argv;
+ s_info.argv = argv;
- act.sa_sigaction = signal_handler;
- act.sa_flags = SA_SIGINFO;
+ act.sa_sigaction = signal_handler;
+ act.sa_flags = SA_SIGINFO;
- if (sigemptyset(&act.sa_mask) != 0) {
- ErrPrint("Failed to init signal: %s\n", strerror(errno));
- }
+ if (sigemptyset(&act.sa_mask) != 0) {
+ ErrPrint("Failed to init signal: %s\n", strerror(errno));
+ }
- if (sigaddset(&act.sa_mask, SIGUSR1) != 0) {
- ErrPrint("Failed to add set: %s\n", strerror(errno));
- }
+ if (sigaddset(&act.sa_mask, SIGUSR1) != 0) {
+ ErrPrint("Failed to add set: %s\n", strerror(errno));
+ }
+
+ if (sigaddset(&act.sa_mask, SIGALRM) != 0) {
+ ErrPrint("Failed to add set: %s\n", strerror(errno));
+ }
- if (sigaddset(&act.sa_mask, SIGALRM) != 0) {
- ErrPrint("Failed to add set: %s\n", strerror(errno));
+ ecore_abort = getenv("ECORE_ERROR_ABORT");
+ if (!ecore_abort || ecore_abort[0] != '1') {
+ if (sigaddset(&act.sa_mask, SIGSEGV) != 0) {
+ ErrPrint("Failed to add set: %s\n", strerror(errno));
+ }
+ if (sigaddset(&act.sa_mask, SIGABRT) != 0) {
+ ErrPrint("Failed to add set: %s\n", strerror(errno));
+ }
+ if (sigaddset(&act.sa_mask, SIGILL) != 0) {
+ ErrPrint("Failed to add set: %s\n", strerror(errno));
}
- ecore_abort = getenv("ECORE_ERROR_ABORT");
- if (!ecore_abort || ecore_abort[0] != '1') {
- if (sigaddset(&act.sa_mask, SIGSEGV) != 0) {
- ErrPrint("Failed to add set: %s\n", strerror(errno));
- }
- if (sigaddset(&act.sa_mask, SIGABRT) != 0) {
- ErrPrint("Failed to add set: %s\n", strerror(errno));
- }
- if (sigaddset(&act.sa_mask, SIGILL) != 0) {
- ErrPrint("Failed to add set: %s\n", strerror(errno));
- }
-
- if (sigaction(SIGSEGV, &act, &s_info.SEGV_act) < 0) {
- ErrPrint("Failed to install the SEGV handler\n");
- }
-
- if (sigaction(SIGABRT, &act, &s_info.ABRT_act) < 0) {
- ErrPrint("Faield to install the ABRT handler\n");
- }
-
- if (sigaction(SIGILL, &act, &s_info.ILL_act) < 0) {
- ErrPrint("Faield to install the ILL handler\n");
- }
+ if (sigaction(SIGSEGV, &act, &s_info.SEGV_act) < 0) {
+ ErrPrint("Failed to install the SEGV handler\n");
}
- if (sigaction(SIGUSR1, &act, &s_info.USR1_act) < 0) {
- ErrPrint("Failed to install the USR1 handler\n");
+ if (sigaction(SIGABRT, &act, &s_info.ABRT_act) < 0) {
+ ErrPrint("Faield to install the ABRT handler\n");
}
- if (sigaction(SIGALRM, &act, &s_info.ALRM_act) < 0) {
- ErrPrint("Failed to install the ALRM handler\n");
+ if (sigaction(SIGILL, &act, &s_info.ILL_act) < 0) {
+ ErrPrint("Faield to install the ILL handler\n");
}
+ }
- return 0;
+ if (sigaction(SIGUSR1, &act, &s_info.USR1_act) < 0) {
+ ErrPrint("Failed to install the USR1 handler\n");
+ }
+
+ if (sigaction(SIGALRM, &act, &s_info.ALRM_act) < 0) {
+ ErrPrint("Failed to install the ALRM handler\n");
+ }
+
+ return 0;
}
HAPI int fault_fini(void)
{
- /*!
- * \todo
- * remove all signal handlers
- */
- return 0;
+ /*!
+ * \todo
+ * remove all signal handlers
+ */
+ return 0;
}
HAPI int fault_mark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm, int life_time)
{
- if (!s_info.disable_checker) {
- dynamicbox_provider_send_call(pkgname, filename, funcname);
- }
- /*!
- * \NOTE
- * To use this "alarm", the dynamicbox have to do not use the 'sleep' series functions.
- * because those functions will generate alarm signal.
- * then the module will be deactivated
- *
- * Enable alarm for detecting infinite loop
- */
- if (!noalarm) {
+ if (!s_info.disable_checker) {
+ dynamicbox_provider_send_call(pkgname, filename, funcname);
+ }
+ /*!
+ * \NOTE
+ * To use this "alarm", the dynamicbox have to do not use the 'sleep' series functions.
+ * because those functions will generate alarm signal.
+ * then the module will be deactivated
+ *
+ * Enable alarm for detecting infinite loop
+ */
+ if (!noalarm) {
#if defined(_USE_ECORE_TIME_GET)
- s_info.alarm_tv = ecore_time_get();
+ s_info.alarm_tv = ecore_time_get();
#else
- if (gettimeofday(&s_info.alarm_tv, NULL) < 0) {
- ErrPrint("gettimeofday: %s\n", strerror(errno));
- s_info.alarm_tv.tv_sec = 0;
- s_info.alarm_tv.tv_usec = 0;
- }
-#endif
- s_info.marked = 1;
- alarm(life_time);
+ if (gettimeofday(&s_info.alarm_tv, NULL) < 0) {
+ ErrPrint("gettimeofday: %s\n", strerror(errno));
+ s_info.alarm_tv.tv_sec = 0;
+ s_info.alarm_tv.tv_usec = 0;
}
+#endif
+ s_info.marked = 1;
+ alarm(life_time);
+ }
- return 0;
+ return 0;
}
HAPI int fault_unmark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm)
{
- if (!noalarm) {
- /*!
- * \NOTE
- * Disable alarm
- */
- alarm(0);
- s_info.marked = 0;
- }
-
- if (!s_info.disable_checker) {
- dynamicbox_provider_send_ret(pkgname, filename, funcname);
- }
- return 0;
+ if (!noalarm) {
+ /*!
+ * \NOTE
+ * Disable alarm
+ */
+ alarm(0);
+ s_info.marked = 0;
+ }
+
+ if (!s_info.disable_checker) {
+ dynamicbox_provider_send_ret(pkgname, filename, funcname);
+ }
+ return 0;
}
HAPI void fault_disable_call_option(void)
{
- s_info.disable_checker = 1;
+ s_info.disable_checker = 1;
}
/* End of a file */
static void font_changed_cb(void *user_data)
{
- char *font_name;
-
- evas_font_reinit();
-
- if (s_info.font_name) {
- font_name = vconf_get_str(SLAVE_VCONFKEY_FONT_NAME);
- if (!font_name) {
- ErrPrint("Invalid font name (NULL)\n");
- return;
- }
-
- if (!strcmp(s_info.font_name, font_name)) {
- DbgPrint("Font is not changed (Old: %s(%p) <> New: %s(%p))\n", s_info.font_name, s_info.font_name, font_name, font_name);
- free(font_name);
- return;
- }
-
- DbgPrint("Release old font name: %s(%p)\n", s_info.font_name, s_info.font_name);
- free(s_info.font_name);
- } else {
- int ret;
-
- font_name = NULL;
- ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &font_name);
- if (ret != SYSTEM_SETTINGS_ERROR_NONE || !font_name) {
- ErrPrint("System settings: %d, font_name[%p]\n", ret, font_name);
- return;
- }
+ char *font_name;
+
+ evas_font_reinit();
+
+ if (s_info.font_name) {
+ font_name = vconf_get_str(SLAVE_VCONFKEY_FONT_NAME);
+ if (!font_name) {
+ ErrPrint("Invalid font name (NULL)\n");
+ return;
+ }
+
+ if (!strcmp(s_info.font_name, font_name)) {
+ DbgPrint("Font is not changed (Old: %s(%p) <> New: %s(%p))\n", s_info.font_name, s_info.font_name, font_name, font_name);
+ free(font_name);
+ return;
+ }
+
+ DbgPrint("Release old font name: %s(%p)\n", s_info.font_name, s_info.font_name);
+ free(s_info.font_name);
+ } else {
+ int ret;
+
+ font_name = NULL;
+ ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, &font_name);
+ if (ret != SYSTEM_SETTINGS_ERROR_NONE || !font_name) {
+ ErrPrint("System settings: %d, font_name[%p]\n", ret, font_name);
+ return;
}
+ }
- s_info.font_name = font_name;
- DbgPrint("Font name is changed to %s(%p)\n", s_info.font_name, s_info.font_name);
+ s_info.font_name = font_name;
+ DbgPrint("Font name is changed to %s(%p)\n", s_info.font_name, s_info.font_name);
- /**
- * @NOTE
- * Try to update all dynamicboxes
- */
- edje_text_class_set(TEXT_CLASS, s_info.font_name, DEFAULT_FONT_SIZE);
+ /**
+ * @NOTE
+ * Try to update all dynamicboxes
+ */
+ edje_text_class_set(TEXT_CLASS, s_info.font_name, DEFAULT_FONT_SIZE);
- DbgPrint("Call system event\n");
- dbox_system_event_all(DBOX_SYS_EVENT_FONT_CHANGED);
+ DbgPrint("Call system event\n");
+ dbox_system_event_all(DBOX_SYS_EVENT_FONT_CHANGED);
}
static inline int convert_font_size(int size)
{
- switch (size) {
+ switch (size) {
case SYSTEM_SETTINGS_FONT_SIZE_SMALL:
- size = -80;
- break;
+ size = -80;
+ break;
case SYSTEM_SETTINGS_FONT_SIZE_NORMAL:
- size = -100;
- break;
+ size = -100;
+ break;
case SYSTEM_SETTINGS_FONT_SIZE_LARGE:
- size = -150;
- break;
+ size = -150;
+ break;
case SYSTEM_SETTINGS_FONT_SIZE_HUGE:
- size = -190;
- break;
+ size = -190;
+ break;
case SYSTEM_SETTINGS_FONT_SIZE_GIANT:
- size = -250;
- break;
+ size = -250;
+ break;
default:
- size = -100;
- break;
- }
+ size = -100;
+ break;
+ }
- DbgPrint("Return size: %d\n", size);
- return size;
+ DbgPrint("Return size: %d\n", size);
+ return size;
}
static void font_size_cb(system_settings_key_e key, void *user_data)
{
- int size;
+ int size;
- if (system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &size) != SYSTEM_SETTINGS_ERROR_NONE) {
- return;
- }
+ if (system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &size) != SYSTEM_SETTINGS_ERROR_NONE) {
+ return;
+ }
- size = convert_font_size(size);
+ size = convert_font_size(size);
- if (size == s_info.font_size) {
- DbgPrint("Font size is not changed\n");
- return;
- }
+ if (size == s_info.font_size) {
+ DbgPrint("Font size is not changed\n");
+ return;
+ }
- s_info.font_size = size;
- DbgPrint("Font size is changed to %d, but don't try to update it.\n", size);
+ s_info.font_size = size;
+ DbgPrint("Font size is changed to %d, but don't try to update it.\n", size);
}
static void tts_changed_cb(keynode_t *node, void *user_data)
{
- DbgPrint("TTS status is changed\n");
- dbox_system_event_all(DBOX_SYS_EVENT_TTS_CHANGED);
+ DbgPrint("TTS status is changed\n");
+ dbox_system_event_all(DBOX_SYS_EVENT_TTS_CHANGED);
}
static void mmc_changed_cb(keynode_t *node, void *user_data)
{
- DbgPrint("MMC status is changed\n");
- dbox_system_event_all(DBOX_SYS_EVENT_MMC_STATUS_CHANGED);
+ DbgPrint("MMC status is changed\n");
+ dbox_system_event_all(DBOX_SYS_EVENT_MMC_STATUS_CHANGED);
}
static void time_changed_cb(keynode_t *node, void *user_data)
{
- DbgPrint("Time is changed\n");
- dbox_system_event_all(DBOX_SYS_EVENT_TIME_CHANGED);
+ DbgPrint("Time is changed\n");
+ dbox_system_event_all(DBOX_SYS_EVENT_TIME_CHANGED);
}
static void initialize_glib_type_system(void)
{
- GType type;
+ GType type;
- type = G_TYPE_DBUS_ACTION_GROUP;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_ANNOTATION_INFO;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_ARG_INFO;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_AUTH_OBSERVER;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_CALL_FLAGS;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_CAPABILITY_FLAGS;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_CONNECTION;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_CONNECTION_FLAGS;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_ERROR;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_INTERFACE;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_INTERFACE_INFO;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_INTERFACE_SKELETON;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_INTERFACE_SKELETON_FLAGS;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_MENU_MODEL;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_MESSAGE;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_MESSAGE_BYTE_ORDER;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_MESSAGE_FLAGS;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_MESSAGE_HEADER_FIELD;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_MESSAGE_TYPE;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_METHOD_INFO;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_METHOD_INVOCATION;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_NODE_INFO;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_OBJECT;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_OBJECT_MANAGER;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_OBJECT_MANAGER_CLIENT;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_OBJECT_MANAGER_CLIENT_FLAGS;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_OBJECT_MANAGER_SERVER;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_OBJECT_PROXY;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_OBJECT_SKELETON;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_PROPERTY_INFO;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_PROPERTY_INFO_FLAGS;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_PROXY;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_PROXY_FLAGS;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_SEND_MESSAGE_FLAGS;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_SERVER;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_SERVER_FLAGS;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_SIGNAL_FLAGS;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_SIGNAL_INFO;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = G_TYPE_DBUS_SUBTREE_FLAGS;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = JSON_TYPE_NODE;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = JSON_TYPE_OBJECT;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = JSON_TYPE_ARRAY;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = JSON_TYPE_ARRAY;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = JSON_TYPE_SERIALIZABLE;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = JSON_TYPE_PARSER;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
- type = JSON_TYPE_GENERATOR;
- if (type != G_TYPE_OBJECT) {
- DbgPrint("initialized\n");
- }
+ type = G_TYPE_DBUS_ACTION_GROUP;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_ANNOTATION_INFO;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_ARG_INFO;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_AUTH_OBSERVER;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_CALL_FLAGS;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_CAPABILITY_FLAGS;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_CONNECTION;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_CONNECTION_FLAGS;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_ERROR;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_INTERFACE;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_INTERFACE_INFO;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_INTERFACE_SKELETON;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_INTERFACE_SKELETON_FLAGS;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_MENU_MODEL;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_MESSAGE;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_MESSAGE_BYTE_ORDER;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_MESSAGE_FLAGS;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_MESSAGE_HEADER_FIELD;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_MESSAGE_TYPE;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_METHOD_INFO;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_METHOD_INVOCATION;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_NODE_INFO;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_OBJECT;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_OBJECT_MANAGER;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_OBJECT_MANAGER_CLIENT;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_OBJECT_MANAGER_CLIENT_FLAGS;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_OBJECT_MANAGER_SERVER;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_OBJECT_PROXY;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_OBJECT_SKELETON;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_PROPERTY_INFO;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_PROPERTY_INFO_FLAGS;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_PROXY;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_PROXY_FLAGS;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_SEND_MESSAGE_FLAGS;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_SERVER;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_SERVER_FLAGS;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_SIGNAL_FLAGS;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_SIGNAL_INFO;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = G_TYPE_DBUS_SUBTREE_FLAGS;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = JSON_TYPE_NODE;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = JSON_TYPE_OBJECT;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = JSON_TYPE_ARRAY;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = JSON_TYPE_ARRAY;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = JSON_TYPE_SERIALIZABLE;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = JSON_TYPE_PARSER;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
+ type = JSON_TYPE_GENERATOR;
+ if (type != G_TYPE_OBJECT) {
+ DbgPrint("initialized\n");
+ }
}
static bool app_create(void *argv)
{
- int ret;
+ int ret;
- elm_app_base_scale_set(WVGA_DEFAULT_SCALE);
+ elm_app_base_scale_set(WVGA_DEFAULT_SCALE);
- dynamicbox_conf_init();
- if (!dynamicbox_conf_is_loaded()) {
- ret = dynamicbox_conf_load();
- if (ret < 0) {
- DbgPrint("Configureation manager is initiated: %d\n", ret);
- }
+ dynamicbox_conf_init();
+ if (!dynamicbox_conf_is_loaded()) {
+ ret = dynamicbox_conf_load();
+ if (ret < 0) {
+ DbgPrint("Configureation manager is initiated: %d\n", ret);
}
+ }
- critical_log_init(util_basename(((char **)argv)[0]));
+ critical_log_init(util_basename(((char **)argv)[0]));
- /*!
- * Touch the glib type system
- */
- initialize_glib_type_system();
+ /*!
+ * Touch the glib type system
+ */
+ initialize_glib_type_system();
- DbgPrint("Scale factor: %lf\n", elm_config_scale_get());
+ DbgPrint("Scale factor: %lf\n", elm_config_scale_get());
- if (DYNAMICBOX_CONF_COM_CORE_THREAD) {
- if (setenv("PROVIDER_COM_CORE_THREAD", "true", 0) < 0) {
- ErrPrint("setenv: %s\n", strerror(errno));
- }
- } else {
- if (setenv("PROVIDER_COM_CORE_THREAD", "false", 0) < 0){
- ErrPrint("setenv: %s\n", strerror(errno));
- }
+ if (DYNAMICBOX_CONF_COM_CORE_THREAD) {
+ if (setenv("PROVIDER_COM_CORE_THREAD", "true", 0) < 0) {
+ ErrPrint("setenv: %s\n", strerror(errno));
}
-
- ret = dynamicbox_service_init();
- if (ret < 0) {
- DbgPrint("Livebox service init: %d\n", ret);
+ } else {
+ if (setenv("PROVIDER_COM_CORE_THREAD", "false", 0) < 0){
+ ErrPrint("setenv: %s\n", strerror(errno));
}
+ }
- /**
- * @note
- * Slave is not able to initiate system, before
- * receive its name from the master
- *
- * So create callback doesn't do anything.
- */
- ret = fault_init(argv);
- if (ret < 0) {
- DbgPrint("Crash recover is initiated: %d\n", ret);
- }
+ ret = dynamicbox_service_init();
+ if (ret < 0) {
+ DbgPrint("Livebox service init: %d\n", ret);
+ }
- ret = update_monitor_init();
- if (ret < 0) {
- DbgPrint("Content update monitor is initiated: %d\n", ret);
- }
+ /**
+ * @note
+ * Slave is not able to initiate system, before
+ * receive its name from the master
+ *
+ * So create callback doesn't do anything.
+ */
+ ret = fault_init(argv);
+ if (ret < 0) {
+ DbgPrint("Crash recover is initiated: %d\n", ret);
+ }
- s_info.table = ea_theme_font_table_new("/usr/share/themes/FontInfoTable.xml");
- if (s_info.table) {
- DbgPrint("FONT TABLE Prepared");
- ea_theme_fonts_set(s_info.table);
- }
- ea_theme_event_callback_add(EA_THEME_CALLBACK_TYPE_FONT, font_changed_cb, NULL);
-
- ret = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, font_size_cb, NULL);
- if (ret < 0) {
- DbgPrint("System font size changed callback is added: %d\n", ret);
- }
+ ret = update_monitor_init();
+ if (ret < 0) {
+ DbgPrint("Content update monitor is initiated: %d\n", ret);
+ }
- ret = vconf_notify_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, time_changed_cb, NULL);
- if (ret < 0) {
- DbgPrint("System time changed event callback added: %d\n", ret);
- }
+ s_info.table = ea_theme_font_table_new("/usr/share/themes/FontInfoTable.xml");
+ if (s_info.table) {
+ DbgPrint("FONT TABLE Prepared");
+ ea_theme_fonts_set(s_info.table);
+ }
+ ea_theme_event_callback_add(EA_THEME_CALLBACK_TYPE_FONT, font_changed_cb, NULL);
- ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, mmc_changed_cb, NULL);
- if (ret < 0) {
- DbgPrint("MMC status changed event callback added: %d\n", ret);
- }
+ ret = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, font_size_cb, NULL);
+ if (ret < 0) {
+ DbgPrint("System font size changed callback is added: %d\n", ret);
+ }
- ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, tts_changed_cb, NULL);
- if (ret < 0) {
- DbgPrint("TTS changed callback is added: %s\n", ret);
- }
+ ret = vconf_notify_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, time_changed_cb, NULL);
+ if (ret < 0) {
+ DbgPrint("System time changed event callback added: %d\n", ret);
+ }
+
+ ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, mmc_changed_cb, NULL);
+ if (ret < 0) {
+ DbgPrint("MMC status changed event callback added: %d\n", ret);
+ }
+
+ ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, tts_changed_cb, NULL);
+ if (ret < 0) {
+ DbgPrint("TTS changed callback is added: %s\n", ret);
+ }
- font_changed_cb(NULL);
- font_size_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, NULL);
+ font_changed_cb(NULL);
+ font_size_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE, NULL);
- dbox_init();
+ dbox_init();
- return TRUE;
+ return TRUE;
}
static void app_terminate(void *data)
{
- int ret;
+ int ret;
- DbgPrint("Terminating provider\n");
+ DbgPrint("Terminating provider\n");
- dbox_fini();
+ dbox_fini();
- if (s_info.table) {
- DbgPrint("FONT TABLE Destroyed");
- ea_theme_font_table_free(s_info.table);
- s_info.table = NULL;
- }
+ if (s_info.table) {
+ DbgPrint("FONT TABLE Destroyed");
+ ea_theme_font_table_free(s_info.table);
+ s_info.table = NULL;
+ }
- ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, tts_changed_cb);
- if (ret < 0) {
- DbgPrint("TTS changed callback is added: %s\n", ret);
- }
+ ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, tts_changed_cb);
+ if (ret < 0) {
+ DbgPrint("TTS changed callback is added: %s\n", ret);
+ }
- ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE);
- if (ret < 0) {
- DbgPrint("unset fontsize: %d\n", ret);
- }
+ ret = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_SIZE);
+ if (ret < 0) {
+ DbgPrint("unset fontsize: %d\n", ret);
+ }
- ea_theme_event_callback_del(EA_THEME_CALLBACK_TYPE_FONT, font_changed_cb);
+ ea_theme_event_callback_del(EA_THEME_CALLBACK_TYPE_FONT, font_changed_cb);
- ret = vconf_ignore_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, time_changed_cb);
- if (ret < 0) {
- DbgPrint("Remove time changed callback: %d\n", ret);
- }
+ ret = vconf_ignore_key_changed(VCONFKEY_SYSTEM_TIME_CHANGED, time_changed_cb);
+ if (ret < 0) {
+ DbgPrint("Remove time changed callback: %d\n", ret);
+ }
- ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, mmc_changed_cb);
- if (ret < 0) {
- DbgPrint("Remove MMC status changed callback: %d\n", ret);
- }
+ ret = vconf_ignore_key_changed(VCONFKEY_SYSMAN_MMC_STATUS, mmc_changed_cb);
+ if (ret < 0) {
+ DbgPrint("Remove MMC status changed callback: %d\n", ret);
+ }
- ret = update_monitor_fini();
- if (ret < 0) {
- DbgPrint("Content update monitor is finalized: %d\n", ret);
- }
+ ret = update_monitor_fini();
+ if (ret < 0) {
+ DbgPrint("Content update monitor is finalized: %d\n", ret);
+ }
- ret = fault_fini();
- if (ret < 0) {
- DbgPrint("Crash recover is finalized: %d\n", ret);
- }
+ ret = fault_fini();
+ if (ret < 0) {
+ DbgPrint("Crash recover is finalized: %d\n", ret);
+ }
- ret = client_fini();
- if (ret < 0) {
- DbgPrint("client finalized: %d\n", ret);
- }
+ ret = client_fini();
+ if (ret < 0) {
+ DbgPrint("client finalized: %d\n", ret);
+ }
- ret = dynamicbox_service_fini();
- if (ret < 0) {
- DbgPrint("dynamicbox service fini: %d\n", ret);
- }
+ ret = dynamicbox_service_fini();
+ if (ret < 0) {
+ DbgPrint("dynamicbox service fini: %d\n", ret);
+ }
- free(s_info.font_name);
- s_info.font_name = NULL;
+ free(s_info.font_name);
+ s_info.font_name = NULL;
- critical_log_fini();
+ critical_log_fini();
- exit(0);
- return;
+ exit(0);
+ return;
}
static void app_pause(void *data)
{
- /* Will not be invoked */
- return;
+ /* Will not be invoked */
+ return;
}
static void app_resume(void *data)
{
- /* Will not be invoked */
- return;
+ /* Will not be invoked */
+ return;
}
static void app_region_changed(app_event_info_h event_info, void *data)
static void app_control(app_control_h service, void *data)
{
- int ret;
- char *name;
- char *secured;
- static int initialized = 0;
+ int ret;
+ char *name;
+ char *secured;
+ static int initialized = 0;
- if (initialized) {
- ErrPrint("Already initialized\n");
- return;
- }
+ if (initialized) {
+ ErrPrint("Already initialized\n");
+ return;
+ }
- ret = app_control_get_extra_data(service, "name", &name);
- if (ret != APP_CONTROL_ERROR_NONE) {
- ErrPrint("Name is not valid\n");
- return;
- }
+ ret = app_control_get_extra_data(service, "name", &name);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ ErrPrint("Name is not valid\n");
+ return;
+ }
- ret = app_control_get_extra_data(service, "secured", &secured);
- if (ret != APP_CONTROL_ERROR_NONE) {
- free(name);
- ErrPrint("Secured is not valid\n");
- return;
- }
+ ret = app_control_get_extra_data(service, "secured", &secured);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ free(name);
+ ErrPrint("Secured is not valid\n");
+ return;
+ }
- if (!strcasecmp(secured, "true")) {
- /* Don't use the update timer */
- dbox_turn_secured_on();
- }
+ if (!strcasecmp(secured, "true")) {
+ /* Don't use the update timer */
+ dbox_turn_secured_on();
+ }
- DbgPrint("Name assigned: %s\n", name);
- DbgPrint("Secured: %s\n", secured);
- ret = client_init(name);
- free(name);
- free(secured);
+ DbgPrint("Name assigned: %s\n", name);
+ DbgPrint("Secured: %s\n", secured);
+ ret = client_init(name);
+ free(name);
+ free(secured);
- initialized = 1;
- return;
+ initialized = 1;
+ return;
}
#if defined(_ENABLE_MCHECK)
static inline void mcheck_cb(enum mcheck_status status)
{
- char *ptr;
+ char *ptr;
- ptr = util_get_current_module(NULL);
+ ptr = util_get_current_module(NULL);
- switch (status) {
+ switch (status) {
case MCHECK_DISABLED:
- ErrPrint("[DISABLED] Heap incosistency detected: %s\n", ptr);
- break;
+ ErrPrint("[DISABLED] Heap incosistency detected: %s\n", ptr);
+ break;
case MCHECK_OK:
- ErrPrint("[OK] Heap incosistency detected: %s\n", ptr);
- break;
+ ErrPrint("[OK] Heap incosistency detected: %s\n", ptr);
+ break;
case MCHECK_HEAD:
- ErrPrint("[HEAD] Heap incosistency detected: %s\n", ptr);
- break;
+ ErrPrint("[HEAD] Heap incosistency detected: %s\n", ptr);
+ break;
case MCHECK_TAIL:
- ErrPrint("[TAIL] Heap incosistency detected: %s\n", ptr);
- break;
+ ErrPrint("[TAIL] Heap incosistency detected: %s\n", ptr);
+ break;
case MCHECK_FREE:
- ErrPrint("[FREE] Heap incosistency detected: %s\n", ptr);
- break;
+ ErrPrint("[FREE] Heap incosistency detected: %s\n", ptr);
+ break;
default:
- break;
- }
+ break;
+ }
}
#endif
HAPI int main_heap_monitor_is_enabled(void)
{
- return s_info.heap_monitor_initialized ? s_info.heap_monitor_initialized() : 0;
+ return s_info.heap_monitor_initialized ? s_info.heap_monitor_initialized() : 0;
}
HAPI size_t main_heap_monitor_target_usage(const char *name)
{
- return s_info.heap_monitor_target_usage ? s_info.heap_monitor_target_usage(name) : 0;
+ return s_info.heap_monitor_target_usage ? s_info.heap_monitor_target_usage(name) : 0;
}
HAPI int main_heap_monitor_add_target(const char *name)
{
- return s_info.heap_monitor_add_target ? s_info.heap_monitor_add_target(name) : 0;
+ return s_info.heap_monitor_add_target ? s_info.heap_monitor_add_target(name) : 0;
}
HAPI int main_heap_monitor_del_target(const char *name)
{
- return s_info.heap_monitor_del_target ? s_info.heap_monitor_del_target(name) : 0;
+ return s_info.heap_monitor_del_target ? s_info.heap_monitor_del_target(name) : 0;
}
/* End of a file */
int errno;
static struct info {
- Eina_List *dynamicbox_list;
- enum current_operations current_op;
+ Eina_List *dynamicbox_list;
+ enum current_operations current_op;
} s_info = {
- .dynamicbox_list = NULL,
- .current_op = DBOX_OP_UNKNOWN,
+ .dynamicbox_list = NULL,
+ .current_op = DBOX_OP_UNKNOWN,
};
static inline struct so_item *find_dynamicbox(const char *pkgname)
{
- Eina_List *l;
- struct so_item *item;
+ Eina_List *l;
+ struct so_item *item;
- EINA_LIST_FOREACH(s_info.dynamicbox_list, l, item) {
- if (!strcmp(item->pkgname, pkgname)) {
- return item;
- }
+ EINA_LIST_FOREACH(s_info.dynamicbox_list, l, item) {
+ if (!strcmp(item->pkgname, pkgname)) {
+ return item;
}
+ }
- return NULL;
+ return NULL;
}
static inline char *so_adaptor_alloc(const char *abi)
{
- /* TODO: Implement me */
- DbgPrint("ABI[%s] loads %s\n", abi, "/usr/lib/libdynamicbox-cpp.so");
- return strdup("/usr/lib/libdynamicbox-cpp.so");
+ /* TODO: Implement me */
+ DbgPrint("ABI[%s] loads %s\n", abi, "/usr/lib/libdynamicbox-cpp.so");
+ return strdup("/usr/lib/libdynamicbox-cpp.so");
}
static inline char *so_path_alloc(const char *pkgname)
{
- char *dbox_id;
- char *path;
+ char *dbox_id;
+ char *path;
- dbox_id = dynamicbox_service_dbox_id(pkgname);
- if (!dbox_id) {
- ErrPrint("Failed to get package name\n");
- return NULL;
- } else {
- path = dynamicbox_service_libexec(dbox_id);
- free(dbox_id);
- }
+ dbox_id = dynamicbox_service_dbox_id(pkgname);
+ if (!dbox_id) {
+ ErrPrint("Failed to get package name\n");
+ return NULL;
+ } else {
+ path = dynamicbox_service_libexec(dbox_id);
+ free(dbox_id);
+ }
- DbgPrint("so path: %s\n", path);
- return path;
+ DbgPrint("so path: %s\n", path);
+ return path;
}
static void delete_dynamicbox(struct so_item *item)
{
- int ret;
+ int ret;
- fault_mark_call(item->pkgname, "finalize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+ fault_mark_call(item->pkgname, "finalize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
- if (item->adaptor.finalize) {
- ret = item->adaptor.finalize(item->pkgname);
- } else if (item->dynamicbox.finalize) {
- ret = item->dynamicbox.finalize();
- } else {
- ErrPrint("%s has no finalize\n", item->pkgname);
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
+ if (item->adaptor.finalize) {
+ ret = item->adaptor.finalize(item->pkgname);
+ } else if (item->dynamicbox.finalize) {
+ ret = item->dynamicbox.finalize();
+ } else {
+ ErrPrint("%s has no finalize\n", item->pkgname);
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
- fault_unmark_call(item->pkgname, "finalize", __func__, USE_ALARM);
+ fault_unmark_call(item->pkgname, "finalize", __func__, USE_ALARM);
- if (ret == DBOX_STATUS_ERROR_BUSY) {
- DbgPrint("Keep SO in a process space (%s)\n", item->so_fname);
- } else {
- if (ret < 0) {
- ErrPrint("Package %s, finalize returns %d\n", item->pkgname, ret);
- }
- DbgPrint("Unload SO from process space (%s)\n", item->so_fname);
- s_info.dynamicbox_list = eina_list_remove(s_info.dynamicbox_list, item);
- main_heap_monitor_del_target(item->so_fname);
- util_dump_current_so_info(item->so_fname);
- if (dlclose(item->handle) != 0) {
- ErrPrint("dlclose: %s\n", dlerror());
- }
- free(item->so_fname);
- free(item->pkgname);
- free(item);
- }
+ if (ret == DBOX_STATUS_ERROR_BUSY) {
+ DbgPrint("Keep SO in a process space (%s)\n", item->so_fname);
+ } else {
+ if (ret < 0) {
+ ErrPrint("Package %s, finalize returns %d\n", item->pkgname, ret);
+ }
+ DbgPrint("Unload SO from process space (%s)\n", item->so_fname);
+ s_info.dynamicbox_list = eina_list_remove(s_info.dynamicbox_list, item);
+ main_heap_monitor_del_target(item->so_fname);
+ util_dump_current_so_info(item->so_fname);
+ if (dlclose(item->handle) != 0) {
+ ErrPrint("dlclose: %s\n", dlerror());
+ }
+ free(item->so_fname);
+ free(item->pkgname);
+ free(item);
+ }
}
static struct so_item *new_adaptor(const char *pkgname, const char *abi)
{
- struct so_item *item;
- char *errmsg;
+ struct so_item *item;
+ char *errmsg;
- item = calloc(1, sizeof(*item));
- if (!item) {
- ErrPrint("Memory: %s\n", strerror(errno));
- return NULL;
- }
+ item = calloc(1, sizeof(*item));
+ if (!item) {
+ ErrPrint("Memory: %s\n", strerror(errno));
+ return NULL;
+ }
- item->pkgname = strdup(pkgname);
- if (!item->pkgname) {
- ErrPrint("Memory: %s\n", strerror(errno));
- free(item);
- return NULL;
- }
+ item->pkgname = strdup(pkgname);
+ if (!item->pkgname) {
+ ErrPrint("Memory: %s\n", strerror(errno));
+ free(item);
+ return NULL;
+ }
- /*! \TODO:
- * item->timeout
- */
+ /*! \TODO:
+ * item->timeout
+ */
- /*! \TODO
- * item->has_dynamicbox_script
- */
+ /*! \TODO
+ * item->has_dynamicbox_script
+ */
- item->inst_list = NULL;
+ item->inst_list = NULL;
- item->so_fname = so_adaptor_alloc(abi);
- if (!item->so_fname) {
- free(item->pkgname);
- free(item);
- return NULL;
- }
+ item->so_fname = so_adaptor_alloc(abi);
+ if (!item->so_fname) {
+ free(item->pkgname);
+ free(item);
+ return NULL;
+ }
- fault_mark_call(pkgname, __func__, __func__, USE_ALARM, DEFAULT_LOAD_TIMER);
- item->handle = dlopen(item->so_fname, RTLD_LOCAL | RTLD_NOW | RTLD_DEEPBIND);
- if (!item->handle) {
- fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
- ErrPrint("dlopen: %s - %s\n", dlerror(), item->so_fname);
- free(item->so_fname);
- free(item->pkgname);
- free(item);
- return NULL;
- }
+ fault_mark_call(pkgname, __func__, __func__, USE_ALARM, DEFAULT_LOAD_TIMER);
+ item->handle = dlopen(item->so_fname, RTLD_LOCAL | RTLD_NOW | RTLD_DEEPBIND);
+ if (!item->handle) {
fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
+ ErrPrint("dlopen: %s - %s\n", dlerror(), item->so_fname);
+ free(item->so_fname);
+ free(item->pkgname);
+ free(item);
+ return NULL;
+ }
+ fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
+
+ errmsg = dlerror();
+ if (errmsg) {
+ DbgPrint("dlerror(can be ignored): %s\n", errmsg);
+ }
+
+ item->adaptor.create = (adaptor_create_t)dlsym(item->handle, "dynamicbox_create");
+ if (!item->adaptor.create) {
+ ErrPrint("symbol: dynamicbox_create - %s\n", dlerror());
+ delete_dynamicbox(item);
+ return NULL;
+ }
- errmsg = dlerror();
- if (errmsg) {
- DbgPrint("dlerror(can be ignored): %s\n", errmsg);
- }
-
- item->adaptor.create = (adaptor_create_t)dlsym(item->handle, "dynamicbox_create");
- if (!item->adaptor.create) {
- ErrPrint("symbol: dynamicbox_create - %s\n", dlerror());
- delete_dynamicbox(item);
- return NULL;
- }
-
- item->adaptor.destroy = (adaptor_destroy_t)dlsym(item->handle, "dynamicbox_destroy");
- if (!item->adaptor.destroy) {
- ErrPrint("symbol: dynamicbox_destroy - %s\n", dlerror());
- delete_dynamicbox(item);
- return NULL;
- }
-
- item->adaptor.pinup = (adaptor_pinup_t)dlsym(item->handle, "dynamicbox_pinup");
- if (!item->adaptor.pinup) {
- ErrPrint("symbol: dynamicbox_pinup - %s\n", dlerror());
- }
-
- item->adaptor.is_updated = (adaptor_is_updated_t)dlsym(item->handle, "dynamicbox_need_to_update");
- if (!item->adaptor.is_updated) {
- ErrPrint("symbol: dynamicbox_need_to_update - %s\n", dlerror());
- }
-
- item->adaptor.update_content = (adaptor_update_content_t)dlsym(item->handle, "dynamicbox_update_content");
- if (!item->adaptor.update_content) {
- ErrPrint("symbol: dynamicbox_update_content - %s\n", dlerror());
- }
-
- item->adaptor.clicked = (adaptor_clicked_t)dlsym(item->handle, "dynamicbox_clicked");
- if (!item->adaptor.clicked) {
- ErrPrint("symbol: dynamicbox_clicked - %s\n", dlerror());
- }
-
- item->adaptor.script_event = (adaptor_script_t)dlsym(item->handle, "dynamicbox_content_event");
- if (!item->adaptor.script_event) {
- ErrPrint("symbol: dynamicbox_content_event - %s\n", dlerror());
- }
-
- item->adaptor.resize = (adaptor_resize_t)dlsym(item->handle, "dynamicbox_resize");
- if (!item->adaptor.resize) {
- ErrPrint("symbol: dynamicbox_resize - %s\n", dlerror());
- }
-
- item->adaptor.create_needed = (adaptor_create_needed_t)dlsym(item->handle, "dynamicbox_need_to_create");
- if (!item->adaptor.create_needed) {
- ErrPrint("symbol: dynamicbox_need_to_create - %s\n", dlerror());
- }
-
- item->adaptor.change_group = (adaptor_change_group_t)dlsym(item->handle, "dynamicbox_change_group");
- if (!item->adaptor.change_group) {
- ErrPrint("symbol: dynamicbox_change_group - %s\n", dlerror());
- }
-
- item->adaptor.get_output_info = (adaptor_get_output_info_t)dlsym(item->handle, "dynamicbox_get_info");
- if (!item->adaptor.get_output_info) {
- ErrPrint("symbol: dynamicbox_get_info - %s\n", dlerror());
- }
-
- item->adaptor.initialize = (adaptor_initialize_t)dlsym(item->handle, "dynamicbox_initialize");
- if (!item->adaptor.initialize) {
- ErrPrint("symbol: dynamicbox_initialize - %s\n", dlerror());
- }
-
- item->adaptor.finalize = (adaptor_finalize_t)dlsym(item->handle, "dynamicbox_finalize");
- if (!item->adaptor.finalize) {
- ErrPrint("symbol: dynamicbox_finalize - %s\n", dlerror());
- }
-
- item->adaptor.need_to_destroy = (adaptor_need_to_destroy_t)dlsym(item->handle, "dynamicbox_need_to_destroy");
- if (!item->adaptor.need_to_destroy) {
- ErrPrint("symbol: dynamicbox_need_to_destroy - %s\n", dlerror());
- }
-
- item->adaptor.sys_event = (adaptor_system_event_t)dlsym(item->handle, "dynamicbox_system_event");
- if (!item->adaptor.sys_event) {
- ErrPrint("symbol: lievbox_system_event - %s\n", dlerror());
- }
-
- item->adaptor.is_pinned_up = (adaptor_is_pinned_up_t)dlsym(item->handle, "dynamicbox_is_pinned_up");
- if (!item->adaptor.is_pinned_up) {
- ErrPrint("symbol: dynamicbox_is_pinned_up - %s\n", dlerror());
- }
-
- item->adaptor.get_alt_info = (adaptor_get_alt_info_t)dlsym(item->handle, "dynamicbox_get_alt_info");
- if (!item->adaptor.get_alt_info) {
- ErrPrint("symbol: dynamicbox_get_alt_info - %s\n", dlerror());
- }
-
- item->adaptor.set_content_info = (adaptor_set_content_info_t)dlsym(item->handle, "dynamicbox_set_content_info");
- if (!item->adaptor.set_content_info) {
- ErrPrint("symbol: dynamicbox_set_content_info - %s\n", dlerror());
- }
-
- if (item->adaptor.initialize) {
- int ret;
- fault_mark_call(pkgname, "initialize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+ item->adaptor.destroy = (adaptor_destroy_t)dlsym(item->handle, "dynamicbox_destroy");
+ if (!item->adaptor.destroy) {
+ ErrPrint("symbol: dynamicbox_destroy - %s\n", dlerror());
+ delete_dynamicbox(item);
+ return NULL;
+ }
+
+ item->adaptor.pinup = (adaptor_pinup_t)dlsym(item->handle, "dynamicbox_pinup");
+ if (!item->adaptor.pinup) {
+ ErrPrint("symbol: dynamicbox_pinup - %s\n", dlerror());
+ }
+
+ item->adaptor.is_updated = (adaptor_is_updated_t)dlsym(item->handle, "dynamicbox_need_to_update");
+ if (!item->adaptor.is_updated) {
+ ErrPrint("symbol: dynamicbox_need_to_update - %s\n", dlerror());
+ }
+
+ item->adaptor.update_content = (adaptor_update_content_t)dlsym(item->handle, "dynamicbox_update_content");
+ if (!item->adaptor.update_content) {
+ ErrPrint("symbol: dynamicbox_update_content - %s\n", dlerror());
+ }
+
+ item->adaptor.clicked = (adaptor_clicked_t)dlsym(item->handle, "dynamicbox_clicked");
+ if (!item->adaptor.clicked) {
+ ErrPrint("symbol: dynamicbox_clicked - %s\n", dlerror());
+ }
+
+ item->adaptor.script_event = (adaptor_script_t)dlsym(item->handle, "dynamicbox_content_event");
+ if (!item->adaptor.script_event) {
+ ErrPrint("symbol: dynamicbox_content_event - %s\n", dlerror());
+ }
+
+ item->adaptor.resize = (adaptor_resize_t)dlsym(item->handle, "dynamicbox_resize");
+ if (!item->adaptor.resize) {
+ ErrPrint("symbol: dynamicbox_resize - %s\n", dlerror());
+ }
+
+ item->adaptor.create_needed = (adaptor_create_needed_t)dlsym(item->handle, "dynamicbox_need_to_create");
+ if (!item->adaptor.create_needed) {
+ ErrPrint("symbol: dynamicbox_need_to_create - %s\n", dlerror());
+ }
+
+ item->adaptor.change_group = (adaptor_change_group_t)dlsym(item->handle, "dynamicbox_change_group");
+ if (!item->adaptor.change_group) {
+ ErrPrint("symbol: dynamicbox_change_group - %s\n", dlerror());
+ }
+
+ item->adaptor.get_output_info = (adaptor_get_output_info_t)dlsym(item->handle, "dynamicbox_get_info");
+ if (!item->adaptor.get_output_info) {
+ ErrPrint("symbol: dynamicbox_get_info - %s\n", dlerror());
+ }
+
+ item->adaptor.initialize = (adaptor_initialize_t)dlsym(item->handle, "dynamicbox_initialize");
+ if (!item->adaptor.initialize) {
+ ErrPrint("symbol: dynamicbox_initialize - %s\n", dlerror());
+ }
+
+ item->adaptor.finalize = (adaptor_finalize_t)dlsym(item->handle, "dynamicbox_finalize");
+ if (!item->adaptor.finalize) {
+ ErrPrint("symbol: dynamicbox_finalize - %s\n", dlerror());
+ }
+
+ item->adaptor.need_to_destroy = (adaptor_need_to_destroy_t)dlsym(item->handle, "dynamicbox_need_to_destroy");
+ if (!item->adaptor.need_to_destroy) {
+ ErrPrint("symbol: dynamicbox_need_to_destroy - %s\n", dlerror());
+ }
+
+ item->adaptor.sys_event = (adaptor_system_event_t)dlsym(item->handle, "dynamicbox_system_event");
+ if (!item->adaptor.sys_event) {
+ ErrPrint("symbol: lievbox_system_event - %s\n", dlerror());
+ }
+
+ item->adaptor.is_pinned_up = (adaptor_is_pinned_up_t)dlsym(item->handle, "dynamicbox_is_pinned_up");
+ if (!item->adaptor.is_pinned_up) {
+ ErrPrint("symbol: dynamicbox_is_pinned_up - %s\n", dlerror());
+ }
+
+ item->adaptor.get_alt_info = (adaptor_get_alt_info_t)dlsym(item->handle, "dynamicbox_get_alt_info");
+ if (!item->adaptor.get_alt_info) {
+ ErrPrint("symbol: dynamicbox_get_alt_info - %s\n", dlerror());
+ }
+
+ item->adaptor.set_content_info = (adaptor_set_content_info_t)dlsym(item->handle, "dynamicbox_set_content_info");
+ if (!item->adaptor.set_content_info) {
+ ErrPrint("symbol: dynamicbox_set_content_info - %s\n", dlerror());
+ }
+
+ if (item->adaptor.initialize) {
+ int ret;
+ fault_mark_call(pkgname, "initialize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
- ret = item->adaptor.initialize(pkgname);
+ ret = item->adaptor.initialize(pkgname);
- fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM);
- if (ret < 0) {
- ErrPrint("Failed to initialize package %s\n", pkgname);
- delete_dynamicbox(item);
- return NULL;
- }
+ fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM);
+ if (ret < 0) {
+ ErrPrint("Failed to initialize package %s\n", pkgname);
+ delete_dynamicbox(item);
+ return NULL;
}
+ }
- s_info.dynamicbox_list = eina_list_append(s_info.dynamicbox_list, item);
- return item;
+ s_info.dynamicbox_list = eina_list_append(s_info.dynamicbox_list, item);
+ return item;
}
static struct so_item *new_dynamicbox(const char *pkgname)
{
- struct so_item *item;
- char *errmsg;
+ struct so_item *item;
+ char *errmsg;
- item = calloc(1, sizeof(*item));
- if (!item) {
- ErrPrint("Memory: %s\n", strerror(errno));
- return NULL;
- }
+ item = calloc(1, sizeof(*item));
+ if (!item) {
+ ErrPrint("Memory: %s\n", strerror(errno));
+ return NULL;
+ }
- item->pkgname = strdup(pkgname);
- if (!item->pkgname) {
- ErrPrint("Memory: %s\n", strerror(errno));
- free(item);
- return NULL;
- }
+ item->pkgname = strdup(pkgname);
+ if (!item->pkgname) {
+ ErrPrint("Memory: %s\n", strerror(errno));
+ free(item);
+ return NULL;
+ }
- /*! \TODO:
- * item->timeout
- */
+ /*! \TODO:
+ * item->timeout
+ */
- /*! \TODO
- * item->has_dynamicbox_script
- */
+ /*! \TODO
+ * item->has_dynamicbox_script
+ */
- item->inst_list = NULL;
+ item->inst_list = NULL;
- item->so_fname = so_path_alloc(pkgname);
- if (!item->so_fname) {
- free(item->pkgname);
- free(item);
- return NULL;
- }
+ item->so_fname = so_path_alloc(pkgname);
+ if (!item->so_fname) {
+ free(item->pkgname);
+ free(item);
+ return NULL;
+ }
- fault_mark_call(pkgname, __func__, __func__, USE_ALARM, DEFAULT_LOAD_TIMER);
- item->handle = dlopen(item->so_fname, RTLD_LOCAL | RTLD_NOW | RTLD_DEEPBIND);
- if (!item->handle) {
- fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
- ErrPrint("dlopen: %s - %s\n", dlerror(), item->so_fname);
- free(item->so_fname);
- free(item->pkgname);
- free(item);
- return NULL;
- }
+ fault_mark_call(pkgname, __func__, __func__, USE_ALARM, DEFAULT_LOAD_TIMER);
+ item->handle = dlopen(item->so_fname, RTLD_LOCAL | RTLD_NOW | RTLD_DEEPBIND);
+ if (!item->handle) {
fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
+ ErrPrint("dlopen: %s - %s\n", dlerror(), item->so_fname);
+ free(item->so_fname);
+ free(item->pkgname);
+ free(item);
+ return NULL;
+ }
+ fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
+
+ errmsg = dlerror();
+ if (errmsg) {
+ DbgPrint("dlerror(can be ignored): %s\n", errmsg);
+ }
+
+ item->dynamicbox.create = (create_t)dlsym(item->handle, "dynamicbox_create");
+ if (!item->dynamicbox.create) {
+ ErrPrint("symbol: dynamicbox_create - %s\n", dlerror());
+ delete_dynamicbox(item);
+ return NULL;
+ }
- errmsg = dlerror();
- if (errmsg) {
- DbgPrint("dlerror(can be ignored): %s\n", errmsg);
- }
-
- item->dynamicbox.create = (create_t)dlsym(item->handle, "dynamicbox_create");
- if (!item->dynamicbox.create) {
- ErrPrint("symbol: dynamicbox_create - %s\n", dlerror());
- delete_dynamicbox(item);
- return NULL;
- }
-
- item->dynamicbox.destroy = (destroy_t)dlsym(item->handle, "dynamicbox_destroy");
- if (!item->dynamicbox.destroy) {
- ErrPrint("symbol: dynamicbox_destroy - %s\n", dlerror());
- delete_dynamicbox(item);
- return NULL;
- }
-
- item->dynamicbox.pinup = (pinup_t)dlsym(item->handle, "dynamicbox_pinup");
- if (!item->dynamicbox.pinup) {
- ErrPrint("symbol: dynamicbox_pinup - %s\n", dlerror());
- }
-
- item->dynamicbox.is_updated = (is_updated_t)dlsym(item->handle, "dynamicbox_need_to_update");
- if (!item->dynamicbox.is_updated) {
- ErrPrint("symbol: dynamicbox_need_to_update - %s\n", dlerror());
- }
-
- item->dynamicbox.update_content = (update_content_t)dlsym(item->handle, "dynamicbox_update_content");
- if (!item->dynamicbox.update_content) {
- ErrPrint("symbol: dynamicbox_update_content - %s\n", dlerror());
- }
-
- item->dynamicbox.clicked = (clicked_t)dlsym(item->handle, "dynamicbox_clicked");
- if (!item->dynamicbox.clicked) {
- ErrPrint("symbol: dynamicbox_clicked - %s\n", dlerror());
- }
-
- item->dynamicbox.script_event = (script_t)dlsym(item->handle, "dynamicbox_content_event");
- if (!item->dynamicbox.script_event) {
- ErrPrint("symbol: dynamicbox_content_event - %s\n", dlerror());
- }
-
- item->dynamicbox.resize = (resize_t)dlsym(item->handle, "dynamicbox_resize");
- if (!item->dynamicbox.resize) {
- ErrPrint("symbol: dynamicbox_resize - %s\n", dlerror());
- }
-
- item->dynamicbox.create_needed = (create_needed_t)dlsym(item->handle, "dynamicbox_need_to_create");
- if (!item->dynamicbox.create_needed) {
- ErrPrint("symbol: dynamicbox_need_to_create - %s\n", dlerror());
- }
-
- item->dynamicbox.change_group = (change_group_t)dlsym(item->handle, "dynamicbox_change_group");
- if (!item->dynamicbox.change_group) {
- ErrPrint("symbol: dynamicbox_change_group - %s\n", dlerror());
- }
-
- item->dynamicbox.get_output_info = (get_output_info_t)dlsym(item->handle, "dynamicbox_get_info");
- if (!item->dynamicbox.get_output_info) {
- ErrPrint("symbol: dynamicbox_get_info - %s\n", dlerror());
- }
-
- item->dynamicbox.initialize = (initialize_t)dlsym(item->handle, "dynamicbox_initialize");
- if (!item->dynamicbox.initialize) {
- ErrPrint("symbol: dynamicbox_initialize - %s\n", dlerror());
- }
-
- item->dynamicbox.finalize = (finalize_t)dlsym(item->handle, "dynamicbox_finalize");
- if (!item->dynamicbox.finalize) {
- ErrPrint("symbol: dynamicbox_finalize - %s\n", dlerror());
- }
-
- item->dynamicbox.need_to_destroy = (need_to_destroy_t)dlsym(item->handle, "dynamicbox_need_to_destroy");
- if (!item->dynamicbox.need_to_destroy) {
- ErrPrint("symbol: dynamicbox_need_to_destroy - %s\n", dlerror());
- }
-
- item->dynamicbox.sys_event = (system_event_t)dlsym(item->handle, "dynamicbox_system_event");
- if (!item->dynamicbox.sys_event) {
- ErrPrint("symbol: dynamicbox_system_event - %s\n", dlerror());
- }
-
- item->dynamicbox.is_pinned_up = (is_pinned_up_t)dlsym(item->handle, "dynamicbox_is_pinned_up");
- if (!item->dynamicbox.is_pinned_up) {
- ErrPrint("symbol: dynamicbox_is_pinned_up - %s\n", dlerror());
- }
-
- item->dynamicbox.get_alt_info = (get_alt_info_t)dlsym(item->handle, "dynamicbox_get_alt_info");
- if (!item->dynamicbox.get_alt_info) {
- ErrPrint("symbol: dynamicbox_get_alt_info - %s\n", dlerror());
- }
-
- item->dynamicbox.set_content_info = (set_content_info_t)dlsym(item->handle, "dynamicbox_set_content_info");
- if (!item->dynamicbox.set_content_info) {
- ErrPrint("symbol: dynamicbox_set_content_info - %s\n", dlerror());
- }
-
- main_heap_monitor_add_target(item->so_fname);
-
- if (item->dynamicbox.initialize) {
- int ret;
- fault_mark_call(pkgname, "initialize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+ item->dynamicbox.destroy = (destroy_t)dlsym(item->handle, "dynamicbox_destroy");
+ if (!item->dynamicbox.destroy) {
+ ErrPrint("symbol: dynamicbox_destroy - %s\n", dlerror());
+ delete_dynamicbox(item);
+ return NULL;
+ }
+
+ item->dynamicbox.pinup = (pinup_t)dlsym(item->handle, "dynamicbox_pinup");
+ if (!item->dynamicbox.pinup) {
+ ErrPrint("symbol: dynamicbox_pinup - %s\n", dlerror());
+ }
+
+ item->dynamicbox.is_updated = (is_updated_t)dlsym(item->handle, "dynamicbox_need_to_update");
+ if (!item->dynamicbox.is_updated) {
+ ErrPrint("symbol: dynamicbox_need_to_update - %s\n", dlerror());
+ }
+
+ item->dynamicbox.update_content = (update_content_t)dlsym(item->handle, "dynamicbox_update_content");
+ if (!item->dynamicbox.update_content) {
+ ErrPrint("symbol: dynamicbox_update_content - %s\n", dlerror());
+ }
+
+ item->dynamicbox.clicked = (clicked_t)dlsym(item->handle, "dynamicbox_clicked");
+ if (!item->dynamicbox.clicked) {
+ ErrPrint("symbol: dynamicbox_clicked - %s\n", dlerror());
+ }
+
+ item->dynamicbox.script_event = (script_t)dlsym(item->handle, "dynamicbox_content_event");
+ if (!item->dynamicbox.script_event) {
+ ErrPrint("symbol: dynamicbox_content_event - %s\n", dlerror());
+ }
+
+ item->dynamicbox.resize = (resize_t)dlsym(item->handle, "dynamicbox_resize");
+ if (!item->dynamicbox.resize) {
+ ErrPrint("symbol: dynamicbox_resize - %s\n", dlerror());
+ }
+
+ item->dynamicbox.create_needed = (create_needed_t)dlsym(item->handle, "dynamicbox_need_to_create");
+ if (!item->dynamicbox.create_needed) {
+ ErrPrint("symbol: dynamicbox_need_to_create - %s\n", dlerror());
+ }
+
+ item->dynamicbox.change_group = (change_group_t)dlsym(item->handle, "dynamicbox_change_group");
+ if (!item->dynamicbox.change_group) {
+ ErrPrint("symbol: dynamicbox_change_group - %s\n", dlerror());
+ }
+
+ item->dynamicbox.get_output_info = (get_output_info_t)dlsym(item->handle, "dynamicbox_get_info");
+ if (!item->dynamicbox.get_output_info) {
+ ErrPrint("symbol: dynamicbox_get_info - %s\n", dlerror());
+ }
+
+ item->dynamicbox.initialize = (initialize_t)dlsym(item->handle, "dynamicbox_initialize");
+ if (!item->dynamicbox.initialize) {
+ ErrPrint("symbol: dynamicbox_initialize - %s\n", dlerror());
+ }
+
+ item->dynamicbox.finalize = (finalize_t)dlsym(item->handle, "dynamicbox_finalize");
+ if (!item->dynamicbox.finalize) {
+ ErrPrint("symbol: dynamicbox_finalize - %s\n", dlerror());
+ }
+
+ item->dynamicbox.need_to_destroy = (need_to_destroy_t)dlsym(item->handle, "dynamicbox_need_to_destroy");
+ if (!item->dynamicbox.need_to_destroy) {
+ ErrPrint("symbol: dynamicbox_need_to_destroy - %s\n", dlerror());
+ }
+
+ item->dynamicbox.sys_event = (system_event_t)dlsym(item->handle, "dynamicbox_system_event");
+ if (!item->dynamicbox.sys_event) {
+ ErrPrint("symbol: dynamicbox_system_event - %s\n", dlerror());
+ }
+
+ item->dynamicbox.is_pinned_up = (is_pinned_up_t)dlsym(item->handle, "dynamicbox_is_pinned_up");
+ if (!item->dynamicbox.is_pinned_up) {
+ ErrPrint("symbol: dynamicbox_is_pinned_up - %s\n", dlerror());
+ }
+
+ item->dynamicbox.get_alt_info = (get_alt_info_t)dlsym(item->handle, "dynamicbox_get_alt_info");
+ if (!item->dynamicbox.get_alt_info) {
+ ErrPrint("symbol: dynamicbox_get_alt_info - %s\n", dlerror());
+ }
+
+ item->dynamicbox.set_content_info = (set_content_info_t)dlsym(item->handle, "dynamicbox_set_content_info");
+ if (!item->dynamicbox.set_content_info) {
+ ErrPrint("symbol: dynamicbox_set_content_info - %s\n", dlerror());
+ }
+
+ main_heap_monitor_add_target(item->so_fname);
+
+ if (item->dynamicbox.initialize) {
+ int ret;
+ fault_mark_call(pkgname, "initialize", __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
- ret = item->dynamicbox.initialize(pkgname);
+ ret = item->dynamicbox.initialize(pkgname);
- fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM);
- if (ret < 0) {
- ErrPrint("Failed to initialize package %s\n", pkgname);
- delete_dynamicbox(item);
- return NULL;
- }
+ fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM);
+ if (ret < 0) {
+ ErrPrint("Failed to initialize package %s\n", pkgname);
+ delete_dynamicbox(item);
+ return NULL;
}
+ }
- s_info.dynamicbox_list = eina_list_append(s_info.dynamicbox_list, item);
- return item;
+ s_info.dynamicbox_list = eina_list_append(s_info.dynamicbox_list, item);
+ return item;
}
static inline struct instance *new_instance(const char *id, const char *content, const char *cluster, const char *category)
{
- struct instance *inst;
-
- inst = calloc(1, sizeof(*inst));
- if (!inst) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return NULL;
- }
-
- inst->id = strdup(id);
- if (!inst->id) {
- ErrPrint("Heap: %s\n", strerror(errno));
- free(inst);
- return NULL;
- }
-
- DbgPrint("Default content: [%s]\n", content);
- if (content) {
- inst->content = strdup(content);
- if (!inst->content) {
- ErrPrint("memory: %s\n", strerror(errno));
- free(inst->id);
- free(inst);
- return NULL;
- }
- }
-
- if (cluster) {
- inst->cluster = strdup(cluster);
- if (!inst->cluster) {
- ErrPrint("memory: %s\n", strerror(errno));
- free(inst->id);
- free(inst->content);
- free(inst);
- return NULL;
- }
- }
+ struct instance *inst;
- if (category) {
- inst->category = strdup(category);
- if (!inst->category) {
- ErrPrint("memory: %s\n", strerror(errno));
- free(inst->cluster);
- free(inst->id);
- free(inst->content);
- free(inst);
- return NULL;
- }
- }
+ inst = calloc(1, sizeof(*inst));
+ if (!inst) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return NULL;
+ }
- return inst;
+ inst->id = strdup(id);
+ if (!inst->id) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ free(inst);
+ return NULL;
+ }
+
+ DbgPrint("Default content: [%s]\n", content);
+ if (content) {
+ inst->content = strdup(content);
+ if (!inst->content) {
+ ErrPrint("memory: %s\n", strerror(errno));
+ free(inst->id);
+ free(inst);
+ return NULL;
+ }
+ }
+
+ if (cluster) {
+ inst->cluster = strdup(cluster);
+ if (!inst->cluster) {
+ ErrPrint("memory: %s\n", strerror(errno));
+ free(inst->id);
+ free(inst->content);
+ free(inst);
+ return NULL;
+ }
+ }
+
+ if (category) {
+ inst->category = strdup(category);
+ if (!inst->category) {
+ ErrPrint("memory: %s\n", strerror(errno));
+ free(inst->cluster);
+ free(inst->id);
+ free(inst->content);
+ free(inst);
+ return NULL;
+ }
+ }
+
+ return inst;
}
static inline int delete_instance(struct instance *inst)
{
- free(inst->icon);
- free(inst->name);
- free(inst->cluster);
- free(inst->category);
- free(inst->id);
- free(inst->content);
- free(inst->title);
- free(inst);
- return DBOX_STATUS_ERROR_NONE;
+ free(inst->icon);
+ free(inst->name);
+ free(inst->cluster);
+ free(inst->category);
+ free(inst->id);
+ free(inst->content);
+ free(inst->title);
+ free(inst);
+ return DBOX_STATUS_ERROR_NONE;
}
static inline struct instance *find_instance(struct so_item *item, const char *id)
{
- struct instance *inst;
- Eina_List *l;
+ struct instance *inst;
+ Eina_List *l;
- EINA_LIST_FOREACH(item->inst_list, l, inst) {
- if (!strcmp(inst->id, id)) {
- return inst;
- }
+ EINA_LIST_FOREACH(item->inst_list, l, inst) {
+ if (!strcmp(inst->id, id)) {
+ return inst;
}
+ }
- return NULL;
+ return NULL;
}
HAPI struct instance *so_find_instance(const char *pkgname, const char *id)
{
- struct so_item *item;
+ struct so_item *item;
- item = find_dynamicbox(pkgname);
- if (!item) {
- return NULL;
- }
+ item = find_dynamicbox(pkgname);
+ if (!item) {
+ return NULL;
+ }
- return find_instance(item, id);
+ return find_instance(item, id);
}
HAPI int so_create(const char *pkgname, const char *id, const char *content_info, int timeout, int has_dynamicbox_script, const char *cluster, const char *category, const char *abi, struct instance **out)
{
- struct so_item *item;
- struct instance *inst;
- int ret;
-
- item = find_dynamicbox(pkgname);
- if (item) {
- inst = find_instance(item, id);
- if (inst) {
- ErrPrint("Instance: %s - %s is already exists\n", pkgname, id);
- return DBOX_STATUS_ERROR_EXIST;
- }
+ struct so_item *item;
+ struct instance *inst;
+ int ret;
+
+ item = find_dynamicbox(pkgname);
+ if (item) {
+ inst = find_instance(item, id);
+ if (inst) {
+ ErrPrint("Instance: %s - %s is already exists\n", pkgname, id);
+ return DBOX_STATUS_ERROR_EXIST;
+ }
+ } else {
+ if (!strcasecmp(abi, "c")) {
+ item = new_dynamicbox(pkgname);
} else {
- if (!strcasecmp(abi, "c")) {
- item = new_dynamicbox(pkgname);
- } else {
- item = new_adaptor(pkgname, abi);
- }
-
- if (!item) {
- return DBOX_STATUS_ERROR_FAULT;
- }
+ item = new_adaptor(pkgname, abi);
}
- inst = new_instance(id, content_info, cluster, category);
- if (!inst) {
- if (!item->inst_list) {
- delete_dynamicbox(item);
- }
+ if (!item) {
+ return DBOX_STATUS_ERROR_FAULT;
+ }
+ }
- return DBOX_STATUS_ERROR_FAULT;
+ inst = new_instance(id, content_info, cluster, category);
+ if (!inst) {
+ if (!item->inst_list) {
+ delete_dynamicbox(item);
}
- item->inst_list = eina_list_append(item->inst_list, inst);
- item->has_dynamicbox_script = has_dynamicbox_script;
- item->timeout = timeout;
+ return DBOX_STATUS_ERROR_FAULT;
+ }
- fault_mark_call(pkgname, id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+ item->inst_list = eina_list_append(item->inst_list, inst);
+ item->has_dynamicbox_script = has_dynamicbox_script;
+ item->timeout = timeout;
- s_info.current_op = DBOX_OP_CREATE;
- if (item->adaptor.create) {
- ret = item->adaptor.create(pkgname, util_uri_to_path(id), content_info, cluster, category);
- } else if (item->dynamicbox.create) {
- ret = item->dynamicbox.create(util_uri_to_path(id), content_info, cluster, category);
- } else { /*! \NOTE: This is not possible, but for the exceptional handling */
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
+ fault_mark_call(pkgname, id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
- fault_unmark_call(pkgname, id, __func__, USE_ALARM);
+ s_info.current_op = DBOX_OP_CREATE;
+ if (item->adaptor.create) {
+ ret = item->adaptor.create(pkgname, util_uri_to_path(id), content_info, cluster, category);
+ } else if (item->dynamicbox.create) {
+ ret = item->dynamicbox.create(util_uri_to_path(id), content_info, cluster, category);
+ } else { /*! \NOTE: This is not possible, but for the exceptional handling */
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
- if (ret < 0) {
- item->inst_list = eina_list_remove(item->inst_list, inst);
- delete_instance(inst);
-
- if (!item->inst_list) {
- /* There is no instances, unload this dynamicbox */
- delete_dynamicbox(item);
- }
- return ret;
- }
+ fault_unmark_call(pkgname, id, __func__, USE_ALARM);
- inst->item = item;
- *out = inst;
+ if (ret < 0) {
+ item->inst_list = eina_list_remove(item->inst_list, inst);
+ delete_instance(inst);
+
+ if (!item->inst_list) {
+ /* There is no instances, unload this dynamicbox */
+ delete_dynamicbox(item);
+ }
return ret;
+ }
+
+ inst->item = item;
+ *out = inst;
+ return ret;
}
HAPI int so_destroy(struct instance *inst, int unload)
{
- struct so_item *item;
- int ret;
+ struct so_item *item;
+ int ret;
- item = inst->item;
- if (!item) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ item = inst->item;
+ if (!item) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
- s_info.current_op = DBOX_OP_DESTROY;
- if (item->adaptor.destroy) {
- ret = item->adaptor.destroy(item->pkgname, util_uri_to_path(inst->id));
- } else if (item->dynamicbox.destroy) {
- ret = item->dynamicbox.destroy(util_uri_to_path(inst->id));
- } else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
+ s_info.current_op = DBOX_OP_DESTROY;
+ if (item->adaptor.destroy) {
+ ret = item->adaptor.destroy(item->pkgname, util_uri_to_path(inst->id));
+ } else if (item->dynamicbox.destroy) {
+ ret = item->dynamicbox.destroy(util_uri_to_path(inst->id));
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
- item->inst_list = eina_list_remove(item->inst_list, inst);
- delete_instance(inst);
+ item->inst_list = eina_list_remove(item->inst_list, inst);
+ delete_instance(inst);
- if (unload && !item->inst_list) {
- delete_dynamicbox(item);
- }
+ if (unload && !item->inst_list) {
+ delete_dynamicbox(item);
+ }
- return ret;
+ return ret;
}
HAPI char *so_pinup(struct instance *inst, int pinup)
{
- struct so_item *item;
- char *ret;
-
- item = inst->item;
- if (!item) {
- return NULL;
- }
+ struct so_item *item;
+ char *ret;
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-
- s_info.current_op = DBOX_OP_PINUP;
- if (item->adaptor.pinup) {
- ret = item->adaptor.pinup(item->pkgname, util_uri_to_path(inst->id), pinup);
- } else if (item->dynamicbox.pinup) {
- ret = item->dynamicbox.pinup(util_uri_to_path(inst->id), pinup);
- } else {
- ret = NULL;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
-
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
- return ret;
+ item = inst->item;
+ if (!item) {
+ return NULL;
+ }
+
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+ s_info.current_op = DBOX_OP_PINUP;
+ if (item->adaptor.pinup) {
+ ret = item->adaptor.pinup(item->pkgname, util_uri_to_path(inst->id), pinup);
+ } else if (item->dynamicbox.pinup) {
+ ret = item->dynamicbox.pinup(util_uri_to_path(inst->id), pinup);
+ } else {
+ ret = NULL;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
+
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+ return ret;
}
HAPI int so_is_pinned_up(struct instance *inst)
{
- struct so_item *item;
- int ret;
-
- item = inst->item;
- if (!item) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-
- s_info.current_op = DBOX_OP_IS_PINNED_UP;
- if (item->adaptor.is_pinned_up) {
- ret = item->adaptor.is_pinned_up(item->pkgname, util_uri_to_path(inst->id));
- } else if (item->dynamicbox.is_pinned_up) {
- ret = item->dynamicbox.is_pinned_up(util_uri_to_path(inst->id));
- } else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
-
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
- return ret;
+ struct so_item *item;
+ int ret;
+
+ item = inst->item;
+ if (!item) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+ s_info.current_op = DBOX_OP_IS_PINNED_UP;
+ if (item->adaptor.is_pinned_up) {
+ ret = item->adaptor.is_pinned_up(item->pkgname, util_uri_to_path(inst->id));
+ } else if (item->dynamicbox.is_pinned_up) {
+ ret = item->dynamicbox.is_pinned_up(util_uri_to_path(inst->id));
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
+
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+ return ret;
}
HAPI int so_is_updated(struct instance *inst)
{
- struct so_item *item;
- int ret;
+ struct so_item *item;
+ int ret;
- item = inst->item;
- if (!item) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ item = inst->item;
+ if (!item) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
- s_info.current_op = DBOX_OP_NEED_TO_UPDATE;
- if (item->adaptor.is_updated) {
- ret = item->adaptor.is_updated(item->pkgname, util_uri_to_path(inst->id));
- } else if (item->dynamicbox.is_updated) {
- ret = item->dynamicbox.is_updated(util_uri_to_path(inst->id));
- } else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
+ s_info.current_op = DBOX_OP_NEED_TO_UPDATE;
+ if (item->adaptor.is_updated) {
+ ret = item->adaptor.is_updated(item->pkgname, util_uri_to_path(inst->id));
+ } else if (item->dynamicbox.is_updated) {
+ ret = item->dynamicbox.is_updated(util_uri_to_path(inst->id));
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
- return ret;
+ return ret;
}
HAPI int so_need_to_destroy(struct instance *inst)
{
- struct so_item *item;
- int ret;
+ struct so_item *item;
+ int ret;
- item = inst->item;
- if (!item) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ item = inst->item;
+ if (!item) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
- s_info.current_op = DBOX_OP_NEED_TO_DESTROY;
- if (item->adaptor.need_to_destroy) {
- ret = item->adaptor.need_to_destroy(item->pkgname, util_uri_to_path(inst->id));
- } else if (item->dynamicbox.need_to_destroy) {
- ret = item->dynamicbox.need_to_destroy(util_uri_to_path(inst->id));
- } else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
+ s_info.current_op = DBOX_OP_NEED_TO_DESTROY;
+ if (item->adaptor.need_to_destroy) {
+ ret = item->adaptor.need_to_destroy(item->pkgname, util_uri_to_path(inst->id));
+ } else if (item->dynamicbox.need_to_destroy) {
+ ret = item->dynamicbox.need_to_destroy(util_uri_to_path(inst->id));
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
- return ret;
+ return ret;
}
HAPI int so_update(struct instance *inst)
{
- struct so_item *item;
- int ret;
-
- item = inst->item;
- if (!item) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-
- s_info.current_op = DBOX_OP_UPDATE_CONTENT;
- if (item->adaptor.update_content) {
- ret = item->adaptor.update_content(item->pkgname, util_uri_to_path(inst->id));
- } else if (item->dynamicbox.update_content) {
- ret = item->dynamicbox.update_content(util_uri_to_path(inst->id));
- } else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
-
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
- return ret;
+ struct so_item *item;
+ int ret;
+
+ item = inst->item;
+ if (!item) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+ s_info.current_op = DBOX_OP_UPDATE_CONTENT;
+ if (item->adaptor.update_content) {
+ ret = item->adaptor.update_content(item->pkgname, util_uri_to_path(inst->id));
+ } else if (item->dynamicbox.update_content) {
+ ret = item->dynamicbox.update_content(util_uri_to_path(inst->id));
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
+
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+ return ret;
}
HAPI int so_clicked(struct instance *inst, const char *event, double timestamp, double x, double y)
{
- struct so_item *item;
- int ret;
+ struct so_item *item;
+ int ret;
- item = inst->item;
- if (!item) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ item = inst->item;
+ if (!item) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
- DbgPrint("PERF_DBOX\n");
+ DbgPrint("PERF_DBOX\n");
- s_info.current_op = DBOX_OP_CLICKED;
- if (item->adaptor.clicked) {
- ret = item->adaptor.clicked(item->pkgname, util_uri_to_path(inst->id), event, timestamp, x, y);
- } else if (item->dynamicbox.clicked) {
- ret = item->dynamicbox.clicked(util_uri_to_path(inst->id), event, timestamp, x, y);
- } else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
+ s_info.current_op = DBOX_OP_CLICKED;
+ if (item->adaptor.clicked) {
+ ret = item->adaptor.clicked(item->pkgname, util_uri_to_path(inst->id), event, timestamp, x, y);
+ } else if (item->dynamicbox.clicked) {
+ ret = item->dynamicbox.clicked(util_uri_to_path(inst->id), event, timestamp, x, y);
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
- return ret;
+ return ret;
}
HAPI int so_script_event(struct instance *inst, const char *emission, const char *source, dynamicbox_event_info_t event_info)
{
- struct so_item *item;
- int ret;
+ struct so_item *item;
+ int ret;
- item = inst->item;
- if (!item) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ item = inst->item;
+ if (!item) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
- s_info.current_op = DBOX_OP_CONTENT_EVENT;
- if (item->adaptor.script_event) {
- ret = item->adaptor.script_event(item->pkgname, util_uri_to_path(inst->id), emission, source, event_info);
- } else if (item->dynamicbox.script_event) {
- ret = item->dynamicbox.script_event(util_uri_to_path(inst->id), emission, source, event_info);
- } else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
+ s_info.current_op = DBOX_OP_CONTENT_EVENT;
+ if (item->adaptor.script_event) {
+ ret = item->adaptor.script_event(item->pkgname, util_uri_to_path(inst->id), emission, source, event_info);
+ } else if (item->dynamicbox.script_event) {
+ ret = item->dynamicbox.script_event(util_uri_to_path(inst->id), emission, source, event_info);
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
- return ret;
+ return ret;
}
HAPI int so_resize(struct instance *inst, int w, int h)
{
- struct so_item *item;
- int ret;
- int type;
-
- item = inst->item;
- if (!item) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- type = dynamicbox_service_size_type(w, h);
- if (type == DBOX_SIZE_TYPE_UNKNOWN) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-
- s_info.current_op = DBOX_OP_RESIZE;
- if (item->adaptor.resize) {
- ret = item->adaptor.resize(item->pkgname, util_uri_to_path(inst->id), type);
- } else if (item->dynamicbox.resize) {
- ret = item->dynamicbox.resize(util_uri_to_path(inst->id), type);
- } else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
-
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
-
- return ret;
+ struct so_item *item;
+ int ret;
+ int type;
+
+ item = inst->item;
+ if (!item) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ type = dynamicbox_service_size_type(w, h);
+ if (type == DBOX_SIZE_TYPE_UNKNOWN) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+ s_info.current_op = DBOX_OP_RESIZE;
+ if (item->adaptor.resize) {
+ ret = item->adaptor.resize(item->pkgname, util_uri_to_path(inst->id), type);
+ } else if (item->dynamicbox.resize) {
+ ret = item->dynamicbox.resize(util_uri_to_path(inst->id), type);
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
+
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+
+ return ret;
}
HAPI int so_set_content_info(struct instance *inst, const char *content_info)
{
- struct so_item *item;
- int ret;
-
- item = inst->item;
- if (!item) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
- s_info.current_op = DBOX_OP_SET_CONTENT_INFO;
- if (item->adaptor.set_content_info) {
- ret = item->adaptor.set_content_info(item->pkgname, util_uri_to_path(inst->id), content_info);
- } else if (item->dynamicbox.set_content_info) {
- ret = item->dynamicbox.set_content_info(util_uri_to_path(inst->id), content_info);
- } else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
-
- return ret;
+ struct so_item *item;
+ int ret;
+
+ item = inst->item;
+ if (!item) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+ s_info.current_op = DBOX_OP_SET_CONTENT_INFO;
+ if (item->adaptor.set_content_info) {
+ ret = item->adaptor.set_content_info(item->pkgname, util_uri_to_path(inst->id), content_info);
+ } else if (item->dynamicbox.set_content_info) {
+ ret = item->dynamicbox.set_content_info(util_uri_to_path(inst->id), content_info);
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+
+ return ret;
}
HAPI int so_create_needed(const char *pkgname, const char *cluster, const char *category, const char *abi)
{
- struct so_item *item;
- int ret;
-
- item = find_dynamicbox(pkgname);
- if (!item) {
- if (!strcasecmp(abi, "c")) {
- item = new_dynamicbox(pkgname);
- } else {
- item = new_adaptor(pkgname, abi);
- }
-
- if (!item) {
- return DBOX_STATUS_ERROR_FAULT;
- }
- }
-
- fault_mark_call(item->pkgname, __func__, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+ struct so_item *item;
+ int ret;
- s_info.current_op = DBOX_OP_NEED_TO_CREATE;
- if (item->adaptor.create_needed) {
- ret = item->adaptor.create_needed(pkgname, cluster, category);
- } else if (item->dynamicbox.create_needed) {
- ret = item->dynamicbox.create_needed(cluster, category);
+ item = find_dynamicbox(pkgname);
+ if (!item) {
+ if (!strcasecmp(abi, "c")) {
+ item = new_dynamicbox(pkgname);
} else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ item = new_adaptor(pkgname, abi);
}
- s_info.current_op = DBOX_OP_UNKNOWN;
-
- fault_unmark_call(item->pkgname, __func__, __func__, USE_ALARM);
-
- DbgPrint("[%s] returns %d\n", pkgname, ret);
- return ret;
-}
-HAPI int so_change_group(struct instance *inst, const char *cluster, const char *category)
-{
- struct so_item *item;
- int ret;
- char *tmp_cluster;
- char *tmp_category;
-
- item = inst->item;
if (!item) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return DBOX_STATUS_ERROR_FAULT;
}
+ }
- tmp_cluster = strdup(cluster);
- if (!tmp_cluster) {
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
+ fault_mark_call(item->pkgname, __func__, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
- tmp_category = strdup(category);
- if (!tmp_category) {
- free(tmp_cluster);
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
+ s_info.current_op = DBOX_OP_NEED_TO_CREATE;
+ if (item->adaptor.create_needed) {
+ ret = item->adaptor.create_needed(pkgname, cluster, category);
+ } else if (item->dynamicbox.create_needed) {
+ ret = item->dynamicbox.create_needed(cluster, category);
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+ fault_unmark_call(item->pkgname, __func__, __func__, USE_ALARM);
- s_info.current_op = DBOX_OP_CHANGE_GROUP;
- if (item->adaptor.change_group) {
- ret = item->adaptor.change_group(item->pkgname, util_uri_to_path(inst->id), cluster, category);
- } else if (item->dynamicbox.change_group) {
- ret = item->dynamicbox.change_group(util_uri_to_path(inst->id), cluster, category);
- } else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
+ DbgPrint("[%s] returns %d\n", pkgname, ret);
+ return ret;
+}
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
- if (ret >= 0) {
- free(inst->cluster);
- free(inst->category);
+HAPI int so_change_group(struct instance *inst, const char *cluster, const char *category)
+{
+ struct so_item *item;
+ int ret;
+ char *tmp_cluster;
+ char *tmp_category;
+
+ item = inst->item;
+ if (!item) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ tmp_cluster = strdup(cluster);
+ if (!tmp_cluster) {
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+
+ tmp_category = strdup(category);
+ if (!tmp_category) {
+ free(tmp_cluster);
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+ s_info.current_op = DBOX_OP_CHANGE_GROUP;
+ if (item->adaptor.change_group) {
+ ret = item->adaptor.change_group(item->pkgname, util_uri_to_path(inst->id), cluster, category);
+ } else if (item->dynamicbox.change_group) {
+ ret = item->dynamicbox.change_group(util_uri_to_path(inst->id), cluster, category);
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
+
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+ if (ret >= 0) {
+ free(inst->cluster);
+ free(inst->category);
- inst->cluster = tmp_cluster;
- inst->category = tmp_category;
- } else {
- free(tmp_cluster);
- free(tmp_category);
- }
+ inst->cluster = tmp_cluster;
+ inst->category = tmp_category;
+ } else {
+ free(tmp_cluster);
+ free(tmp_category);
+ }
- return ret;
+ return ret;
}
HAPI int so_get_alt_info(struct instance *inst, char **icon, char **name)
{
- struct so_item *item;
- int ret;
+ struct so_item *item;
+ int ret;
- item = inst->item;
- if (!item) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ item = inst->item;
+ if (!item) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- *icon = NULL;
- *name = NULL;
+ *icon = NULL;
+ *name = NULL;
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
- s_info.current_op = DBOX_OP_GET_ALT_INFO;
- if (item->adaptor.get_alt_info) {
- ret = item->adaptor.get_alt_info(item->pkgname, util_uri_to_path(inst->id), icon, name);
- } else if (item->dynamicbox.get_alt_info) {
- ret = item->dynamicbox.get_alt_info(util_uri_to_path(inst->id), icon, name);
- } else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
-
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
- if (ret >= 0) {
- if (*icon) {
- free(inst->icon);
- inst->icon = *icon;
- }
-
- if (*name) {
- free(inst->name);
- inst->name = *name;
- }
+ s_info.current_op = DBOX_OP_GET_ALT_INFO;
+ if (item->adaptor.get_alt_info) {
+ ret = item->adaptor.get_alt_info(item->pkgname, util_uri_to_path(inst->id), icon, name);
+ } else if (item->dynamicbox.get_alt_info) {
+ ret = item->dynamicbox.get_alt_info(util_uri_to_path(inst->id), icon, name);
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
+
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+ if (ret >= 0) {
+ if (*icon) {
+ free(inst->icon);
+ inst->icon = *icon;
}
- if (main_heap_monitor_is_enabled()) {
- DbgPrint("%s allocates %d bytes\n", item->pkgname, main_heap_monitor_target_usage(item->so_fname));
+ if (*name) {
+ free(inst->name);
+ inst->name = *name;
}
+ }
- return ret;
+ if (main_heap_monitor_is_enabled()) {
+ DbgPrint("%s allocates %d bytes\n", item->pkgname, main_heap_monitor_target_usage(item->so_fname));
+ }
+
+ return ret;
}
HAPI int so_get_output_info(struct instance *inst, int *w, int *h, double *priority, char **content, char **title)
{
- struct so_item *item;
- int ret;
+ struct so_item *item;
+ int ret;
+
+ item = inst->item;
+ if (!item) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ *content = NULL;
+ *title = NULL;
+
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+ s_info.current_op = DBOX_OP_GET_INFO;
+ if (item->adaptor.get_output_info) {
+ ret = item->adaptor.get_output_info(item->pkgname, util_uri_to_path(inst->id), w, h, priority, content, title);
+ } else if (item->dynamicbox.get_output_info) {
+ ret = item->dynamicbox.get_output_info(util_uri_to_path(inst->id), w, h, priority, content, title);
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
+
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+ if (ret >= 0) {
+ inst->w = *w;
+ inst->h = *h;
+ inst->priority = *priority;
+
+ /*!
+ * \todo
+ * Add "*content" "*title" address validation code.
+ * using mcheck?
+ */
- item = inst->item;
- if (!item) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ if (*content) {
+ free(inst->content);
+ inst->content = *content;
}
- *content = NULL;
- *title = NULL;
-
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-
- s_info.current_op = DBOX_OP_GET_INFO;
- if (item->adaptor.get_output_info) {
- ret = item->adaptor.get_output_info(item->pkgname, util_uri_to_path(inst->id), w, h, priority, content, title);
- } else if (item->dynamicbox.get_output_info) {
- ret = item->dynamicbox.get_output_info(util_uri_to_path(inst->id), w, h, priority, content, title);
- } else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
-
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
- if (ret >= 0) {
- inst->w = *w;
- inst->h = *h;
- inst->priority = *priority;
-
- /*!
- * \todo
- * Add "*content" "*title" address validation code.
- * using mcheck?
- */
-
- if (*content) {
- free(inst->content);
- inst->content = *content;
- }
-
- if (*title) {
- free(inst->title);
- inst->title = *title;
- }
+ if (*title) {
+ free(inst->title);
+ inst->title = *title;
}
+ }
- if (main_heap_monitor_is_enabled()) {
- DbgPrint("%s allocates %d bytes\n", item->pkgname, main_heap_monitor_target_usage(item->so_fname));
- }
+ if (main_heap_monitor_is_enabled()) {
+ DbgPrint("%s allocates %d bytes\n", item->pkgname, main_heap_monitor_target_usage(item->so_fname));
+ }
- return ret;
+ return ret;
}
HAPI int so_sys_event(struct instance *inst, int event)
{
- struct so_item *item;
- int ret;
-
- item = inst->item;
- if (!item) {
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
-
- fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
-
- s_info.current_op = DBOX_OP_SYSTEM_EVENT;
- if (item->adaptor.sys_event) {
- ret = item->adaptor.sys_event(item->pkgname, util_uri_to_path(inst->id), event);
- } else if (item->dynamicbox.sys_event) {
- ret = item->dynamicbox.sys_event(util_uri_to_path(inst->id), event);
- } else {
- ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
- }
- s_info.current_op = DBOX_OP_UNKNOWN;
-
- fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
- return ret;
+ struct so_item *item;
+ int ret;
+
+ item = inst->item;
+ if (!item) {
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
+
+ s_info.current_op = DBOX_OP_SYSTEM_EVENT;
+ if (item->adaptor.sys_event) {
+ ret = item->adaptor.sys_event(item->pkgname, util_uri_to_path(inst->id), event);
+ } else if (item->dynamicbox.sys_event) {
+ ret = item->dynamicbox.sys_event(util_uri_to_path(inst->id), event);
+ } else {
+ ret = DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ }
+ s_info.current_op = DBOX_OP_UNKNOWN;
+
+ fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
+ return ret;
}
HAPI enum current_operations so_current_op(void)
{
- return s_info.current_op;
+ return s_info.current_op;
}
/* End of a file */
int errno;
struct cb_item {
- char *filename;
- int (*cb)(const char *filename, void *data, int over);
- void *data;
- int deleted;
+ char *filename;
+ int (*cb)(const char *filename, void *data, int over);
+ void *data;
+ int deleted;
};
static struct info {
- int ifd;
- int iwd;
- Ecore_Fd_Handler *handler;
- Eina_List *update_list;
- Eina_List *delete_list;
- unsigned int update_list_in_use;
- unsigned int delete_list_in_use;
+ int ifd;
+ int iwd;
+ Ecore_Fd_Handler *handler;
+ Eina_List *update_list;
+ Eina_List *delete_list;
+ unsigned int update_list_in_use;
+ unsigned int delete_list_in_use;
} s_info = {
- .ifd = -EINVAL,
- .iwd = -EINVAL,
- .handler = NULL,
- .update_list = NULL,
- .delete_list = NULL,
- .update_list_in_use = 0,
- .delete_list_in_use = 0,
+ .ifd = -EINVAL,
+ .iwd = -EINVAL,
+ .handler = NULL,
+ .update_list = NULL,
+ .delete_list = NULL,
+ .update_list_in_use = 0,
+ .delete_list_in_use = 0,
};
static void *update_item_destroy(struct cb_item *item, Eina_List *l)
{
- void *data;
-
- if (s_info.update_list_in_use) {
- item->deleted = 1;
- data = item->data;
- } else {
- s_info.update_list = eina_list_remove_list(s_info.update_list, l);
- data = item->data;
- free(item->filename);
- free(item);
- }
-
- return data;
+ void *data;
+
+ if (s_info.update_list_in_use) {
+ item->deleted = 1;
+ data = item->data;
+ } else {
+ s_info.update_list = eina_list_remove_list(s_info.update_list, l);
+ data = item->data;
+ free(item->filename);
+ free(item);
+ }
+
+ return data;
}
static void *delete_item_destroy(struct cb_item *item, Eina_List *l)
{
- void *data;
-
- if (s_info.delete_list_in_use == 1) {
- item->deleted = 1;
- data = item->data;
- } else {
- s_info.delete_list = eina_list_remove_list(s_info.delete_list, l);
- data = item->data;
- free(item->filename);
- free(item);
- }
-
- return data;
+ void *data;
+
+ if (s_info.delete_list_in_use == 1) {
+ item->deleted = 1;
+ data = item->data;
+ } else {
+ s_info.delete_list = eina_list_remove_list(s_info.delete_list, l);
+ data = item->data;
+ free(item->filename);
+ free(item);
+ }
+
+ return data;
}
static Eina_Bool monitor_cb(void *data, Ecore_Fd_Handler *handler)
{
- int fd;
- int read_size;
- char *buffer;
- register int i;
- struct inotify_event *evt;
- char *filename;
- int len;
- int ret;
-
- fd = ecore_main_fd_handler_fd_get(handler);
- if (fd < 0) {
- ErrPrint("Failed to get file handler\n");
- return ECORE_CALLBACK_CANCEL;
- }
+ int fd;
+ int read_size;
+ char *buffer;
+ register int i;
+ struct inotify_event *evt;
+ char *filename;
+ int len;
+ int ret;
+
+ fd = ecore_main_fd_handler_fd_get(handler);
+ if (fd < 0) {
+ ErrPrint("Failed to get file handler\n");
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ if (ioctl(fd, FIONREAD, &read_size) < 0) {
+ ErrPrint("Failed to get q size (%s)\n", strerror(errno));
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ if (read_size <= 0) {
+ ErrPrint("Buffer is not ready!!!\n");
+ return ECORE_CALLBACK_RENEW;
+ }
- if (ioctl(fd, FIONREAD, &read_size) < 0) {
- ErrPrint("Failed to get q size (%s)\n", strerror(errno));
- return ECORE_CALLBACK_CANCEL;
- }
+ buffer = calloc(read_size+1, sizeof(char));
+ if (!buffer) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ return ECORE_CALLBACK_CANCEL;
+ }
- if (read_size <= 0) {
- ErrPrint("Buffer is not ready!!!\n");
- return ECORE_CALLBACK_RENEW;
+ if (read(fd, buffer, read_size) != read_size) {
+ ErrPrint("Could not get entire events (%s)\n", strerror(errno));
+ free(buffer);
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ i = 0;
+ while (i < read_size) {
+ evt = (struct inotify_event *)(buffer + i);
+ i += sizeof(*evt) + evt->len;
+
+ if (util_check_ext(evt->name, "gnp.") == 0
+ && util_check_ext(evt->name, "csed.") == 0)
+ {
+ continue;
}
- buffer = calloc(read_size+1, sizeof(char));
- if (!buffer) {
- ErrPrint("Error: %s\n", strerror(errno));
- return ECORE_CALLBACK_CANCEL;
+ len = strlen(evt->name) + strlen(DYNAMICBOX_CONF_IMAGE_PATH) + 1;
+ filename = malloc(len);
+ if (!filename) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ /* We met error, but keep going,
+ * and care the remained buffer.
+ */
+ continue;
}
- if (read(fd, buffer, read_size) != read_size) {
- ErrPrint("Could not get entire events (%s)\n", strerror(errno));
- free(buffer);
- return ECORE_CALLBACK_CANCEL;
+ ret = snprintf(filename, len, "%s%s", DYNAMICBOX_CONF_IMAGE_PATH, evt->name);
+ if (ret < 0) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ /* We met error, but keep goging.
+ * and care the remained buffer.
+ */
+ free(filename);
+ continue;
}
- i = 0;
- while (i < read_size) {
- evt = (struct inotify_event *)(buffer + i);
- i += sizeof(*evt) + evt->len;
-
- if (util_check_ext(evt->name, "gnp.") == 0
- && util_check_ext(evt->name, "csed.") == 0)
- {
- continue;
- }
-
- len = strlen(evt->name) + strlen(DYNAMICBOX_CONF_IMAGE_PATH) + 1;
- filename = malloc(len);
- if (!filename) {
- ErrPrint("Error: %s\n", strerror(errno));
- /* We met error, but keep going,
- * and care the remained buffer.
- */
- continue;
- }
-
- ret = snprintf(filename, len, "%s%s", DYNAMICBOX_CONF_IMAGE_PATH, evt->name);
- if (ret < 0) {
- ErrPrint("Error: %s\n", strerror(errno));
- /* We met error, but keep goging.
- * and care the remained buffer.
- */
- free(filename);
- continue;
- }
-
- if (evt->mask & (IN_DELETE | IN_MOVED_FROM)) {
- update_monitor_trigger_delete_cb(filename, !!(evt->mask & IN_Q_OVERFLOW));
- } else if (evt->mask & (IN_CLOSE_WRITE | IN_MOVED_TO)) {
- update_monitor_trigger_update_cb(filename, !!(evt->mask & IN_Q_OVERFLOW));
- }
-
- free(filename);
+ if (evt->mask & (IN_DELETE | IN_MOVED_FROM)) {
+ update_monitor_trigger_delete_cb(filename, !!(evt->mask & IN_Q_OVERFLOW));
+ } else if (evt->mask & (IN_CLOSE_WRITE | IN_MOVED_TO)) {
+ update_monitor_trigger_update_cb(filename, !!(evt->mask & IN_Q_OVERFLOW));
}
- free(buffer);
- return ECORE_CALLBACK_RENEW;
+ free(filename);
+ }
+
+ free(buffer);
+ return ECORE_CALLBACK_RENEW;
}
HAPI int update_monitor_init(void)
{
- DbgPrint("Shared folder: %s\n", DYNAMICBOX_CONF_IMAGE_PATH);
-
- s_info.ifd = inotify_init();
- if (s_info.ifd < 0) {
- ErrPrint("Error: %s\n", strerror(errno));
- return DBOX_STATUS_ERROR_IO_ERROR;
+ DbgPrint("Shared folder: %s\n", DYNAMICBOX_CONF_IMAGE_PATH);
+
+ s_info.ifd = inotify_init();
+ if (s_info.ifd < 0) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_IO_ERROR;
+ }
+
+ if (access(DYNAMICBOX_CONF_IMAGE_PATH, R_OK | X_OK) != 0) {
+ ErrPrint("Image folder is not exists\n");
+ return DBOX_STATUS_ERROR_IO_ERROR;
+ }
+
+ s_info.iwd = inotify_add_watch(s_info.ifd, DYNAMICBOX_CONF_IMAGE_PATH,
+ IN_DELETE | IN_CLOSE_WRITE | IN_MOVED_TO | IN_MOVED_FROM);
+
+ if (s_info.iwd < 0) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ if (close(s_info.ifd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
}
-
- if (access(DYNAMICBOX_CONF_IMAGE_PATH, R_OK | X_OK) != 0) {
- ErrPrint("Image folder is not exists\n");
- return DBOX_STATUS_ERROR_IO_ERROR;
+ s_info.ifd = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return DBOX_STATUS_ERROR_IO_ERROR;
+ }
+
+ s_info.handler = ecore_main_fd_handler_add(s_info.ifd,
+ ECORE_FD_READ, monitor_cb, NULL, NULL, NULL);
+ if (!s_info.handler) {
+ ErrPrint("Failed to add a FD handler\n");
+ if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0) {
+ ErrPrint("inotify_rm_watch: %s", strerror(errno));
}
+ s_info.iwd = -EINVAL;
- s_info.iwd = inotify_add_watch(s_info.ifd, DYNAMICBOX_CONF_IMAGE_PATH,
- IN_DELETE | IN_CLOSE_WRITE | IN_MOVED_TO | IN_MOVED_FROM);
-
- if (s_info.iwd < 0) {
- ErrPrint("Error: %s\n", strerror(errno));
- if (close(s_info.ifd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
- }
- s_info.ifd = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- return DBOX_STATUS_ERROR_IO_ERROR;
+ if (close(s_info.ifd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
}
+ s_info.ifd = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ return DBOX_STATUS_ERROR_FAULT;
+ }
- s_info.handler = ecore_main_fd_handler_add(s_info.ifd,
- ECORE_FD_READ, monitor_cb, NULL, NULL, NULL);
- if (!s_info.handler) {
- ErrPrint("Failed to add a FD handler\n");
- if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0) {
- ErrPrint("inotify_rm_watch: %s", strerror(errno));
- }
- s_info.iwd = -EINVAL;
-
- if (close(s_info.ifd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
- }
- s_info.ifd = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- return DBOX_STATUS_ERROR_FAULT;
- }
-
- DbgPrint("Update monitor is successfully initialized\n");
- return DBOX_STATUS_ERROR_NONE;
+ DbgPrint("Update monitor is successfully initialized\n");
+ return DBOX_STATUS_ERROR_NONE;
}
HAPI int update_monitor_fini(void)
{
- if (!s_info.handler) {
- ErrPrint("Invalid fd handler\n");
- } else {
- ecore_main_fd_handler_del(s_info.handler);
- s_info.handler = NULL;
+ if (!s_info.handler) {
+ ErrPrint("Invalid fd handler\n");
+ } else {
+ ecore_main_fd_handler_del(s_info.handler);
+ s_info.handler = NULL;
+ }
+
+ if (s_info.ifd >= 0) {
+ if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0) {
+ ErrPrint("inotify_rm_watch:%s", strerror(errno));
}
- if (s_info.ifd >= 0) {
- if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0) {
- ErrPrint("inotify_rm_watch:%s", strerror(errno));
- }
-
- s_info.iwd = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ s_info.iwd = DBOX_STATUS_ERROR_INVALID_PARAMETER;
- if (close(s_info.ifd) < 0) {
- ErrPrint("close: %s\n", strerror(errno));
- }
- s_info.ifd = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ if (close(s_info.ifd) < 0) {
+ ErrPrint("close: %s\n", strerror(errno));
}
+ s_info.ifd = DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
HAPI int update_monitor_trigger_update_cb(const char *filename, int over)
{
- Eina_List *l;
- Eina_List *n;
- struct cb_item *item;
- int cnt = 0;
-
- s_info.update_list_in_use = 1;
- EINA_LIST_FOREACH_SAFE(s_info.update_list, l, n, item) {
- if (!strcmp(filename, item->filename)) {
- if (item->deleted || item->cb(filename, item->data, over) == EXIT_FAILURE || item->deleted) {
- /* Item can be deleted from the callback, so need to check existence */
- s_info.update_list = eina_list_remove_list(s_info.update_list, l);
- free(item->filename);
- free(item);
- }
- cnt++;
- }
+ Eina_List *l;
+ Eina_List *n;
+ struct cb_item *item;
+ int cnt = 0;
+
+ s_info.update_list_in_use = 1;
+ EINA_LIST_FOREACH_SAFE(s_info.update_list, l, n, item) {
+ if (!strcmp(filename, item->filename)) {
+ if (item->deleted || item->cb(filename, item->data, over) == EXIT_FAILURE || item->deleted) {
+ /* Item can be deleted from the callback, so need to check existence */
+ s_info.update_list = eina_list_remove_list(s_info.update_list, l);
+ free(item->filename);
+ free(item);
+ }
+ cnt++;
}
- s_info.update_list_in_use = 0;
+ }
+ s_info.update_list_in_use = 0;
- return cnt == 0 ? DBOX_STATUS_ERROR_INVALID_PARAMETER : DBOX_STATUS_ERROR_NONE;
+ return cnt == 0 ? DBOX_STATUS_ERROR_INVALID_PARAMETER : DBOX_STATUS_ERROR_NONE;
}
HAPI int update_monitor_trigger_delete_cb(const char *filename, int over)
{
- Eina_List *l;
- Eina_List *n;
- struct cb_item *item;
- int cnt = 0;
-
- s_info.delete_list_in_use = 1;
- EINA_LIST_FOREACH_SAFE(s_info.delete_list, l, n, item) {
- if (!strcmp(filename, item->filename)) {
- /* delete should be checked before call the callback & after call the callback */
- if (item->deleted || item->cb(filename, item->data, over) == EXIT_FAILURE || item->deleted) {
- s_info.delete_list = eina_list_remove_list(s_info.delete_list, l);
- free(item->filename);
- free(item);
- }
-
- cnt++;
- }
+ Eina_List *l;
+ Eina_List *n;
+ struct cb_item *item;
+ int cnt = 0;
+
+ s_info.delete_list_in_use = 1;
+ EINA_LIST_FOREACH_SAFE(s_info.delete_list, l, n, item) {
+ if (!strcmp(filename, item->filename)) {
+ /* delete should be checked before call the callback & after call the callback */
+ if (item->deleted || item->cb(filename, item->data, over) == EXIT_FAILURE || item->deleted) {
+ s_info.delete_list = eina_list_remove_list(s_info.delete_list, l);
+ free(item->filename);
+ free(item);
+ }
+
+ cnt++;
}
- s_info.delete_list_in_use = 0;
+ }
+ s_info.delete_list_in_use = 0;
- return cnt == 0 ? DBOX_STATUS_ERROR_INVALID_PARAMETER : DBOX_STATUS_ERROR_NONE;
+ return cnt == 0 ? DBOX_STATUS_ERROR_INVALID_PARAMETER : DBOX_STATUS_ERROR_NONE;
}
HAPI int update_monitor_add_update_cb(const char *filename,
- int (*cb)(const char *filename, void *data, int over), void *data)
+ int (*cb)(const char *filename, void *data, int over), void *data)
{
- struct cb_item *item;
-
- item = calloc(1, sizeof(*item));
- if (!item) {
- ErrPrint("calloc:%s\n", strerror(errno));
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
-
- item->filename = strdup(filename);
- if (!item->filename) {
- ErrPrint("Error: %s\n", strerror(errno));
- free(item);
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
- item->cb = cb;
- item->data = data;
-
- s_info.update_list = eina_list_append(s_info.update_list, item);
- return DBOX_STATUS_ERROR_NONE;
+ struct cb_item *item;
+
+ item = calloc(1, sizeof(*item));
+ if (!item) {
+ ErrPrint("calloc:%s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+
+ item->filename = strdup(filename);
+ if (!item->filename) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ free(item);
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+ item->cb = cb;
+ item->data = data;
+
+ s_info.update_list = eina_list_append(s_info.update_list, item);
+ return DBOX_STATUS_ERROR_NONE;
}
HAPI int update_monitor_add_delete_cb(const char *filename,
- int (*cb)(const char *filename, void *data, int over), void *data)
+ int (*cb)(const char *filename, void *data, int over), void *data)
{
- struct cb_item *item;
-
- item = calloc(1, sizeof(*item));
- if (!item) {
- ErrPrint("calloc:%s", strerror(errno));
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
-
- item->filename = strdup(filename);
- if (!item->filename) {
- ErrPrint("Error: %s\n", strerror(errno));
- free(item);
- return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
- }
-
- item->cb = cb;
- item->data = data;
-
- s_info.delete_list = eina_list_append(s_info.delete_list, item);
- return DBOX_STATUS_ERROR_NONE;
+ struct cb_item *item;
+
+ item = calloc(1, sizeof(*item));
+ if (!item) {
+ ErrPrint("calloc:%s", strerror(errno));
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+
+ item->filename = strdup(filename);
+ if (!item->filename) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ free(item);
+ return DBOX_STATUS_ERROR_OUT_OF_MEMORY;
+ }
+
+ item->cb = cb;
+ item->data = data;
+
+ s_info.delete_list = eina_list_append(s_info.delete_list, item);
+ return DBOX_STATUS_ERROR_NONE;
}
HAPI void *update_monitor_del_update_cb(const char *filename,
- int (*cb)(const char *filename, void *data, int over))
+ int (*cb)(const char *filename, void *data, int over))
{
- Eina_List *l;
- struct cb_item *item;
+ Eina_List *l;
+ struct cb_item *item;
- EINA_LIST_FOREACH(s_info.update_list, l, item) {
- if (item->cb == cb && !strcmp(item->filename, filename)) {
- return update_item_destroy(item, l);
- }
+ EINA_LIST_FOREACH(s_info.update_list, l, item) {
+ if (item->cb == cb && !strcmp(item->filename, filename)) {
+ return update_item_destroy(item, l);
}
+ }
- return NULL;
+ return NULL;
}
HAPI void *update_monitor_del_delete_cb(const char *filename,
- int (*cb)(const char *filename, void *data, int over))
+ int (*cb)(const char *filename, void *data, int over))
{
- Eina_List *l;
- struct cb_item *item;
+ Eina_List *l;
+ struct cb_item *item;
- EINA_LIST_FOREACH(s_info.delete_list, l, item) {
- if (item->cb == cb && !strcmp(item->filename, filename)) {
- return delete_item_destroy(item, l);
- }
+ EINA_LIST_FOREACH(s_info.delete_list, l, item) {
+ if (item->cb == cb && !strcmp(item->filename, filename)) {
+ return delete_item_destroy(item, l);
}
+ }
- return NULL;
+ return NULL;
}
/* End of a file */
HAPI int util_check_ext(const char *icon, const char *ext)
{
- int len;
+ int len;
- len = strlen(icon) - 1;
- while (len >= 0 && *ext && icon[len] == *ext) {
- len--;
- ext++;
- }
+ len = strlen(icon) - 1;
+ while (len >= 0 && *ext && icon[len] == *ext) {
+ len--;
+ ext++;
+ }
- return *ext ? 0 : 1;
+ return *ext ? 0 : 1;
}
HAPI int util_get_filesize(const char *filename)
{
- struct stat buf;
+ struct stat buf;
- if (stat(filename, &buf) < 0) {
- ErrPrint("error: %s\n", strerror(errno));
- return DBOX_STATUS_ERROR_IO_ERROR;
- }
+ if (stat(filename, &buf) < 0) {
+ ErrPrint("error: %s\n", strerror(errno));
+ return DBOX_STATUS_ERROR_IO_ERROR;
+ }
- if (!S_ISREG(buf.st_mode)) {
- ErrPrint("%s is not a file\n", filename);
- return DBOX_STATUS_ERROR_INVALID_PARAMETER;
- }
+ if (!S_ISREG(buf.st_mode)) {
+ ErrPrint("%s is not a file\n", filename);
+ return DBOX_STATUS_ERROR_INVALID_PARAMETER;
+ }
- return buf.st_size;
+ return buf.st_size;
}
HAPI double util_timestamp(void)
{
#if defined(_USE_ECORE_TIME_GET)
- return ecore_time_get();
+ return ecore_time_get();
#else
- struct timeval tv;
+ struct timeval tv;
- if (gettimeofday(&tv, NULL) < 0) {
- static unsigned long internal_count = 0;
+ if (gettimeofday(&tv, NULL) < 0) {
+ static unsigned long internal_count = 0;
- ErrPrint("gettimeofday: %s\n", strerror(errno));
- tv.tv_sec = internal_count++;
- tv.tv_usec = 0;
- }
+ ErrPrint("gettimeofday: %s\n", strerror(errno));
+ tv.tv_sec = internal_count++;
+ tv.tv_usec = 0;
+ }
- return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
+ return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f;
#endif
}
HAPI const char *util_basename(const char *name)
{
- int length;
+ int length;
- length = name ? strlen(name) : 0;
- if (!length) {
- return ".";
- }
+ length = name ? strlen(name) : 0;
+ if (!length) {
+ return ".";
+ }
- while (--length > 0 && name[length] != '/');
+ while (--length > 0 && name[length] != '/');
- return length <= 0 ? name : name + length + (name[length] == '/');
+ return length <= 0 ? name : name + length + (name[length] == '/');
}
/*!
*/
HAPI char *util_get_current_module(char **symbol)
{
- int *stack;
- Dl_info dinfo;
- char *ret;
- pthread_attr_t attr;
- unsigned int stack_boundary = 0;
- unsigned int stack_size = 0;
- register int i;
+ int *stack;
+ Dl_info dinfo;
+ char *ret;
+ pthread_attr_t attr;
+ unsigned int stack_boundary = 0;
+ unsigned int stack_size = 0;
+ register int i;
+
+ if (!pthread_getattr_np(pthread_self(), &attr)) {
+ if (!pthread_attr_getstack(&attr, (void *)&stack_boundary, &stack_size)) {
+ stack_boundary += stack_size;
+ }
+ pthread_attr_destroy(&attr);
+ }
- if (!pthread_getattr_np(pthread_self(), &attr)) {
- if (!pthread_attr_getstack(&attr, (void *)&stack_boundary, &stack_size)) {
- stack_boundary += stack_size;
- }
- pthread_attr_destroy(&attr);
+ ret = NULL;
+ for (i = 0, stack = (int *)&stack; (unsigned int)stack < stack_boundary ; stack++, i++) {
+ if (!dladdr((void *)*stack, &dinfo)) {
+ continue;
}
- ret = NULL;
- for (i = 0, stack = (int *)&stack; (unsigned int)stack < stack_boundary ; stack++, i++) {
- if (!dladdr((void *)*stack, &dinfo)) {
- continue;
- }
-
-
- ret = dynamicbox_service_dbox_id_by_libexec(dinfo.dli_fname);
- if (!ret) {
- DbgPrint("[%d] fname[%s] symbol[%s]\n", i, dinfo.dli_fname, dinfo.dli_sname);
- continue;
- }
-
- free(ret);
- ret = strdup(dinfo.dli_fname);
-
- if (symbol) {
- if (dinfo.dli_sname) {
- *symbol = strdup(dinfo.dli_sname);
- } else {
- *symbol = NULL;
- }
- }
- break;
+
+ ret = dynamicbox_service_dbox_id_by_libexec(dinfo.dli_fname);
+ if (!ret) {
+ DbgPrint("[%d] fname[%s] symbol[%s]\n", i, dinfo.dli_fname, dinfo.dli_sname);
+ continue;
+ }
+
+ free(ret);
+ ret = strdup(dinfo.dli_fname);
+
+ if (symbol) {
+ if (dinfo.dli_sname) {
+ *symbol = strdup(dinfo.dli_sname);
+ } else {
+ *symbol = NULL;
+ }
}
+ break;
+ }
- return ret;
+ return ret;
}
HAPI const char *util_uri_to_path(const char *uri)
{
- int len;
+ int len;
- len = strlen(SCHEMA_FILE);
- if (strncasecmp(uri, SCHEMA_FILE, len)) {
- return NULL;
- }
+ len = strlen(SCHEMA_FILE);
+ if (strncasecmp(uri, SCHEMA_FILE, len)) {
+ return NULL;
+ }
- return uri + len;
+ return uri + len;
}
HAPI double util_time_delay_for_compensation(double period)
{
- unsigned long long curtime;
- unsigned long long _period;
- unsigned long long remain;
- struct timeval tv;
- double ret;
-
- if (period == 0.0f) {
- DbgPrint("Period is ZERO\n");
- return 0.0f;
- }
-
- if (gettimeofday(&tv, NULL) < 0) {
- ErrPrint("gettimeofday: %s\n", strerror(errno));
- return period;
- }
-
- curtime = (unsigned long long)tv.tv_sec * 1000000llu + (unsigned long long)tv.tv_usec;
-
- _period = (unsigned long long)(period * (double)1000000);
- if (_period == 0llu) {
- ErrPrint("%lf <> %llu\n", period, _period);
- return period;
- }
-
- remain = curtime % _period;
-
- ret = (double)remain / (double)1000000;
- return period - ret;
+ unsigned long long curtime;
+ unsigned long long _period;
+ unsigned long long remain;
+ struct timeval tv;
+ double ret;
+
+ if (period == 0.0f) {
+ DbgPrint("Period is ZERO\n");
+ return 0.0f;
+ }
+
+ if (gettimeofday(&tv, NULL) < 0) {
+ ErrPrint("gettimeofday: %s\n", strerror(errno));
+ return period;
+ }
+
+ curtime = (unsigned long long)tv.tv_sec * 1000000llu + (unsigned long long)tv.tv_usec;
+
+ _period = (unsigned long long)(period * (double)1000000);
+ if (_period == 0llu) {
+ ErrPrint("%lf <> %llu\n", period, _period);
+ return period;
+ }
+
+ remain = curtime % _period;
+
+ ret = (double)remain / (double)1000000;
+ return period - ret;
}
HAPI void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void *data)
{
- Ecore_Timer *timer;
- double delay;
+ Ecore_Timer *timer;
+ double delay;
- timer = ecore_timer_add(interval, cb, data);
- if (!timer) {
- return NULL;
- }
+ timer = ecore_timer_add(interval, cb, data);
+ if (!timer) {
+ return NULL;
+ }
- delay = util_time_delay_for_compensation(interval) - interval;
- ecore_timer_delay(timer, delay);
+ delay = util_time_delay_for_compensation(interval) - interval;
+ ecore_timer_delay(timer, delay);
- return timer;
+ return timer;
}
HAPI void util_timer_interval_set(void *timer, double interval)
{
- double delay;
- ecore_timer_interval_set(timer, interval);
- ecore_timer_reset(timer);
+ double delay;
+ ecore_timer_interval_set(timer, interval);
+ ecore_timer_reset(timer);
- delay = util_time_delay_for_compensation(interval) - interval;
- ecore_timer_delay(timer, delay);
+ delay = util_time_delay_for_compensation(interval) - interval;
+ ecore_timer_delay(timer, delay);
}
static int dump_so_info_cb(struct dl_phdr_info *info, size_t size, void *data)
{
- if (data && info->dlpi_name && !strcmp(data, info->dlpi_name)) {
- register int i;
- ErrPrint("Base Address of %s [%p]\n", util_basename(info->dlpi_name), info->dlpi_addr);
- for (i = 0; i < info->dlpi_phnum; i++) {
- ErrPrint("type[%x] off[%x] vaddr[%lx] paddr[%lx] fsz[%x] msz[%x] f[%x] align[%x]\n",
- info->dlpi_phdr[i].p_type,
- info->dlpi_phdr[i].p_offset,
- info->dlpi_phdr[i].p_vaddr,
- info->dlpi_phdr[i].p_paddr,
- info->dlpi_phdr[i].p_filesz,
- info->dlpi_phdr[i].p_memsz,
- info->dlpi_phdr[i].p_flags,
- info->dlpi_phdr[i].p_align);
- }
+ if (data && info->dlpi_name && !strcmp(data, info->dlpi_name)) {
+ register int i;
+ ErrPrint("Base Address of %s [%p]\n", util_basename(info->dlpi_name), info->dlpi_addr);
+ for (i = 0; i < info->dlpi_phnum; i++) {
+ ErrPrint("type[%x] off[%x] vaddr[%lx] paddr[%lx] fsz[%x] msz[%x] f[%x] align[%x]\n",
+ info->dlpi_phdr[i].p_type,
+ info->dlpi_phdr[i].p_offset,
+ info->dlpi_phdr[i].p_vaddr,
+ info->dlpi_phdr[i].p_paddr,
+ info->dlpi_phdr[i].p_filesz,
+ info->dlpi_phdr[i].p_memsz,
+ info->dlpi_phdr[i].p_flags,
+ info->dlpi_phdr[i].p_align);
}
+ }
- return 0;
+ return 0;
}
HAPI void util_dump_current_so_info(const char *path)
{
- (void)dl_iterate_phdr(dump_so_info_cb, (void *)path);
+ (void)dl_iterate_phdr(dump_so_info_cb, (void *)path);
}
/* End of a file */
void *util_screen_get(void)
{
- return NULL;
+ return NULL;
}
int util_screen_size_get(int *width, int *height)
{
- *width = 0;
- *height = 0;
- return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
+ *width = 0;
+ *height = 0;
+ return DBOX_STATUS_ERROR_NOT_IMPLEMENTED;
}
int util_screen_init(void)
{
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
int util_screen_fini(void)
{
- return DBOX_STATUS_ERROR_NONE;
+ return DBOX_STATUS_ERROR_NONE;
}
/* End of a file */
void *util_screen_get(void)
{
- return ecore_x_display_get();
+ return ecore_x_display_get();
}
int util_screen_size_get(int *width, int *height)
{
- ecore_x_window_size_get(0, width, height);
- return DBOX_STATUS_ERROR_NONE;
+ ecore_x_window_size_get(0, width, height);
+ return DBOX_STATUS_ERROR_NONE;
}
int util_screen_init(void)
{
- return ecore_x_init(NULL);
+ return ecore_x_init(NULL);
}
int util_screen_fini(void)
{
- return ecore_x_shutdown();
+ return ecore_x_shutdown();
}
/* End of a file */