guint source;
guint timer;
char *loader_path;
+ char *loader_extra;
} candidate_process_context_t;
typedef struct {
} loader_context_t;
static GList *candidate_slot_list;
-static candidate_process_context_t* __add_slot(int type, int loader_id, int caller_pid, const char *loader_path);
+static candidate_process_context_t* __add_slot(int type, int loader_id, int caller_pid, const char *loader_path, const char *extra);
static int __remove_slot(int type, int loader_id);
static int __add_default_slots();
int pid;
char type_str[2] = {0, };
char loader_id_str[10] = {0, };
- char *argv[] = {NULL, NULL, NULL, NULL};
+ char *argv[] = {NULL, NULL, NULL, NULL, NULL};
candidate_process_context_t* cpt = __find_slot(type, loader_id);
if (cpt == NULL)
argv[0] = cpt->loader_path;
argv[1] = type_str;
argv[2] = loader_id_str;
+ argv[3] = cpt->loader_extra;
if (execv(argv[0], argv) < 0)
_E("Failed to prepare candidate_process");
else
{
const char *add_slot_str = NULL;
const char *caller_pid = NULL;
+ const char *extra;
int lid;
_W("cmd add loader");
add_slot_str = bundle_get_val(kb, AUL_K_LOADER_PATH);
caller_pid = bundle_get_val(kb, AUL_K_CALLER_PID);
+ extra = bundle_get_val(kb, AUL_K_LOADER_EXTRA);
if (add_slot_str && caller_pid) {
lid = __make_loader_id();
- candidate_process_context_t *cpc = __add_slot(LAUNCHPAD_TYPE_DYNAMIC, lid, atoi(caller_pid), add_slot_str);
+ candidate_process_context_t *cpc = __add_slot(LAUNCHPAD_TYPE_DYNAMIC, lid, atoi(caller_pid), add_slot_str, extra);
if (cpc)
cpc->timer = g_timeout_add(2000, __handle_preparing_candidate_process, cpc);
return G_SOURCE_CONTINUE;
}
-static candidate_process_context_t* __add_slot(int type, int loader_id, int caller_pid, const char *loader_path)
+static candidate_process_context_t* __add_slot(int type, int loader_id, int caller_pid, const char *loader_path, const char *loader_extra)
{
candidate_process_context_t *cpc;
int fd = -1;
cpc->source = 0;
cpc->timer = 0;
cpc->loader_path = strdup(loader_path);
+ cpc->loader_extra = loader_extra ? strdup(loader_extra) : NULL;
fd = __listen_candidate_process(cpc->type, cpc->loader_id);
if (fd == -1) {
candidate_slot_list = g_list_remove_link(candidate_slot_list, iter);
free(cpc->loader_path);
+ if (cpc->loader_extra)
+ free(cpc->loader_extra);
+
free(cpc);
return 0;
}
static int __add_default_slots()
{
- if (__add_slot(LAUNCHPAD_TYPE_COMMON, PAD_LOADER_ID_STATIC, 0, LOADER_PATH_DEFAULT) == NULL)
+ if (__add_slot(LAUNCHPAD_TYPE_COMMON, PAD_LOADER_ID_STATIC, 0, LOADER_PATH_DEFAULT, NULL) == NULL)
return -1;
if (__prepare_candidate_process(LAUNCHPAD_TYPE_COMMON, PAD_LOADER_ID_STATIC) != 0)
return -1;
- if (__add_slot(LAUNCHPAD_TYPE_SW, PAD_LOADER_ID_STATIC, 0, LOADER_PATH_DEFAULT) == NULL)
+ if (__add_slot(LAUNCHPAD_TYPE_SW, PAD_LOADER_ID_STATIC, 0, LOADER_PATH_DEFAULT, NULL) == NULL)
return -1;
if (__prepare_candidate_process(LAUNCHPAD_TYPE_SW, PAD_LOADER_ID_STATIC) != 0)
return -1;
- if (__add_slot(LAUNCHPAD_TYPE_HW, PAD_LOADER_ID_STATIC, 0, LOADER_PATH_DEFAULT) == NULL)
+ if (__add_slot(LAUNCHPAD_TYPE_HW, PAD_LOADER_ID_STATIC, 0, LOADER_PATH_DEFAULT, NULL) == NULL)
return -1;
if (__prepare_candidate_process(LAUNCHPAD_TYPE_HW, PAD_LOADER_ID_STATIC) != 0)
return -1;
if (access(LOADER_PATH_WRT, F_OK | X_OK) == 0) {
- if (__add_slot(LAUNCHPAD_TYPE_WRT, PAD_LOADER_ID_STATIC, 0, LOADER_PATH_WRT) == NULL)
+ if (__add_slot(LAUNCHPAD_TYPE_WRT, PAD_LOADER_ID_STATIC, 0, LOADER_PATH_WRT, NULL) == NULL)
return -1;
if (__prepare_candidate_process(LAUNCHPAD_TYPE_WRT, PAD_LOADER_ID_STATIC) != 0)
return -1;
static void __at_exit_to_release_bundle()
{
- if (__bundle) {
+ if (__bundle)
bundle_free(__bundle);
- __bundle = NULL;
- }
}
static void __release_appid_at_exit(void)
if (menu_info != NULL)
_appinfo_free(menu_info);
+ if (__bundle) {
+ bundle_free(__bundle);
+ __bundle = NULL;
+ }
+
return ret;
}
{
int client_fd;
int ret = -1;
+ bundle *extra = NULL;
#ifdef _APPFW_FEATURE_LOADER_PRIORITY
char err_str[MAX_LOCAL_BUFSZ] = { 0, };
int res = setpriority(PRIO_PROCESS, 0, LOWEST_PRIO);
/* TODO : should be add to check permission in the kernel*/
setsid();
+ if (argc > 3)
+ extra = bundle_decode((const bundle_raw *)argv[3], strlen(argv[3]));
+
if (__loader_callbacks->create) {
- __loader_callbacks->create(argc, argv, __loader_type, __loader_user_data);
+ __loader_callbacks->create(extra, __loader_type, __loader_user_data);
ret = 0;
}
+ if (extra)
+ bundle_free(extra);
+
#ifdef _APPFW_FEATURE_LOADER_PRIORITY
res = setpriority(PRIO_PGRP, 0, 0);
if (res == -1)
static Ecore_Fd_Handler *__fd_handler;
static loader_receiver_cb __receiver;
+static int __argc;
+static char** __argv;
+
static void __init_window(void)
{
Evas_Object *win = elm_win_add(NULL, "package_name", ELM_WIN_BASIC);
free(theme);
}
-static void __loader_create_cb(int argc, char **argv, int type, void *user_data)
+static void __loader_create_cb(bundle *extra, int type, void *user_data)
{
int elm_init_cnt = 0;
- __preload_init(argc, argv);
+ __preload_init(__argc, __argv);
__preload_init_for_process_pool();
- elm_init_cnt = elm_init(g_argc, g_argv);
+ elm_init_cnt = elm_init(__argc, __argv);
_D("[candidate] elm init, returned: %d", elm_init_cnt);
switch (type) {
SECURE_LOGE("access() failed for file: \"%s\", error: %d (%s)",
argv[0], errno, strerror_r(errno, err_str, sizeof(err_str)));
else {
- SECURE_LOGD("[candidate] Exec application (%s)", g_argv[0]);
+ SECURE_LOGD("[candidate] Exec application (%s)", __argv[0]);
if (execv(argv[0], argv) < 0)
SECURE_LOGE("execv() failed for file: \"%s\", error: %d (%s)",
argv[0], errno, strerror_r(errno, err_str, sizeof(err_str)));
.remove_fd = __adapter_remove_fd
};
+ __argc = argc;
+ __argv = argv;
+
return launchpad_loader_main(argc, argv, &callbacks, &adapter, NULL);
}