int on_boot_timeout;
guint on_boot_timer;
int sched_priority;
+ GList *condition_path_exists;
} candidate_process_context_t;
typedef struct {
static gboolean __on_boot_timeout_cb(gpointer user_data)
{
candidate_process_context_t *context = user_data;
+ const char *path;
+ GList *iter;
_W("type(%d), loader_name(%s)", context->type, context->loader_name);
context->on_boot_timer = 0;
context->type, context->loader_name,
context->pid);
} else {
+ iter = context->condition_path_exists;
+ while (iter != NULL) {
+ path = (char *)iter->data;
+ iter = g_list_next(iter);
+ if (access(path, F_OK) != 0) {
+ _D("%s does not exist", path);
+ context->on_boot_timer = g_timeout_add(100,
+ __on_boot_timeout_cb, context);
+ return G_SOURCE_REMOVE;
+ }
+
+ context->condition_path_exists = g_list_remove(
+ context->condition_path_exists, path);
+ }
+
__prepare_candidate_process(context->type, context->loader_id);
context->touched = true;
}
slot_info.app_check = true;
slot_info.on_boot_timeout = 0;
slot_info.sched_priority = 0;
+ slot_info.condition_path_exists = NULL;
cpc = __add_slot(&slot_info);
free(loader_name);
slot_info.app_check = true;
slot_info.on_boot_timeout = 0;
slot_info.sched_priority = 0;
+ slot_info.condition_path_exists = NULL;
cpc = __add_slot(&slot_info);
bundle_free_encoded_rawdata(&extra);
cpc->cpu_check_count = 0;
cpc->on_boot_timeout = info->on_boot_timeout;
cpc->sched_priority = info->sched_priority;
+ cpc->condition_path_exists = g_list_copy(info->condition_path_exists);
if ((cpc->deactivation_method & METHOD_OUT_OF_MEMORY) &&
__is_low_memory())
.app_check = info->app_check,
.on_boot_timeout = info->on_boot_timeout,
.sched_priority = info->sched_priority,
+ .condition_path_exists = info->condition_path_exists,
};
if (!strcmp(info->exe, "null")) {
#define TAG_APP_CHECK "APP_CHECK"
#define TAG_ON_BOOT_TIMEOUT "ON_BOOT_TIMEOUT"
#define TAG_SCHED_PRIORITY "SCHED_PRIORITY"
+#define TAG_CONDITION_PATH_EXISTS "CONDITION_PATH_EXISTS"
#define VAL_ON "ON"
#define VAL_OFF "OFF"
}
}
+static void __parse_condition_path_exists(loader_info_t *info, char *line)
+{
+ char *token;
+ char *savedptr;
+
+ token = strtok_r(line, " |\t\r\n", &savedptr);
+ while (token) {
+ info->condition_path_exists = g_list_append(
+ info->condition_path_exists, strdup(token));
+ token = strtok_r(NULL, " |\t\r\n", &savedptr);
+ }
+}
+
static void __parse_extra(loader_info_t *info, char *line)
{
char *tok1 = NULL;
cur_info->sched_priority = -20;
else if (cur_info->sched_priority > 19)
cur_info->sched_priority = 19;
+ } else if (strcasecmp(TAG_CONDITION_PATH_EXISTS, tok1) == 0) {
+ __parse_condition_path_exists(cur_info, buf);
}
}