const f_string_t controller_f_a[] = {
"controller_convert_group_id",
"controller_convert_user_id",
+ "controller_entry_setting_read_map",
"controller_file_load",
"controller_lock_create",
"controller_rule_copy",
"f_console_parameter_process",
"f_environment_get_all",
"f_file_exists",
+ "f_file_mode_to_mode",
"f_file_name_base",
"f_file_stat",
"f_file_stream_open",
enum {
controller_f_controller_convert_group_id_e,
controller_f_controller_convert_user_id_e,
+ controller_f_controller_entry_setting_read_map_e,
controller_f_controller_file_load_e,
controller_f_controller_lock_create_e,
controller_f_controller_rule_copy_e,
controller_f_f_console_parameter_process_e,
controller_f_f_environment_get_all_e,
controller_f_f_file_exists_e,
+ controller_f_f_file_mode_to_mode_e,
controller_f_f_file_name_base_e,
controller_f_f_file_stat_e,
controller_f_f_file_stream_open_e,
for (j = 2; j < cache->ats.used; j += 2) {
if (cache->ats.array[j] == i) {
- controller_print_error_entry_item_failure(&main->program.error, cache, entry->items.array[i].name, "cannot be executed because recursion is not allowed");
+ controller_print_error_entry_item_failure(&main->program.error, cache, is_entry, entry->items.array[i].name, "cannot be executed because recursion is not allowed");
if (F_status_is_error_not(status)) {
status = F_status_set_error(F_recurse);
if (error_has || i >= entry->items.used) {
if (i >= entry->items.used) {
- controller_print_error_entry_item_failure(&main->program.error, cache, actions->array[cache->ats.array[at_j]].parameters.array[0], "does not exist");
+ controller_print_error_entry_item_failure(&main->program.error, cache, is_entry, actions->array[cache->ats.array[at_j]].parameters.array[0], "does not exist");
if (F_status_is_error_not(status)) {
status = F_status_set_error(F_valid_not);
return status;
}
- // utilize the ats cache as an item execution stack (at_i is for item index, and at_j (at_i + 1) is for action index).
- cache->ats.array[0] = failsafe ? main->setting.failsafe_item_id : 0;
+ // Utilize the "ats" cache as an item execution stack (at_i is for item index, and at_j (at_i + 1) is for action index).
+ cache->ats.array[0] = failsafe ? main->process.failsafe_item_id : 0;
cache->ats.array[1] = 0;
cache->ats.used = 2;
}
if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.message.verbosity > f_console_verbosity_normal_e) {
- controller_print_message_entry_item_process(&main->program.message, is_entry, failsafe ? controller_print_entry_failsafe_s : f_string_empty_s, cache->action.name_item);
+ controller_print_message_entry_item_process(&main->program.message, is_entry, failsafe ? controller_failsafe_s : f_string_empty_s, cache->action.name_item);
}
// The pre-process determines if ready is explicitly specified within the entry file and if it is not start as ready.
}
}
else if (entry_action->type == controller_entry_action_type_item_e) {
- if (entry_action->number == 0 || entry_action->number >= entry->items.used || failsafe && entry_action->number == main->setting.failsafe_item_id) {
+ if (entry_action->number == 0 || entry_action->number >= entry->items.used || failsafe && entry_action->number == main->process.failsafe_item_id) {
// This should not happen if the pre-process is working as intended, but in case it doesn't, return a critical error to prevent infinite recursion and similar errors.
controller_print_error_entry_item_invalid(&main->program.error, cache, is_entry, entry_action->number);
status_lock = controller_lock_write(is_entry, &main->thread, &main->thread.lock.rule);
if (F_status_is_error(status_lock)) {
- controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_false, &main->thread);
+ controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
break;
}
- status = controller_rules_increase(&main->setting.rules);
+ status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_rule_t), (void **) &main->process.rules.array, &main->process.rules.used, &main->process.rules.size);
f_thread_unlock(&main->thread.lock.rule);
if (F_status_is_error(status)) {
- controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_rules_increase), F_true);
+ controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(f_memory_array_increase), F_true);
return status;
}
status_lock = controller_lock_read(is_entry, &main->thread, &main->thread.lock.rule);
if (F_status_is_error(status_lock)) {
- controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_true, &main->thread);
+ controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
break;
}
- status = controller_rule_find(alias_rule, main->setting.rules, 0);
+ status = controller_rule_find(alias_rule, main->process.rules, 0);
f_thread_unlock(&main->thread.lock.rule);
if ((main->setting.flag & controller_main_flag_simulate_e) || main->program.error.verbosity == f_console_verbosity_verbose_e || main->program.error.verbosity == f_console_verbosity_debug_e || (entry->show == controller_entry_show_init_e && entry_action->type != controller_entry_action_type_consider_e)) {
- controller_print_message_entry_item_rule(&main->program.message, entry, entry_action, is_entry);
+ controller_print_message_entry_item_rule(&main->program.message, entry, entry_action, is_entry, alias_rule);
}
if (!controller_thread_is_enabled(is_entry, &main->thread)) break;
status_lock = controller_lock_write(is_entry, &main->thread, &main->thread.lock.rule);
if (F_status_is_fine(status_lock)) {
- status = controller_rule_read(main, is_entry, alias_rule, cache, entry, &main->setting.rules.array[main->setting.rules.used]);
+ status = controller_rule_read(main, cache, is_entry, alias_rule, entry, &main->process.rules.array[main->process.rules.used]);
}
// Restore cache.
cache->action.line_item = cache_line_item;
if (F_status_is_error(status_lock)) {
- controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_false, &main->thread);
+ controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_false);
break;
}
if (main->program.error.verbosity > f_console_verbosity_quiet_e) {
controller_lock_print(main->program.error.to, &main->thread);
- controller_print_error_entry_cache(is_entry, &main->program.error, &cache->action);
+ controller_print_error_entry_cache(&main->program.error, &cache->action, is_entry);
controller_unlock_print_flush(main->program.error.to, &main->thread);
}
}
}
else {
- ++main->setting.rules.used;
+ ++main->process.rules.used;
}
f_thread_unlock(&main->thread.lock.rule);
options_instance |= controller_instance_option_asynchronous_e;
}
- status = controller_rule_process_begin(main, options_force, alias_rule, controller_entry_action_type_to_rule_action_type(entry_action->type), options_instance, is_entry ? controller_instance_type_entry_e : controller_instance_type_exit_e, stack, *cache);
-
- if (F_status_set_fine(status) == F_memory_not || status == F_child || F_status_set_fine(status) == F_interrupt) {
- break;
- }
+ status = controller_rule_instance_begin(main, cache, options_force, alias_rule, controller_entry_action_type_to_rule_action_type(entry_action->type), options_instance, is_entry ? controller_instance_type_entry_e : controller_instance_type_exit_e, stack);
+ if (F_status_set_fine(status) == F_memory_not || status == F_child || F_status_set_fine(status) == F_interrupt) break;
if (F_status_is_error(status) && !(main->setting.flag & controller_main_flag_simulate_e) && (entry_action->code & controller_entry_rule_code_require_d)) {
return F_status_set_error(F_require);
if (main->setting.flag & controller_main_flag_simulate_e) return F_execute;
- controller_thread_process_cancel(main, is_entry, is_entry ? controller_thread_cancel_execute_e : controller_thread_cancel_exit_execute_e);
+ controller_thread_instance_cancel(main, is_entry, is_entry ? controller_thread_cancel_execute_e : controller_thread_cancel_exit_execute_e);
int result = 0;
int option = FL_execute_parameter_option_path_d;
if (entry_action->code == controller_entry_timeout_code_exit_d) {
entry->timeout_exit = entry_action->number;
- controller_print_output_entry_setting_simulate_value(&main->program.output, is_entry, controller_timeout_s, controller_exit_s, entry->items.array[main->setting.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
+ controller_print_output_entry_setting_simulate_value(&main->program.output, is_entry, controller_timeout_s, controller_exit_s, entry->items.array[main->process.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
}
else if (entry_action->code == controller_entry_timeout_code_kill_d) {
entry->timeout_kill = entry_action->number;
- controller_print_output_entry_setting_simulate_value(&main->program.output, is_entry, controller_timeout_s, controller_kill_s, entry->items.array[main->setting.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
+ controller_print_output_entry_setting_simulate_value(&main->program.output, is_entry, controller_timeout_s, controller_kill_s, entry->items.array[main->process.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
}
else if (entry_action->code == controller_entry_timeout_code_start_d) {
entry->timeout_start = entry_action->number;
- controller_print_output_entry_setting_simulate_value(&main->program.output, is_entry, controller_timeout_s, controller_start_s, entry->items.array[main->setting.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
+ controller_print_output_entry_setting_simulate_value(&main->program.output, is_entry, controller_timeout_s, controller_start_s, entry->items.array[main->process.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
}
else if (entry_action->code == controller_entry_timeout_code_stop_d) {
entry->timeout_stop = entry_action->number;
- controller_print_output_entry_setting_simulate_value(&main->program.output, is_entry, controller_timeout_s, controller_stop_s, entry->items.array[main->setting.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
+ controller_print_output_entry_setting_simulate_value(&main->program.output, is_entry, controller_timeout_s, controller_stop_s, entry->items.array[main->process.failsafe_item_id].name, controller_print_entry_suffix_megatime_s);
}
}
else if (entry_action->type == controller_entry_action_type_failsafe_e) {
return F_status_is_error(F_critical);
}
else {
- main->setting.flag |= controller_setting_flag_failsafe_e;
- main->setting.failsafe_item_id = entry_action->number;
+ main->setting.flag |= controller_process_flag_failsafe_e;
+ main->process.failsafe_item_id = entry_action->number;
- controller_print_output_entry_setting_simulate_value(&main->program.output, is_entry, controller_failsafe_s, f_string_empty_s, entry->items.array[main->setting.failsafe_item_id].name, f_string_empty_s);
+ controller_print_output_entry_setting_simulate_value(&main->program.output, is_entry, controller_failsafe_s, f_string_empty_s, entry->items.array[main->process.failsafe_item_id].name, f_string_empty_s);
}
}
}
if (F_status_is_error(status_lock)) return status_lock;
// Check to see if any required processes failed, but do not do this if already operating in failsafe.
- if (F_status_is_error_not(status) && !failsafe && !(main->setting.flag & controller_main_flag_validate_e) && main->setting.mode != controller_process_mode_helper_e) {
+ if (F_status_is_error_not(status) && !failsafe && !(main->setting.flag & controller_main_flag_validate_e) && main->process.mode != controller_process_mode_helper_e) {
const f_status_t status_wait = controller_rule_wait_all(main, is_entry, F_true);
if (F_status_is_error(status_wait)) return status_wait;
if (status_wait == F_require) return F_status_set_error(F_require);
f_state_t state = macro_f_state_t_initialize_1(controller_allocation_large_d, controller_allocation_small_d, F_okay, 0, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
f_range_t range = content_range;
- fll_fss_extended_read(cache->buffer_file, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0, &state);
+ fll_fss_extended_read(main->thread.cache.buffer_file, &range, &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0, &state);
}
if (F_status_is_error(status)) {
f_number_unsigned_t i = 0;
- controller_entry_t * const entry = is_entry ? &main->setting.entry : &main->setting.exit;
+ controller_entry_t * const entry = is_entry ? &main->process.entry : &main->process.exit;
f_state_t state = f_state_t_initialize;
for (; i < cache->object_actions.used; ++i) {
if (is_entry && f_compare_dynamic(controller_control_s, cache->action.name_action) == F_equal_to) {
if (cache->content_actions.array[i].used < 1 || cache->content_actions.array[i].used > 2) {
- controller_entry_setting_read_print_setting_requires_between(main, is_entry, *cache, 1, 2);
+ controller_print_error_entry_setting_requires_between(&main->program.error, cache, is_entry, 1, 2);
continue;
}
}
cache->action.generic.used = 0;
- main->setting.path_control.used = 0;
+ main->process.path_control.used = 0;
status = f_rip_dynamic_partial_nulless(cache->buffer_file, cache->content_actions.array[i].array[0], &cache->action.generic);
break;
}
- main->setting.path_control.used = 0;
+ main->process.path_control.used = 0;
status = controller_path_canonical_relative(main, main->process.path_current, cache->action.generic, &main->process.path_control);
}
if (f_compare_dynamic_partial_string(controller_service_s.string, cache->buffer_file, controller_service_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) {
- main->setting.mode = controller_process_mode_service_e;
+ main->process.mode = controller_process_mode_service_e;
}
else if (f_compare_dynamic_partial_string(controller_helper_s.string, cache->buffer_file, controller_helper_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) {
- main->setting.mode = controller_process_mode_helper_e;
+ main->process.mode = controller_process_mode_helper_e;
}
else if (f_compare_dynamic_partial_string(controller_program_s.string, cache->buffer_file, controller_program_s.used, cache->content_actions.array[i].array[0]) == F_equal_to) {
- main->setting.mode = controller_process_mode_program_e;
+ main->process.mode = controller_process_mode_program_e;
}
else {
- controller_entry_setting_read_print_setting_unknown_action_value(main, is_entry, *cache, i);
+ controller_entry_setting_read_print_setting_unknown_action_value(main, cache, is_entry, cache->action.name_action, cache->content_actions.array[i].array[0]);
continue;
}
entry->pid = controller_entry_pid_require_e;
}
else {
- controller_entry_setting_read_print_setting_unknown_action_value(main, is_entry, *cache, i);
+ controller_print_warning_entry_setting_unknown_action_value(&main->program.warning, cache, is_entry, cache->action.name_action, cache->content_actions.array[i].array[0]);
continue;
}
continue;
}
- main->setting.path_pid.used = 0;
+ main->process.path_pid.used = 0;
- status = controller_path_canonical_relative(main, main->process.path_current, cache->action.generic, &main->setting.path_pid);
+ status = controller_path_canonical_relative(main, main->process.path_current, cache->action.generic, &main->process.path_pid);
if (F_status_is_error(status)) {
controller_print_error_entry(&main->program.error, is_entry, F_status_set_fine(status), macro_controller_f(controller_path_canonical_relative), F_true);
entry->session = controller_entry_session_same_e;
}
else {
- controller_entry_setting_read_print_setting_unknown_action_value(main, is_entry, *cache, i);
+ controller_print_warning_entry_setting_unknown_action_value(&main->program.warning, cache, is_entry, cache->action.name_action, cache->content_actions.array[i].array[0]);
continue;
}
entry->show = controller_entry_show_init_e;
}
else {
- controller_entry_setting_read_print_setting_unknown_action_value(main, is_entry, *cache, i);
+ controller_print_warning_entry_setting_unknown_action_value(&main->program.warning, cache, is_entry, cache->action.name_action, cache->content_actions.array[i].array[0]);
continue;
}
}
else if (f_compare_dynamic(controller_timeout_s, cache->action.name_action) == F_equal_to) {
if (cache->content_actions.array[i].used < 1 || cache->content_actions.array[i].used > 2) {
- controller_entry_setting_read_print_setting_requires_between(main, is_entry, *cache, 1, 2);
+ controller_print_error_entry_setting_requires_between(&main->program.error, cache, is_entry, 1, 2);
continue;
}
time = &entry->timeout_stop;
}
else {
- controller_entry_setting_read_print_setting_unknown_action_value(main, is_entry, *cache, i);
+ controller_print_warning_entry_setting_unknown_action_value(&main->program.warning, cache, is_entry, cache->action.name_action, cache->content_actions.array[i].array[0]);
continue;
}
f_string_static_t path = f_string_static_t_initialize;
- if (main->setting.path_setting.used) {
- path.used = main->setting.path_setting.used + F_path_separator_s_length + main->thread.cache.action.name_file.used;
+ if (main->process.path_setting.used) {
+ path.used = main->process.path_setting.used + F_path_separator_s_length + main->thread.cache.action.name_file.used;
}
else {
path.used = main->thread.cache.action.name_file.used;
f_char_t path_string[path.used + 1];
path.string = path_string;
- if (main->setting.path_setting.used) {
- memcpy(path_string, main->setting.path_setting.string, sizeof(f_char_t) * main->setting.path_setting.used);
- memcpy(path_string + main->setting.path_setting.used + F_path_separator_s_length, main->thread.cache.action.name_file.string, sizeof(f_char_t) * main->thread.cache.action.name_file.used);
+ if (main->process.path_setting.used) {
+ memcpy(path_string, main->process.path_setting.string, sizeof(f_char_t) * main->process.path_setting.used);
+ memcpy(path_string + main->process.path_setting.used + F_path_separator_s_length, main->thread.cache.action.name_file.string, sizeof(f_char_t) * main->thread.cache.action.name_file.used);
- path_string[main->setting.path_setting.used] = f_path_separator_s.string[0];
+ path_string[main->process.path_setting.used] = f_path_separator_s.string[0];
}
else {
memcpy(path_string, main->thread.cache.action.name_file.string, sizeof(f_char_t) * main->thread.cache.action.name_file.used);
f_status_t status = F_okay;
- if (main->setting.entry.pid != controller_entry_pid_disable_e && !main->setting.path_pid.used) {
- status = controller_file_pid_create(main->program.pid, main->setting.path_pid);
+ if (main->process.entry.pid != controller_entry_pid_disable_e && !main->process.path_pid.used) {
+ status = controller_file_pid_create(main->program.pid, main->process.path_pid);
// Report pid file error but because this could be an "init" program, consider the pid file as optional and continue on.
if (F_status_is_error(status)) {
status = F_okay;
}
else {
- main->setting.flag |= controller_setting_flag_pid_created_e;
+ main->setting.flag |= controller_process_flag_pid_created_e;
controller_print_debug_perform_pid_file_create_success(&main->program.debug);
}
}
// Disabled, all parts are not yet implemented.
- /*if (main->setting.path_control.used) {
+ /*if (main->process.path_control.used) {
status = controller_perform_ready_socket(main, is_entry);
// Do not fail on non-memory errors related to creating the control socket.
f_status_t status = F_okay;
if (main->process.control.flag & controller_control_flag_readonly_e) {
- if (f_file_exists(main->setting.path_control, F_true) != F_true) {
+ if (f_file_exists(main->process.path_control, F_true) != F_true) {
controller_print_debug_perform_control_socket_missing_read_only(&main->program.debug);
return F_data_not;
}
if (!(main->process.control.flag & controller_control_flag_readonly_e)) {
- status = f_file_remove(main->setting.path_control);
+ status = f_file_remove(main->process.path_control);
if (F_status_set_fine(status) == F_memory_not) {
controller_print_error(global->thread, &main->program.error, F_status_set_fine(status), macro_controller_f(f_file_remove), F_true);
}
}
- main->process.control.server.name = main->setting.path_control;
+ main->process.control.server.name = main->process.path_control;
status = f_socket_bind(&main->process.control.server);
f_socket_disconnect(&main->process.control.server, f_socket_close_fast_e);
if (!(main->process.control.flag & controller_control_flag_readonly_e)) {
- f_file_remove(main->setting.path_control);
+ f_file_remove(main->process.path_control);
}
if (F_status_set_fine(status) == F_memory_not) {
}
if (main->process.control.flag & (controller_control_flag_has_user_e | controller_control_flag_has_group_e)) {
- status = f_file_role_change(main->setting.path_control, main->process.control.user, main->process.control.group, F_true);
+ status = f_file_role_change(main->process.path_control, main->process.control.user, main->process.control.group, F_true);
if (F_status_is_error(status)) {
f_socket_disconnect(&main->process.control.server, f_socket_close_fast_e);
if (!(main->process.control.flag & controller_control_flag_readonly_e)) {
- f_file_remove(main->setting.path_control);
+ f_file_remove(main->process.path_control);
}
if (F_status_set_fine(status) == F_memory_not) {
}
if (main->process.control.flag & controller_control_flag_has_mode_e) {
- status = f_file_mode_set(main->setting.path_control, main->process.control.mode);
+ status = f_file_mode_set(main->process.path_control, main->process.control.mode);
if (F_status_is_error(status)) {
f_socket_disconnect(&main->process.control.server, f_socket_close_fast_e);
if (!(main->process.control.flag & controller_control_flag_readonly_e)) {
- f_file_remove(main->setting.path_control);
+ f_file_remove(main->process.path_control);
}
if (F_status_set_fine(status) == F_memory_not) {
f_socket_disconnect(&main->process.control.server, f_socket_close_fast_e);
if (!(main->process.control.flag & controller_control_flag_readonly_e)) {
- f_file_remove(main->setting.path_control);
+ f_file_remove(main->process.path_control);
}
if (global->thread->id_control) {
controller_lock_print(print->to, &main->thread);
fl_print_format("%r%[%QControl socket '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
- fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, main->setting.path_control, print->notable);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, main->process.path_control, print->notable);
fl_print_format("%[' %S, code %]", print->to, print->context, message, print->context);
fl_print_format(f_string_format_ui_single_s.string, print->to, print->notable, status, print->notable);
fl_print_format(f_string_format_sentence_end_s.string, print->to, print->context, print->context, f_string_eol_s);
controller_lock_print(print->to, &main->thread);
fl_print_format("%rControl socket '", print->to, f_string_eol_s);
- fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, main->setting.path_control, print->notable);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, main->process.path_control, print->notable);
fl_print_format("' created.%r", print->to, f_string_eol_s);
controller_unlock_print_flush(print->to, &main->thread);
controller_lock_print(print->to, &main->thread);
fl_print_format("%r%[%QControl socket '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
- fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, main->setting.path_control, print->notable);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, main->process.path_control, print->notable);
fl_print_format("' .%r", print->to, f_string_eol_s);
fl_print_format("%[' cannot be found while read only mode is enabled and so the Control socket is unavailable.%]%r", print->to, print->context, print->context, f_string_eol_s);
controller_lock_print(print->to, &main->thread);
fl_print_format("%rPID file '", print->to, f_string_eol_s);
- fl_print_format("%[%Q%]'.%r", print->to, print->notable, main->setting.path_pid, print->notable, f_string_eol_s);
+ fl_print_format("%[%Q%]'.%r", print->to, print->notable, main->process.path_pid, print->notable, f_string_eol_s);
- if (main->setting.path_control.used) {
+ if (main->process.path_control.used) {
fl_print_format("%rControl socket '", print->to, f_string_eol_s);
- fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, main->setting.path_control, print->notable);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, main->process.path_control, print->notable);
fl_print_format("'.%r", print->to, f_string_eol_s);
}
if (F_status_set_fine(status) == F_read_only) {
fl_print_format("%r%[%QThe pid file '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
- fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, main->setting.path_pid, print->notable);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, main->process.path_pid, print->notable);
fl_print_format("%[' could not be written because the destination is read only.%]%r", print->to, print->context, print->context, f_string_eol_s);
}
else {
- controller_print_error_file_status(print, function, F_true, main->setting.path_pid, f_file_operation_create_s, fll_error_file_type_file_e, status);
+ controller_print_error_file_status(print, function, F_true, main->process.path_pid, f_file_operation_create_s, fll_error_file_type_file_e, status);
}
f_file_stream_lock(print->to);
- controller_print_error_entry_cache(print->to, &main->thread.cache.action, is_entry);
+ controller_print_error_entry_cache(print, &main->thread.cache.action, is_entry);
controller_unlock_print_flush(print->to, &main->thread);
}
controller_lock_print(print->to, &main->thread);
fl_print_format("%rPID file '", print->to, f_string_eol_s);
- fl_print_format("%[%Q%]' created.%r", print->to, print->notable, main->setting.path_pid, print->notable, f_string_eol_s);
+ fl_print_format("%[%Q%]' created.%r", print->to, print->notable, main->process.path_pid, print->notable, f_string_eol_s);
controller_unlock_print_flush(print->to, &main->thread);
}
#endif // _di_controller_print_error_
#ifndef _di_controller_print_error_failsafe_item_
- f_status_t controller_print_error_failsafe_item(fl_print_t * const print, controller_thread_t * const thread, f_string_dynamic_t * const name) {
+ f_status_t controller_print_error_failsafe_item(fl_print_t * const print, controller_thread_t * const thread, const f_string_dynamic_t name) {
if (!print) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
* @param name
* The name of the item.
*
- * Must not be NULL.
- *
* @return
* F_okay on success.
* F_output_not on success, but no printing is performed.
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_controller_print_error_failsafe_item_
- extern f_status_t controller_print_error_failsafe_item(fl_print_t * const print, controller_thread_t * const thread, f_string_dynamic_t * const name);
+ extern f_status_t controller_print_error_failsafe_item(fl_print_t * const print, controller_thread_t * const thread, const f_string_dynamic_t name);
#endif // _di_controller_print_error_failsafe_item_
/**
#endif
#ifndef _di_controller_print_error_entry_item_failure_
- f_status_t controller_print_error_entry_item_failure(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name, const f_string_static_t message) {
+ f_status_t controller_print_error_entry_item_failure(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name, const f_string_t message) {
if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
#endif
/**
- * Print the entry item related error.
+ * Print the Entry Item related error.
*
* @param print
* The output structure to print to.
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_controller_print_error_entry_item_failure_
- extern f_status_t controller_print_error_entry_item_failure(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name, const f_string_static_t message);
+ extern f_status_t controller_print_error_entry_item_failure(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name, const f_string_t message);
#endif // _di_controller_print_error_entry_item_failure_
/**
- * Print an error message for an invalid entry item.
+ * Print an error message for an invalid Entry Item.
*
* @param print
* The output structure to print to.
#endif // _di_controller_print_error_entry_item_invalid_
/**
- * Print an error message about an entry it setting option not being supported.
+ * Print an error message about an Entry Item Setting option not being supported.
*
* @param print
* The output structure to print to.
controller_lock_print(print->to, &main->thread);
- controller_print_error_file_status(print, function, F_true, main->setting.path_pid, f_file_operation_create_s, fll_error_file_type_file_e, status);
+ controller_print_error_file_status(print, function, F_true, main->process.path_pid, f_file_operation_create_s, fll_error_file_type_file_e, status);
f_file_stream_lock(print->to);
}
#endif // _di_controller_print_output_entry_setting_simulate_value_
-#ifndef _di_controller_print_entry_output_setting_validate_
- f_status_t controller_print_entry_output_setting_validate(fl_print_t * const print, const uint8_t is_entry) {
+#ifndef _di_controller_print_output_entry_setting_validate_
+ f_status_t controller_print_output_entry_setting_validate(fl_print_t * const print, const uint8_t is_entry) {
if (!print || !print->custom) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
// Mode.
- if (main->setting.mode == controller_process_mode_service_e) {
+ if (main->process.mode == controller_process_mode_service_e) {
string = &controller_mode_s;
}
- else if (main->setting.mode == controller_process_mode_helper_e) {
+ else if (main->process.mode == controller_process_mode_helper_e) {
string = &controller_helper_s;
}
- else if (main->setting.mode == controller_process_mode_program_e) {
+ else if (main->process.mode == controller_process_mode_program_e) {
string = &controller_program_s;
}
else {
// Pid File.
fl_print_format(" %[%r%]", print->to, print->set.important, controller_pid_file_s, print->set.important);
- if (main->setting.path_pid.used) {
- fl_print_format(" %r", print->to, main->setting.path_pid);
+ if (main->process.path_pid.used) {
+ fl_print_format(" %r", print->to, main->process.path_pid);
}
fl_print_format("%r", print->to, f_string_eol_s);
// Control.
fl_print_format(" %[%r%]", print->to, print->set.important, controller_control_s, print->set.important);
- if (main->setting.path_control.used) {
- fl_print_format(" %Q", print->to, main->setting.path_control);
+ if (main->process.path_control.used) {
+ fl_print_format(" %Q", print->to, main->process.path_control);
}
fl_print_format("%r", print->to, f_string_eol_s);
return F_okay;
}
-#endif // _di_controller_print_entry_output_setting_validate_
+#endif // _di_controller_print_output_entry_setting_validate_
#ifdef __cplusplus
} // extern "C"
*
* F_output_not (with error bit) if setting is NULL.
*/
-#ifndef _di_controller_print_entry_output_setting_validate_
- extern f_status_t controller_print_entry_output_setting_validate(fl_print_t * const print, const uint8_t is_entry);
-#endif // _di_controller_print_entry_output_setting_validate_
+#ifndef _di_controller_print_output_entry_setting_validate_
+ extern f_status_t controller_print_output_entry_setting_validate(fl_print_t * const print, const uint8_t is_entry);
+#endif // _di_controller_print_output_entry_setting_validate_
#ifdef __cplusplus
} // extern "C"
#endif
#ifndef _di_controller_print_warning_entry_setting_unknown_action_
- f_status_t controller_print_warning_entry_setting_unknown_action(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry) {
+ f_status_t controller_print_warning_entry_setting_unknown_action(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name) {
if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
if (print->verbosity < f_console_verbosity_debug_e) return F_output_not;
controller_lock_print(print->to, &main->thread);
fl_print_format("%r%[%QUnknown %r item setting '%]", print->to.stream, f_string_eol_s, print->context, print->prefix, is_entry ? controller_entry_s : controller_exit_s, print->context);
- fl_print_format(f_string_format_Q_single_s.string, print->to.stream, print->notable, cache->action.name_action, print->notable);
+ fl_print_format(f_string_format_Q_single_s.string, print->to.stream, print->notable, name, print->notable);
fl_print_format(f_string_format_sentence_end_quote_s.string, print->to.stream, print->context, print->context, f_string_eol_s);
controller_print_error_entry_cache(print, &cache->action, is_entry);
}
#endif // _di_controller_print_warning_entry_setting_unknown_action_
+#ifndef _di_controller_print_warning_entry_setting_unknown_action_value_
+ f_status_t controller_print_warning_entry_setting_unknown_action_value(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name, const f_string_static_t unknown) {
+
+ if (!print || !print->custom || !cache) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_debug_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%r%[%QThe %r item setting '%]", print->to.stream, f_string_eol_s, print->context, print->prefix, is_entry ? controller_entry_s : controller_exit_s, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to.stream, print->notable, name, print->notable);
+ fl_print_format("%[' has an unknown value '%]", print->to.stream, print->context, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to.stream, print->notable, unknown, print->notable);
+ fl_print_format(f_string_format_sentence_end_quote_s.string, print->to.stream, print->context, print->context, f_string_eol_s);
+
+ controller_print_error_entry_cache(print, &cache->action, is_entry);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_print_warning_entry_setting_unknown_action_value_
+
#ifdef __cplusplus
} // extern "C"
#endif
#endif
/**
- * Print a message for when an entry setting action is unknown.
+ * Print a message for when an Entry Setting Action is unknown.
*
* @param print
* The output structure to print to.
* @param is_entry
* If TRUE, then this loads as an entry.
* If FALSE, then this loads as an exit.
+ * @param name
+ * The parameter name whose value is unknown.
*
* @return
* F_okay on success.
* F_output_not (with error bit) if setting is NULL.
*/
#ifndef _di_controller_print_warning_entry_setting_unknown_action_
- extern f_status_t controller_print_warning_entry_setting_unknown_action(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry);
+ extern f_status_t controller_print_warning_entry_setting_unknown_action(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name);
#endif // _di_controller_print_warning_entry_setting_unknown_action_
+/**
+ * Print a message for when an Entry Setting Action value is unknown.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param cache
+ * The cache.
+ *
+ * Must not be NULL.
+ * @param is_entry
+ * If TRUE, then this loads as an entry.
+ * If FALSE, then this loads as an exit.
+ * @param name
+ * The parameter name whose value is unknown.
+ * @param unknown
+ * The unknown value.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ */
+#ifndef _di_controller_print_warning_entry_setting_unknown_action_value_
+ extern f_status_t controller_print_warning_entry_setting_unknown_action_value(fl_print_t * const print, controller_cache_t * const cache, const uint8_t is_entry, const f_string_static_t name, const f_string_static_t unknown);
+#endif // _di_controller_print_warning_entry_setting_unknown_action_value_
+
#ifdef __cplusplus
} // extern "C"
#endif
for (i = 2; i < cache->content_action.used; ++i) {
if (f_compare_dynamic_partial_string(controller_delay_s.string, cache->buffer_item, controller_delay_s.used, cache->content_action.array[i]) == F_equal_to) {
- status = controller_rule_action_read_rerun_number(main, controller_delay_s.string, cache, &i, &rerun_item->delay);
+ status = controller_rule_action_read_rerun_number(main, cache, controller_delay_s.string, &i, &rerun_item->delay);
}
else if (f_compare_dynamic_partial_string(controller_max_s.string, cache->buffer_item, controller_max_s.used, cache->content_action.array[i]) == F_equal_to) {
- status = controller_rule_action_read_rerun_number(main, controller_max_s.string, cache, &i, &rerun_item->max);
+ status = controller_rule_action_read_rerun_number(main, cache, controller_max_s.string, &i, &rerun_item->max);
}
else if (f_compare_dynamic_partial_string(controller_reset_s.string, cache->buffer_item, controller_reset_s.used, cache->content_action.array[i]) == F_equal_to) {
item->reruns[type_rerun].is |= rerun_item == &item->reruns[type_rerun].failure ? controller_rule_rerun_is_failure_reset_d : controller_rule_rerun_is_success_reset_d;
}
}
else {
- status = controller_rule_instance_do(options_force, instance);
+ status = controller_rule_instance_perform(options_force, instance);
if (status == F_child || F_status_set_fine(status) == F_interrupt) {
f_thread_unlock(&instance->active);
}
#endif // _di_controller_rule_instance_begin_
-#ifndef _di_controller_rule_instance_do_
- f_status_t controller_rule_instance_do(const uint8_t options_force, controller_instance_t * const instance) {
+#ifndef _di_controller_rule_instance_perform_
+ f_status_t controller_rule_instance_perform(const uint8_t options_force, controller_instance_t * const instance) {
if (!instance || !instance->main) return F_status_set_error(F_parameter);
return controller_thread_is_enabled_instance(instance) ? status : F_status_set_error(F_interrupt);
}
-#endif // _di_controller_rule_instance_do_
+#endif // _di_controller_rule_instance_perform_
#ifdef __cplusplus
} // extern "C"
#endif // _di_controller_rule_instance_begin_
/**
- * Helper for calling controller_rule_instance().
+ * Perform the work
*
* This does all the preparation work that needs to be synchronously performed within the same thread.
* This will copy the rule by the alias to the instance structure.
* @param instance
* The instance data.
*
+ * Must not be NULL.
+ *
* @return
* F_okay on success.
* F_found on the instance was found to already be running (nothing to do).
* @see controller_rule_instance()
* @see controller_rule_instance_begin()
*/
-#ifndef _di_controller_rule_instance_do_
- extern f_status_t controller_rule_instance_do(const uint8_t options_force, controller_instance_t * const instance);
-#endif // _di_controller_rule_instance_do_
+#ifndef _di_controller_rule_instance_perform_
+ extern f_status_t controller_rule_instance_perform(const uint8_t options_force, controller_instance_t * const instance);
+#endif // _di_controller_rule_instance_perform_
#ifdef __cplusplus
} // extern "C"
fl_print_format(f_string_format_Q_single_s.string, main->program.warning.to, main->program.warning.notable, cache->action.name_action, main->program.warning.notable);
fl_print_format(f_string_format_sentence_end_quote_s.string, main->program.warning.to, main->program.warning.context, main->program.warning.context, f_string_eol_s);
- controller_print_error_rule_cache(&main->program.warning, cache->action, F_true);
+ controller_print_error_rule_cache(&main->program.warning, &cache->action, F_true);
controller_unlock_print_flush(main->program.warning.to, &main->thread);
}
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the rule "read" functionality.
+ * Provides the rule "parameter" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
-#ifndef _controller_main_rule_read_h
-#define _controller_main_rule_read_h
+#ifndef _controller_main_rule_parameter_h
+#define _controller_main_rule_parameter_h
#ifdef __cplusplus
extern "C" {
} // extern "C"
#endif
-#endif // _controller_main_rule_read_h
+#endif // _controller_main_rule_parameter_h
#endif
#ifndef _di_controller_rule_read_
- f_status_t controller_rule_read(controller_t * const main, controller_cache_t * const cache, const bool is_normal, const f_string_static_t alias, controller_entry_t * const entry, controller_rule_t * const rule) {
+ f_status_t controller_rule_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, const f_string_static_t alias, controller_entry_t * const entry, controller_rule_t * const rule) {
if (!main || !cache || !entry || !rule) return F_status_set_error(F_parameter);
fl_print_format(f_string_format_Q_single_s.string, main->program.warning.to, main->program.warning.notable, cache->action.name_item, main->program.warning.notable);
fl_print_format(f_string_format_sentence_end_quote_s.string, main->program.warning.to, main->program.warning.context, main->program.warning.context, f_string_eol_s);
- controller_print_error_rule_cache(&main->program.warning, cache->action, F_true);
+ controller_print_error_rule_cache(&main->program.warning, &cache->action, F_true);
controller_unlock_print_flush(main->program.warning.to, &main->thread);
}
* @see fll_fss_basic_list_read().
*/
#ifndef _di_controller_rule_read_
- extern f_status_t controller_rule_read(controller_t * const main, controller_cache_t * const cache, const bool is_normal, const f_string_static_t alias, controller_entry_t * const entry, controller_rule_t * const rule);
+ extern f_status_t controller_rule_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, const f_string_static_t alias, controller_entry_t * const entry, controller_rule_t * const rule);
#endif // _di_controller_rule_read_
*status = controller_entry_preprocess(main, F_true);
if ((main->setting.flag & controller_main_flag_simulate_e) && (main->setting.flag & controller_main_flag_validate_e)) {
- controller_print_entry_output_setting_validate(main, F_true);
+ controller_print_output_entry_setting_validate(&main->program.output, F_true);
}
}
*status = controller_entry_preprocess(main, F_false);
if ((main->setting.flag & controller_main_flag_simulate_e) && (main->setting.flag & controller_main_flag_validate_e)) {
- controller_print_entry_output_setting_validate(main, F_false);
+ controller_print_output_entry_setting_validate(&main->program.output, F_false);
}
}
if (!instance || !instance->main) return;
if (!controller_thread_is_enabled(is_normal, &instance->main->thread)) return;
- const f_status_t status = controller_rule_instance_do(controller_instance_option_asynchronous_e, instance);
+ const f_status_t status = controller_rule_instance_perform(controller_instance_option_asynchronous_e, instance);
// A forked child instance should de-allocate memory on exit.
// It seems that this function doesn't return to the calling thread for a forked child instance, even with the "return 0;" below.
*
* Must not be NULL.
*
- * @see controller_rule_instance_do()
+ * @see controller_rule_instance_perform()
*/
#ifndef _di_controller_thread_instance_
extern void controller_thread_instance(const uint8_t is_normal, controller_instance_t * const instance);