ecore-x
ecore
provider
- heap-monitor
livebox-service
edje
evas
SET(PACKAGE "${PROJECT_NAME}")
SET(LOCALEDIR "/usr/apps/org.tizen.${PROJECT_NAME}/res/locale")
+SET(ICON_PROVIDER "icon-provider-slave")
+SET(EXE_LOADER "${PROJECT_NAME}")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
ADD_DEFINITIONS("-DPATH_MAX=256")
ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
ADD_DEFINITIONS("-DLOCALEDIR=\"${LOCALEDIR}\"")
-ADD_DEFINITIONS("-DEXEC_NAME=\"${PROJECT_NAME}\"")
+ADD_DEFINITIONS("-DEXEC_NAME=\"${PROJECT_NAME}.loader\"")
ADD_DEFINITIONS("-DMASTER_PKGNAME=\"data-provider-master\"")
ADD_DEFINITIONS("-DSLAVE_PKGNAME=\"org.tizen.data-provider-slave\"")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Winline -Werror -g -fno-builtin-malloc")
#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
-ADD_EXECUTABLE(${PROJECT_NAME}
+ADD_EXECUTABLE("${PROJECT_NAME}.loader"
src/main.c
src/so_handler.c
src/fault.c
src/client.c
src/critical_log.c
)
+TARGET_LINK_LIBRARIES("${PROJECT_NAME}.loader" ${pkg_LDFLAGS} "-ldl")
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkg_LDFLAGS} "-ldl")
-
-ADD_EXECUTABLE(icon-provider-slave
+ADD_EXECUTABLE(${ICON_PROVIDER}
icon_src/main.c
icon_src/script_handler.c
src/util.c
)
-TARGET_LINK_LIBRARIES("icon-provider-slave" ${pkg_LDFLAGS} "-ldl")
+TARGET_LINK_LIBRARIES(${ICON_PROVIDER} ${pkg_LDFLAGS} "-ldl")
+
+ADD_EXECUTABLE(${EXE_LOADER}
+ stub/main.c
+)
+TARGET_LINK_LIBRARIES(${EXE_LOADER} ${pkg_LDFLAGS} "-ldl")
#INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.data-provider-slave.desktop DESTINATION /usr/share/applications)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.data-provider-slave.xml DESTINATION /usr/share/packages)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "org.tizen.${PROJECT_NAME}")
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/apps/org.tizen.${PROJECT_NAME}/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+INSTALL(TARGETS "${PROJECT_NAME}.loader" DESTINATION /usr/apps/org.tizen.${PROJECT_NAME}/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.data-provider-slave.rule DESTINATION /etc/smack/accesses.d)
-INSTALL(TARGETS "icon-provider-slave" DESTINATION /usr/apps/org.tizen.${PROJECT_NAME}/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+INSTALL(TARGETS ${ICON_PROVIDER} DESTINATION /usr/apps/org.tizen.${PROJECT_NAME}/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+INSTALL(TARGETS ${EXE_LOADER} DESTINATION /usr/apps/org.tizen.${PROJECT_NAME}/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
# INCLUDE FOR BUILD & INSTALL .PO FILES
ADD_SUBDIRECTORY(res)
*/
extern int main_heap_monitor_is_enabled(void);
+extern size_t main_heap_monitor_target_usage(const char *name);
+extern int main_heap_monitor_add_target(const char *name);
+extern int main_heap_monitor_del_target(const char *name);
/* End of a file */
<!-- Executable file -->
<filesystem path="/usr/apps/org.tizen.data-provider-slave/bin/data-provider-slave" label="org.tizen.data-provider-slave" exec_label="org.tizen.data-provider-slave" />
+ <filesystem path="/usr/apps/org.tizen.data-provider-slave/bin/icon-provider-slave" label="org.tizen.data-provider-slave" exec_label="org.tizen.data-provider-slave" />
+ <filesystem path="/usr/apps/org.tizen.data-provider-slave/bin/data-provider-slave.loader" label="org.tizen.data-provider-slave" exec_label="org.tizen.data-provider-slave" />
<!-- For the package manager -->
<filesystem path="/usr/share/packages/org.tizen.data-provider-slave.xml" label="_" />
Name: org.tizen.data-provider-slave
Summary: Plugin type livebox service provider.
-Version: 0.12.9
+Version: 0.12.10
Release: 1
Group: HomeTF/Livebox
License: Flora License
.input = "/dev/input/event1",
},
- .ping_time = 240.0f,
+ .ping_time = 120.0f,
.slave_max_load = 30,
.use_sw_backend = 0,
if (so_current_op() != LIVEBOX_OP_UNKNOWN) {
ErrPrint("Current operation: %d\n", so_current_op());
- return LB_STATUS_ERROR_INVALID;
+ /*!
+ * \note
+ * Some case requires to update the content of other box from livebox_XXX ABI.
+ * In that case this function can be used so we have not to filter it from here.
+ * ex) Setting accessibility.
+ * Press the assistive light, turned on, need to update other instances too.
+ * Then the box will use this function from livebox_clicked function.
+ */
}
EINA_LIST_FOREACH(s_info.item_list, l, item) {
#include <string.h>
#include <malloc.h>
#include <mcheck.h>
+#include <dlfcn.h>
#include <Elementary.h>
#include <dlog.h>
#include <bundle.h>
-#include <heap-monitor.h>
#include <livebox-service.h>
#include <provider.h>
#include <vconf.h>
#endif
static struct info {
- int heap_monitor;
char *font_name;
int font_size;
+ int (*heap_monitor_initialized)(void);
+ size_t (*heap_monitor_target_usage)(const char *name);
+ int (*heap_monitor_add_target)(const char *name);
+ int (*heap_monitor_del_target)(const char *name);
+ void *heap_monitor;
} s_info = {
- .heap_monitor = 0,
.font_name = NULL,
.font_size = DEFAULT_FONT_SIZE,
+ .heap_monitor_initialized = NULL,
+ .heap_monitor_target_usage = NULL,
+ .heap_monitor_add_target = NULL,
+ .heap_monitor_del_target = NULL,
+ .heap_monitor = NULL,
};
static void update_font_cb(void *data)
return;
}
- if (!!strcasecmp(secured, "true")) {
- if (s_info.heap_monitor) {
- heap_monitor_start();
- /* Add GUARD */
- // heap_monitor_add_target("/usr/apps/org.tizen."EXEC_NAME"/bin/"EXEC_NAME);
- }
- } else {
+ if (!strcasecmp(secured, "true")) {
/* Don't use the update timer */
lb_turn_secured_on();
}
return;
}
-/* From GNU libc 2.14 this macro is defined, to declare
- hook variables as volatile. Define it as empty for
- older glibc versions */
-#ifndef __MALLOC_HOOK_VOLATILE
- #define __MALLOC_HOOK_VOLATILE
-#endif
-
-void (*__MALLOC_HOOK_VOLATILE __malloc_initialize_hook)(void) = heap_monitor_init;
-
#if defined(_ENABLE_MCHECK)
static inline void mcheck_cb(enum mcheck_status status)
{
app_event_callback_s event_callback;
const char *option;
+ memset(argv[0], 0, strlen(argv[0]));
+ strcpy(argv[0], "/usr/apps/org.tizen.data-provider-slave/bin/data-provider-slave");
+ DbgPrint("Replace argv[0] with %s\n", argv[0]);
+
#if defined(_ENABLE_MCHECK)
mcheck(mcheck_cb);
#endif
option = getenv("PROVIDER_HEAP_MONITOR_START");
if (option && !strcasecmp(option, "true")) {
- s_info.heap_monitor = 1;
+ s_info.heap_monitor = dlopen("/usr/lib/libheap-monitor.so", RTLD_NOW);
+ if (s_info.heap_monitor) {
+ s_info.heap_monitor_initialized = dlsym(s_info.heap_monitor, "heap_monitor_initialized");
+ s_info.heap_monitor_target_usage = dlsym(s_info.heap_monitor, "heap_monitor_target_usage");
+ s_info.heap_monitor_add_target = dlsym(s_info.heap_monitor, "heap_monitor_add_target");
+ s_info.heap_monitor_del_target = dlsym(s_info.heap_monitor, "heap_monitor_del_target");
+ }
}
setenv("BUFMGR_LOCK_TYPE", "once", 0);
event_callback.region_format_changed = app_region_changed;
ret = app_efl_main(&argc, &argv, &event_callback, NULL);
critical_log_fini();
+ ErrPrint("Failed to init: %d\n", ret);
+ if (s_info.heap_monitor) {
+ if (dlclose(s_info.heap_monitor) < 0) {
+ ErrPrint("dlclose: %s\n", strerror(errno));
+ }
+ }
return ret;
}
HAPI int main_heap_monitor_is_enabled(void)
{
- return s_info.heap_monitor;
+ 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;
+}
+
+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;
+}
+
+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;
}
/* End of a file */
#include <dlog.h>
#include <Eina.h>
#include <provider.h>
-#include <heap-monitor.h>
#include <livebox-service.h>
#include <livebox-errno.h>
ErrPrint("Package %s, finalize returns %d\n", item->pkgname, ret);
}
- heap_monitor_del_target(item->so_fname);
+ main_heap_monitor_del_target(item->so_fname);
if (dlclose(item->handle) != 0) {
ErrPrint("dlclose: %s\n", dlerror());
}
fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM);
if (ret < 0) {
ErrPrint("Failed to initialize package %s\n", pkgname);
- heap_monitor_del_target(item->so_fname);
+ main_heap_monitor_del_target(item->so_fname);
delete_livebox(item);
return NULL;
}
ErrPrint("symbol: livebox_is_pinned_up - %s\n", dlerror());
}
- heap_monitor_add_target(item->so_fname);
+ main_heap_monitor_add_target(item->so_fname);
if (item->livebox.initialize) {
int ret;
fault_unmark_call(pkgname, "initialize", __func__, USE_ALARM);
if (ret < 0) {
ErrPrint("Failed to initialize package %s\n", pkgname);
- heap_monitor_del_target(item->so_fname);
+ main_heap_monitor_del_target(item->so_fname);
delete_livebox(item);
return NULL;
}
}
if (main_heap_monitor_is_enabled()) {
- DbgPrint("%s allocates %d bytes\n", item->pkgname, heap_monitor_target_usage(item->so_fname));
+ DbgPrint("%s allocates %d bytes\n", item->pkgname, main_heap_monitor_target_usage(item->so_fname));
}
return ret;
--- /dev/null
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#include <dlog.h>
+#include <livebox-errno.h>
+
+#include "debug.h"
+#if defined(LOG_TAG)
+#undef LOG_TAG
+#define LOG_TAG "DATA_PROVIDER_SLAVE_LOADER"
+#endif
+
+int errno;
+
+/*!
+ * Defined for liblivebox
+ */
+const char *livebox_find_pkgname(const char *filename)
+{
+ return NULL;
+}
+
+int livebox_request_update_by_id(const char *filename)
+{
+ return LB_STATUS_ERROR_NOT_EXIST;
+}
+
+int livebox_trigger_update_monitor(const char *id, int is_pd)
+{
+ return LB_STATUS_ERROR_INVALID;
+}
+
+int main(int argc, char *argv[])
+{
+ int i;
+ char **_argv;
+ const char *option;
+
+ if (argc < 4) {
+ return -EINVAL;
+ }
+
+ _argv = malloc(sizeof(char *) * (argc+2));
+ if (!_argv) {
+ ErrPrint("%s\n", strerror(errno));
+ return -ENOMEM;
+ }
+
+ for (i = 1; i < argc; i++) {
+ _argv[i] = strdup(argv[i]);
+ }
+ _argv[i] = NULL;
+
+ _argv[0] = strdup("/usr/apps/org.tizen.data-provider-slave/bin/data-provider-slave.loader");
+ DbgPrint("Replace argv[0] with %s\n", _argv[0]);
+ for (i = 0; i < argc; i++) {
+ DbgPrint("argv[%d]: %s\n", i, _argv[i]);
+ }
+
+ option = getenv("PROVIDER_HEAP_MONITOR_START");
+ if (option && !strcasecmp(option, "true")) {
+ DbgPrint("Heap monitor is enabled\n");
+ setenv("LD_PRELOAD", "/usr/lib/libheap-monitor.so", 1);
+ }
+
+ execvp(_argv[0], _argv);
+ ErrPrint("%s\n", strerror(errno));
+ return 0;
+}
+
+/* End of a file */