build_sources_library main/common/string/general.c main/common/string/rule.c
build_sources_library main/instance.c main/path.c
build_sources_library main/rule.c main/rule/action.c main/rule/execute.c main/rule/expand.c main/rule/instance.c main/rule/is.c main/rule/item.c main/rule/parameter.c main/rule/read.c main/rule/setting.c main/rule/validate.c main/rule/wait.c
-build_sources_library main/print/data.c main/print/debug.c main/print/error.c main/print/lock.c main/print/message.c main/print/rule.c main/print/verbose.c main/print/warning.c
+build_sources_library main/print/action.c main/print/data.c main/print/debug.c main/print/error.c main/print/lock.c main/print/message.c main/print/rule.c main/print/verbose.c main/print/warning.c
build_sources_library main/signal.c main/time.c
build_sources_library main/thread.c main/thread/control.c main/thread/entry.c main/thread/instance.c main/thread/is.c main/thread/rule.c
build_sources_headers main/common/type/cache.h main/common/type/control.h main/common/type/entry.h main/common/type/execute.h main/common/type/global.h main/common/type/lock.h main/common/type/instance.h main/common/type/program.h main/common/type/rule.h main/common/type/thread.h
build_sources_headers main/instance.h main/path.h
build_sources_headers main/rule.h main/rule/action.h main/rule/execute.h main/rule/expand.h main/rule/instance.h main/rule/is.h main/rule/item.h main/rule/parameter.h main/rule/read.h main/rule/setting.h main/rule/validate.h main/rule/wait.h
-build_sources_headers main/print/data.h main/print/debug.h main/print/error.h main/print/lock.h main/print/message.h main/print/rule.h main/print/verbose.h main/print/warning.h
+build_sources_headers main/print/action.h main/print/data.h main/print/debug.h main/print/error.h main/print/lock.h main/print/message.h main/print/rule.h main/print/verbose.h main/print/warning.h
build_sources_headers main/signal.h main/time.h
build_sources_headers main/thread.h main/thread/control.h main/thread/entry.h main/thread/instance.h main/thread/is.h main/thread/rule.h
extern "C" {
#endif
+#ifndef _di_controller_main_error_simplify_
+ f_status_t controller_main_error_simplify(const f_status_t status) {
+
+ if (status == F_memory_not) {
+ return F_status_set_error(F_memory);
+ }
+
+ if (status == F_file_open_max || status == F_space_not || status == F_busy) {
+ return F_status_set_error(F_resource);
+ }
+
+ if (status == F_access_denied || status == F_filesystem_quota_block || status == F_prohibited || status == F_input_output) {
+ return F_status_set_error(F_access);
+ }
+
+ if (status == F_complete_not_utf || status == F_complete_not_utf_block || status == F_complete_not_utf_eof || status == F_complete_not_utf_eol || status == F_complete_not_utf_eos || status == F_complete_not_utf_stop) {
+ return F_status_set_error(F_encoding);
+ }
+
+ if (status == F_number || status == F_number_negative || status == F_number_positive || status == F_number_overflow) {
+ return F_status_set_error(F_number);
+ }
+
+ if (status == F_parameter || status == F_found_not || status == F_interrupt || status == F_support_not || status == F_critical) {
+ return F_status_set_error(status);
+ }
+
+ if (status == F_valid_not) {
+ return F_status_set_error(F_valid_not);
+ }
+
+ return F_status_set_error(F_failure);
+ }
+#endif // _di_controller_main_error_simplify_
+
+#ifndef _di_controller_main_range_after_number_sign_
+ f_range_t controller_main_range_after_number_sign(const f_string_static_t buffer, const f_range_t range) {
+
+ f_range_t result = range;
+
+ for (; result.start <= result.stop; ++result.start) {
+
+ if (!buffer.string[result.start]) continue;
+
+ if (buffer.string[result.start] == f_string_ascii_minus_s.string[0] || buffer.string[result.start] == f_string_ascii_plus_s.string[0]) {
+ ++result.start;
+ }
+
+ break;
+ } // for
+
+ return result;
+ }
+#endif // _di_controller_main_range_after_number_sign_
+
#ifndef _di_controller_main_setting_load_
void controller_main_setting_load(const f_console_arguments_t arguments, controller_main_t * const main, controller_program_t * const program) {
#endif
/**
+ * Given a wide range of status codes (that are errors), simplify them down to a small subset.
+ *
+ * @param status
+ * The status code (without the error bit set) to simplify.
+ *
+ * @return
+ * A subset of status codes (with error bit set).
+ */
+#ifndef _di_controller_main_error_simplify_
+ extern f_status_t controller_main_error_simplify(const f_status_t status) F_attribute_visibility_internal_d;
+#endif // _di_controller_main_error_simplify_
+
+/**
+ * Given a string whose range represents a number, seek past the first positive or negative sign.
+ *
+ * This will stop at the first non-NULL, non-'+' and non-'-' characters.
+ *
+ * Only the first '+' or '-' are processed.
+ *
+ * @param buffer
+ * The string referenced by the range.
+ * @param range
+ * The range within the buffer to process.
+ *
+ * @return
+ * The string range.
+ * The start range will be past the stop range on overflow or on any failure.
+ */
+#ifndef _di_controller_main_range_after_number_sign_
+ extern f_range_t controller_main_range_after_number_sign(const f_string_static_t buffer, const f_range_t range) F_attribute_visibility_internal_d;
+#endif // _di_controller_main_range_after_number_sign_
+
+/**
* Perform the standard program setting load settings.
*
* This prints error messages as appropriate.
#ifndef _di_controller_f_a_
const f_string_t controller_f_a[] = {
- "controller_rule_actions_increase_by",
"controller_rule_copy",
"controller_rule_items_increase_by",
"controller_path_canonical_relative",
"fl_fss_extended_list_content_read",
"fl_fss_extended_list_object_read",
"fl_iki_read",
+ "fll_control_group_prepare",
"fll_execute_program",
"fll_fss_basic_list_read",
"fll_fss_extended_read",
*/
#ifndef _di_controller_f_e_
enum {
- controller_f_controller_rule_actions_increase_by_e,
controller_f_controller_rule_copy_e,
controller_f_controller_rule_items_increase_by_e,
controller_f_controller_path_canonical_relative_e,
controller_f_fl_fss_extended_list_content_read_e,
controller_f_fl_fss_extended_list_object_read_e,
controller_f_fl_iki_read_e,
+ controller_f_fll_control_group_prepare_e,
controller_f_fll_execute_program_e,
controller_f_fll_fss_basic_list_read_e,
controller_f_fll_fss_extended_read_e,
const f_string_static_t controller_long_validate_s = macro_f_string_static_t_initialize_1(CONTROLLER_long_validate_s, 0, CONTROLLER_long_validate_s_length);
#endif // _di_controller_parameter_s_
-/**
- * Special strings used for rules.
- */
+#ifndef _di_controller_print_rule_s_
+ const f_string_static_t controller_print_rule_control_groups_prepare_s = macro_f_string_static_t_initialize_1(CONTROLLER_print_rule_control_groups_prepare_s, 0, CONTROLLER_print_rule_control_groups_prepare_s_length);
+#endif // _di_controller_print_rule_s_
+
#ifndef _di_controller_rule_s_
const f_string_static_t controller_rule_needed_s = macro_f_string_static_t_initialize_1(CONTROLLER_rule_needed_s, 0, CONTROLLER_rule_needed_s_length);
const f_string_static_t controller_rule_wanted_s = macro_f_string_static_t_initialize_1(CONTROLLER_rule_wanted_s, 0, CONTROLLER_rule_wanted_s_length);
#endif // _di_controller_default_s_
/**
+ * Special strings used for printing.
+ */
+#ifndef _di_controller_print_rule_s_
+ #define CONTROLLER_print_rule_control_groups_prepare_s "prepare control groups for"
+ #define CONTROLLER_print_rule_control_groups_prepare_s_length 24
+
+ extern const f_string_static_t controller_print_rule_control_groups_prepare_s;
+#endif // _di_controller_print_rule_s_
+
+/**
* Special strings used for rules.
*/
#ifndef _di_controller_rule_s_
* main: The main program data.
* program: The program data.
* thread: The thread data for a specific thread.
+ *
+ * message: A message printer, with custom set to this structure.
+ * output: An output printer, with custom set to this structure.
+ * error: An error printer, with custom set to this structure.
+ * warning: A warning printer, with custom set to this structure.
+ * debug: A debug printer, with custom set to this structure.
*/
#ifndef _di_controller_global_t_
typedef struct {
controller_main_t *main;
controller_program_t *program;
controller_thread_t *thread;
+
+ fl_print_t message;
+ fl_print_t output;
+ fl_print_t error;
+ fl_print_t warning;
+ fl_print_t debug;
} controller_global_t;
#define controller_global_t_initialize { 0, 0, 0 }
main, \
program, \
thread, \
+ fl_print_t_initialize, \
+ fl_print_t_initialize, \
+ macro_fl_print_t_initialize_error(), \
+ macro_fl_print_t_initialize_warning(), \
+ macro_fl_print_t_initialize_debug(), \
}
#endif // _di_controller_global_t_
* action: The action being performed.
* options: Configuration options for this thread.
* state: The state of the process.
- * type: The currently active process type (from the controller_data_type_*_e).
+ * type: The currently active process type (from the controller_instance_type_*_e).
* result: The last return code from an execution of a process.
*
* active: A read/write lock representing that something is currently using this (read locks = in use, write lock = begin deleting).
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/wait.h>
#include <unistd.h>
// FLL-0 includes.
// FLL-1 includes.
#include <fll/level_1/conversion.h>
+#include <fll/level_1/environment.h>
#include <fll/level_1/execute.h>
#include <fll/level_1/fss.h>
#include <fll/level_1/fss/extended.h>
#include <fll/level_1/fss/extended_list.h>
+#include <fll/level_1/iki.h>
#include <fll/level_1/path.h>
#include <fll/level_1/print.h>
// FLL-2 includes.
#include <fll/level_2/error.h>
+#include <fll/level_2/control_group.h>
#include <fll/level_2/fss.h>
#include <fll/level_2/fss/basic_list.h>
#include <fll/level_2/fss/extended.h>
#include <program/controller/main/common/define/thread.h>
#include <program/controller/main/common/enumeration/control.h>
#include <program/controller/main/common/enumeration/entry.h>
+#include <program/controller/main/common/enumeration/instance.h>
#include <program/controller/main/common/enumeration/rule.h>
#include <program/controller/main/common/enumeration/program.h>
#include <program/controller/main/common/enumeration/thread.h>
#include <program/controller/main/common/type/global.h>
#include <program/controller/main/common.h>
#include <program/controller/main/path.h>
+#include <program/controller/main/print/action.h>
#include <program/controller/main/print/data.h>
#include <program/controller/main/print/debug.h>
#include <program/controller/main/print/error.h>
--- /dev/null
+#include "../controller.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Provides the print action functionality.
+ *
+ * This is auto-included and should not need to be explicitly included.
+ */
+#ifndef _controller_main_print_action_h
+#define _controller_main_print_action_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _controller_main_print_action_h
}
#endif // _di_controller_main_print_error_status_
+#ifndef _di_controller_main_print_error_rule_
+ f_status_t controller_main_print_error_rule(fl_print_t * const print, const f_status_t status, const f_string_t function, const bool fallback, const bool item) {
+
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ // fll_error_print() automatically locks, so manually handle only the mutex locking and flushing rather than calling controller_lock_print().
+ f_thread_mutex_lock(&global->thread->lock.print);
+
+ controller_global_t * const global = (controller_global_t *) print->custom; // @fixme The print->custom is currently controller_main_t, but threads need to change this. Thread-specific print objects?
+
+ fll_error_print(print, F_status_set_fine(global->main->setting.state.status), function, fll_error_file_flag_fallback_e);
+
+ fll_error_print(print, status, function, fallback);
+
+ f_file_stream_lock(print->to);
+
+ controller_rule_print_error_cache(print, cache, item);
+
+ controller_unlock_print_flush(print->to, thread);
+
+ return F_okay;
+ }
+#endif // _di_controller_main_print_error_rule_
+
+#ifndef _di_controller_rule_print_error_cache_
+ void controller_rule_print_error_cache(fl_print_t * const print, const controller_cache_action_t cache, const bool item) {
+
+ if (print->verbosity == f_console_verbosity_quiet_e) return;
+
+ fl_print_format("%r%[%QWhile processing ", print->to, f_string_eol_s, print->context, print->prefix);
+
+ if (cache.name_action.used) {
+ fl_print_format("%r '%]", print->to, item ? controller_action_s : controller_value_s, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, cache.name_action, print->notable);
+ fl_print_format("%[' on line%] ", print->to, print->context, print->context);
+ fl_print_format("%[%un%]", print->to, print->notable, cache.line_action, print->notable);
+ fl_print_format("%[ for ", print->to, print->context);
+ }
+
+ if (cache.name_item.used) {
+ fl_print_format("rule %r '%]", print->to, item ? controller_item_s : controller_settings_s, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, cache.name_item, print->notable);
+ fl_print_format("%[' on line%] ", print->to, print->context, print->context);
+ fl_print_format("%[%un%]", print->to, print->notable, cache.line_item, print->notable);
+ fl_print_format("%[ for ", print->to, print->context);
+ }
+
+ if (cache.name_file.used) {
+ fl_print_format("rule file '%]%[%Q%]%['", print->to, print->context, print->notable, cache.name_file, print->notable, print->context);
+ }
+
+ fl_print_format(".%]%r", print->to, print->context, f_string_eol_s);
+ }
+#endif // _di_controller_rule_print_error_cache_
+
#ifdef __cplusplus
} // extern "C"
#endif
extern f_status_t controller_main_print_error_status(fl_print_t * const print, const f_string_t function, const f_status_t status);
#endif // _di_controller_main_print_error_status_
+/**
+ * Print generic error/warning information.
+ *
+ * This is essentially a wrapper to fll_error_print() that includes locking.
+ *
+ * @param thread
+ * The thread data.
+ * @param print
+ * Designates how printing is to be performed.
+ * @param cache
+ * The action cache.
+ * @param status
+ * The status code to process.
+ * Make sure this has F_status_set_fine() called if the status code has any error or warning bits.
+ * @param function
+ * The name of the function where the error happened.
+ * Set to 0 to disable.
+ * @param fallback
+ * Set to F_true to print the fallback error message for unknown errors.
+ * @param item
+ * If TRUE, then this error is associated with an item.
+ * If FALSE, then this error is associated with a rule setting.
+ *
+ * @see fll_error_print()
+ * @see controller_rule_print_error_cache()
+ */
+#ifndef _di_controller_rule_print_error_
+ extern void controller_rule_print_error(controller_thread_t * const thread, fl_print_t * const print, const controller_cache_action_t cache, const f_status_t status, const f_string_t function, const bool fallback, const bool item) F_attribute_visibility_internal_d;
+#endif // _di_controller_rule_print_error_
+
+/**
+ * Print additional error/warning information in addition to existing error.
+ *
+ * This is explicitly intended to be used in addition to the error message.
+ *
+ * This neither locks the thread nor does it check to see if output is enabled or disabled.
+ *
+ * @param print
+ * The error or warning output structure.
+ * @param cache
+ * A structure for containing and caching relevant data.
+ * @param item
+ * If TRUE, then this error is associated with an item.
+ * If FALSE, then this error is associated with a rule setting.
+ *
+ * @see controller_rule_action_read()
+ * @see controller_rule_item_read()
+ * @see controller_rule_items_read()
+ * @see controller_rule_read()
+ * @see controller_rule_setting_read()
+ */
+#ifndef _di_controller_rule_print_error_cache_
+ extern void controller_rule_print_error_cache(fl_print_t * const print, const controller_cache_action_t cache, const bool item) F_attribute_visibility_internal_d;
+#endif // _di_controller_rule_print_error_cache_
+
#ifdef __cplusplus
} // extern "C"
#endif
if (F_status_is_error(status)) {
controller_main_print_error(&global->main->program.error, macro_controller_f(f_string_dynamic_append_nulless));
- actions->array[actions->used++].status = controller_status_simplify_error(F_status_set_fine(status));
+ actions->array[actions->used++].status = controller_main_error_simplify(F_status_set_fine(status));
return status;
}
if (actions->array[actions->used].parameters.array[0].used) {
- state.step_large = controller_common_allocation_iki_large_d;
- state.step_small = controller_common_allocation_iki_small_d;
+ state.step_large = controller_allocation_iki_large_d;
+ state.step_small = controller_allocation_iki_small_d;
state.interrupt = &controller_main_thread_signal_state_iki;
f_range_t range_iki = macro_f_range_t_initialize_2(actions->array[actions->used].parameters.array[0].used);
if (F_status_is_error(status)) {
controller_main_print_error(&global->main->program.error, macro_controller_f(fl_iki_read));
- actions->array[actions->used++].status = controller_status_simplify_error(F_status_set_fine(status));
+ actions->array[actions->used++].status = controller_main_error_simplify(F_status_set_fine(status));
return status;
}
for (i = 0; i < cache->object_actions.used; ++i) {
- status = controller_rule_actions_increase_by(controller_allocation_small_d, actions);
+ status = f_memory_array_increase_by(controller_allocation_small_d, sizeof(controller_rule_action_t), (void **) &actions->array, &actions->used, &actions->size);
if (F_status_is_error(status)) {
- controller_main_print_error(&global->main->program.error, macro_controller_f(controller_rule_actions_increase_by));
+ controller_main_print_error(&global->main->program.error, macro_controller_f(f_memory_array_increase_by));
return status;
}
status = controller_rule_parameters_read(global, cache->buffer_item, &cache->object_actions.array[i], &cache->content_actions.array[i], &actions->array[actions->used], &state);
if (F_status_is_error(status)) {
- actions->array[actions->used++].status = controller_status_simplify_error(F_status_set_fine(status));
+ actions->array[actions->used++].status = controller_main_error_simplify(F_status_set_fine(status));
return status;
}
if (F_status_is_error(status)) {
controller_main_print_error(&global->main->program.error, macro_controller_f(f_string_dynamic_partial_mash_nulless));
- actions->array[actions->used++].status = controller_status_simplify_error(F_status_set_fine(status));
+ actions->array[actions->used++].status = controller_main_error_simplify(F_status_set_fine(status));
return status;
}
if (actions->array[actions->used].parameters.array[0].used) {
- state.step_large = controller_common_allocation_iki_large_d;
- state.step_small = controller_common_allocation_iki_small_d;
+ state.step_large = controller_allocation_iki_large_d;
+ state.step_small = controller_allocation_iki_small_d;
state.interrupt = &controller_main_thread_signal_state_iki;
f_range_t range_iki = macro_f_range_t_initialize_2(actions->array[actions->used].parameters.array[0].used);
if (F_status_is_error(status)) {
controller_main_print_error(&global->main->program.error, macro_controller_f(fl_iki_read));
- actions->array[actions->used++].status = controller_status_simplify_error(F_status_set_fine(status));
+ actions->array[actions->used++].status = controller_main_error_simplify(F_status_set_fine(status));
return status;
}
status = controller_rule_parameters_read(global, cache->buffer_item, 0, &cache->content_action, &actions->array[actions->used], &state);
if (F_status_is_error(status)) {
- actions->array[actions->used++].status = controller_status_simplify_error(F_status_set_fine(status));
+ actions->array[actions->used++].status = controller_main_error_simplify(F_status_set_fine(status));
return status;
}
}
if (F_status_is_error_not(status) && status == F_data_not) {
- if (global->main->program.warning.verbosity == f_console_verbosity_debug_e) {
- controller_main_print_rule_debug_item_action_empty(&global->main->program.debug);
- }
+ controller_main_print_rule_debug_item_action_empty(&global->main->program.debug, cache);
}
return status;
status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, cache->content_action.array[++(*index)], &parsed);
if (F_status_set_fine(status) == F_number_positive) {
- status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_action.array[*index]), &parsed);
+ status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_main_range_after_number_sign(cache->buffer_item, cache->content_action.array[*index]), &parsed);
}
if (status == F_data_not) {
}
}
- controller_rule_print_rule_message_cache(&global->main->program.error, cache->action, F_true);
+ controller_rule_print_rule_message_cache(&global->main->program.error, &cache->action, F_true);
controller_unlock_print_flush(global->main->program.error.to, global->thread);
}
* @return
* F_okay on success.
*
- * Errors (with error bit) from: controller_rule_actions_increase_by().
* Errors (with error bit) from: controller_rule_parameters_read().
* Errors (with error bit) from: f_fss_count_lines().
+ * Errors (with error bit) from: f_memory_array_increase_by().
*
- * @see controller_rule_actions_increase_by()
* @see controller_rule_parameters_read()
* @see f_fss_count_lines()
+ * @see f_memory_array_increase_by()
*/
#ifndef _di_controller_rule_action_read_
extern f_status_t controller_rule_action_read(controller_global_t * const global, const bool is_normal, const uint8_t type, const uint8_t method, controller_cache_t * const cache, controller_rule_item_t * const item, controller_rule_actions_t * const actions, f_range_t * const range);
#endif // _di_controller_rule_action_read_
+/**
+ * Process a number from a rule file, incrementing index as necessary.
+ *
+ * This prints error messages as necessary.
+ *
+ * This is intended to be called by controller_rule_action_read().
+ *
+ * @param global
+ * The global data.
+ * Must not be NULL.
+ *
+ * This does not alter global.main.setting.state.status.
+ * @param name
+ * The name representing the value whose number is being processed.
+ * @param cache
+ * A structure for containing and caching relevant data.
+ * @param index
+ * The position within the content action array for some rule to process.
+ * @param number
+ * The processed number will be saved here.
+ *
+ * @return
+ * F_okay on success.
+ *
+ * F_valid_not (with error bit) on failure due to invalid value.
+ *
+ * Errors (with error bit) from: fl_conversion_dynamic_partial_to_signed_detect().
+ *
+ * @see controller_rule_action_read()
+ * @see fl_conversion_dynamic_partial_to_signed_detect()
+ */
+#ifndef _di_controller_rule_action_read_rerun_number_
+ extern f_status_t controller_rule_action_read_rerun_number(controller_global_t * const global, const f_string_t name, controller_cache_t * const cache, f_number_unsigned_t * const index, f_number_unsigned_t * const number);
+#endif // _di_controller_rule_action_read_rerun_number_
+
#ifdef __cplusplus
} // extern "C"
controller_execute_set_t execute_set = macro_controller_execute_set_t_initialize_1(0, 0, &environment, &signals, 0, fl_execute_as_t_initialize);
- if (process->rule.affinity.used) {
- execute_set.as.affinity = &process->rule.affinity;
+ if (instance->rule.affinity.used) {
+ execute_set.as.affinity = &instance->rule.affinity;
}
- if (process->rule.capability) {
- execute_set.as.capability = process->rule.capability;
+ if (instance->rule.capability) {
+ execute_set.as.capability = instance->rule.capability;
}
- if (process->rule.has & controller_rule_has_cgroup_d) {
- execute_set.as.control_group = &process->rule.cgroup;
+ if (instance->rule.has & controller_rule_has_cgroup_d) {
+ execute_set.as.control_group = &instance->rule.cgroup;
// Make sure all required cgroup directories exist.
- if (controller_rule_status_is_available(action, process->rule)) {
- status = fll_control_group_prepare(process->rule.cgroup);
+ if (controller_rule_status_is_available(action, instance->rule)) {
+ status = fll_control_group_prepare(instance->rule.cgroup);
if (F_status_is_error(status)) {
- controller_main_print_error_file(&main->program.error, macro_controller_f(fll_control_group_prepare), process->rule.cgroup.path, controller_rule_print_control_groups_prepare_s, fll_error_file_type_directory_e);
+ controller_main_print_error_file(&global->main->program.error, macro_controller_f(fll_control_group_prepare), instance->rule.cgroup.path, controller_print_rule_control_groups_prepare_s, fll_error_file_type_directory_e);
return status;
}
}
}
- if (process->rule.has & controller_rule_has_group_d) {
- execute_set.as.id_group = &process->rule.group;
+ if (instance->rule.has & controller_rule_has_group_d) {
+ execute_set.as.id_group = &instance->rule.group;
- if (process->rule.groups.used) {
- execute_set.as.id_groups = &process->rule.groups;
+ if (instance->rule.groups.used) {
+ execute_set.as.id_groups = &instance->rule.groups;
}
}
- if (process->rule.limits.used) {
- execute_set.as.limits = &process->rule.limits;
+ if (instance->rule.limits.used) {
+ execute_set.as.limits = &instance->rule.limits;
}
- if (process->rule.has & controller_rule_has_scheduler_d) {
- execute_set.as.scheduler = &process->rule.scheduler;
+ if (instance->rule.has & controller_rule_has_scheduler_d) {
+ execute_set.as.scheduler = &instance->rule.scheduler;
}
- if (process->rule.has & controller_rule_has_nice_d) {
- execute_set.as.nice = &process->rule.nice;
+ if (instance->rule.has & controller_rule_has_nice_d) {
+ execute_set.as.nice = &instance->rule.nice;
}
- if (process->rule.has & controller_rule_has_user_d) {
- execute_set.as.id_user = &process->rule.user;
+ if (instance->rule.has & controller_rule_has_user_d) {
+ execute_set.as.id_user = &instance->rule.user;
}
- if (process->rule.has & controller_rule_has_environment_d) {
- status = fl_environment_load_names(process->rule.environment, &environment);
+ if (instance->rule.has & controller_rule_has_environment_d) {
+ status = fl_environment_load_names(instance->rule.environment, &environment);
if (F_status_is_error(status)) {
controller_main_print_error_status(&global->main->program.error, macro_controller_f(fl_environment_load_names), F_status_set_fine(status));
// When a "define" from the entry/exit is in the "environment", add it to the exported environments (and overwrite any existing environment variable of the same name).
controller_entry_t *entry = 0;
- if (process->type == controller_data_type_entry_e) {
- entry = &global->setting->entry;
+ if (instance->type == controller_instance_type_entry_e) {
+ entry = &global->program->entry;
}
- else if (process->type == controller_data_type_exit_e) {
- entry = &global->setting->exit;
+ else if (instance->type == controller_instance_type_exit_e) {
+ entry = &global->program->exit;
}
if (entry) {
for (i = 0; i < entry->define.used; ++i) {
- for (j = 0; j < process->rule.environment.used; ++j) {
+ for (j = 0; j < instance->rule.environment.used; ++j) {
- if (f_compare_dynamic(entry->define.array[i].key, process->rule.environment.array[j]) == F_equal_to) {
+ if (f_compare_dynamic(entry->define.array[i].key, instance->rule.environment.array[j]) == F_equal_to) {
for (k = 0; k < environment.used; ++k) {
}
// When a "define" is in the "environment", add it to the exported environments (and overwrite any existing environment variable of the same name).
- for (i = 0; i < process->rule.define.used; ++i) {
+ for (i = 0; i < instance->rule.define.used; ++i) {
- for (j = 0; j < process->rule.environment.used; ++j) {
+ for (j = 0; j < instance->rule.environment.used; ++j) {
- if (f_compare_dynamic(process->rule.define.array[i].key, process->rule.environment.array[j]) == F_equal_to) {
+ if (f_compare_dynamic(instance->rule.define.array[i].key, instance->rule.environment.array[j]) == F_equal_to) {
for (k = 0; k < environment.used; ++k) {
- if (f_compare_dynamic(process->rule.define.array[i].key, environment.array[k].key) == F_equal_to) {
+ if (f_compare_dynamic(instance->rule.define.array[i].key, environment.array[k].key) == F_equal_to) {
environment.array[k].value.used = 0;
- status = f_string_dynamic_append(process->rule.define.array[i].value, &environment.array[k].value);
+ status = f_string_dynamic_append(instance->rule.define.array[i].value, &environment.array[k].value);
if (F_status_is_error(status)) {
controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
} // for
if (k == environment.used) {
- status = f_string_maps_append(process->rule.define.array[i], &environment);
+ status = f_string_maps_append(instance->rule.define.array[i], &environment);
if (F_status_is_error(status)) {
controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status));
else {
controller_entry_t *entry = 0;
- if (process->type == controller_data_type_entry_e) {
- entry = &global->setting->entry;
+ if (instance->type == controller_instance_type_entry_e) {
+ entry = &global->program->entry;
}
- else if (process->type == controller_data_type_exit_e) {
- entry = &global->setting->exit;
+ else if (instance->type == controller_instance_type_exit_e) {
+ entry = &global->program->exit;
}
// When a custom define is specified, it needs to be exported into the environment.
- if (entry->define.used || process->rule.define.used) {
+ if (entry->define.used || instance->rule.define.used) {
// Copy all environment variables over when a custom define is used.
status = f_environment_get_all(&environment);
}
} // for
- for (i = 0; i < process->rule.define.used; ++i) {
+ for (i = 0; i < instance->rule.define.used; ++i) {
- status = f_string_maps_append(process->rule.define.array[i], &environment);
+ status = f_string_maps_append(instance->rule.define.array[i], &environment);
if (F_status_is_error(status)) {
controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status));
}
}
- for (i = 0; i < process->rule.items.used && controller_thread_is_enabled_process(process, global->thread); ++i) {
+ for (i = 0; i < instance->rule.items.used && controller_main_thread_is_enabled_instance(instance, global->thread); ++i) {
- if (process->rule.items.array[i].type == controller_rule_item_type_settings_e) continue;
+ if (instance->rule.items.array[i].type == controller_rule_item_type_settings_e) continue;
- for (j = 0; j < process->rule.items.array[i].actions.used; ++j) {
+ for (j = 0; j < instance->rule.items.array[i].actions.used; ++j) {
- if (!controller_thread_is_enabled_process(process, global->thread)) {
+ if (!controller_main_thread_is_enabled_instance(instance, global->thread)) {
status = F_status_set_error(F_interrupt);
break;
}
- if (process->rule.items.array[i].actions.array[j].type != action) continue;
+ if (instance->rule.items.array[i].actions.array[j].type != action) continue;
execute_set.parameter.data = 0;
execute_set.parameter.option = FL_execute_parameter_option_threadsafe_d | FL_execute_parameter_option_return_d;
- if (process->rule.items.array[i].with & controller_with_full_path_d) {
+ if (instance->rule.items.array[i].with & controller_with_full_path_d) {
execute_set.parameter.option |= FL_execute_parameter_option_path_d;
}
- if (process->rule.items.array[i].with & controller_with_session_new_d) {
+ if (instance->rule.items.array[i].with & controller_with_session_new_d) {
execute_set.parameter.option |= FL_execute_parameter_option_session_d;
}
- if (process->rule.items.array[i].type == controller_rule_item_type_command_e) {
- status = controller_rule_expand(global, process->rule.items.array[i].actions.array[j], process);
+ if (instance->rule.items.array[i].type == controller_rule_item_type_command_e) {
+ status = controller_rule_expand(global, instance->rule.items.array[i].actions.array[j], instance);
if (F_status_is_error(status)) {
- controller_rule_print_error(global->thread, &global->main->program.error, process->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
+ controller_rule_print_error(global->thread, &global->main->program.error, instance->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
break;
}
do {
- status = controller_rule_execute_foreground(process->rule.items.array[i].type, f_string_empty_s, process->cache.expanded, options, &execute_set, process);
+ status = controller_rule_execute_foreground(instance->rule.items.array[i].type, f_string_empty_s, instance->cache.expanded, options, &execute_set, instance);
if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_set_fine(status) == F_lock) break;
if (F_status_is_error(status) && F_status_set_fine(status) != F_failure) break;
- } while (controller_rule_execute_rerun(controller_rule_action_type_to_action_execute_type(action), process, &process->rule.items.array[i]) > 0);
+ } while (controller_rule_execute_rerun(controller_rule_action_type_to_action_execute_type(action), instance, &instance->rule.items.array[i]) > 0);
if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_set_fine(status) == F_lock) break;
if (F_status_is_error(status)) {
- process->rule.items.array[i].actions.array[j].status = F_status_set_error(F_failure);
+ instance->rule.items.array[i].actions.array[j].status = F_status_set_error(F_failure);
- if (!(options & controller_process_option_simulate_d)) break;
+ if (!(options & controller_instance_option_simulate_e)) break;
success = F_status_set_error(F_failure);
}
success = F_true;
}
}
- else if (process->rule.items.array[i].type == controller_rule_item_type_script_e) {
- status = controller_rule_expand(global, process->rule.items.array[i].actions.array[j], process);
+ else if (instance->rule.items.array[i].type == controller_rule_item_type_script_e) {
+ status = controller_rule_expand(global, instance->rule.items.array[i].actions.array[j], instance);
if (F_status_is_error(status)) {
- controller_rule_print_error(global->thread, &global->main->program.error, process->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
+ controller_rule_print_error(global->thread, &global->main->program.error, instance->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
break;
}
- if (process->cache.expanded.used) {
- execute_set.parameter.data = &process->cache.expanded.array[0];
+ if (instance->cache.expanded.used) {
+ execute_set.parameter.data = &instance->cache.expanded.array[0];
}
else {
execute_set.parameter.data = 0;
}
do {
- if (process->rule.engine.used) {
- status = controller_rule_execute_foreground(process->rule.items.array[i].type, process->rule.engine, process->rule.engine_arguments, options, &execute_set, process);
+ if (instance->rule.engine.used) {
+ status = controller_rule_execute_foreground(instance->rule.items.array[i].type, instance->rule.engine, instance->rule.engine_arguments, options, &execute_set, instance);
}
else {
- status = controller_rule_execute_foreground(process->rule.items.array[i].type, *global->main->setting.default_engine, process->rule.engine_arguments, options, &execute_set, process);
+ status = controller_rule_execute_foreground(instance->rule.items.array[i].type, *global->main->setting.default_engine, instance->rule.engine_arguments, options, &execute_set, instance);
}
if (status == F_child || F_status_set_fine(status) == F_lock) break;
if (F_status_is_error(status) && F_status_set_fine(status) != F_failure) break;
- } while (controller_rule_execute_rerun(controller_rule_action_type_to_action_execute_type(action), process, &process->rule.items.array[i]) > 0);
+ } while (controller_rule_execute_rerun(controller_rule_action_type_to_action_execute_type(action), instance, &instance->rule.items.array[i]) > 0);
if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_set_fine(status) == F_lock) break;
if (F_status_is_error(status)) {
- process->rule.items.array[i].actions.array[j].status = F_status_set_error(F_failure);
+ instance->rule.items.array[i].actions.array[j].status = F_status_set_error(F_failure);
- if (!(options & controller_process_option_simulate_d)) break;
+ if (!(options & controller_instance_option_simulate_e)) break;
success = F_status_set_error(F_failure);
}
success = F_true;
}
}
- else if (process->rule.items.array[i].type == controller_rule_item_type_service_e) {
- status = controller_rule_expand(global, process->rule.items.array[i].actions.array[j], process);
+ else if (instance->rule.items.array[i].type == controller_rule_item_type_service_e) {
+ status = controller_rule_expand(global, instance->rule.items.array[i].actions.array[j], instance);
if (F_status_is_error(status)) {
- controller_rule_print_error(global->thread, &global->main->program.error, process->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
+ controller_rule_print_error(global->thread, &global->main->program.error, instance->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
break;
}
- if (process->rule.items.array[i].pid_file.used) {
+ if (instance->rule.items.array[i].pid_file.used) {
do {
- status = controller_rule_execute_pid_with(process->rule.items.array[i].pid_file, process->rule.items.array[i].type, f_string_empty_s, process->cache.expanded, options, process->rule.items.array[i].with, &execute_set, process);
+ status = controller_rule_execute_pid_with(instance->rule.items.array[i].pid_file, instance->rule.items.array[i].type, f_string_empty_s, instance->cache.expanded, options, instance->rule.items.array[i].with, &execute_set, instance);
if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_set_fine(status) == F_lock) break;
if (F_status_is_error(status) && F_status_set_fine(status) != F_failure) break;
- } while (controller_rule_execute_rerun(controller_rule_action_type_to_action_execute_type(action), process, &process->rule.items.array[i]) > 0);
+ } while (controller_rule_execute_rerun(controller_rule_action_type_to_action_execute_type(action), instance, &instance->rule.items.array[i]) > 0);
if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_set_fine(status) == F_lock) break;
if (F_status_is_error(status)) {
- process->rule.items.array[i].actions.array[j].status = F_status_set_error(F_failure);
+ instance->rule.items.array[i].actions.array[j].status = F_status_set_error(F_failure);
- if (!(options & controller_process_option_simulate_d)) break;
+ if (!(options & controller_instance_option_simulate_e)) break;
success = F_status_set_error(F_failure);
}
else {
success = F_status_set_error(F_failure);
- controller_rule_action_print_error_missing_pid(&global->main->program.error, process->rule.alias);
+ controller_rule_action_print_error_missing_pid(&global->main->program.error, instance->rule.alias);
}
}
- else if (process->rule.items.array[i].type == controller_rule_item_type_utility_e) {
- if (process->rule.items.array[i].pid_file.used) {
- status = controller_rule_expand(global, process->rule.items.array[i].actions.array[j], process);
+ else if (instance->rule.items.array[i].type == controller_rule_item_type_utility_e) {
+ if (instance->rule.items.array[i].pid_file.used) {
+ status = controller_rule_expand(global, instance->rule.items.array[i].actions.array[j], instance);
if (F_status_is_error(status)) {
- controller_rule_print_error(global->thread, &global->main->program.error, process->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
+ controller_rule_print_error(global->thread, &global->main->program.error, instance->cache.action, F_status_set_fine(status), "controller_rule_expand", F_true, F_false);
break;
}
- if (process->cache.expanded.used) {
- execute_set.parameter.data = &process->cache.expanded.array[0];
+ if (instance->cache.expanded.used) {
+ execute_set.parameter.data = &instance->cache.expanded.array[0];
}
else {
execute_set.parameter.data = 0;
}
do {
- status = controller_rule_execute_pid_with(process->rule.items.array[i].pid_file, process->rule.items.array[i].type, process->rule.engine.used ? process->rule.engine : *global->main->setting.default_engine, process->rule.engine_arguments, options, process->rule.items.array[i].with, &execute_set, process);
+ status = controller_rule_execute_pid_with(instance->rule.items.array[i].pid_file, instance->rule.items.array[i].type, instance->rule.engine.used ? instance->rule.engine : *global->main->setting.default_engine, instance->rule.engine_arguments, options, instance->rule.items.array[i].with, &execute_set, instance);
if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_set_fine(status) == F_lock) break;
if (F_status_is_error(status) && F_status_set_fine(status) != F_failure) break;
- } while (controller_rule_execute_rerun(controller_rule_action_type_to_action_execute_type(action), process, &process->rule.items.array[i]) > 0);
+ } while (controller_rule_execute_rerun(controller_rule_action_type_to_action_execute_type(action), instance, &instance->rule.items.array[i]) > 0);
if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_set_fine(status) == F_lock) break;
if (F_status_is_error(status)) {
- process->rule.items.array[i].actions.array[j].status = F_status_set_error(F_failure);
+ instance->rule.items.array[i].actions.array[j].status = F_status_set_error(F_failure);
- if (!(options & controller_process_option_simulate_d)) break;
+ if (!(options & controller_instance_option_simulate_e)) break;
success = F_status_set_error(F_failure);
}
else {
success = F_status_set_error(F_failure);
- controller_rule_action_print_error_missing_pid(&global->main->program.error, process->rule.alias);
+ controller_rule_action_print_error_missing_pid(&global->main->program.error, instance->rule.alias);
}
}
else {
fl_print_format("%r%[%QAction type is unknown, ignoring.%]%r", global->main->program.warning.to, f_string_eol_s, global->main->program.warning.context, global->main->program.warning.prefix, global->main->program.warning.context, f_string_eol_s);
- controller_rule_print_rule_message_cache(&global->main->program.warning, process->cache.action, F_true);
+ controller_rule_print_rule_message_cache(&global->main->program.warning, instance->cache.action, F_true);
controller_unlock_print_flush(global->main->program.warning.to, global->thread);
}
}
} // for
- if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_is_error(status) && !(options & controller_process_option_simulate_d)) {
+ if (status == F_child || F_status_set_fine(status) == F_interrupt || F_status_is_error(status) && !(options & controller_instance_option_simulate_e)) {
break;
}
} // for
// Lock failed, attempt to re-establish lock before returning.
if (F_status_set_fine(status) == F_lock) {
- status = controller_lock_read(process, global->thread, &process->lock);
+ status = controller_lock_read(instance, global->thread, &instance->lock);
if (F_status_is_error(status)) return F_status_set_error(F_lock);
success = F_false;
}
- if (!controller_thread_is_enabled_process(process, global->thread)) {
+ if (!controller_main_thread_is_enabled_instance(instance, global->thread)) {
return F_status_set_error(F_interrupt);
}
f_status_t status = F_okay;
f_status_t status_lock = F_okay;
- controller_main_t * const main = (controller_main_t *) process->main_data;
- controller_thread_t * const thread = (controller_thread_t *) process->main_thread;
+ controller_main_t * const main = (controller_main_t *) instance->main_data;
+ controller_thread_t * const thread = (controller_thread_t *) instance->main_thread;
f_execute_result_t result = f_execute_result_t_initialize;
- status = controller_pids_increase(&process->childs);
+ status = controller_pids_increase(&instance->childs);
if (F_status_is_error(status)) {
- controller_main_print_error_status(&global->main->program.error, macro_controller_f(controller_pids_increase), F_status_set_fine(status));
+ controller_main_print_error_status(&main->program.error, macro_controller_f(controller_pids_increase), F_status_set_fine(status));
return status;
}
{
f_number_unsigned_t i = 0;
- while (i < process->childs.used && process->childs.array[i]) {
+ while (i < instance->childs.used && instance->childs.array[i]) {
++i;
} // while
- child = &process->childs.array[i];
+ child = &instance->childs.array[i];
- if (i == process->childs.used) {
- ++process->childs.used;
+ if (i == instance->childs.used) {
+ ++instance->childs.used;
}
}
- if (options & controller_process_option_simulate_d) {
+ if (options & controller_instance_option_simulate_e) {
if (main->program.output.verbosity != f_console_verbosity_quiet_e) {
controller_lock_print(main->program.output.to, thread);
} // for
fl_print_format("%]' from '", main->program.output.to, main->program.context.set.important);
- fl_print_format("%[%Q%]'.%r", main->program.output.to, main->program.context.set.notable, process->rule.name, main->program.context.set.notable, f_string_eol_s);
+ fl_print_format("%[%Q%]'.%r", main->program.output.to, main->program.context.set.notable, instance->rule.name, main->program.context.set.notable, f_string_eol_s);
controller_unlock_print_flush(main->program.output.to, thread);
}
{
const f_time_spec_t delay = controller_time_milliseconds(controller_thread_simulation_timeout_d);
- if (controller_time_sleep_nanoseconds(main, (controller_process_t *) process->main_setting, delay) == -1) {
+ if (controller_time_sleep_nanoseconds(main, (controller_process_t *) instance->main_setting, delay) == -1) {
status = F_status_set_error(F_interrupt);
}
}
if (F_status_set_fine(status) != F_interrupt) {
- fl_execute_parameter_t simulated_parameter = macro_fl_execute_parameter_t_initialize_1(execute_set->parameter.option, execute_set->parameter.wait, process->rule.has & controller_rule_has_environment_d ? execute_set->parameter.environment : 0, execute_set->parameter.signals, &f_string_empty_s);
+ fl_execute_parameter_t simulated_parameter = macro_fl_execute_parameter_t_initialize_1(execute_set->parameter.option, execute_set->parameter.wait, instance->rule.has & controller_rule_has_environment_d ? execute_set->parameter.environment : 0, execute_set->parameter.signals, &f_string_empty_s);
- status = fll_execute_program(*main->setting.default_engine, process->rule.engine_arguments, &simulated_parameter, &execute_set->as, (void *) &result);
+ status = fll_execute_program(*main->setting.default_engine, instance->rule.engine_arguments, &simulated_parameter, &execute_set->as, (void *) &result);
}
}
else {
const pid_t id_child = result.pid;
result.status = 0;
- f_thread_unlock(&process->lock);
+ f_thread_unlock(&instance->lock);
- status_lock = controller_lock_write_process(process, thread, &process->lock);
+ status_lock = controller_lock_write_process(instance, thread, &instance->lock);
if (F_status_is_error(status_lock)) {
- controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, thread);
+ controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false, thread);
if (F_status_set_fine(status_lock) != F_interrupt) {
- status = controller_lock_read_process(process, thread, &process->lock);
+ status = controller_lock_read_process(instance, thread, &instance->lock);
if (status == F_okay) {
return status_lock;
return F_status_set_error(F_lock);
}
- // Assign the child process id to allow for the cancel process to send appropriate termination signals to the child process.
+ // Assign the child instance id to allow for the cancel instance to send appropriate termination signals to the child instance.
*child = id_child;
- f_thread_unlock(&process->lock);
+ f_thread_unlock(&instance->lock);
- status_lock = controller_lock_read_process(process, thread, &process->lock);
+ status_lock = controller_lock_read_process(instance, thread, &instance->lock);
if (F_status_is_error(status_lock)) {
- controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, thread);
+ controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true, thread);
}
if (F_status_set_fine(status_lock) != F_interrupt) {
- // Have the parent wait for the child process to finish.
+ // Have the parent wait for the child instance to finish.
waitpid(id_child, &result.status, 0);
}
- if (F_status_set_fine(status_lock) == F_interrupt || !controller_thread_is_enabled_process(process, thread)) {
+ if (F_status_set_fine(status_lock) == F_interrupt || !controller_main_thread_is_enabled_instance(instance, thread)) {
if (status_lock == F_okay) {
return F_status_set_error(F_interrupt);
}
}
if (status_lock == F_okay) {
- f_thread_unlock(&process->lock);
+ f_thread_unlock(&instance->lock);
}
- status_lock = controller_lock_write_process(process, thread, &process->lock);
+ status_lock = controller_lock_write_process(instance, thread, &instance->lock);
if (F_status_is_error(status_lock)) {
- controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, thread);
+ controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false, thread);
if (F_status_set_fine(status_lock) != F_interrupt) {
- status = controller_lock_read_process(process, thread, &process->lock);
+ status = controller_lock_read_process(instance, thread, &instance->lock);
if (status == F_okay) {
return status_lock;
return F_status_set_error(F_lock);
}
- process->result = result.status;
+ instance->result = result.status;
// Remove the pid now that waidpid() has returned.
*child = 0;
- f_thread_unlock(&process->lock);
+ f_thread_unlock(&instance->lock);
- status_lock = controller_lock_read_process(process, thread, &process->lock);
+ status_lock = controller_lock_read_process(instance, thread, &instance->lock);
if (F_status_is_error(status_lock)) {
- controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, thread);
+ controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true, thread);
return F_status_set_error(F_lock);
}
else {
main->program.child = result.status;
- if (!controller_thread_is_enabled_process(process, thread)) {
+ if (!controller_main_thread_is_enabled_instance(instance, thread)) {
return F_status_set_error(F_interrupt);
}
}
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
- if ((WIFEXITED(process->result) && WEXITSTATUS(process->result)) || status == F_control_group || status == F_failure || status == F_limit || status == F_processor || status == F_schedule) {
- controller_rule_item_print_error_execute(type == controller_rule_item_type_script_e, program.used ? program : arguments.array[0], status, process);
+ if ((WIFEXITED(instance->result) && WEXITSTATUS(instance->result)) || status == F_control_group || status == F_failure || status == F_limit || status == F_processor || status == F_schedule) {
+ controller_rule_item_print_error_execute(type == controller_rule_item_type_script_e, program.used ? program : arguments.array[0], status, instance);
}
else {
- controller_main_print_error_status(&global->main->program.error, macro_controller_f(fll_execute_program), F_status_set_fine(status));
+ controller_main_print_error_status(&main->program.error, macro_controller_f(fll_execute_program), F_status_set_fine(status));
}
status = F_status_set_error(status);
f_status_t status = F_okay;
f_status_t status_lock = F_okay;
- controller_main_t * const main = (controller_main_t *) process->main_data;
- controller_thread_t * const thread = (controller_thread_t *) process->main_thread;
+ controller_main_t * const main = (controller_main_t *) instance->main_data;
+ controller_thread_t * const thread = (controller_thread_t *) instance->main_thread;
f_execute_result_t result = f_execute_result_t_initialize;
- status = controller_pids_increase(&process->childs);
+ status = controller_pids_increase(&instance->childs);
if (F_status_is_error(status)) {
- controller_main_print_error_status(&global->main->program.error, macro_controller_f(controller_pids_increase), F_status_set_fine(status));
+ controller_main_print_error_status(&main->program.error, macro_controller_f(controller_pids_increase), F_status_set_fine(status));
return status;
}
- status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &process->path_pids.array, &process->path_pids.used, &process->path_pids.size);
+ status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &instance->path_pids.array, &instance->path_pids.used, &instance->path_pids.size);
if (F_status_is_error(status)) {
- controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_memory_array_increase), F_status_set_fine(status));
+ controller_main_print_error_status(&main->program.error, macro_controller_f(f_memory_array_increase), F_status_set_fine(status));
return status;
}
{
f_number_unsigned_t i = 0;
- while (i < process->childs.used && process->childs.array[i]) {
+ while (i < instance->childs.used && instance->childs.array[i]) {
++i;
} // while
- child = &process->childs.array[i];
+ child = &instance->childs.array[i];
- if (i == process->childs.used) {
- ++process->childs.used;
+ if (i == instance->childs.used) {
+ ++instance->childs.used;
}
i = 0;
- while (i < process->path_pids.used && process->path_pids.array[i].used) {
+ while (i < instance->path_pids.used && instance->path_pids.array[i].used) {
++i;
} // while
- child_pid_file = &process->path_pids.array[i];
+ child_pid_file = &instance->path_pids.array[i];
- if (i == process->path_pids.used) {
- ++process->path_pids.used;
+ if (i == instance->path_pids.used) {
+ ++instance->path_pids.used;
}
}
status = f_file_exists(pid_file, F_true);
if (F_status_is_error(status) || status == F_true) {
- controller_main_print_error_file_status(&global->main->program.error, macro_controller_f(f_file_exists), status == F_true ? F_file_found : F_status_set_fine(status), pid_file, f_file_operation_find_s, fll_error_file_type_file_e);
+ controller_main_print_error_file_status(&main->program.error, macro_controller_f(f_file_exists), status == F_true ? F_file_found : F_status_set_fine(status), pid_file, f_file_operation_find_s, fll_error_file_type_file_e);
return status;
}
status = f_string_dynamic_append_nulless(pid_file, child_pid_file);
if (F_status_is_error(status)) {
- controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_string_dynamic_append_nulless), F_status_set_fine(status));
+ controller_main_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append_nulless), F_status_set_fine(status));
return status;
}
- if (options & controller_process_option_simulate_d) {
+ if (options & controller_instance_option_simulate_e) {
if (main->program.error.verbosity > f_console_verbosity_error_e) {
controller_lock_print(main->program.error.to, thread);
} // for
fl_print_format("%]' from '", main->program.error.to, main->program.context.set.important);
- fl_print_format("%[%Q%]'.%r", main->program.error.to, main->program.context.set.notable, process->rule.name, main->program.context.set.notable, f_string_eol_s);
+ fl_print_format("%[%Q%]'.%r", main->program.error.to, main->program.context.set.notable, instance->rule.name, main->program.context.set.notable, f_string_eol_s);
controller_unlock_print_flush(main->program.error.to, thread);
}
{
const f_time_spec_t delay = controller_time_milliseconds(controller_thread_simulation_timeout_d);
- if (controller_time_sleep_nanoseconds(main, (controller_process_t *) process->main_setting, delay) == -1) {
+ if (controller_time_sleep_nanoseconds(main, (controller_process_t *) instance->main_setting, delay) == -1) {
status = F_status_set_error(F_interrupt);
}
}
if (F_status_set_fine(status) != F_interrupt) {
const f_string_statics_t simulated_arguments = f_string_statics_t_initialize;
- fl_execute_parameter_t simulated_parameter = macro_fl_execute_parameter_t_initialize_1(execute_set->parameter.option, execute_set->parameter.wait, process->rule.has & controller_rule_has_environment_d ? execute_set->parameter.environment : 0, execute_set->parameter.signals, &f_string_empty_s);
+ fl_execute_parameter_t simulated_parameter = macro_fl_execute_parameter_t_initialize_1(execute_set->parameter.option, execute_set->parameter.wait, instance->rule.has & controller_rule_has_environment_d ? execute_set->parameter.environment : 0, execute_set->parameter.signals, &f_string_empty_s);
status = fll_execute_program(*main->setting.default_engine, simulated_arguments, &simulated_parameter, &execute_set->as, (void *) &result);
}
const pid_t id_child = result.pid;
result.status = 0;
- f_thread_unlock(&process->lock);
+ f_thread_unlock(&instance->lock);
- status_lock = controller_lock_write_process(process, thread, &process->lock);
+ status_lock = controller_lock_write_process(instance, thread, &instance->lock);
if (F_status_is_error(status_lock)) {
- controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, thread);
+ controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false, thread);
if (F_status_set_fine(status_lock) != F_interrupt) {
- status = controller_lock_read_process(process, thread, &process->lock);
+ status = controller_lock_read_process(instance, thread, &instance->lock);
if (status == F_okay) {
return status_lock;
return F_status_set_error(F_lock);
}
- // Assign the child process id to allow for the cancel process to send appropriate termination signals to the child process.
+ // Assign the child instance id to allow for the cancel instance to send appropriate termination signals to the child instance.
*child = id_child;
- f_thread_unlock(&process->lock);
+ f_thread_unlock(&instance->lock);
- status_lock = controller_lock_read_process(process, thread, &process->lock);
+ status_lock = controller_lock_read_process(instance, thread, &instance->lock);
if (F_status_is_error(status_lock)) {
- controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, thread);
+ controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true, thread);
}
if (F_status_set_fine(status_lock) != F_interrupt) {
- // The child process should perform the change into background, therefore it is safe to wait for the child to exit (another process is spawned).
+ // The child instance should perform the change into background, therefore it is safe to wait for the child to exit (another instance is spawned).
waitpid(id_child, &result.status, 0);
}
- if (!controller_thread_is_enabled_process(process, thread)) {
+ if (!controller_main_thread_is_enabled_instance(instance, thread)) {
if (status_lock == F_okay) {
return F_status_set_error(F_interrupt);
}
}
if (status_lock == F_okay) {
- f_thread_unlock(&process->lock);
+ f_thread_unlock(&instance->lock);
}
- status_lock = controller_lock_write_process(process, thread, &process->lock);
+ status_lock = controller_lock_write_process(instance, thread, &instance->lock);
if (F_status_is_error(status_lock)) {
- controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, thread);
+ controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_false, thread);
if (F_status_set_fine(status_lock) != F_interrupt) {
- status = controller_lock_read_process(process, thread, &process->lock);
+ status = controller_lock_read_process(instance, thread, &instance->lock);
if (status == F_okay) {
return status_lock;
return F_status_set_error(F_lock);
}
- process->result = result.status;
+ instance->result = result.status;
// Remove the pid now that waidpid() has returned.
*child = 0;
- f_thread_unlock(&process->lock);
+ f_thread_unlock(&instance->lock);
- status_lock = controller_lock_read_process(process, thread, &process->lock);
+ status_lock = controller_lock_read_process(instance, thread, &instance->lock);
if (F_status_is_error(status_lock)) {
- controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, thread);
+ controller_lock_print_error_critical(&main->program.error, F_status_set_fine(status_lock), F_true, thread);
return F_status_set_error(F_lock);
}
else {
main->program.child = result.status;
- if (!controller_thread_is_enabled_process(process, thread)) {
+ if (!controller_main_thread_is_enabled_instance(instance, thread)) {
return F_status_set_error(F_interrupt);
}
}
if (F_status_is_error(status)) {
status = F_status_set_fine(status);
- if ((WIFEXITED(process->result) && WEXITSTATUS(process->result)) || status == F_control_group || status == F_failure || status == F_limit || status == F_processor || status == F_schedule) {
- controller_rule_item_print_error_execute(type == controller_rule_item_type_utility_e, program.used ? program : arguments.array[0], status, process);
+ if ((WIFEXITED(instance->result) && WEXITSTATUS(instance->result)) || status == F_control_group || status == F_failure || status == F_limit || status == F_processor || status == F_schedule) {
+ controller_rule_item_print_error_execute(type == controller_rule_item_type_utility_e, program.used ? program : arguments.array[0], status, instance);
}
else {
- controller_main_print_error_status(&global->main->program.error, macro_controller_f(fll_execute_program), F_status_set_fine(status));
+ controller_main_print_error_status(&main->program.error, macro_controller_f(fll_execute_program), F_status_set_fine(status));
}
return F_status_set_error(status);
if (!instance || !item) return F_status_set_error(F_parameter);
- const int result = WIFEXITED(process->result) ? WEXITSTATUS(process->result) : 0;
+ const int result = WIFEXITED(instance->result) ? WEXITSTATUS(instance->result) : 0;
if (item->reruns[action].is & (result ? controller_rule_rerun_is_failure_d : controller_rule_rerun_is_success_d)) {
- controller_main_t * const main = (controller_main_t *) process->main_data;
- controller_thread_t * const thread = (controller_thread_t *) process->main_thread;
+ controller_main_t * const main = (controller_main_t *) instance->main_data;
+ controller_thread_t * const thread = (controller_thread_t *) instance->main_thread;
controller_rule_rerun_item_t *rerun_item = result ? &item->reruns[action].failure : &item->reruns[action].success;
- if (!controller_thread_is_enabled_process(process, thread)) return -2;
+ if (!controller_main_thread_is_enabled_instance(instance, thread)) return -2;
if (!rerun_item->max || rerun_item->count < rerun_item->max) {
if (main->program.error.verbosity == f_console_verbosity_debug_e) {
controller_lock_print(main->program.output.to, thread);
fl_print_format("%rRe-running '", main->program.output.to, f_string_eol_s);
- fl_print_format("%[%r%]' '", main->program.output.to, main->program.context.set.title, process->rule.alias, main->program.context.set.title);
+ fl_print_format("%[%r%]' '", main->program.output.to, main->program.context.set.title, instance->rule.alias, main->program.context.set.title);
fl_print_format("%[%r%]' with a ", main->program.output.to, main->program.context.set.notable, controller_rule_action_execute_type_name(action), main->program.context.set.notable);
fl_print_format("%[%r%] of ", main->program.output.to, main->program.context.set.notable, controller_delay_s, main->program.context.set.notable);
fl_print_format("%[%ul%] MegaTime", main->program.output.to, main->program.context.set.notable, rerun_item->delay, main->program.context.set.notable);
if (rerun_item->delay) {
const f_time_spec_t delay = controller_time_milliseconds(rerun_item->delay);
- if (controller_time_sleep_nanoseconds(main, (controller_process_t *) process->main_setting, delay) == -1) {
+ if (controller_time_sleep_nanoseconds(main, (controller_process_t *) instance->main_setting, delay) == -1) {
return -1;
}
- if (!controller_thread_is_enabled_process(process, thread)) return -2;
+ if (!controller_main_thread_is_enabled_instance(instance, thread)) return -2;
}
if (item->reruns[action].is & (result ? controller_rule_rerun_is_failure_reset_d : controller_rule_rerun_is_success_reset_d)) {
* - controller_rule_action_type_stop_e
* @param options
* Process options to consider when executing.
- * If bit controller_process_option_simulate_d, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
+ * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
* @param process
* The process data for processing this rule.
*
* The arguments to pass to the program.
* @param options
* Process options to consider when executing.
- * If bit controller_process_option_simulate_d, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
+ * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
* @param execute_set
* The execute parameter and as settings.
* @param process
* The arguments to pass to the program.
* @param options
* Process options to consider when executing.
- * If bit controller_process_option_simulate_d, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
+ * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
* @param with
* The "with" option flags.
* @param execute_set
} // for
if (i == process->rule.define.used) {
- controller_entry_t * const entry = process->type == controller_data_type_entry_e ? &((controller_process_t *) process->main_setting)->entry : &((controller_process_t *) process->main_setting)->exit;
+ controller_entry_t * const entry = process->type == controller_instance_type_entry_e ? &((controller_process_t *) process->main_setting)->entry : &((controller_process_t *) process->main_setting)->exit;
for (i = 0; i < entry->define.used; ++i) {
} // for
if (i == process->rule.parameter.used) {
- controller_entry_t * const entry = process->type == controller_data_type_entry_e ? &((controller_process_t *) process->main_setting)->entry : &((controller_process_t *) process->main_setting)->exit;
+ controller_entry_t * const entry = process->type == controller_instance_type_entry_e ? &((controller_process_t *) process->main_setting)->entry : &((controller_process_t *) process->main_setting)->exit;
for (i = 0; i < entry->parameter.used; ++i) {
f_console_standard_long_normal_s,
f_console_standard_long_verbose_s,
f_console_standard_long_debug_s,
- controller_long_init_s,
controller_long_interruptible_s,
controller_long_daemon_s,
controller_long_simulate_s,
f_console_symbol_short_inverse_s, // normal.
f_console_symbol_short_inverse_s, // verbose.
f_console_symbol_short_inverse_s, // debug.
- f_console_symbol_short_normal_s, // daemon.
- f_console_symbol_short_normal_s, // init.
f_console_symbol_short_normal_s, // interruptible.
+ f_console_symbol_short_normal_s, // daemon.
f_console_symbol_short_normal_s, // simulate.
f_console_symbol_short_normal_s, // uninterruptible.
f_console_symbol_short_normal_s, // validate.
f_console_standard_short_normal_s,
f_console_standard_short_verbose_s,
f_console_standard_short_debug_s,
- controller_short_init_s,
controller_short_interruptible_s,
controller_short_daemon_s,
controller_short_simulate_s,
};
const uint8_t codes[] = {
- f_console_standard_parameter_help_e,
+ f_console_standard_parameter_light_e,
f_console_standard_parameter_dark_e,
f_console_standard_parameter_no_color_e,
f_console_standard_parameter_verbosity_quiet_e,
f_console_standard_parameter_verbosity_normal_e,
f_console_standard_parameter_verbosity_verbose_e,
f_console_standard_parameter_verbosity_debug_e,
- controller_parameter_init_e,
controller_parameter_interruptible_e,
controller_parameter_daemon_e,
controller_parameter_simulate_e,
F_false, // normal.
F_false, // verbose.
F_false, // debug.
- F_false, // daemon.
- F_false, // init.
F_false, // interruptible.
+ F_false, // daemon.
F_false, // simulate.
F_false, // uninterruptible.
F_false, // validate.
F_true, // socket.
};
- for (f_number_unsigned_t i = 0; i < 17; ++i) {
+ for (f_number_unsigned_t i = 0; i < 16; ++i) {
if (f_compare_dynamic_partial_string(options[i].string, source, options[i].used, content) == F_equal_to) {
if (values[i]) {
return status;
}
- if ((instance->options & controller_instance_option_simulate_d) && (instance->options & controller_instance_option_validate_d)) {
+ if ((instance->options & controller_instance_option_simulate_e) && (instance->options & controller_instance_option_validate_e)) {
controller_rule_validate(global, instance->rule, instance->action, instance->options, &instance->cache);
}
status = F_false;
}
else {
- status = controller_rule_find(dynamics[i]->array[j], global->setting->rules, &id_rule);
+ status = controller_rule_find(dynamics[i]->array[j], global->program->rules, &id_rule);
f_thread_unlock(&global->thread->lock.rule);
}
status = F_status_set_error(F_found_not);
- if (!(instance->options & controller_instance_option_simulate_d)) {
+ if (!(instance->options & controller_instance_option_simulate_e)) {
if (dependency) {
f_thread_unlock(&dependency->active);
}
// The dependency may have write locks, which needs to be avoided, so copy the alias from the rule.
f_string_static_t alias_other_buffer = f_string_static_t_initialize;
- alias_other_buffer.used = global->setting->rules.array[id_rule].alias.used;
+ alias_other_buffer.used = global->program->rules.array[id_rule].alias.used;
f_char_t alias_other_buffer_string[alias_other_buffer.used + 1];
alias_other_buffer.string = alias_other_buffer_string;
- memcpy(alias_other_buffer_string, global->setting->rules.array[id_rule].alias.string, sizeof(f_char_t) * alias_other_buffer.used);
+ memcpy(alias_other_buffer_string, global->program->rules.array[id_rule].alias.string, sizeof(f_char_t) * alias_other_buffer.used);
alias_other_buffer_string[alias_other_buffer.used] = 0;
f_thread_unlock(&global->thread->lock.rule);
status = controller_instance_wait(global, dependency);
- if (F_status_is_error(status) && !(instance->options & controller_instance_option_simulate_d)) break;
+ if (F_status_is_error(status) && !(instance->options & controller_instance_option_simulate_e)) break;
status = dependency->rule.status[instance->action];
}
status = status_lock;
}
- else if (controller_rule_status_is_available(instance->action, global->setting->rules.array[id_rule])) {
+ else if (controller_rule_status_is_available(instance->action, global->program->rules.array[id_rule])) {
f_thread_unlock(&global->thread->lock.rule);
f_thread_unlock(&dependency->lock);
options_instance = 0;
if (global->main->program.parameters.array[controller_parameter_simulate_e].result & f_console_result_found_e) {
- options_instance |= controller_instance_option_simulate_d;
+ options_instance |= controller_instance_option_simulate_e;
}
- if (instance->options & controller_instance_option_validate_d) {
- options_instance |= controller_instance_option_validate_d;
+ if (instance->options & controller_instance_option_validate_e) {
+ options_instance |= controller_instance_option_validate_e;
}
// Synchronously execute dependency.
controller_unlock_print_flush(global->main->program.error.to, global->thread);
- if (!(dependency->options & controller_instance_option_simulate_d) || F_status_set_fine(status) == F_memory_not) {
+ if (!(dependency->options & controller_instance_option_simulate_e) || F_status_set_fine(status) == F_memory_not) {
f_thread_unlock(&dependency->active);
break;
}
}
else {
- status = global->setting->rules.array[id_rule].status[instance->action];
+ status = global->program->rules.array[id_rule].status[instance->action];
f_thread_unlock(&global->thread->lock.rule);
f_thread_unlock(&dependency->lock);
status = status_lock;
}
- else if (controller_rule_status_is_error(instance->action, global->setting->rules.array[id_rule])) {
+ else if (controller_rule_status_is_error(instance->action, global->program->rules.array[id_rule])) {
f_thread_unlock(&global->thread->lock.rule);
if (i == 0 || i == 1) {
status = F_status_set_error(F_found_not);
- if (!(dependency->options & controller_instance_option_simulate_d)) {
+ if (!(dependency->options & controller_instance_option_simulate_e)) {
f_thread_unlock(&dependency->active);
break;
if (status == F_child || F_status_set_fine(status) == F_interrupt) break;
- if (F_status_is_error(status) && !(instance->options & controller_instance_option_simulate_d)) break;
+ if (F_status_is_error(status) && !(instance->options & controller_instance_option_simulate_e)) break;
} // for
}
return F_status_set_error(F_interrupt);
}
- if ((instance->options & controller_instance_option_wait_d) && F_status_is_error_not(status) && (instance->options & controller_instance_option_validate_d)) {
+ if ((instance->options & controller_instance_option_wait_e) && F_status_is_error_not(status) && (instance->options & controller_instance_option_validate_e)) {
status_lock = controller_rule_wait_all_instance_type(global, instance->type, F_false);
if (F_status_set_fine(status_lock) == F_interrupt) {
}
}
- if (!(instance->options & controller_instance_option_validate_d) && F_status_is_error_not(status)) {
+ if (!(instance->options & controller_instance_option_validate_e) && F_status_is_error_not(status)) {
// Find at least one of the requested action when the rule is required.
- if (instance->options & controller_instance_option_require_d) {
+ if (instance->options & controller_instance_option_require_e) {
bool missing = F_true;
f_number_unsigned_t j = 0;
}
if (F_status_is_error(status)) {
- instance->rule.status[instance->action] = controller_status_simplify_error(F_status_set_fine(status));
+ instance->rule.status[instance->action] = controller_main_error_simplify(F_status_set_fine(status));
}
else {
instance->rule.status[instance->action] = status;
}
// Update the global rule status, which is stored separately from the rule status for this instance.
- if (controller_rule_find(instance->rule.alias, global->setting->rules, &id_rule) == F_true) {
- controller_rule_t *rule = &global->setting->rules.array[id_rule];
+ if (controller_rule_find(instance->rule.alias, global->program->rules, &id_rule) == F_true) {
+ controller_rule_t *rule = &global->program->rules.array[id_rule];
rule->status[instance->action] = instance->rule.status[instance->action];
f_thread_unlock(&instance->lock);
if (F_status_is_error_not(status)) {
- if (instance->action && (options_force & controller_instance_option_asynchronous_d)) {
+ if (instance->action && (options_force & controller_instance_option_asynchronous_e)) {
if (instance->type == controller_instance_type_exit_e) {
status = f_thread_create(0, &instance->id_thread, controller_main_thread_instance_other, (void *) instance);
}
}
}
- if (!action || (options_force & controller_instance_option_asynchronous_d)) {
+ if (!action || (options_force & controller_instance_option_asynchronous_e)) {
instance->state = controller_instance_state_done_e;
}
else {
f_status_t status_lock = F_okay;
- controller_global_t * const global = macro_controller_global_t_initialize_1((controller_main_t *) instance->main_data, (controller_instance_t *) instance->main_setting, (controller_thread_t *) instance->main_thread);
+ controller_global_t global = macro_controller_global_t_initialize((controller_main_t *) instance->main_data, (controller_instance_t *) instance->main_setting, (controller_thread_t *) instance->main_thread);
+
+ global->message = global->main->program.message;
+ global->output = global->main->program.output;
+ global->error = global->main->program.error;
+ global->warning = global->main->program.warning;
+ global->debug = global->main->program.debug;
+
+ global->message.custom = (void *) &global;
+ global->output.custom = (void *) &global;
+ global->error.custom = (void *) &global;
+ global->warning.custom = (void *) &global;
+ global->debug.custom = (void *) &global;
// The instance and active locks shall be held for the duration of this instanceing (aside from switching between read to/from write).
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
status_lock = controller_lock_read_instance(instance, global->thread, &instance->active);
if (F_status_is_error(status_lock)) {
if (F_status_is_error(status_lock)) {
controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
f_thread_unlock(&instance->active);
}
f_thread_unlock(&instance->lock);
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
f_thread_unlock(&instance->active);
}
return status_lock;
}
- if (controller_rule_find(instance->rule.alias, global->setting->rules, &id_rule) == F_true) {
+ if (controller_rule_find(instance->rule.alias, global->program->rules, &id_rule) == F_true) {
f_thread_unlock(&instance->lock);
status_lock = controller_lock_write_instance(instance, global->thread, &instance->lock);
f_thread_unlock(&global->thread->lock.rule);
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
f_thread_unlock(&instance->active);
}
controller_rule_delete(&instance->rule);
- status = controller_rule_copy(global->setting->rules.array[id_rule], &instance->rule);
+ status = controller_rule_copy(global->program->rules.array[id_rule], &instance->rule);
f_thread_unlock(&instance->lock);
f_thread_unlock(&global->thread->lock.rule);
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
f_thread_unlock(&instance->active);
}
// This is a "consider" Action, so do not actually execute the rule.
f_thread_unlock(&instance->lock);
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
f_thread_unlock(&instance->active);
}
if (!controller_thread_is_enabled_instance(instance, global->thread)) {
f_thread_unlock(&instance->lock);
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
f_thread_unlock(&instance->active);
}
if (F_status_is_error(status_lock)) {
controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, global->thread);
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
f_thread_unlock(&instance->active);
}
if (F_status_is_error(status_lock)) {
controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_true, global->thread);
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
f_thread_unlock(&instance->active);
}
if (status == F_child) {
f_thread_unlock(&instance->lock);
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
f_thread_unlock(&instance->active);
}
f_thread_unlock(&instance->lock);
}
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
f_thread_unlock(&instance->active);
}
}
if (F_status_set_fine(status) == F_lock) {
- if (controller_rule_find(instance->rule.alias, global->setting->rules, &id_rule) == F_true) {
- global->setting->rules.array[id_rule].status[instance->action] = status;
+ if (controller_rule_find(instance->rule.alias, global->program->rules, &id_rule) == F_true) {
+ global->program->rules.array[id_rule].status[instance->action] = status;
}
}
}
if (F_status_set_fine(status) == F_interrupt || F_status_set_fine(status) == F_lock && !controller_thread_is_enabled_instance(instance, global->thread)) {
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
f_thread_unlock(&instance->active);
}
if (F_status_is_error(status_lock)) {
controller_lock_print_error_critical(&global->main->program.error, F_status_set_fine(status_lock), F_false, global->thread);
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
f_thread_unlock(&instance->active);
}
return status_lock;
}
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
instance->state = controller_instance_state_done_e;
}
else {
f_thread_unlock(&instance->lock);
- if (options_force & controller_instance_option_asynchronous_d) {
+ if (options_force & controller_instance_option_asynchronous_e) {
f_thread_unlock(&instance->active);
}
* @param options_force
* Force the given instance options, only supporting a subset of instance options.
*
- * If controller_instance_option_asynchronous_d, then asynchronously execute.
- * If not controller_instance_option_asynchronous_d, then synchronously execute.
+ * If controller_instance_option_asynchronous_e, then asynchronously execute.
+ * If not controller_instance_option_asynchronous_e, then synchronously execute.
* @param alias_rule
* The alias of the rule, such as "boot/init".
* @param action
* @param options
* The instance options to pass to the instance.
* @param type
- * The instance type, such as controller_data_type_entry_e.
+ * The instance type, such as controller_instance_type_entry_e.
* @param stack
* A stack representing the instances already running in this rule instance dependency tree.
* This is used to prevent circular dependencies.
* @param options_force
* Force the given instance options, only supporting a subset of instance options.
*
- * If controller_instance_option_asynchronous_d, then asynchronously execute.
- * If not controller_instance_option_asynchronous_d, then synchronously execute.
+ * If controller_instance_option_asynchronous_e, then asynchronously execute.
+ * If not controller_instance_option_asynchronous_e, then synchronously execute.
* @param instance
* The instance data.
*
method = controller_rule_action_method_extended_e;
}
- status = controller_rule_actions_increase_by(controller_allocation_small_d, &item->actions);
+ status = f_memory_array_increase_by(controller_allocation_small_d, sizeof(controller_rule_action_t), (void **) &item->actions.array, &item->actions.used, &item->actions.size);
if (F_status_is_error(status)) {
- controller_main_print_error_status(&global->main->program.error, macro_controller_f(controller_rule_actions_increase_by), F_status_set_fine(status));
+ controller_main_print_error_status(&global->main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(status));
break;
}
if (F_status_is_error(status)) {
controller_rule_item_print_error(global->thread, &global->main->program.error, cache->action, for_item, F_status_set_fine(status));
- rule->status[0] = controller_status_simplify_error(F_status_set_fine(status));
+ rule->status[0] = controller_main_error_simplify(F_status_set_fine(status));
return rule->status[0];
}
* @return
* F_okay on success.
*
- * Simplified status (with error bit) from controller_status_simplify_error() on failure.
+ * Simplified status (with error bit) from controller_main_error_simplify() on failure.
*
* @see controller_rule_items_increase_by().
* @see controller_rule_item_read().
extern f_status_t controller_rule_read(controller_global_t * const global, const bool is_normal, const f_string_static_t alias, controller_cache_t * const cache, controller_entry_t * const entry, controller_rule_t * const rule);
#endif // _di_controller_rule_read_
-/**
- * Process a number from a rule file, incrementing index as necessary.
- *
- * This prints error messages as necessary.
- *
- * This is intended to be called by controller_rule_action_read().
- *
- * @param global
- * The global data.
- * Must not be NULL.
- *
- * This does not alter global.main.setting.state.status.
- * @param name
- * The name representing the value whose number is being processed.
- * @param cache
- * A structure for containing and caching relevant data.
- * @param index
- * The position within the content action array for some rule to process.
- * @param number
- * The processed number will be saved here.
- *
- * @return
- * F_okay on success.
- *
- * F_valid_not (with error bit) on failure due to invalid value.
- *
- * Errors (with error bit) from: fl_conversion_dynamic_partial_to_signed_detect().
- *
- * @see controller_rule_action_read()
- * @see fl_conversion_dynamic_partial_to_signed_detect()
- */
-#ifndef _di_controller_rule_action_read_rerun_number_
- extern f_status_t controller_rule_action_read_rerun_number(controller_global_t * const global, const f_string_t name, controller_cache_t * const cache, f_number_unsigned_t * const index, f_number_unsigned_t * const number);
-#endif // _di_controller_rule_action_read_rerun_number_
-
#ifdef __cplusplus
} // extern "C"
status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, cache->content_actions.array[i].array[j], &number);
if (F_status_set_fine(status) == F_number_positive) {
- status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[j]), &number);
+ status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_main_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[j]), &number);
// Restore error on parameter problem.
if (F_status_set_fine(status) == F_parameter) {
rule->cgroup.path.used = 0;
- status = f_string_dynamic_append(global->setting->path_cgroup, &rule->cgroup.path);
+ status = f_string_dynamic_append(global->program->path_cgroup, &rule->cgroup.path);
if (F_status_is_error(status)) {
controller_rule_print_error(global->thread, &global->main->program.error, cache->action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_false);
fl_print_format(f_string_format_Q_single_s.string, global->main->program.error.to, global->main->program.error.notable, cache->action.name_action, global->main->program.error.notable);
fl_print_format(f_string_format_sentence_end_quote_s.string, global->main->program.error.to, global->main->program.error.context, global->main->program.error.context, f_string_eol_s);
- controller_rule_print_rule_message_cache(&global->main->program.error, cache->action, F_true);
+ controller_rule_print_rule_message_cache(&global->main->program.error, &cache->action, F_true);
controller_unlock_print_flush(global->main->program.error.to, global->thread);
}
status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, cache->content_actions.array[i].array[j], &number);
if (F_status_set_fine(status) == F_number_positive) {
- status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[j]), &number);
+ status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_main_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[j]), &number);
// Restore error on parameter problem.
if (F_status_set_fine(status) == F_parameter) {
status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, cache->content_actions.array[i].array[1], &number);
if (F_status_set_fine(status) == F_number_positive) {
- status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[1]), &number);
+ status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_main_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[1]), &number);
// Restore error on parameter problem.
if (F_status_set_fine(status) == F_parameter) {
status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, cache->buffer_item, cache->content_actions.array[i].array[1], &number);
if (F_status_set_fine(status) == F_number_positive) {
- status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[1]), &number);
+ status = fl_conversion_dynamic_partial_to_unsigned_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_main_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[1]), &number);
// Restore error on parameter problem.
if (F_status_set_fine(status) == F_parameter) {
status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, cache->content_actions.array[i].array[0], &number);
if (F_status_set_fine(status) == F_number_positive) {
- status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[0]), &number);
+ status = fl_conversion_dynamic_partial_to_signed_detect(fl_conversion_data_base_10_c, cache->buffer_item, controller_main_range_after_number_sign(cache->buffer_item, cache->content_actions.array[i].array[0]), &number);
// Restore error on parameter problem.
if (F_status_set_fine(status) == F_parameter) {
fl_print_format(f_string_format_r_single_s.string, main->program.error.to, main->program.error.notable, controller_rule_action_type_name(action), main->program.error.notable);
fl_print_format("%[' while attempting to validate rule execution.%]%r", main->program.error.to, main->program.error.context, main->program.error.context, f_string_eol_s);
- controller_rule_print_rule_message_cache(&global->main->program.error, cache->action, F_true);
+ controller_rule_print_rule_message_cache(&global->main->program.error, &cache->action, F_true);
controller_unlock_print_flush(main->program.error.to, global->thread);
}
fl_print_format("%rRule '", main->program.output.to, f_string_eol_s);
fl_print_format("%[%Q%]' has no '", main->program.output.to, main->program.context.set.title, rule.name, main->program.context.set.title);
fl_print_format("%[%r%]' action to execute and would '", main->program.output.to, main->program.context.set.title, controller_rule_action_type_name(action), main->program.context.set.title);
- fl_print_format("%[%r%]' because it is '", main->program.output.to, main->program.context.set.important, options & controller_process_option_require_d ? controller_fail_s : controller_succeed_s, main->program.context.set.important);
- fl_print_format("%[%r%]'.%r", main->program.output.to, main->program.context.set.important, options & controller_process_option_require_d ? controller_required_s : controller_optional_s, main->program.context.set.important, f_string_eol_s);
+ fl_print_format("%[%r%]' because it is '", main->program.output.to, main->program.context.set.important, options & controller_instance_option_require_e ? controller_fail_s : controller_succeed_s, main->program.context.set.important);
+ fl_print_format("%[%r%]'.%r", main->program.output.to, main->program.context.set.important, options & controller_instance_option_require_e ? controller_required_s : controller_optional_s, main->program.context.set.important, f_string_eol_s);
}
else {
fl_print_format("%rRule '", main->program.output.to, f_string_eol_s);
fl_print_format("'%[%r%]', ", main->program.output.to, main->program.context.set.title, controller_service_s, main->program.context.set.title);
fl_print_format("'%[%r%]', or ", main->program.output.to, main->program.context.set.title, controller_script_s, main->program.context.set.title);
fl_print_format("'%[%r%]'", main->program.output.to, main->program.context.set.title, controller_utility_s, main->program.context.set.title);
- fl_print_format(") and would '%[%r%]' because it is '", main->program.output.to, main->program.context.set.important, options & controller_process_option_require_d ? controller_fail_s : controller_succeed_s, main->program.context.set.important);
- fl_print_format("%[%r%]'.%r", main->program.output.to, main->program.context.set.important, options & controller_process_option_require_d ? controller_required_s : controller_optional_s, main->program.context.set.important, f_string_eol_s);
+ fl_print_format(") and would '%[%r%]' because it is '", main->program.output.to, main->program.context.set.important, options & controller_instance_option_require_e ? controller_fail_s : controller_succeed_s, main->program.context.set.important);
+ fl_print_format("%[%r%]'.%r", main->program.output.to, main->program.context.set.important, options & controller_instance_option_require_e ? controller_required_s : controller_optional_s, main->program.context.set.important, f_string_eol_s);
}
controller_unlock_print_flush(main->program.output.to, global->thread);
f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
// How.
- fl_print_format(" %[%r%] %r%r", main->program.output.to, main->program.context.set.important, controller_how_s, main->program.context.set.important, options & controller_process_option_asynchronous_d ? controller_asynchronous_s : controller_synchronous_s, f_string_eol_s);
+ fl_print_format(" %[%r%] %r%r", main->program.output.to, main->program.context.set.important, controller_how_s, main->program.context.set.important, options & controller_instance_option_asynchronous_e ? controller_asynchronous_s : controller_synchronous_s, f_string_eol_s);
// Nice.
fl_print_format(" %[%r%]", main->program.output.to, main->program.context.set.important, controller_nice_s, main->program.context.set.important);
f_print_dynamic_raw(f_string_eol_s, main->program.output.to);
// Wait.
- fl_print_format(" %[%r%] %r%r", main->program.output.to, main->program.context.set.important, controller_wait_s, main->program.context.set.important, options & controller_process_option_wait_d ? controller_yes_s : controller_no_s, f_string_eol_s);
+ fl_print_format(" %[%r%] %r%r", main->program.output.to, main->program.context.set.important, controller_wait_s, main->program.context.set.important, options & controller_instance_option_wait_e ? controller_yes_s : controller_no_s, f_string_eol_s);
// Affinity.
fl_print_format(" %[%r%] {%r", main->program.output.to, main->program.context.set.important, controller_affinity_s, main->program.context.set.important, f_string_eol_s);
* @param options
* A number using bits to represent specific boolean options.
* If no bits set, then operate normally in a synchronous manner.
- * If bit controller_process_option_simulate_d, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
- * If bit controller_process_option_asynchronous_d, then run asynchronously.
+ * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
+ * If bit controller_instance_option_asynchronous_e, then run asynchronously.
* @param cache
* A structure for containing and caching relevant data.
*/
}
if (required) {
- if (!(instance_list[i]->options & controller_instance_option_require_d)) {
+ if (!(instance_list[i]->options & controller_instance_option_require_e)) {
f_thread_unlock(&instance_list[i]->lock);
f_thread_unlock(&instance_list[i]->active);
if (F_status_is_error(status_lock)) break;
}
- if (instance_list[i]->options & controller_instance_option_require_d) {
+ if (instance_list[i]->options & controller_instance_option_require_e) {
if (controller_rule_status_is_error(instance_list[i]->action, instance_list[i]->rule)) {
status = F_status_set_error(F_require);
break;
}
- if ((instance_list[i]->options & controller_instance_option_require_d)) {
+ if ((instance_list[i]->options & controller_instance_option_require_e)) {
f_thread_unlock(&instance_list[i]->lock);
if (controller_rule_status_is_error(instance_list[i]->action, instance_list[i]->rule)) {
if (!global) return F_status_set_error(F_parameter);
- return controller_rule_wait_all(global, type != controller_data_type_exit_e, required);
+ return controller_rule_wait_all(global, type != controller_instance_type_exit_e, required);
}
#endif // _di_controller_rule_wait_all_instance_type_
if (!instance) return;
if (!controller_main_thread_is_enabled(is_normal, (controller_thread_t * const) instance->thread)) return;
- const f_status_t status = controller_rule_process_do(controller_process_option_asynchronous_d, instance);
+ const f_status_t status = controller_rule_process_do(controller_instance_option_asynchronous_e, instance);
// A forked child instance should deallocate 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.
return;
}
- controller_entry_t * const entry = is_normal ? &global->setting->entry : &global->setting->exit;
+ controller_entry_t * const entry = is_normal ? &global->program->entry : &global->program->exit;
controller_instance_t *instance = 0;
f_time_spec_t time = f_time_spec_t_initialize;
time.tv_sec = 0;
time.tv_nsec = interval_nanoseconds;
- if (global->setting->mode == controller_setting_mode_helper_e && global->main->program.parameters.array[controller_parameter_validate_e].result == f_console_result_none_e) {
+ if (global->program->mode == controller_setting_mode_helper_e && global->main->program.parameters.array[controller_parameter_validate_e].result == f_console_result_none_e) {
int value = 0;
f_number_unsigned_t lapsed = 0;
global->thread->id_signal = 0;
}
- if (global->setting->mode == controller_setting_mode_helper_e && global->main->program.parameters.array[controller_parameter_validate_e].result == f_console_result_none_e) {
+ if (global->program->mode == controller_setting_mode_helper_e && global->main->program.parameters.array[controller_parameter_validate_e].result == f_console_result_none_e) {
f_thread_mutex_unlock(&global->thread->lock.cancel);
return;
instance = global->thread->instances.array[i];
// Do not cancel exit instances, when not performing "execute" during exit.
- if (instance->type == controller_data_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) {
+ if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) {
continue;
}
instance = global->thread->instances.array[i];
// Do not wait for instances, when not performing "execute" during exit.
- if (instance->type == controller_data_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) {
+ if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) {
continue;
}
instance = global->thread->instances.array[i];
// Do not kill exit instances, when not performing "execute" during exit.
- if (instance->type == controller_data_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) continue;
+ if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) continue;
if (instance->id_thread) {
if (instance->childs.used) {
for (j = 0; j < instance->childs.size; ++j) {
// Do not kill exit processes, when not performing "execute" during exit.
- if (instance->type == controller_data_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) continue;
+ if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) continue;
if (instance->childs.array[j]) {
for (j = 0; j < instance->path_pids.used; ++j) {
// Do not kill exit processes, when not performing "execute" during exit.
- if (instance->type == controller_data_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) continue;
+ if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) continue;
if (f_file_exists(instance->path_pids.array[j], F_true) == F_true) {
status = controller_file_pid_read(instance->path_pids.array[j], &pid);
while (instance->childs.used) {
// Do not shrink below an exit instances, when not performing "execute" during exit.
- if (instance->type == controller_data_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) break;
+ if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) break;
if (instance->childs.array[j] > 0) break;
--instance->childs.used;
while (instance->path_pids.used) {
// Do not shrink below an exit instances, when not performing "execute" during exit.
- if (instance->type == controller_data_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) break;
+ if (instance->type == controller_instance_type_exit_e && global->thread->enabled != controller_thread_enabled_exit_execute_e) break;
if (instance->path_pids.array[j].used) break;
--instance->path_pids.used;
if (global->thread->enabled != controller_thread_enabled_exit_e) return;
- if (global->setting->ready == controller_setting_ready_done_e) {
+ if (global->program->ready == controller_setting_ready_done_e) {
// The exit processing runs using the entry thread.
if (global->thread->id_entry) {
#ifndef _di_controller_main_thread_is_enabled_instance_type_
f_status_t controller_main_thread_is_enabled_instance_type(const uint8_t type, controller_thread_t * const thread) {
- return controller_main_thread_is_enabled(type != controller_data_type_exit_e, thread);
+ return controller_main_thread_is_enabled(type != controller_instance_type_exit_e, thread);
}
#endif // _di_controller_main_thread_is_enabled_instance_type_