]> Kevux Git Server - fll/commitdiff
Progress: Controller program migration from 0.6 to 0.7.
authorKevin Day <kevin@kevux.org>
Thu, 14 Mar 2024 03:26:28 +0000 (22:26 -0500)
committerKevin Day <kevin@kevux.org>
Thu, 14 Mar 2024 03:26:28 +0000 (22:26 -0500)
There are way too many changes needed.
Start doing some initial structure updates and directly relating code.
Move a lot of the structures to common.h, temporarily.
This will eventually be moved out.

35 files changed:
level_3/controller/c/common.c
level_3/controller/c/common.h
level_3/controller/c/common/private-common.h
level_3/controller/c/common/private-control.c
level_3/controller/c/common/private-control.h
level_3/controller/c/common/private-entry.c
level_3/controller/c/common/private-entry.h
level_3/controller/c/common/private-process.c
level_3/controller/c/common/private-process.h
level_3/controller/c/common/private-rule.c
level_3/controller/c/common/private-rule.h
level_3/controller/c/common/private-setting.c
level_3/controller/c/common/private-setting.h
level_3/controller/c/controller.c
level_3/controller/c/controller.h
level_3/controller/c/controller/private-controller.c
level_3/controller/c/controller/private-controller.h
level_3/controller/c/entry/private-entry.c
level_3/controller/c/lock/private-lock.c
level_3/controller/c/lock/private-lock.h
level_3/controller/c/main.c
level_3/controller/c/print.c
level_3/controller/c/print.h
level_3/controller/c/process/private-process.c
level_3/controller/c/process/private-process.h
level_3/controller/c/rule/private-rule.c
level_3/controller/c/rule/private-rule.h
level_3/controller/c/rule/private-rule_print.c
level_3/controller/c/rule/private-rule_print.h
level_3/controller/c/thread/private-thread.c
level_3/controller/c/thread/private-thread.h
level_3/controller/c/thread/private-thread_control.c
level_3/controller/c/thread/private-thread_entry.c
level_3/controller/c/thread/private-thread_process.c
level_3/controller/c/thread/private-thread_process.h

index 3aa6e1a060e1ca5d81f0564130550c13b3144e73..72773a5770c3b4ae823284b19d97b786d8e01f2c 100644 (file)
@@ -33,6 +33,37 @@ extern "C" {
   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_d_
 
+#ifndef _di_controller_main_delete_
+  f_status_t controller_main_delete(controller_main_t * const main) {
+
+    if (!main) return F_status_set_error(F_parameter);
+
+    fll_program_data_delete(&main->program);
+    controller_setting_delete(&main->setting);
+
+    if (main->process) {
+      controller_process_delete(main->process);
+    }
+
+    return F_okay;
+  }
+#endif // _di_controller_main_delete_
+
+#ifndef _di_controller_control_delete_
+  f_status_t controller_control_delete(controller_control_t * const control) {
+
+    if (!main) return F_status_set_error(F_parameter);
+
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &control->cache_1.string, &control->cache_1.used, &control->cache_1.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &control->cache_2.string, &control->cache_2.used, &control->cache_2.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &control->cache_3.string, &control->cache_3.used, &control->cache_3.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &control->input.string, &control->input.used, &control->input.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &control->output.string, &control->output.used, &control->output.size);
+
+    return F_okay;
+  }
+#endif // _di_controller_control_delete_
+
 #ifndef _di_controller_control_payload_type_identify_
   uint8_t controller_control_payload_type_identify(const f_string_static_t payload) {
 
@@ -212,28 +243,33 @@ extern "C" {
   }
 #endif // _di_controller_entry_action_type_name_
 
-#ifndef _di_controller_main_delete_
-  f_status_t controller_main_delete(controller_main_t * const main) {
+#ifndef _di_controller_process_delete_
+  f_status_t controller_process_delete(controller_process_t * const process) {
+
+    if (!process) return F_status_set_error(F_parameter);
+
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &process->name_entry.string, &process->name_entry.used, &process->name_entry.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &process->path_cgroup.string, &process->path_cgroup.used, &process->path_cgroup.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &process->path_control.string, &process->path_control.used, &process->path_control.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &process->path_current.string, &process->path_current.used, &process->path_current.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &process->path_pid.string, &process->path_pid.used, &process->path_pid.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &process->path_setting.string, &process->path_setting.used, &process->path_setting.size);
 
-    f_console_parameters_delete(&main->program.parameters);
+    controller_control_delete(&process->control);
 
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.reset.string, &main->program.reset.used, &main->program.reset.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.error.string, &main->program.error.used, &main->program.error.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.important.string, &main->program.important.used, &main->program.important.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.normal.string, &main->program.normal.used, &main->program.normal.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.normal_reset.string, &main->program.normal_reset.used, &main->program.normal_reset.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.notable.string, &main->program.notable.used, &main->program.notable.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.standout.string, &main->program.standout.used, &main->program.standout.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.success.string, &main->program.success.used, &main->program.success.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.title.string, &main->program.title.used, &main->program.title.size);
-    f_memory_array_resize(, sizeof(f_char_t), (void **) &main->program.warning.string, &main->program.warning.used, &main->program.warning.size0);
+    status = f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &process->entry.define.array, &process->entry.define.used, &process->entry.define.size, &f_string_maps_delete_callback);
+    status = f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &process->entry.parameter.array, &process->entry.parameter.used, &process->entry.parameter.size, &f_string_maps_delete_callback);
+    status = f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &process->exit.define.array, &process->exit.define.used, &process->exit.define.size, &f_string_maps_delete_callback);
+    status = f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &process->exit.parameter.array, &process->exit.parameter.used, &process->exit.parameter.size, &f_string_maps_delete_callback);
 
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.path_pid.string, &main->program.path_pid.used, &main->program.path_pid.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &main->program.path_setting.string, &main->program.path_setting.used, &main->program.path_setting.size);
+    controller_entry_items_delete(&process->entry.items);
+    controller_entry_items_delete(&process->exit.items);
+
+    controller_rules_delete_simple(&process->rules);
 
     return F_okay;
   }
-#endif // _di_controller_main_delete_
+#endif // _di_controller_process_delete_
 
 #ifndef _di_controller_rule_action_type_identify_
   uint8_t controller_rule_action_type_identify(const f_string_static_t action) {
@@ -616,14 +652,17 @@ extern "C" {
 
     if (!setting) return F_status_set_error(F_parameter);
 
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &setting->path_pid.string, &setting->path_pid.used, &setting->path_pid.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &setting->path_setting.string, &setting->path_setting.used, &setting->path_setting.size);
+
     return F_okay;
   }
 #endif // _di_controller_setting_delete_
 
 #ifndef _di_controller_setting_load_
-  void controller_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, controller_setting_t * const setting) {
+  f_status_t controller_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main) {
 
-    if (!main) return;
+    if (!main) return F_status_set_error(F_parameter);
 
     main->setting.state.step_small = controller_allocation_console_d;
 
@@ -706,19 +745,376 @@ extern "C" {
     if (main->program.parameters.array[controller_parameter_strip_invalid_e].result & f_console_result_found_e) {
       main->setting.flag |= controller_main_flag_strip_invalid_e;
     }
+
+    return F_okay;
   }
 #endif // _di_controller_setting_load_
 
-#ifndef _di_controller_setting_unload_
-  f_status_t controller_setting_unload(controller_main_t * const main) {
+#ifndef _di_controller_entry_action_delete_
+  f_status_t controller_entry_action_delete(controller_entry_action_t * const action) {
 
-    if (!main) return F_status_set_error(F_parameter);
+    if (!action) return F_status_set_error(F_parameter);
 
-    controller_setting_delete(&main->setting);
+    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size, &f_string_dynamics_delete_callback);
+
+    return F_okay;
+  }
+#endif // _di_controller_entry_action_delete_
+
+#ifndef _di_controller_entry_actions_delete_
+  f_status_t controller_entry_actions_delete(controller_entry_actions_t * const actions) {
+
+    if (!actions) return F_status_set_error(F_parameter);
+
+    // @todo Determine if this should be replaced with a resize callback strategy.
+    actions->used = actions->size;
+
+    while (actions->used) {
+      controller_entry_action_delete(&actions->array[--actions->used]);
+    } // while
+
+    f_memory_array_resize(0, sizeof(controller_entry_action_t), (void **) &actions->array, &actions->used, &actions->size);
+
+    return F_okay;
+  }
+#endif // _di_controller_entry_actions_delete_
+
+#ifndef _di_controller_entry_actions_increase_by_
+  f_status_t controller_entry_actions_increase_by(const f_number_unsigned_t amount, controller_entry_actions_t * const actions) {
+
+    if (!actions) return F_status_set_error(F_parameter);
+
+    if (amount) {
+      if (actions->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
+
+      const f_number_unsigned_t length = actions->used + amount;
+
+      if (length > actions->size) {
+        const f_status_t status = f_memory_resize(actions->size, length, sizeof(controller_entry_action_t), (void **) & actions->array);
+
+        if (F_status_is_error_not(status)) {
+          actions->size = actions->used + amount;
+        }
+
+        return status;
+      }
+    }
+
+    return F_data_not;
+  }
+#endif // _di_controller_entry_actions_increase_by_
+
+#ifndef _di_controller_entry_item_delete_
+  f_status_t controller_entry_item_delete(controller_entry_item_t * const item) {
+
+    if (!item) return F_status_set_error(F_parameter);
+
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &item->name.string, &item->name.used, &item->name.size);
+
+    controller_entry_actions_delete(&item->actions);
+
+    return F_okay;
+  }
+#endif // _di_controller_entry_item_delete_
+
+#ifndef _di_controller_entry_items_delete_
+  f_status_t controller_entry_items_delete(controller_entry_items_t * const items) {
+
+    if (!items) return F_status_set_error(F_parameter);
+
+    // @todo Determine if this should be replaced with a resize callback strategy.
+    items->used = items->size;
+
+    while (items->used) {
+      controller_entry_item_delete(&items->array[--items->used]);
+    } // while
+
+    f_memory_array_resize(0, sizeof(controller_entry_item_t), (void **) &items->array, &items->used, &items->size);
+
+    return F_okay;
+  }
+#endif // _di_controller_entry_items_delete_
+
+#ifndef _di_controller_entry_items_increase_by_
+  f_status_t controller_entry_items_increase_by(const f_number_unsigned_t amount, controller_entry_items_t * const items) {
+
+    if (!items) return F_status_set_error(F_parameter);
+
+    if (amount) {
+      if (items->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
+
+      const f_number_unsigned_t length = items->used + amount;
+
+      if (length > items->size) {
+        const f_status_t status = f_memory_resize(items->size, length, sizeof(controller_entry_item_t), (void **) & items->array);
+
+        if (F_status_is_error_not(status)) {
+          items->size = items->used + amount;
+        }
+
+        return status;
+      }
+    }
+
+    return F_data_not;
+  }
+#endif // _di_controller_entry_items_increase_by_
+
+#ifndef _di_controller_rule_action_t_
+  const f_string_static_t controller_rule_action_method_string_extended_s = macro_f_string_static_t_initialize_1(CONTROLLER_rule_action_method_string_extended_s, 0, CONTROLLER_rule_action_method_string_extended_s_length);
+  const f_string_static_t controller_rule_action_method_string_extended_list_s = macro_f_string_static_t_initialize_1(CONTROLLER_rule_action_method_string_extended_list_s, 0, CONTROLLER_rule_action_method_string_extended_list_s_length);
+#endif // _di_controller_rule_action_t_
+
+#ifndef _di_controller_rule_action_delete_simple_
+  f_status_t controller_rule_action_delete_simple(controller_rule_action_t * const action) {
+
+    if (!action) return F_status_set_error(F_parameter);
+
+    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size, &f_string_dynamics_delete_callback);
+
+    f_memory_array_resize(0, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size);
+
+    return F_okay;
+  }
+#endif // _di_controller_rule_action_delete_simple_
+
+#ifndef _di_controller_rule_actions_delete_simple_
+  f_status_t controller_rule_actions_delete_simple(controller_rule_actions_t * const actions) {
+
+    if (!actions) return F_status_set_error(F_parameter);
+
+    actions->used = actions->size;
+
+    while (actions->used) {
+      controller_rule_action_delete_simple(&actions->array[--actions->used]);
+    } // while
+
+    f_memory_delete(actions->size, sizeof(controller_rule_action_t), (void **) & actions->array);
+    actions->size = 0;
+
+    return F_okay;
+  }
+#endif // _di_controller_rule_actions_delete_simple_
+
+#ifndef _di_controller_rule_actions_increase_by_
+  f_status_t controller_rule_actions_increase_by(const f_number_unsigned_t amount, controller_rule_actions_t * const actions) {
+
+    if (!actions) return F_status_set_error(F_parameter);
+
+    if (amount) {
+      if (actions->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
+
+      const f_number_unsigned_t length = actions->used + amount;
+
+      if (length > actions->size) {
+        const f_status_t status = f_memory_resize(actions->size, length, sizeof(controller_rule_action_t), (void **) & actions->array);
+
+        if (F_status_is_error_not(status)) {
+          actions->size = actions->used + amount;
+        }
+
+        return status;
+      }
+    }
+
+    return F_data_not;
+  }
+#endif // _di_controller_rule_actions_increase_by_
+
+#ifndef _di_controller_rule_delete_
+  f_status_t controller_rule_delete(controller_rule_t * const rule) {
+
+    if (!rule) return F_status_set_error(F_parameter);
+
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &rule->engine.string, &rule->engine.used, &rule->engine.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &rule->name.string, &rule->name.used, &rule->name.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &rule->path.string, &rule->path.used, &rule->path.size);
+
+    f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &rule->define.array, &rule->define.used, &rule->define.size, &f_string_maps_delete_callback);
+    f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &rule->parameter.array, &rule->parameter.used, &rule->parameter.size, &f_string_maps_delete_callback);
+
+    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &rule->engine_arguments.array, &rule->engine_arguments.used, &rule->engine_arguments.size, &f_string_dynamics_delete_callback);
+    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &rule->environment.array, &rule->environment.used, &rule->environment.size, &f_string_dynamics_delete_callback);
+
+    f_memory_array_resize(0, sizeof(int32_t), (void **) &rule->affinity.array, &rule->affinity.used, &rule->affinity.size);
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &rule->cgroup.path.string, &rule->cgroup.path.used, &rule->cgroup.path.size);
+    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &rule->cgroup.groups.array, &rule->cgroup.groups.used, &rule->cgroup.groups.size, &f_string_dynamics_delete_callback);
+    f_memory_array_resize(0, sizeof(int32_t), (void **) &rule->groups.array, &rule->groups.used, &rule->groups.size);
+    f_memory_array_resize(0, sizeof(f_limit_set_t), (void **) &rule->limits.array, &rule->limits.used, &rule->limits.size);
+
+    if (rule->capability) {
+      f_capability_delete(&rule->capability);
+    }
+
+    controller_rule_ons_delete(&rule->ons);
+    controller_rule_items_delete(&rule->items);
+
+    return F_okay;
+  }
+#endif // _di_controller_rule_delete_
+
+#ifndef _di_controller_rule_item_delete_
+  f_status_t controller_rule_item_delete(controller_rule_item_t * const item) {
+
+    if (!item) return F_status_set_error(F_parameter);
+
+    f_memory_array_resize(0, sizeof(f_char_t), (void **) &item->pid_file.string, &item->pid_file.used, &item->pid_file.size);
+
+    controller_rule_actions_delete(&item->actions);
+
+    return F_okay;
+  }
+#endif // _di_controller_rule_item_delete_
+
+#ifndef _di_controller_rule_items_delete_
+  f_status_t controller_rule_items_delete(controller_rule_items_t * const items) {
+
+    if (!items) return F_status_set_error(F_parameter);
+
+    items->used = items->size;
+
+    while (items->used) {
+      controller_rule_item_delete(&items->array[--items->used]);
+    } // while
+
+    f_memory_delete(items->size, sizeof(controller_rule_item_t), (void **) & items->array);
+    items->size = 0;
+
+    return F_okay;
+  }
+#endif // _di_controller_rule_items_delete_
+
+#ifndef _di_controller_rule_on_delete_
+  f_status_t controller_rule_on_delete(controller_rule_on_t * const on) {
+
+    if (!on) return F_status_set_error(F_parameter);
+
+    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &on->need.array, &on->need.used, &on->need.size, &f_string_dynamics_delete_callback);
+    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &on->want.array, &on->want.used, &on->want.size, &f_string_dynamics_delete_callback);
+    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &on->wish.array, &on->wish.used, &on->wish.size, &f_string_dynamics_delete_callback);
+
+    return F_okay;
+  }
+#endif // _di_controller_rule_on_delete_
+
+#ifndef _di_controller_rule_ons_delete_
+  f_status_t controller_rule_ons_delete(controller_rule_ons_t * const ons) {
+
+    if (!ons) return F_status_set_error(F_parameter);
+
+    ons->used = ons->size;
+
+    while (ons->used) {
+      controller_rule_on_delete(&ons->array[--ons->used]);
+    } // while
+
+    f_memory_delete(ons->size, sizeof(controller_rule_on_t), (void **) & ons->array);
+    ons->size = 0;
+
+    return F_okay;
+  }
+#endif // _di_controller_rule_ons_delete_
+
+#ifndef _di_controller_rule_ons_increase_
+  f_status_t controller_rule_ons_increase(controller_rule_ons_t * const ons) {
+
+    if (!ons) return F_status_set_error(F_parameter);
+
+    if (ons->used + 1 > ons->size) {
+      f_number_unsigned_t length = ons->used + controller_common_allocation_small_d;
+
+      if (length > F_number_t_size_unsigned_d) {
+        if (ons->used + 1 > F_number_t_size_unsigned_d) {
+          return F_status_set_error(F_array_too_large);
+        }
+
+        length = F_number_t_size_unsigned_d;
+      }
+
+      return controller_rule_ons_resize(length, ons);
+    }
+
+    return F_data_not;
+  }
+#endif // _di_controller_rule_ons_increase_
+
+#ifndef _di_controller_rule_ons_resize_
+  f_status_t controller_rule_ons_resize(const f_number_unsigned_t length, controller_rule_ons_t * const ons) {
+
+    if (!ons) return F_status_set_error(F_parameter);
+
+    for (f_number_unsigned_t i = length; i < ons->size; ++i) {
+      controller_rule_on_delete(&ons->array[i]);
+    } // for
+
+    const f_status_t status = f_memory_resize(ons->size, length, sizeof(controller_rule_on_t), (void **) & ons->array);
+    if (F_status_is_error(status)) return status;
+
+    ons->size = length;
+
+    if (ons->used > ons->size) {
+      ons->used = length;
+    }
+
+    return F_okay;
+  }
+#endif // _di_controller_rule_ons_resize_
+
+#ifndef _di_controller_rules_delete_
+  f_status_t controller_rules_delete(controller_rules_t * const rules) {
+
+    if (!rules) return F_status_set_error(F_parameter);
+
+    controller_rules_resize(0, rules);
+
+    return F_okay;
+  }
+#endif // _di_controller_rules_delete_
+
+#ifndef _di_controller_rules_increase_
+  f_status_t controller_rules_increase(controller_rules_t * const rules) {
+
+    if (!rules) return F_status_set_error(F_parameter);
+
+    if (rules->used + 1 > rules->size) {
+      f_number_unsigned_t length = rules->used + controller_common_allocation_small_d;
+
+      if (length > F_number_t_size_unsigned_d) {
+        if (rules->used + 1 > F_number_t_size_unsigned_d) {
+          return F_status_set_error(F_array_too_large);
+        }
+
+        length = F_number_t_size_unsigned_d;
+      }
+
+      return controller_rules_resize(length, rules);
+    }
+
+    return F_data_not;
+  }
+#endif // _di_controller_rules_increase_
+
+#ifndef _di_controller_rules_resize_
+  f_status_t controller_rules_resize(const f_number_unsigned_t length, controller_rules_t * const rules) {
+
+    if (!rules) return F_status_set_error(F_parameter);
+
+    for (f_number_unsigned_t i = length; i < rules->size; ++i) {
+      controller_rule_delete(&rules->array[i]);
+    } // for
+
+    const f_status_t status = f_memory_resize(rules->size, length, sizeof(controller_rule_t), (void **) & rules->array);
+    if (F_status_is_error(status)) return status;
+
+    rules->size = length;
+
+    if (rules->used > rules->size) {
+      rules->used = length;
+    }
 
     return F_okay;
   }
-#endif // _di_controller_setting_unload_
+#endif // _di_controller_rules_resize_
 
 #ifdef __cplusplus
 } // extern "C"
index 0b40131cb1f20b8a9576349a1efcd76ac0150bcb..e7577a33c882febfc3dbe344933ac1d74f463700 100644 (file)
@@ -164,99 +164,6 @@ extern "C" {
 #endif // _di_controller_parameter_d_
 
 /**
- * The main program data.
- *
- * child:                      Reserved for a child process, often representing the child return status or the child process ID.
- * context:                    The color context.
- * default_engine:             The default scripting engine.
- * default_path_pid:           The default PID file path.
- * default_path_pid_init:      The default PID file path, when run as init.
- * default_path_pid_prefix:    The default PID file path prefix.
- * default_path_pid_suffix:    The default PID file path suffix.
- * default_path_setting:       The default setting path.
- * default_path_setting_init:  The default setting path, when run as init.
- * default_path_socket:        The default socket file path.
- * default_path_socket_init:   The default socket file path, when run as init.
- * default_path_socket_prefix: The default socket file path prefix.
- * default_path_socket_suffix: The default socket file path suffix.
- * error:                      The output file for error printing.
- * as_init:                    Designate whether or not this is running as an init program.
- * output:                     The output file for general printing.
- * parameters:                 The state of pre-defined parameters passed to the program.
- * pid:                        The PID of the program.
- * program_name:               The name of the program.
- * program_name_long:          The long name of the program.
- * signal:                     The process signal management structure.
- * umask:                      The umask settings, needed for avoiding calls to umask() to read the current umask.
- * warning:                    The output file for warning printing.
- */
-#ifndef _di_controller_main_t_
-  typedef struct {
-    f_console_parameters_t parameters;
-
-    bool as_init;
-
-    fl_print_t output;
-    fl_print_t error;
-    fl_print_t warning;
-
-    f_signal_t signal;
-
-    pid_t pid;
-    mode_t umask;
-    int child;
-
-    const f_string_static_t *default_engine;
-    const f_string_static_t *default_path_pid;
-    const f_string_static_t *default_path_pid_init;
-    const f_string_static_t *default_path_pid_prefix;
-    const f_string_static_t *default_path_pid_suffix;
-    const f_string_static_t *default_path_setting;
-    const f_string_static_t *default_path_setting_init;
-    const f_string_static_t *default_path_socket;
-    const f_string_static_t *default_path_socket_init;
-    const f_string_static_t *default_path_socket_prefix;
-    const f_string_static_t *default_path_socket_suffix;
-    const f_string_static_t *program_name;
-    const f_string_static_t *program_name_long;
-
-    f_string_dynamic_t path_pid;
-    f_string_dynamic_t path_setting;
-
-    f_color_context_t context;
-  } controller_main_t; // @todo refactor this name, and create a controller_main_t that holds the program data, settings, and possibly this.
-
-  #define controller_main_t_initialize \
-    { \
-      f_console_parameters_t_initialize, \
-      F_false, \
-      fl_print_t_initialize, \
-      macro_fl_print_t_initialize_error(), \
-      macro_fl_print_t_initialize_warning(), \
-      f_signal_t_initialize, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      0, \
-      f_string_dynamic_t_initialize, \
-      f_string_dynamic_t_initialize, \
-      f_color_context_t_initialize, \
-    }
-#endif // _di_controller_main_t_
-
-/**
  * Codes representing control payload types.
  *
  * controller_control_payload_type_*:
@@ -447,6 +354,7 @@ extern "C" {
  *   - file_to:       Using a specified destination file.
  *   - header:        Enable printing of headers.
  *   - help:          Print help.
+ *   - init:          Operate as an "init" program.
  *   - print_first:   When set, print new line to message output on program begin after loading settings.
  *   - print_last:    When set, print new line to message output on program end.
  *   - separate:      Enable printing of separators.
@@ -462,12 +370,13 @@ extern "C" {
     controller_main_flag_file_to_e       = 0x4,
     controller_main_flag_header_e        = 0x8,
     controller_main_flag_help_e          = 0x10,
-    controller_main_flag_print_first_e   = 0x20,
-    controller_main_flag_print_last_e    = 0x40,
-    controller_main_flag_separate_e      = 0x80,
-    controller_main_flag_strip_invalid_e = 0x100,
-    controller_main_flag_verify_e        = 0x200,
-    controller_main_flag_version_e       = 0x400,
+    controller_main_flag_init_e          = 0x20,
+    controller_main_flag_print_first_e   = 0x40,
+    controller_main_flag_print_last_e    = 0x80,
+    controller_main_flag_separate_e      = 0x100,
+    controller_main_flag_strip_invalid_e = 0x200,
+    controller_main_flag_verify_e        = 0x400,
+    controller_main_flag_version_e       = 0x800,
   }; // enum
 #endif // _di_controller_main_flag_e_
 
@@ -477,25 +386,1026 @@ extern "C" {
  * This is passed to the program-specific main entry point to designate program settings.
  * These program settings are often processed from the program arguments (often called the command line arguments).
  *
- * flag: Flags passed to the main function.
+ * flag:    Flags passed to the main function.
+ * as_init: Designate whether or not this is running as an init program.
  *
  * state: The state information.
+ *
+ * default_engine:             The default scripting engine.
+ * default_path_pid:           The default PID file path.
+ * default_path_pid_init:      The default PID file path, when run as init.
+ * default_path_pid_prefix:    The default PID file path prefix.
+ * default_path_pid_suffix:    The default PID file path suffix.
+ * default_path_setting:       The default setting path.
+ * default_path_setting_init:  The default setting path, when run as init.
+ * default_path_socket:        The default socket file path.
+ * default_path_socket_init:   The default socket file path, when run as init.
+ * default_path_socket_prefix: The default socket file path prefix.
+ * default_path_socket_suffix: The default socket file path suffix.
+ *
+ * program_name:      The short program name.
+ * program_name_long: The long program name.
+ *
+ * path_pid:     The name of the program.
+ * path_setting: The long name of the program.
  */
 #ifndef _di_controller_setting_t_
   typedef struct {
     uint16_t flag;
 
     f_state_t state;
+
+    const f_string_static_t *default_engine;
+    const f_string_static_t *default_path_pid;
+    const f_string_static_t *default_path_pid_init;
+    const f_string_static_t *default_path_pid_prefix;
+    const f_string_static_t *default_path_pid_suffix;
+    const f_string_static_t *default_path_setting;
+    const f_string_static_t *default_path_setting_init;
+    const f_string_static_t *default_path_socket;
+    const f_string_static_t *default_path_socket_init;
+    const f_string_static_t *default_path_socket_prefix;
+    const f_string_static_t *default_path_socket_suffix;
+
+    f_string_static_t program_name;
+    f_string_static_t program_name_long;
+
+    f_string_dynamic_t path_pid;
+    f_string_dynamic_t path_setting;
   } controller_setting_t;
 
   #define controller_setting_t_initialize \
     { \
       controller_main_flag_none_e, \
       f_state_t_initialize, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      0, \
+      f_string_static_t_initialize, \
+      f_string_static_t_initialize, \
+      f_string_dynamic_t_initialize, \
+      f_string_dynamic_t_initialize, \
     }
 #endif // _di_controller_setting_t_
 
 /**
+ * Provide default control settings.
+ *
+ * controller_control_default:
+ *   - socket_backlog:     The amount of waiting client connections to support while handling a socket connection.
+ *   - socket_buffer:      The preferred max size of the buffer such that if the buffer exceeds this then it is reallocated to this size at the end of processing.
+ *   - socket_buffer_max:  The max size allowed in the buffer (this value must not be set smaller than the packet headers).
+ *   - socket_cache:       The preferred max size of the control cache such that if the cache exceeds this then it is reallocated to this size at the end of processing.
+ *   - socket_header:      The minimum size in bytes of the packet header to read to be able to process the size information.
+ *   - socket_linger:      The number of seconds to linger the connection before closing.
+ *   - socket_timeout:     The number of microseconds to wait.
+ *   - socket_payload_max: The max size allowed for the "payload" part of a packet and must be smaller than socket_buffer_max (this is smaller than socket_buffer_max to allow for enough room to afford a header).
+ */
+#ifndef _di_controller_control_defaults_
+  #define controller_control_default_socket_backlog_d     64
+  #define controller_control_default_socket_buffer_d      2048
+  #define controller_control_default_socket_buffer_max_d  4294967296
+  #define controller_control_default_socket_cache_d       128
+  #define controller_control_default_socket_header_d      5
+  #define controller_control_default_socket_linger_d      2
+  #define controller_control_default_socket_timeout_d     10000 // 0.01 seconds.
+  #define controller_control_default_socket_payload_max_d 4294965248
+#endif // _di_controller_defaults_
+
+/**
+ * The control data.
+ *
+ * controller_control_flag_*:
+ *   - readonly:  Control is set to read-only mode.
+ *   - has_user:  A user is manually specified.
+ *   - has_group: A group is manually specified.
+ *   - has_mode:  A file mode is manually specified.
+ *
+ * flag:    Flags from controller_control_flag_*.
+ * user:    The user ID, if specified.
+ * group:   The group ID, if specified.
+ * mode:    The file mode, if specified.
+ * server:  The server socket connection.
+ * client:  The client socket connection.
+ * cache_1: A generic buffer used for caching control related data.
+ * cache_2: A generic buffer used for caching control related data.
+ * cache_3: A generic buffer used for caching control related data.
+ * input:   A buffer used for receiving data from the client.
+ * output:  A buffer used for transmitting data to the client.
+ * address: The socket address structure.
+ */
+#ifndef _di_controller_control_t_
+  enum {
+    controller_control_flag_readonly_e  = 0x1,
+    controller_control_flag_has_user_e  = 0x2,
+    controller_control_flag_has_group_e = 0x4,
+    controller_control_flag_has_mode_e  = 0x8,
+  };
+
+  typedef struct {
+    uint8_t flag;
+
+    uid_t user;
+    gid_t group;
+    mode_t mode;
+
+    f_socket_t server;
+    f_socket_t client;
+
+    f_string_dynamic_t cache_1;
+    f_string_dynamic_t cache_2;
+    f_string_dynamic_t cache_3;
+
+    f_string_dynamic_t input;
+    f_string_dynamic_t output;
+
+    struct sockaddr_un address;
+  } controller_control_t;
+
+  #define controller_control_t_initialize { \
+    0, \
+    -1, \
+    -1, \
+    0, \
+    f_socket_t_initialize, \
+    f_socket_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    { }, \
+  }
+#endif // _di_controller_control_t_
+
+/**
+ * A codes repesent different flags associated with a packet.
+ *
+ * controller_control_packet_flag_*:
+ *   - binary:     Designate that the packet is in binary mode (when not set then packet is in string mode).
+ *   - endian_big: Designate that the packet is in big endian order (when not set then packet is in little endian order).
+ */
+#ifndef _di_controller_control_packet_flag_
+  #define controller_control_packet_flag_binary_d     0x10000000
+  #define controller_control_packet_flag_endian_big_d 0x01000000
+#endif // _di_controller_control_packet_flag_
+
+/**
+ * An Entry Item Action.
+ *
+ * controller_entry_action_flag_*:
+ *   - undefined: The given type and code are designated as undefined.
+ *
+ * controller_entry_action_type_*:
+ *   - consider: Designate a rule to be pre-loaded.
+ *   - execute:  Execute into another program.
+ *   - failsafe: Designate a failsafe "item".
+ *   - freeze:   A Rule Action for freezing.
+ *   - item:     A named set of Rules.
+ *   - kill:     A Rule Action for killing.
+ *   - pause:    A Rule Action for pausing.
+ *   - ready:    Designate readiness for special processing for Entry or Exit.
+ *   - reload:   A Rule Action for reloading.
+ *   - restart:  A Rule Action for restarting.
+ *   - resume:   A Rule Action for resuming.
+ *   - start:    A Rule Action for starting.
+ *   - stop:     A Rule Action for stopping.
+ *   - timeout:  Inline timeout settings.
+ *   - thaw:     A Rule Action for unfreezing.
+ *
+ * controller_entry_rule_code_*:
+ *   - asynchronous: Process Rule asynchronously.
+ *   - require:      Require Rule operations to succeed or the Entry/Exit will fail.
+ *   - wait:         Wait for all existing asynchronous processes to finish before operating Rule.
+ *
+ * controller_entry_timeout_code_*:
+ *   - exit:  The timeout Action represents an exit timeout.
+ *   - kill:  The timeout Action represents a kill timeout.
+ *   - start: The timeout Action represents a start timeout.
+ *   - stop:  The timeout Action represents a stop timeout.
+ *
+ * type:       The type of Action.
+ * code:       A single code or sub-type associated with the Action.
+ * flag:       A set of flags to describe special behavior for the given type and code (flags may be different per type and code).
+ * line:       The line number where the Entry Item begins.
+ * number:     The unsigned number that some types use instead of the "parameters".
+ * status:     The overall status.
+ * parameters: The values associated with the Action.
+ */
+#ifndef _di_controller_entry_action_t_
+  #define controller_entry_rule_code_asynchronous_d 0x1
+  #define controller_entry_rule_code_require_d      0x2
+  #define controller_entry_rule_code_wait_d         0x4
+
+  #define controller_entry_timeout_code_exit_d  0x1
+  #define controller_entry_timeout_code_kill_d  0x2
+  #define controller_entry_timeout_code_start_d 0x4
+  #define controller_entry_timeout_code_stop_d  0x8
+
+  enum {
+    controller_entry_action_flag_none_e      = 0x0,
+    controller_entry_action_flag_undefined_e = 0x1,
+  };
+
+  typedef struct {
+    uint8_t type;
+    uint8_t code;
+    uint8_t flag;
+
+    f_number_unsigned_t line;
+    f_number_unsigned_t number;
+
+    f_status_t status;
+
+    f_string_dynamics_t parameters;
+  } controller_entry_action_t;
+
+  #define controller_entry_action_t_initialize { \
+    0, \
+    0, \
+    0, \
+    controller_entry_action_flag_none_e, \
+    0, \
+    F_known_not, \
+    f_string_dynamics_t_initialize, \
+  }
+#endif // _di_controller_entry_action_t_
+
+/**
+ * The Entry Item Actions.
+ *
+ * array: An array of Entry Item Actions.
+ * size:  Total amount of allocated space.
+ * used:  Total number of allocated spaces used.
+ */
+#ifndef _di_controller_entry_actions_t_
+  typedef struct {
+    controller_entry_action_t *array;
+
+    f_number_unsigned_t size;
+    f_number_unsigned_t used;
+  } controller_entry_actions_t;
+
+  #define controller_entry_actions_t_initialize { \
+    0, \
+    0, \
+    0, \
+  }
+#endif // _di_controller_entry_actions_t_
+
+/**
+ * An Entry Item.
+ *
+ * line:    The line number where the Entry Item begins.
+ * name:    The name of the Entry Item.
+ * actions: The Actions associated with the Entry Item.
+ */
+#ifndef _di_controller_entry_item_t_
+  typedef struct {
+    f_number_unsigned_t line;
+    f_string_dynamic_t name;
+
+    controller_entry_actions_t actions;
+  } controller_entry_item_t;
+
+  #define controller_entry_item_t_initialize \
+    { \
+      0, \
+      f_string_dynamic_t_initialize, \
+      controller_entry_actions_t_initialize, \
+    }
+#endif // _di_controller_entry_item_t_
+
+/**
+ * An Entry Items.
+ *
+ * array: An array of Entry Items.
+ * size:  Total amount of allocated space.
+ * used:  Total number of allocated spaces used.
+ */
+#ifndef _di_controller_entry_items_t_
+  typedef struct {
+    controller_entry_item_t *array;
+
+    f_number_unsigned_t size;
+    f_number_unsigned_t used;
+  } controller_entry_items_t;
+
+  #define controller_entry_items_t_initialize { \
+    0, \
+    0, \
+    0, \
+  }
+
+  #define macro_controller_entry_items_t_clear(items) \
+    items.array = 0; \
+    items.size = 0; \
+    items.used = 0;
+#endif // _di_controller_entry_items_t_
+
+/**
+ * The Entry or Exit.
+ *
+ * Entry and Exit files are essentially the same structure with minor differences in settings and behavior.
+ * The structure is identical and due to lacking any particularly good name to represent both "entry" or "exit", the name "entry" is being used for both.
+ *
+ * controller_entry_flag_*:
+ *   - none_e:             No flags are set.
+ *   - timeout_exit_no_e:  The exit timeout is disabled.
+ *   - timeout_kill_no_e:  The kill timeout is disabled for Rules by default.
+ *   - timeout_start_no_e: The start timeout is disabled for Rules by default.
+ *   - timeout_stop_no_e:  The stop timeout is disabled for Rules by default.
+ *
+ * controller_entry_session_*:
+ *   - none: No special session configuration specified, use built in defaults.
+ *   - new:  Designate the default to use a new session, ignoring built in defaults (passing FL_execute_parameter_option_session_d to the execute functions).
+ *   - same: Designate the default to use a same session, ignoring built in defaults.
+ *
+ * controller_entry_pid_*:
+ *   - disable: Do not check for or create a PID file to represent the entry execution.
+ *   - require: Check to see if the PID file exists for an entry at startup and then when "ready" create a pid file, display error on pid file already exists or on failure and then fail.
+ *   - ready:   When "ready" create a pid file, display error on failure and then fail (does not check if PID file exists).
+ *
+ * controller_entry_show_*:
+ *   - normal: Do not print anything other than warnings and errors, but allow executed programs and scripts to output however they like.
+ *   - init:   Print like an init program, printing status of entry and rules as they are being started, stopped, etc...
+ *
+ * define:        Any defines (environment variables) made available to all Rules in this entry for IKI substitution or just as environment variables.
+ * flag:          A set of flags, primarily used to designate that timeouts are disabled.
+ * items:         The array of entry items.
+ * parameter:     Any parameters made available to all Rules in this entry for IKI substitution.
+ * pid:           The PID file generation setting.
+ * session:       The default session settings (when NULL, no default is specified).
+ * show:          The show setting for controlling what to show when executing entry items and rules.
+ * status:        The overall status.
+ * timeout_exit:  The timeout to wait when exiting the Controller program after sending the terminate signal to send the kill signal.
+ * timeout_kill:  The timeout to wait relating to using a kill signal.
+ * timeout_start: The timeout to wait relating to starting a process.
+ * timeout_stop:  The timeout to wait relating to stopping a process.
+ */
+#ifndef _di_controller_entry_t_
+  enum {
+    controller_entry_pid_disable_e = 0,
+    controller_entry_pid_require_e,
+    controller_entry_pid_ready_e,
+  };
+
+  enum {
+    controller_entry_show_normal_e = 0,
+    controller_entry_show_init_e,
+  };
+
+  enum {
+    controller_entry_session_none_e = 0,
+    controller_entry_session_new_e,
+    controller_entry_session_same_e,
+  };
+
+  enum {
+    controller_entry_flag_none_e             = 0x0,
+    controller_entry_flag_timeout_exit_no_e  = 0x1,
+    controller_entry_flag_timeout_kill_no_e  = 0x2,
+    controller_entry_flag_timeout_start_no_e = 0x4,
+    controller_entry_flag_timeout_stop_no_e  = 0x8,
+  };
+
+  typedef struct {
+    f_status_t status;
+
+    uint8_t pid;
+    uint8_t session;
+    uint8_t show;
+    uint8_t flag;
+
+    f_number_unsigned_t timeout_exit;
+    f_number_unsigned_t timeout_kill;
+    f_number_unsigned_t timeout_start;
+    f_number_unsigned_t timeout_stop;
+
+    f_string_maps_t define;
+    f_string_maps_t parameter;
+
+    controller_entry_items_t items;
+  } controller_entry_t;
+
+  #define controller_entry_t_initialize { \
+    F_known_not, \
+    controller_entry_pid_require_e, \
+    controller_entry_session_none_e, \
+    controller_entry_show_normal_e, \
+    0, \
+    controller_thread_exit_timeout_d, \
+    0, \
+    0, \
+    0, \
+    f_string_maps_t_initialize, \
+    f_string_maps_t_initialize, \
+    controller_entry_items_t_initialize, \
+  }
+#endif // _di_controller_entry_t_
+
+/**
+ * The Rule "rerun" item for controlling re-execution.
+ *
+ * count: A count of the number of executions.
+ * delay: The time to wait before attempting to re-run.
+ * max:   The maximum number of times to re-run (with 0 representing re-run infinitely) for executions.
+ */
+#ifndef _di_controller_rule_rerun_item_t_
+  typedef struct {
+    bool reset;
+
+    f_number_unsigned_t count;
+    f_number_unsigned_t delay;
+    f_number_unsigned_t max;
+  } controller_rule_rerun_item_t;
+
+  #define controller_rule_rerun_item_initialize { \
+    F_false, \
+    0, \
+    5000, \
+    0, \
+
+  #define macro_controller_rule_rerun_item_initialize(item) { \
+    item.reset = F_false; \
+    item.count = 0; \
+    item.delay = 5000; \
+    item.max = 0; \
+  }
+#endif // _di_controller_rule_rerun_item_t_
+
+/**
+ * The Rule "rerun" values for controlling re-execution.
+ *
+ * controller_rule_rerun_is_*:
+ *   - failure:       The success re-run is enabled.
+ *   - failure_reset: Reset success counter when failure is returned.
+ *   - success:       The success re-run is enabled.
+ *   - success_reset: Reset failure counter when success is returned.
+ *
+ * is:            A bitwise set of options to designate whether rerun is enabled or not and other options.
+ * count_failure: A count of the number of failed executions.
+ * count_success: A count of the number of successful executions.
+ * delay_failure: The time to wait before attempting to "rerun" for failed executions.
+ * delay_success: The time to wait before attempting to "rerun" for successful executions.
+ * max_failure:   The maximum number of times to "rerun" (with 0 representing "rerun" infinitely) for failed executions.
+ * max_success:   The maximum number of times to "rerun" (with 0 representing "rerun" infinitely) for successful executions.
+ */
+#ifndef _di_controller_rule_rerun_t_
+  #define controller_rule_rerun_is_failure_d       0x1
+  #define controller_rule_rerun_is_failure_reset_d 0x2
+  #define controller_rule_rerun_is_success_d       0x4
+  #define controller_rule_rerun_is_success_reset_d 0x8
+
+  typedef struct {
+    uint8_t is;
+
+    controller_rule_rerun_item_t failure;
+    controller_rule_rerun_item_t success;
+  } controller_rule_rerun_t;
+
+  #define controller_rule_rerun_initialize { \
+    0, \
+    controller_rule_rerun_item_initialize, \
+    controller_rule_rerun_item_initialize, \
+  }
+#endif // _di_controller_rule_rerun_t_
+
+/**
+ * A Rule Action.
+ *
+ * controller_rule_action_method_*:
+ *   - extended:      Designate that this Action is represented using FSS Extended.
+ *   - extended_list: Designate that this Action is represented using FSS Extended List.
+ *
+ * type:       The Rule Action type.
+ * line:       The line number where the Rule Action begins.
+ * status:     The last execution status of the Rule Action.
+ * parameters: All parameters associated with the Rule Action.
+ */
+#ifndef _di_controller_rule_action_t_
+  #define CONTROLLER_rule_action_method_string_extended_s      "FSS-0001 (Extended)"
+  #define CONTROLLER_rule_action_method_string_extended_list_s "FSS-0003 (Extended List)"
+
+  #define CONTROLLER_rule_action_method_string_extended_s_length      19
+  #define CONTROLLER_rule_action_method_string_extended_list_s_length 24
+
+  extern const f_string_static_t controller_rule_action_method_string_extended_s;
+  extern const f_string_static_t controller_rule_action_method_string_extended_list_s;
+
+  enum {
+    controller_rule_action_method_extended_e = 1,
+    controller_rule_action_method_extended_list_e,
+  };
+
+  typedef struct {
+    uint8_t type;
+    f_number_unsigned_t line;
+    f_status_t status;
+
+    f_string_dynamics_t parameters;
+    f_iki_datas_t ikis;
+  } controller_rule_action_t;
+
+  #define controller_rule_action_t_initialize { \
+    0, \
+    0, \
+    F_known_not, \
+    f_string_dynamics_t_initialize, \
+    f_iki_datas_t_initialize, \
+  }
+#endif // _di_controller_rule_action_t_
+
+/**
+ * The Rule Actions.
+ *
+ * array: An array of Rule Actions.
+ * size:  Total amount of allocated space.
+ * used:  Total number of allocated spaces used.
+ */
+#ifndef _di_controller_rule_actions_t_
+  typedef struct {
+    controller_rule_action_t *array;
+
+    f_number_unsigned_t size;
+    f_number_unsigned_t used;
+  } controller_rule_actions_t;
+
+  #define controller_rule_actions_t_initialize { \
+    0, \
+    0, \
+    0, \
+  }
+#endif // _di_controller_rule_actions_t_
+
+/**
+ * A Rule Item.
+ *
+ * controller_rule_item_type_*:
+ *   - command: A Command to execute.
+ *   - script:  A Script to execute.
+ *   - service: A Service to execute.
+ *   - setting: Settings associated with the Rule Item.
+ *   - utility: A Utility to execute.
+ *
+ * type:    The type of the Rule Item.
+ * with:    A bitwise number representing execute "with" options.
+ * line:    The line number where the Rule Item begins.
+ * reruns:  An array designating rerun settings for each execution type available.
+ * actions: The actions associated with the Rule Item.
+ */
+#ifndef _di_controller_rule_item_t_
+  typedef struct {
+    uint8_t type;
+    uint8_t with;
+    f_number_unsigned_t line;
+
+    f_string_dynamic_t pid_file;
+    controller_rule_rerun_t reruns[controller_rule_action_execute_type__enum_size_e];
+    controller_rule_actions_t actions;
+  } controller_rule_item_t;
+
+  #define controller_rule_item_t_initialize \
+    { \
+      0, \
+      0, \
+      0, \
+      f_string_dynamic_t_initialize, \
+      { \
+        controller_rule_rerun_t_initialize, \
+        controller_rule_rerun_t_initialize, \
+        controller_rule_rerun_t_initialize, \
+        controller_rule_rerun_t_initialize, \
+        controller_rule_rerun_t_initialize, \
+        controller_rule_rerun_t_initialize, \
+        controller_rule_rerun_t_initialize, \
+        controller_rule_rerun_t_initialize, \
+        controller_rule_rerun_t_initialize, \
+      }, \
+      controller_rule_actions_t_initialize, \
+    }
+#endif // _di_controller_rule_item_t_
+
+/**
+ * The Rule Items.
+ *
+ * array: An array of Rule Items.
+ * size:  Total amount of allocated space.
+ * used:  Total number of allocated spaces used.
+ */
+#ifndef _di_controller_rule_items_t_
+  typedef struct {
+    controller_rule_item_t *array;
+
+    f_number_unsigned_t size;
+    f_number_unsigned_t used;
+  } controller_rule_items_t;
+
+  #define controller_rule_items_initialize { \
+    0, \
+    0, \
+    0, \
+  }
+#endif // _di_controller_rule_items_t_
+
+/**
+ * The Rule "on" values for designating dependencies.
+ *
+ * action: The Rule Action type this "on" dependencies are associated with.
+ * need:   The Rule Alias for a required Rule.
+ * want:   The Rule Alias for an optional Rule that is required to succeed if found.
+ * wish:   The Rule Alias for an optional Rule that is not required.
+ */
+#ifndef _di_controller_rule_on_t_
+  typedef struct {
+    uint8_t action;
+
+    f_string_dynamics_t need;
+    f_string_dynamics_t want;
+    f_string_dynamics_t wish;
+  } controller_rule_on_t;
+
+  #define controller_rule_on_initialize { \
+    0, \
+    f_string_dynamics_t_initialize, \
+    f_string_dynamics_t_initialize, \
+    f_string_dynamics_t_initialize, \
+  }
+#endif // _di_controller_rule_on_t_
+
+/**
+ * The Rule "on" array.
+ *
+ * array: An array of Rule "on" values.
+ * size:  Total amount of allocated space.
+ * used:  Total number of allocated spaces used.
+ */
+#ifndef _di_controller_rule_ons_t_
+  typedef struct {
+    controller_rule_on_t *array;
+
+    f_number_unsigned_t size;
+    f_number_unsigned_t used;
+  } controller_rule_ons_t;
+
+  #define controller_rule_ons_t_initialize { \
+    0, \
+    0, \
+    0, \
+  }
+#endif // _di_controller_rule_ons_t_
+
+/**
+ * A Rule.
+ *
+ * controller_rule_setting_type_*:
+ *   - affinity:         Setting type representing a affinity.
+ *   - capability:       Setting type representing a capability.
+ *   - cgroup:           Setting type representing a control group.
+ *   - define:           Setting type representing a define.
+ *   - engine:           Setting type representing a engine.
+ *   - engine_arguments: Setting type representing a engine.
+ *   - environment:      Setting type representing a environment.
+ *   - group:            Setting type representing a group.
+ *   - limit:            Setting type representing a limit.
+ *   - name:             Setting type representing a name.
+ *   - nice:             Setting type representing a nice.
+ *   - on:               Setting type representing a on.
+ *   - parameter:        Setting type representing a parameter.
+ *   - path:             Setting type representing a path.
+ *   - scheduler:        Setting type representing a scheduler.
+ *   - user:             Setting type representing a user.
+ *
+ * controller_rule_has_*:
+ *   - cgroup:    Has type representing a control group.
+ *   - group:     Has type representing a group.
+ *   - nice:      Has type representing a nice.
+ *   - scheduler: Has type representing a scheduler.
+ *   - user:      Has type representing a user.
+ *
+ * affinity:         The cpu affinity to be used when executing the Rule.
+ * alias:            The distinct ID (machine name) of the Rule, such as "service/ssh".
+ * capability:       The capability setting if the Rule "has" a capability.
+ * cgroup:           The control group setting if the Rule "has" a control group.
+ * define:           Any defines (environment variables) made available to the Rule for IKI substitution or just as environment variables.
+ * engine:           The program or path to the program of the scripting engine to use when processing scripts in this Rule.
+ * engine_arguments: Any arguments to pass to the engine program.
+ * environment:      All environment variables allowed to be exposed to the Rule when processing.
+ * group:            The group ID if the Rule "has" a group.
+ * groups:           A set of group IDs to run the process with (first specified group is the primary group).
+ * has:              Bitwise set of "has" codes representing what the Rule has.
+ * items:            All items associated with the Rule.
+ * limits:           The cpu/resource limits to use when executing the Rule.
+ * name:             A human name for the Rule (does not have to be distinct), such as "Bash Script".
+ * nice:             The niceness value if the Rule "has" nice.
+ * on:               A set of parameters for defining dependencies and how they are needed, wanted, or wished for.
+ * parameter:        Any parameters made available to the Rule for IKI substitution.
+ * path:             The path to the Rule file.
+ * scheduler:        The scheduler setting if the Rule "has" a scheduler.
+ * status:           A set of action-specific success/failure status of the Rule. Each index represents a controller_rule_action_type_* enum value. Index 0 represents a global status.
+ * timeout_exit:     The timeout to wait when exiting the Controller program after sending the terminate signal to send the kill signal.
+ * timeout_kill:     The timeout to wait relating to using a kill signal.
+ * timeout_start:    The timeout to wait relating to starting a process.
+ * timeout_stop:     The timeout to wait relating to stopping a process.
+ * timestamp:        The timestamp when the Rule was loaded.
+ * user:             The User ID if the Rule "has" a user.
+ */
+#ifndef _di_controller_rule_t_
+  enum {
+    controller_rule_setting_type_affinity_e = 1,
+    controller_rule_setting_type_capability_e,
+    controller_rule_setting_type_cgroup_e,
+    controller_rule_setting_type_define_e,
+    controller_rule_setting_type_engine_e,
+    controller_rule_setting_type_environment_e,
+    controller_rule_setting_type_group_e,
+    controller_rule_setting_type_limit_e,
+    controller_rule_setting_type_name_e,
+    controller_rule_setting_type_nice_e,
+    controller_rule_setting_type_on_e,
+    controller_rule_setting_type_parameter_e,
+    controller_rule_setting_type_path_e,
+    controller_rule_setting_type_scheduler_e,
+    controller_rule_setting_type_timeout_e,
+    controller_rule_setting_type_user_e,
+  };
+
+  // bitwise codes representing properties on controller_rule_t that have been found in the Rule file.
+  #define controller_rule_has_cgroup_d 0x1
+  #define controller_rule_has_environment_d   0x2
+  #define controller_rule_has_group_d         0x4
+  #define controller_rule_has_nice_d          0x8
+  #define controller_rule_has_scheduler_d     0x10
+  #define controller_rule_has_user_d          0x20
+
+  // Designate codes for timeout settings to be used during the loading of the Rule timeout settings.
+  #define controller_rule_timeout_code_kill_d  1
+  #define controller_rule_timeout_code_start_d 2
+  #define controller_rule_timeout_code_stop_d  3
+
+  typedef struct {
+    f_status_t status[controller_rule_action_type__enum_size_e];
+
+    f_number_unsigned_t timeout_kill;
+    f_number_unsigned_t timeout_start;
+    f_number_unsigned_t timeout_stop;
+
+    uint8_t has;
+    int nice;
+    uid_t user;
+    gid_t group;
+
+    f_time_spec_t timestamp;
+
+    f_string_dynamic_t alias;
+    f_string_dynamic_t engine;
+    f_string_dynamic_t name;
+    f_string_dynamic_t path;
+
+    f_string_maps_t define;
+    f_string_maps_t parameter;
+
+    f_string_dynamics_t engine_arguments;
+    f_string_dynamics_t environment;
+
+    f_int32s_t affinity;
+    f_capability_t capability;
+    f_control_group_t cgroup;
+    f_int32s_t groups;
+    f_limit_sets_t limits;
+    f_execute_scheduler_t scheduler;
+
+    controller_rule_ons_t ons;
+    controller_rule_items_t items;
+  } controller_rule_t;
+
+  #define controller_rule_t_initialize { \
+      { \
+        F_known_not, \
+        F_known_not, \
+        F_known_not, \
+        F_known_not, \
+        F_known_not, \
+        F_known_not, \
+        F_known_not, \
+        F_known_not, \
+        F_known_not, \
+        F_known_not, \
+        F_known_not, \
+        F_known_not, \
+        F_known_not, \
+        F_known_not, \
+        F_known_not, \
+      }, \
+    0, \
+    0, \
+    0, \
+    0, \
+    0, \
+    0, \
+    0, \
+    f_time_spec_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    f_string_maps_t_initialize, \
+    f_string_maps_t_initialize, \
+    f_string_dynamics_t_initialize, \
+    f_string_dynamics_t_initialize, \
+    f_int32s_t_initialize, \
+    f_capability_t_initialize, \
+    f_control_group_t_initialize, \
+    f_int32s_t_initialize, \
+    f_limit_sets_t_initialize, \
+    f_execute_scheduler_t_initialize, \
+    controller_rule_ons_initialize, \
+    controller_rule_items_initialize, \
+  }
+#endif // _di_controller_rule_t_
+
+/**
+ * The Rules.
+ *
+ * array: An array of Rules.
+ * size:  Total amount of allocated space.
+ * used:  Total number of allocated spaces used.
+ */
+#ifndef _di_controller_rules_t_
+  typedef struct {
+    controller_rule_t *array;
+
+    f_number_unsigned_t size;
+    f_number_unsigned_t used;
+  } controller_rules_t;
+
+  #define controller_rules_t_initialize { \
+    0, \
+    0, \
+    0, \
+  }
+#endif // _di_controller_rules_t_
+
+/**
+ * The process specific settings.
+ *
+ * controller_setting_ready_*:
+ *   - no:    Entry/Exit is not ready.
+ *   - wait:  Entry/Exit has "ready" somewhere in the file but is not yet ready.
+ *   - yes:   Entry/Exit is now ready (Entry/Exit is still being processed).
+ *   - done:  Entry/Exit is ready and processing is complete.
+ *   - fail:  Entry/Exit processing failed.
+ *   - abort: Abort received before finished processing Entry/Exit.
+ *
+ * controller_setting_mode_*:
+ *   - helper:  Run as a helper, exiting when finished prrocess entry (and any respective exit).
+ *   - program: Run as a program, exiting when finished prrocess entry (and any respective exit).
+ *   - service: Run as a service, listening for requests after processing entry.
+ *
+ * controller_setting_flag_*:
+ *   - interruptible: When specified, program responds to interrupt signals, otherwise block/ignore interrupt signals.
+ *   - pid_created:   When specified, the program responds to interrupt signals, otherwise block/ignore interrupt signals.
+ *   - failsafe:      When specified, failsafe mode is enabled, otherwise failsafe mode is disabled.
+ *
+ * flag:             Flags from controller_setting_flag_*.
+ * ready:            State representing if the settings are all loaded and is ready to run program operations.
+ * mode:             Controller setting mode based on the setting mode enumerator.
+ * control:          The control socket data.
+ * failsafe_item_id: The Entry Item ID to execute when failsafe execution is enabled.
+ * path_cgroup:      Directory path to the cgroup directory.
+ * path_control:     File path to the control socket (used for printing the path).
+ * path_pid:         File path to the PID file.
+ * path_setting:     File path to the setting directory.
+ * entry:            The Entry settings.
+ * rules:            All rules and their respective settings.
+ */
+#ifndef _di_controller_process_t_
+  enum {
+    controller_setting_ready_no_e = 0,
+    controller_setting_ready_wait_e,
+    controller_setting_ready_yes_e,
+    controller_setting_ready_done_e,
+    controller_setting_ready_fail_e,
+    controller_setting_ready_abort_e,
+  }; // enum
+
+  enum {
+    controller_setting_mode_service_e = 0,
+    controller_setting_mode_helper_e,
+    controller_setting_mode_program_e,
+  }; // enum
+
+  enum {
+    controller_setting_flag_interruptible_e = 0x1,
+    controller_setting_flag_pid_created_e   = 0x2,
+    controller_setting_flag_failsafe_e      = 0x4,
+  }; // enum
+
+  typedef struct {
+    uint8_t flag;
+    uint8_t ready;
+    uint8_t mode;
+
+    f_number_unsigned_t failsafe_item_id;
+
+    controller_control_t control;
+
+    f_string_dynamic_t path_cgroup;
+    f_string_dynamic_t path_control;
+    f_string_dynamic_t path_current;
+    f_string_dynamic_t path_pid;
+    f_string_dynamic_t path_setting;
+
+    f_string_dynamic_t name_entry;
+
+    controller_entry_t entry;
+    controller_entry_t exit;
+    controller_rules_t rules;
+  } controller_process_t;
+
+  #define controller_process_t_initialize { \
+    0, \
+    0, \
+    0, \
+    0, \
+    controller_control_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    f_string_dynamic_t_initialize, \
+    controller_entry_t_initialize, \
+    controller_entry_t_initialize, \
+    controller_rules_t_initialize, \
+  }
+#endif // _di_controller_process_t_
+
+/**
+ * The main program data as a single structure.
+ *
+ * program: The main program data.
+ * setting: The settings data.
+ *
+ * process: The active process information.
+ */
+#ifndef _di_controller_main_t_
+  typedef struct {
+    fll_program_data_t program;
+    controller_setting_t setting;
+
+    controller_process_t *process;
+  } controller_main_t;
+
+  #define controller_main_t_initialize \
+    { \
+      fll_program_data_t_initialize, \
+      controller_setting_t_initialize, \
+      controller_process_t_initialize, \
+    }
+#endif // _di_controller_main_t_
+
+/**
+ * Deallocate main program data.
+ *
+ * @param main
+ *   The main program data.
+ *
+ *   This does not alter main.setting.state.status.
+ *
+ * @return
+ *   F_okay on success.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_controller_main_delete_
+  extern f_status_t controller_main_delete(controller_main_t * const main);
+#endif // _di_controller_main_delete_
+
+/**
+ * Delete the controller control data.
+ *
+ * @param control
+ *   The controller control data.
+ *
+ * @return
+ *   F_okay on success.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_controller_control_delete_
+  extern f_status_t controller_control_delete(controller_control_t * const control);
+#endif // _di_controller_control_delete_
+
+/**
  * Identify the payload code the given name represents.
  *
  * @param payload
@@ -552,27 +1462,19 @@ extern "C" {
 #endif // _di_controller_entry_action_type_name_
 
 /**
- * Deallocate main.
- *
- * If main.signal is non-zero, then this blocks and handles the following signals:
- *   - F_signal_abort
- *   - F_signal_broken_pipe
- *   - F_signal_hangup
- *   - F_signal_interrupt
- *   - F_signal_quit
- *   - F_signal_termination
+ * Delete the controller process data.
  *
- * @param main
- *   The main program data.
+ * @param process
+ *   The controller process data.
  *
  * @return
  *   F_okay on success.
  *
- *   Status codes (with error bit) are returned on any problem.
+ *   F_parameter (with error bit) if a parameter is invalid.
  */
-#ifndef _di_controller_main_delete_
-  extern f_status_t controller_main_delete(controller_main_t * const main);
-#endif // _di_controller_main_delete_
+#ifndef _di_controller_process_delete_
+  extern f_status_t controller_process_delete(controller_process_t * const process);
+#endif // _di_controller_process_delete_
 
 /**
  * Identify the rule action code the given name represents.
@@ -714,10 +1616,8 @@ extern "C" {
  *   The parameters passed to the process (often referred to as command line arguments).
  * @param main
  *   The main program data.
- * @param setting
- *   The main program settings.
  *
- *   This alters setting.state.status:
+ *   This alters main.setting.state.status:
  *     F_okay on success.
  *
  *     Errors (with error bit) from: f_console_parameter_process().
@@ -727,30 +1627,330 @@ extern "C" {
  * @see fll_program_parameter_process_context()
  */
 #ifndef _di_controller_setting_load_
-  extern void controller_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main, controller_setting_t * const setting);
+  extern f_status_t controller_setting_load(const f_console_arguments_t arguments, fll_program_data_t * const main);
 #endif // _di_controller_setting_load_
 
 /**
- * Perform the standard program setting unload process.
+ * Fully deallocate all memory for the given entry action without caring about return status.
  *
- * @param main
- *   The main program and setting data.
- *   All buffers are deallocated.
+ * @param action
+ *   The action to deallocate.
  *
- *   This does not alter main.setting.state.status.
+ * @see f_memory_arrays_resize()
+ *
+ * @return
+ *   F_okay on success.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_controller_entry_action_delete_
+  extern f_status_t controller_entry_action_delete(controller_entry_action_t * const action);
+#endif // _di_controller_entry_action_delete_
+
+/**
+ * Fully deallocate all memory for the given entry actions without caring about return status.
+ *
+ * @param actions
+ *   The entry_actions to deallocate.
+ *
+ * @return
+ *   F_okay on success.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
+ * @see controller_entry_action_delete()
+ * @see f_memory_delete()
+ */
+#ifndef _di_controller_entry_actions_delete_
+  extern f_status_t controller_entry_actions_delete(controller_entry_actions_t * const actions);
+#endif // _di_controller_entry_actions_delete_
+
+/**
+ * Increase the size of the entry item actions array by the specified amount, but only if necessary.
+ *
+ * This only increases size if the current used plus amount is greater than the currently allocated size.
+ *
+ * @param amount
+ *   A positive number representing how much to increase the size by.
+ * @param actions
+ *   The entry item actions to resize.
+ *
+ * @return
+ *   F_okay on success.
+ *   F_array_too_large (with error bit) if the resulting new size is bigger than the max array length.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_resize()
+ */
+#ifndef _di_controller_entry_actions_increase_by_
+  extern f_status_t controller_entry_actions_increase_by(const f_number_unsigned_t amount, controller_entry_actions_t * const actions);
+#endif // _di_controller_entry_actions_increase_by_
+
+/**
+ * Fully deallocate all memory for the given entry item without caring about return status.
+ *
+ * @param item
+ *   The item to deallocate.
+ *
+ * @return
+ *   F_okay on success.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
+ * @see f_memory_array_resize()
+ */
+#ifndef _di_controller_entry_item_delete_
+  extern f_status_t controller_entry_item_delete(controller_entry_item_t * const item);
+#endif // _di_controller_entry_item_delete_
+
+/**
+ * Fully deallocate all memory for the given entry items without caring about return status.
+ *
+ * @param items
+ *   The entry_items to deallocate.
  *
  * @return
  *   F_okay on success.
  *
  *   F_parameter (with error bit) if a parameter is invalid.
  *
- *   Errors (with error bit) from: controller_setting_delete().
+ * @see controller_entry_item_delete()
+ * @see f_memory_delete()
+ */
+#ifndef _di_controller_entry_items_delete_
+  extern f_status_t controller_entry_items_delete(controller_entry_items_t * const items);
+#endif // _di_controller_entry_items_delete_
+
+/**
+ * Increase the size of the entry items array by the specified amount, but only if necessary.
+ *
+ * This only increases size if the current used plus amount is greater than the currently allocated size.
+ *
+ * @param amount
+ *   A positive number representing how much to increase the size by.
+ * @param items
+ *   The entry items to resize.
+ *
+ * @return
+ *   F_okay on success.
+ *   F_array_too_large (with error bit) if the resulting new size is bigger than the max array length.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_resize()
+ */
+#ifndef _di_controller_entry_items_increase_by_
+  extern f_status_t controller_entry_items_increase_by(const f_number_unsigned_t amount, controller_entry_items_t * const items);
+#endif // _di_controller_entry_items_increase_by_
+
+/**
+ * Fully deallocate all memory for the given Rule Action without caring about return status.
+ *
+ * @param action
+ *   The action to deallocate.
+ *
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_controller_rule_action_delete_
+  extern void controller_rule_action_delete(controller_rule_action_t * const action);
+#endif // _di_controller_rule_action_delete_
+
+/**
+ * Fully deallocate all memory for the given Rule Actions without caring about return status.
+ *
+ * @param actions
+ *   The rule_actions to deallocate.
+ *
+ * @see controller_rule_action_delete()
+ * @see f_memory_delete()
+ */
+#ifndef _di_controller_rule_actions_delete_
+  extern void controller_rule_actions_delete(controller_rule_actions_t * const actions);
+#endif // _di_controller_rule_actions_delete_
+
+/**
+ * Increase the size of the Rule Actions array by the specified amount, but only if necessary.
+ *
+ * This only increases size if the current used plus amount is greater than the currently allocated size.
+ *
+ * @param amount
+ *   A positive number representing how much to increase the size by.
+ * @param actions
+ *   The actions to resize.
+ *
+ * @return
+ *   F_okay on success.
+ *   F_array_too_large (with error bit) if the resulting new size is bigger than the max array length.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_controller_rule_actions_increase_by_
+  extern f_status_t controller_rule_actions_increase_by(const f_number_unsigned_t amount, controller_rule_actions_t * const actions);
+#endif // _di_controller_rule_actions_increase_by_
+
+/**
+ * Fully deallocate all memory for the given Rule without caring about return status.
+ *
+ * @param rule
+ *   The rule to deallocate.
+ *
+ * @see controller_rule_items_delete()
+ * @see f_capability_delete()
+ * @see f_memory_array_resize()
+ * @see f_memory_arrays_resize()
+ */
+#ifndef _di_controller_rule_delete_
+  extern void controller_rule_delete(controller_rule_t * const rule);
+#endif // _di_controller_rule_delete_
+
+/**
+ * Fully deallocate all memory for the given Rule Item without caring about return status.
+ *
+ * @param item
+ *   The item to deallocate.
+ *
+ * @see f_memory_array_resize()
+ */
+#ifndef _di_controller_rule_item_delete_
+  extern void controller_rule_item_delete(controller_rule_item_t * const item);
+#endif // _di_controller_rule_item_delete_
+
+/**
+ * Fully deallocate all memory for the given Rule Items without caring about return status.
+ *
+ * @param items
+ *   The rule_items to deallocate.
+ *
+ * @see controller_rule_item_delete()
+ * @see f_memory_delete()
+ */
+#ifndef _di_controller_rule_items_delete_
+  extern void controller_rule_items_delete(controller_rule_items_t * const items);
+#endif // _di_controller_rule_items_delete_
+
+/**
+ * Fully deallocate all memory for the given Rule Item without caring about return status.
+ *
+ * @param on
+ *   The on to deallocate.
+ *
+ * @see f_memory_array_resize()
+ */
+#ifndef _di_controller_rule_on_delete_
+  extern void controller_rule_on_delete(controller_rule_on_t * const on);
+#endif // _di_controller_rule_on_delete_
+
+/**
+ * Fully deallocate all memory for the given Rule Items without caring about return status.
+ *
+ * @param ons
+ *   The rule_ons to deallocate.
+ *
+ * @see controller_rule_on_delete()
+ * @see f_memory_delete()
+ */
+#ifndef _di_controller_rule_ons_delete_
+  extern void controller_rule_ons_delete(controller_rule_ons_t * const ons);
+#endif // _di_controller_rule_ons_delete_
+
+/**
+ * Increase the size of the Rule array, but only if necessary.
+ *
+ * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d).
+ * If already set to the maximum buffer size, then the resize will fail.
+ *
+ * @param ons
+ *   The on array to resize.
+ *
+ * @return
+ *   F_okay on success.
+ *   F_data_not on success, but there is no reason to increase size (used + controller_common_allocation_small_d <= size).
+ *
+ *   F_array_too_large (with error bit) if the new array length is too large.
+ *   F_memory_not (with error bit) on out of memory.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
+ * @see controller_rule_ons_resize()
+ */
+#ifndef _di_controller_rule_ons_increase_
+  extern f_status_t controller_rule_ons_increase(controller_rule_ons_t * const ons);
+#endif // _di_controller_rule_increase_
+
+/**
+ * Resize the Rule array.
+ *
+ * @param length
+ *   The new size to use.
+ * @param ons
+ *   The on array to resize.
+ *
+ * @return
+ *   F_okay on success.
+ *
+ *   F_memory_not (with error bit) on out of memory.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
+ * @see f_memory_resize()
+ */
+#ifndef _di_controller_rule_ons_resize_
+  extern f_status_t controller_rule_ons_resize(const f_number_unsigned_t length, controller_rule_ons_t * const ons);
+#endif // _di_controller_rule_ons_resize_
+
+/**
+ * Fully deallocate all memory for the given Rules without caring about return status.
+ *
+ * @param rules
+ *   The rules to deallocate.
+ *
+ * @see controller_rules_resize()
+ */
+#ifndef _di_controller_rules_delete_
+  extern void controller_rules_delete(controller_rules_t * const rules);
+#endif // _di_controller_rules_delete_
+
+/**
+ * Increase the size of the Rule array, but only if necessary.
+ *
+ * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d).
+ * If already set to the maximum buffer size, then the resize will fail.
+ *
+ * @param rules
+ *   The rule array to resize.
+ *
+ * @return
+ *   F_okay on success.
+ *   F_data_not on success, but there is no reason to increase size (used + controller_common_allocation_small_d <= size).
+ *
+ *   F_array_too_large (with error bit) if the new array length is too large.
+ *   F_memory_not (with error bit) on out of memory.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
+ * @see controller_rules_resize()
+ */
+#ifndef _di_controller_rules_increase_
+  extern f_status_t controller_rules_increase(controller_rules_t * const rules);
+#endif // _di_controller_rule_increase_
+
+/**
+ * Resize the Rule array.
+ *
+ * @param length
+ *   The new size to use.
+ * @param rules
+ *   The rule array to resize.
+ *
+ * @return
+ *   F_okay on success.
+ *
+ *   F_memory_not (with error bit) on out of memory.
+ *   F_parameter (with error bit) if a parameter is invalid.
  *
- * @see controller_setting_delete()
+ * @see f_memory_resize()
  */
-#ifndef _di_controller_setting_unload_
-  extern f_status_t controller_setting_unload(controller_main_t * const main);
-#endif // _di_controller_setting_unload_
+#ifndef _di_controller_rules_resize_
+  extern f_status_t controller_rules_resize(const f_number_unsigned_t length, controller_rules_t * const rules);
+#endif // _di_controller_rules_resize_
 
 #ifdef __cplusplus
 } // extern "C"
index c7b3fd37d416e842447788336fd041af47999e65..ba3ac5e46b0d6bb2d6c067425b86eebd5311ac6d 100644 (file)
@@ -475,10 +475,10 @@ extern "C" {
  * setting: All loaded settings.
  * thread:  All thread related data.
  */
-#ifndef _di_controller_main_t_
+#ifndef _di_controller_main_old_t_
   typedef struct {
     controller_main_t *main;
-    controller_setting_t *setting;
+    controller_process_t *setting;
     controller_thread_t *thread;
   } controller_global_t;
 
@@ -489,7 +489,7 @@ extern "C" {
     setting, \
     thread, \
   }
-#endif // _di_controller_main_t_
+#endif // _di_controller_main_old_t_
 
 /**
  * A wrapper used for passing a set of entry processing and execution related data.
@@ -500,7 +500,7 @@ extern "C" {
 #ifndef _di_controller_main_entry_t_
   typedef struct {
     controller_global_t *global;
-    controller_setting_t *setting;
+    controller_process_t *setting;
   } controller_main_entry_t;
 
   #define controller_main_entry_t_initialize { 0, 0 }
index 5a2732218f1cfc978160e0ec507a1050bd00f0ab..4f5eb4f436d03591b33c430c51dbbda827d452b1 100644 (file)
@@ -5,18 +5,6 @@
 extern "C" {
 #endif
 
-#ifndef _di_controller_control_delete_simple_
-  void controller_control_delete_simple(controller_control_t * const control) {
-
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &control->cache_1.string, &control->cache_1.used, &control->cache_1.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &control->cache_2.string, &control->cache_2.used, &control->cache_2.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &control->cache_3.string, &control->cache_3.used, &control->cache_3.size);
-
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &control->input.string, &control->input.used, &control->input.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &control->output.string, &control->output.used, &control->output.size);
-  }
-#endif // _di_controller_control_delete_simple_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 367ad3ceb49596f4a74ccddbe2057bfef2011e2d..03ea664c298b9086efc785ba2c6d48fa4b2b1b42 100644 (file)
 extern "C" {
 #endif
 
-/**
- * Provide default control settings.
- *
- * controller_control_default:
- *   - socket_backlog:     The amount of waiting client connections to support while handling a socket connection.
- *   - socket_buffer:      The preferred max size of the buffer such that if the buffer exceeds this then it is reallocated to this size at the end of processing.
- *   - socket_buffer_max:  The max size allowed in the buffer (this value must not be set smaller than the packet headers).
- *   - socket_cache:       The preferred max size of the control cache such that if the cache exceeds this then it is reallocated to this size at the end of processing.
- *   - socket_header:      The minimum size in bytes of the packet header to read to be able to process the size information.
- *   - socket_linger:      The number of seconds to linger the connection before closing.
- *   - socket_timeout:     The number of microseconds to wait.
- *   - socket_payload_max: The max size allowed for the "payload" part of a packet and must be smaller than socket_buffer_max (this is smaller than socket_buffer_max to allow for enough room to afford a header).
- */
-#ifndef _di_controller_control_defaults_
-  #define controller_control_default_socket_backlog_d     64
-  #define controller_control_default_socket_buffer_d      2048
-  #define controller_control_default_socket_buffer_max_d  4294967296
-  #define controller_control_default_socket_cache_d       128
-  #define controller_control_default_socket_header_d      5
-  #define controller_control_default_socket_linger_d      2
-  #define controller_control_default_socket_timeout_d     10000 // 0.01 seconds.
-  #define controller_control_default_socket_payload_max_d 4294965248
-#endif // _di_controller_defaults_
-
-
-/**
- * The control data.
- *
- * controller_control_flag_*:
- *   - readonly:  Control is set to read-only mode.
- *   - has_user:  A user is manually specified.
- *   - has_group: A group is manually specified.
- *   - has_mode:  A file mode is manually specified.
- *
- * flag:    Flags from controller_control_flag_*.
- * user:    The user ID, if specified.
- * group:   The group ID, if specified.
- * mode:    The file mode, if specified.
- * server:  The server socket connection.
- * client:  The client socket connection.
- * cache_1: A generic buffer used for caching control related data.
- * cache_2: A generic buffer used for caching control related data.
- * cache_3: A generic buffer used for caching control related data.
- * input:   A buffer used for receiving data from the client.
- * output:  A buffer used for transmitting data to the client.
- * address: The socket address structure.
- */
-#ifndef _di_controller_control_t_
-  enum {
-    controller_control_flag_readonly_e  = 0x1,
-    controller_control_flag_has_user_e  = 0x2,
-    controller_control_flag_has_group_e = 0x4,
-    controller_control_flag_has_mode_e  = 0x8,
-  };
-
-  typedef struct {
-    uint8_t flag;
-
-    uid_t user;
-    gid_t group;
-    mode_t mode;
-
-    f_socket_t server;
-    f_socket_t client;
-
-    f_string_dynamic_t cache_1;
-    f_string_dynamic_t cache_2;
-    f_string_dynamic_t cache_3;
-
-    f_string_dynamic_t input;
-    f_string_dynamic_t output;
-
-    struct sockaddr_un address;
-  } controller_control_t;
-
-  #define controller_control_t_initialize { \
-    0, \
-    -1, \
-    -1, \
-    0, \
-    f_socket_t_initialize, \
-    f_socket_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    { }, \
-  }
-#endif // _di_controller_control_t_
-
-/**
- * A codes repesent different flags associated with a packet.
- *
- * controller_control_packet_flag_*:
- *   - binary:     Designate that the packet is in binary mode (when not set then packet is in string mode).
- *   - endian_big: Designate that the packet is in big endian order (when not set then packet is in little endian order).
- */
-#ifndef _di_controller_control_packet_flag_
-  #define controller_control_packet_flag_binary_d     0x10000000
-  #define controller_control_packet_flag_endian_big_d 0x01000000
-#endif // _di_controller_control_packet_flag_
-
-/**
- * Fully deallocate all memory for the given control data without caring about return status.
- *
- * @param control
- *   The structure to deallocate.
- */
-#ifndef _di_controller_control_delete_simple_
-  extern void controller_control_delete_simple(controller_control_t * const control) F_attribute_visibility_internal_d;
-#endif // _di_controller_control_delete_simple_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 08a2372368a8ff4038b7bb180ad95110cccfdf6c..4f5eb4f436d03591b33c430c51dbbda827d452b1 100644 (file)
@@ -5,96 +5,6 @@
 extern "C" {
 #endif
 
-#ifndef _di_controller_entry_action_delete_simple_
-  void controller_entry_action_delete_simple(controller_entry_action_t * const action) {
-
-    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size, &f_string_dynamics_delete_callback);
-  }
-#endif // _di_controller_entry_action_delete_simple_
-
-#ifndef _di_controller_entry_actions_delete_simple_
-  void controller_entry_actions_delete_simple(controller_entry_actions_t * const actions) {
-
-    // @todo Determine if this should be replaced with a resize callback strategy.
-    actions->used = actions->size;
-
-    while (actions->used) {
-      controller_entry_action_delete_simple(&actions->array[--actions->used]);
-    } // while
-
-    f_memory_array_resize(0, sizeof(controller_entry_action_t), (void **) &actions->array, &actions->used, &actions->size);
-  }
-#endif // _di_controller_entry_actions_delete_simple_
-
-#ifndef _di_controller_entry_actions_increase_by_
-  f_status_t controller_entry_actions_increase_by(const f_number_unsigned_t amount, controller_entry_actions_t * const actions) {
-
-    if (amount) {
-      if (actions->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
-      const f_number_unsigned_t length = actions->used + amount;
-
-      if (length > actions->size) {
-        const f_status_t status = f_memory_resize(actions->size, length, sizeof(controller_entry_action_t), (void **) & actions->array);
-
-        if (F_status_is_error_not(status)) {
-          actions->size = actions->used + amount;
-        }
-
-        return status;
-      }
-    }
-
-    return F_data_not;
-  }
-#endif // _di_controller_entry_actions_increase_by_
-
-#ifndef _di_controller_entry_item_delete_simple_
-  void controller_entry_item_delete_simple(controller_entry_item_t * const item) {
-
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &item->name.string, &item->name.used, &item->name.size);
-
-    controller_entry_actions_delete_simple(&item->actions);
-  }
-#endif // _di_controller_entry_item_delete_simple_
-
-#ifndef _di_controller_entry_items_delete_simple_
-  void controller_entry_items_delete_simple(controller_entry_items_t * const items) {
-
-    // @todo Determine if this should be replaced with a resize callback strategy.
-    items->used = items->size;
-
-    while (items->used) {
-      controller_entry_item_delete_simple(&items->array[--items->used]);
-    } // while
-
-    f_memory_array_resize(0, sizeof(controller_entry_item_t), (void **) &items->array, &items->used, &items->size);
-  }
-#endif // _di_controller_entry_items_delete_simple_
-
-#ifndef _di_controller_entry_items_increase_by_
-  f_status_t controller_entry_items_increase_by(const f_number_unsigned_t amount, controller_entry_items_t * const items) {
-
-    if (amount) {
-      if (items->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
-      const f_number_unsigned_t length = items->used + amount;
-
-      if (length > items->size) {
-        const f_status_t status = f_memory_resize(items->size, length, sizeof(controller_entry_item_t), (void **) & items->array);
-
-        if (F_status_is_error_not(status)) {
-          items->size = items->used + amount;
-        }
-
-        return status;
-      }
-    }
-
-    return F_data_not;
-  }
-#endif // _di_controller_entry_items_increase_by_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index f35e861a36fb6883d7051d81fef03a0e10a99bc2..3e055f415c0d5c61041d95d58246eeb65926cb2a 100644 (file)
 extern "C" {
 #endif
 
-/**
- * An Entry Item Action.
- *
- * controller_entry_action_flag_*:
- *   - undefined: The given type and code are designated as undefined.
- *
- * controller_entry_action_type_*:
- *   - consider: Designate a rule to be pre-loaded.
- *   - execute:  Execute into another program.
- *   - failsafe: Designate a failsafe "item".
- *   - freeze:   A Rule Action for freezing.
- *   - item:     A named set of Rules.
- *   - kill:     A Rule Action for killing.
- *   - pause:    A Rule Action for pausing.
- *   - ready:    Designate readiness for special processing for Entry or Exit.
- *   - reload:   A Rule Action for reloading.
- *   - restart:  A Rule Action for restarting.
- *   - resume:   A Rule Action for resuming.
- *   - start:    A Rule Action for starting.
- *   - stop:     A Rule Action for stopping.
- *   - timeout:  Inline timeout settings.
- *   - thaw:     A Rule Action for unfreezing.
- *
- * controller_entry_rule_code_*:
- *   - asynchronous: Process Rule asynchronously.
- *   - require:      Require Rule operations to succeed or the Entry/Exit will fail.
- *   - wait:         Wait for all existing asynchronous processes to finish before operating Rule.
- *
- * controller_entry_timeout_code_*:
- *   - exit:  The timeout Action represents an exit timeout.
- *   - kill:  The timeout Action represents a kill timeout.
- *   - start: The timeout Action represents a start timeout.
- *   - stop:  The timeout Action represents a stop timeout.
- *
- * type:       The type of Action.
- * code:       A single code or sub-type associated with the Action.
- * flag:       A set of flags to describe special behavior for the given type and code (flags may be different per type and code).
- * line:       The line number where the Entry Item begins.
- * number:     The unsigned number that some types use instead of the "parameters".
- * status:     The overall status.
- * parameters: The values associated with the Action.
- */
-#ifndef _di_controller_entry_action_t_
-  #define controller_entry_rule_code_asynchronous_d 0x1
-  #define controller_entry_rule_code_require_d      0x2
-  #define controller_entry_rule_code_wait_d         0x4
-
-  #define controller_entry_timeout_code_exit_d  0x1
-  #define controller_entry_timeout_code_kill_d  0x2
-  #define controller_entry_timeout_code_start_d 0x4
-  #define controller_entry_timeout_code_stop_d  0x8
-
-  enum {
-    controller_entry_action_flag_none_e      = 0x0,
-    controller_entry_action_flag_undefined_e = 0x1,
-  };
-
-  typedef struct {
-    uint8_t type;
-    uint8_t code;
-    uint8_t flag;
-
-    f_number_unsigned_t line;
-    f_number_unsigned_t number;
-
-    f_status_t status;
-
-    f_string_dynamics_t parameters;
-  } controller_entry_action_t;
-
-  #define controller_entry_action_t_initialize { \
-    0, \
-    0, \
-    0, \
-    controller_entry_action_flag_none_e, \
-    0, \
-    F_known_not, \
-    f_string_dynamics_t_initialize, \
-  }
-#endif // _di_controller_entry_action_t_
-
-/**
- * The Entry Item Actions.
- *
- * array: An array of Entry Item Actions.
- * size:  Total amount of allocated space.
- * used:  Total number of allocated spaces used.
- */
-#ifndef _di_controller_entry_actions_t_
-  typedef struct {
-    controller_entry_action_t *array;
-
-    f_number_unsigned_t size;
-    f_number_unsigned_t used;
-  } controller_entry_actions_t;
-
-  #define controller_entry_actions_t_initialize { \
-    0, \
-    0, \
-    0, \
-  }
-#endif // _di_controller_entry_actions_t_
-
-/**
- * An Entry Item.
- *
- * line:    The line number where the Entry Item begins.
- * name:    The name of the Entry Item.
- * actions: The Actions associated with the Entry Item.
- */
-#ifndef _di_controller_entry_item_t_
-  typedef struct {
-    f_number_unsigned_t line;
-    f_string_dynamic_t name;
-
-    controller_entry_actions_t actions;
-  } controller_entry_item_t;
-
-  #define controller_entry_item_t_initialize \
-    { \
-      0, \
-      f_string_dynamic_t_initialize, \
-      controller_entry_actions_t_initialize, \
-    }
-#endif // _di_controller_entry_item_t_
-
-/**
- * An Entry Items.
- *
- * array: An array of Entry Items.
- * size:  Total amount of allocated space.
- * used:  Total number of allocated spaces used.
- */
-#ifndef _di_controller_entry_items_t_
-  typedef struct {
-    controller_entry_item_t *array;
-
-    f_number_unsigned_t size;
-    f_number_unsigned_t used;
-  } controller_entry_items_t;
-
-  #define controller_entry_items_t_initialize { \
-    0, \
-    0, \
-    0, \
-  }
-
-  #define macro_controller_entry_items_t_clear(items) \
-    items.array = 0; \
-    items.size = 0; \
-    items.used = 0;
-#endif // _di_controller_entry_items_t_
-
-/**
- * The Entry or Exit.
- *
- * Entry and Exit files are essentially the same structure with minor differences in settings and behavior.
- * The structure is identical and due to lacking any particularly good name to represent both "entry" or "exit", the name "entry" is being used for both.
- *
- * controller_entry_flag_*:
- *   - none_e:             No flags are set.
- *   - timeout_exit_no_e:  The exit timeout is disabled.
- *   - timeout_kill_no_e:  The kill timeout is disabled for Rules by default.
- *   - timeout_start_no_e: The start timeout is disabled for Rules by default.
- *   - timeout_stop_no_e:  The stop timeout is disabled for Rules by default.
- *
- * controller_entry_session_*:
- *   - none: No special session configuration specified, use built in defaults.
- *   - new:  Designate the default to use a new session, ignoring built in defaults (passing FL_execute_parameter_option_session_d to the execute functions).
- *   - same: Designate the default to use a same session, ignoring built in defaults.
- *
- * controller_entry_pid_*:
- *   - disable: Do not check for or create a PID file to represent the entry execution.
- *   - require: Check to see if the PID file exists for an entry at startup and then when "ready" create a pid file, display error on pid file already exists or on failure and then fail.
- *   - ready:   When "ready" create a pid file, display error on failure and then fail (does not check if PID file exists).
- *
- * controller_entry_show_*:
- *   - normal: Do not print anything other than warnings and errors, but allow executed programs and scripts to output however they like.
- *   - init:   Print like an init program, printing status of entry and rules as they are being started, stopped, etc...
- *
- * define:        Any defines (environment variables) made available to all Rules in this entry for IKI substitution or just as environment variables.
- * flag:          A set of flags, primarily used to designate that timeouts are disabled.
- * items:         The array of entry items.
- * parameter:     Any parameters made available to all Rules in this entry for IKI substitution.
- * pid:           The PID file generation setting.
- * session:       The default session settings (when NULL, no default is specified).
- * show:          The show setting for controlling what to show when executing entry items and rules.
- * status:        The overall status.
- * timeout_exit:  The timeout to wait when exiting the Controller program after sending the terminate signal to send the kill signal.
- * timeout_kill:  The timeout to wait relating to using a kill signal.
- * timeout_start: The timeout to wait relating to starting a process.
- * timeout_stop:  The timeout to wait relating to stopping a process.
- */
-#ifndef _di_controller_entry_t_
-  enum {
-    controller_entry_pid_disable_e = 0,
-    controller_entry_pid_require_e,
-    controller_entry_pid_ready_e,
-  };
-
-  enum {
-    controller_entry_show_normal_e = 0,
-    controller_entry_show_init_e,
-  };
-
-  enum {
-    controller_entry_session_none_e = 0,
-    controller_entry_session_new_e,
-    controller_entry_session_same_e,
-  };
-
-  enum {
-    controller_entry_flag_none_e             = 0x0,
-    controller_entry_flag_timeout_exit_no_e  = 0x1,
-    controller_entry_flag_timeout_kill_no_e  = 0x2,
-    controller_entry_flag_timeout_start_no_e = 0x4,
-    controller_entry_flag_timeout_stop_no_e  = 0x8,
-  };
-
-  typedef struct {
-    f_status_t status;
-
-    uint8_t pid;
-    uint8_t session;
-    uint8_t show;
-    uint8_t flag;
-
-    f_number_unsigned_t timeout_exit;
-    f_number_unsigned_t timeout_kill;
-    f_number_unsigned_t timeout_start;
-    f_number_unsigned_t timeout_stop;
-
-    f_string_maps_t define;
-    f_string_maps_t parameter;
-
-    controller_entry_items_t items;
-  } controller_entry_t;
-
-  #define controller_entry_t_initialize { \
-    F_known_not, \
-    controller_entry_pid_require_e, \
-    controller_entry_session_none_e, \
-    controller_entry_show_normal_e, \
-    0, \
-    controller_thread_exit_timeout_d, \
-    0, \
-    0, \
-    0, \
-    f_string_maps_t_initialize, \
-    f_string_maps_t_initialize, \
-    controller_entry_items_t_initialize, \
-  }
-#endif // _di_controller_entry_t_
-
-/**
- * Fully deallocate all memory for the given entry action without caring about return status.
- *
- * @param action
- *   The action to deallocate.
- *
- * @see f_memory_arrays_resize()
- */
-#ifndef _di_controller_entry_action_delete_simple_
-  extern void controller_entry_action_delete_simple(controller_entry_action_t * const action) F_attribute_visibility_internal_d;
-#endif // _di_controller_entry_action_delete_simple_
-
-/**
- * Fully deallocate all memory for the given entry actions without caring about return status.
- *
- * @param actions
- *   The entry_actions to deallocate.
- *
- * @see controller_entry_action_delete_simple()
- * @see f_memory_delete()
- */
-#ifndef _di_controller_entry_actions_delete_simple_
-  extern void controller_entry_actions_delete_simple(controller_entry_actions_t * const actions) F_attribute_visibility_internal_d;
-#endif // _di_controller_entry_actions_delete_simple_
-
-/**
- * Increase the size of the entry item actions array by the specified amount, but only if necessary.
- *
- * This only increases size if the current used plus amount is greater than the currently allocated size.
- *
- * @param amount
- *   A positive number representing how much to increase the size by.
- * @param actions
- *   The entry item actions to resize.
- *
- * @return
- *   F_okay on success.
- *   F_array_too_large (with error bit) if the resulting new size is bigger than the max array length.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_resize()
- */
-#ifndef _di_controller_entry_actions_increase_by_
-  extern f_status_t controller_entry_actions_increase_by(const f_number_unsigned_t amount, controller_entry_actions_t * const actions) F_attribute_visibility_internal_d;
-#endif // _di_controller_entry_actions_increase_by_
-
-/**
- * Fully deallocate all memory for the given entry item without caring about return status.
- *
- * @param item
- *   The item to deallocate.
- *
- * @see f_memory_array_resize()
- */
-#ifndef _di_controller_entry_item_delete_simple_
-  extern void controller_entry_item_delete_simple(controller_entry_item_t * const item) F_attribute_visibility_internal_d;
-#endif // _di_controller_entry_item_delete_simple_
-
-/**
- * Fully deallocate all memory for the given entry items without caring about return status.
- *
- * @param items
- *   The entry_items to deallocate.
- *
- * @see controller_entry_item_delete_simple()
- * @see f_memory_delete()
- */
-#ifndef _di_controller_entry_items_delete_simple_
-  extern void controller_entry_items_delete_simple(controller_entry_items_t * const items) F_attribute_visibility_internal_d;
-#endif // _di_controller_entry_items_delete_simple_
-
-/**
- * Increase the size of the entry items array by the specified amount, but only if necessary.
- *
- * This only increases size if the current used plus amount is greater than the currently allocated size.
- *
- * @param amount
- *   A positive number representing how much to increase the size by.
- * @param items
- *   The entry items to resize.
- *
- * @return
- *   F_okay on success.
- *   F_array_too_large (with error bit) if the resulting new size is bigger than the max array length.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_resize()
- */
-#ifndef _di_controller_entry_items_increase_by_
-  extern f_status_t controller_entry_items_increase_by(const f_number_unsigned_t amount, controller_entry_items_t * const items) F_attribute_visibility_internal_d;
-#endif // _di_controller_entry_items_increase_by_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 2be224f22e9d2c3dadcc0b5e29bff6b44021333b..a38c7777819c8776f4e65084e6bfd4ff78e286d2 100644 (file)
@@ -43,7 +43,7 @@ extern "C" {
 #endif // _di_controller_pids_resize_
 
 #ifndef _di_controller_process_delete_simple_
-  void controller_process_delete_simple(controller_process_t * const process) {
+  void controller_process_delete_simple(controller_data_t * const process) {
 
     if (process->id_thread) {
       f_thread_signal_write(process->id_thread, F_signal_kill);
@@ -110,16 +110,16 @@ extern "C" {
       }
     } // for
 
-    status = f_memory_resize(processs->size, length, sizeof(controller_process_t), (void **) & processs->array);
+    status = f_memory_resize(processs->size, length, sizeof(controller_data_t), (void **) & processs->array);
     if (F_status_is_error(status)) return status;
 
     if (length) {
-      controller_process_t *process = 0;
+      controller_data_t *process = 0;
 
       // The lock must be initialized, but only once, so initialize immediately upon allocation.
       for (; processs->size < length; ++processs->size) {
 
-        status = f_memory_new(1, sizeof(controller_process_t), (void **) &processs->array[processs->size]);
+        status = f_memory_new(1, sizeof(controller_data_t), (void **) &processs->array[processs->size]);
 
         if (F_status_is_error_not(status)) {
           process = processs->array[processs->size];
index a43b575c386f1ad12c8f9b1229d9900d65b6a1e3..2cf407671092b2dcdb3a45457afa332588866cf0 100644 (file)
@@ -66,15 +66,15 @@ extern "C" {
  * stack:        A stack used to represent dependencies as Rule ID's to avoid circular rule dependencies (If Rule A waits on Rule B, then Rule B must not wait on Rule A).
  * state:        The state of the process.
  * status:       The last execution status of the process.
- * type:         The currently active process type (from the controller_process_type_*_e).
+ * type:         The currently active process type (from the controller_data_type_*_e).
  * wait:         A thread condition to tell a process waiting process that the rule has is done being processed.
  * wait_lock:    A mutex lock for working with "wait".
  *
  * main_data:    Used for passing the controller_main_t data to the process thread (to populate controller_global_t).
- * main_setting: Used for passing the controller_setting_t data to the process thread (to populate controller_global_t).
+ * main_setting: Used for passing the controller_process_t data to the process thread (to populate controller_global_t).
  * main_thread:  Used for passing the controller_thread_t data to the process thread (to populate controller_global_t).
  */
-#ifndef _di_controller_process_t_
+#ifndef _di_controller_data_t_
   #define controller_process_option_asynchronous_d 0x1
   #define controller_process_option_require_d      0x2
   #define controller_process_option_simulate_d     0x4
@@ -89,9 +89,9 @@ extern "C" {
   };
 
   enum {
-    controller_process_type_entry_e = 1,
-    controller_process_type_exit_e,
-    controller_process_type_control_e,
+    controller_data_type_entry_e = 1,
+    controller_data_type_exit_e,
+    controller_data_type_control_e,
   };
 
   typedef struct {
@@ -121,9 +121,9 @@ extern "C" {
     void *main_data;
     void *main_setting;
     void *main_thread;
-  } controller_process_t;
+  } controller_data_t;
 
-  #define controller_process_t_initialize { \
+  #define controller_data_t_initialize { \
     0, \
     0, \
     0, \
@@ -143,7 +143,7 @@ extern "C" {
     0, \
     0, \
   }
-#endif // _di_controller_process_t_
+#endif // _di_controller_data_t_
 
 /**
  * The Rule Processes.
@@ -156,7 +156,7 @@ extern "C" {
  */
 #ifndef _di_controller_processs_t_
   typedef struct {
-    controller_process_t **array;
+    controller_data_t **array;
 
     f_number_unsigned_t size;
     f_number_unsigned_t used;
@@ -223,7 +223,7 @@ extern "C" {
  * @see f_thread_mutex_delete()
  */
 #ifndef _di_controller_process_delete_simple_
-  extern void controller_process_delete_simple(controller_process_t * const process) F_attribute_visibility_internal_d;
+  extern void controller_process_delete_simple(controller_data_t * const process) F_attribute_visibility_internal_d;
 #endif // _di_controller_process_delete_simple_
 
 /**
index c8b643129c9c084178ad5258e216c92e2873bad5..4f5eb4f436d03591b33c430c51dbbda827d452b1 100644 (file)
@@ -5,220 +5,6 @@
 extern "C" {
 #endif
 
-#ifndef _di_controller_rule_action_t_
-  const f_string_static_t controller_rule_action_method_string_extended_s = macro_f_string_static_t_initialize_1(CONTROLLER_rule_action_method_string_extended_s, 0, CONTROLLER_rule_action_method_string_extended_s_length);
-  const f_string_static_t controller_rule_action_method_string_extended_list_s = macro_f_string_static_t_initialize_1(CONTROLLER_rule_action_method_string_extended_list_s, 0, CONTROLLER_rule_action_method_string_extended_list_s_length);
-#endif // _di_controller_rule_action_t_
-
-#ifndef _di_controller_rule_action_delete_simple_
-  void controller_rule_action_delete_simple(controller_rule_action_t * const action) {
-
-    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size, &f_string_dynamics_delete_callback);
-
-    f_memory_array_resize(0, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size);
-  }
-#endif // _di_controller_rule_action_delete_simple_
-
-#ifndef _di_controller_rule_actions_delete_simple_
-  void controller_rule_actions_delete_simple(controller_rule_actions_t * const actions) {
-
-    actions->used = actions->size;
-
-    while (actions->used) {
-      controller_rule_action_delete_simple(&actions->array[--actions->used]);
-    } // while
-
-    f_memory_delete(actions->size, sizeof(controller_rule_action_t), (void **) & actions->array);
-    actions->size = 0;
-  }
-#endif // _di_controller_rule_actions_delete_simple_
-
-#ifndef _di_controller_rule_actions_increase_by_
-  f_status_t controller_rule_actions_increase_by(const f_number_unsigned_t amount, controller_rule_actions_t * const actions) {
-
-    if (amount) {
-      if (actions->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
-      const f_number_unsigned_t length = actions->used + amount;
-
-      if (length > actions->size) {
-        const f_status_t status = f_memory_resize(actions->size, length, sizeof(controller_rule_action_t), (void **) & actions->array);
-
-        if (F_status_is_error_not(status)) {
-          actions->size = actions->used + amount;
-        }
-
-        return status;
-      }
-    }
-
-    return F_data_not;
-  }
-#endif // _di_controller_rule_actions_increase_by_
-
-#ifndef _di_controller_rule_delete_simple_
-  void controller_rule_delete_simple(controller_rule_t * const rule) {
-
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &rule->engine.string, &rule->engine.used, &rule->engine.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &rule->name.string, &rule->name.used, &rule->name.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &rule->path.string, &rule->path.used, &rule->path.size);
-
-    f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &rule->define.array, &rule->define.used, &rule->define.size, &f_string_maps_delete_callback);
-    f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &rule->parameter.array, &rule->parameter.used, &rule->parameter.size, &f_string_maps_delete_callback);
-
-    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &rule->engine_arguments.array, &rule->engine_arguments.used, &rule->engine_arguments.size, &f_string_dynamics_delete_callback);
-    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &rule->environment.array, &rule->environment.used, &rule->environment.size, &f_string_dynamics_delete_callback);
-
-    f_memory_array_resize(0, sizeof(int32_t), (void **) &rule->affinity.array, &rule->affinity.used, &rule->affinity.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &rule->cgroup.path.string, &rule->cgroup.path.used, &rule->cgroup.path.size);
-    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &rule->cgroup.groups.array, &rule->cgroup.groups.used, &rule->cgroup.groups.size, &f_string_dynamics_delete_callback);
-    f_memory_array_resize(0, sizeof(int32_t), (void **) &rule->groups.array, &rule->groups.used, &rule->groups.size);
-    f_memory_array_resize(0, sizeof(f_limit_set_t), (void **) &rule->limits.array, &rule->limits.used, &rule->limits.size);
-
-    if (rule->capability) {
-      f_capability_delete(&rule->capability);
-    }
-
-    controller_rule_ons_delete_simple(&rule->ons);
-    controller_rule_items_delete_simple(&rule->items);
-  }
-#endif // _di_controller_rule_delete_simple_
-
-#ifndef _di_controller_rule_item_delete_simple_
-  void controller_rule_item_delete_simple(controller_rule_item_t * const item) {
-
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &item->pid_file.string, &item->pid_file.used, &item->pid_file.size);
-
-    controller_rule_actions_delete_simple(&item->actions);
-  }
-#endif // _di_controller_rule_item_delete_simple_
-
-#ifndef _di_controller_rule_items_delete_simple_
-  void controller_rule_items_delete_simple(controller_rule_items_t * const items) {
-
-    items->used = items->size;
-
-    while (items->used) {
-      controller_rule_item_delete_simple(&items->array[--items->used]);
-    } // while
-
-    f_memory_delete(items->size, sizeof(controller_rule_item_t), (void **) & items->array);
-    items->size = 0;
-  }
-#endif // _di_controller_rule_items_delete_simple_
-
-#ifndef _di_controller_rule_on_delete_simple_
-  void controller_rule_on_delete_simple(controller_rule_on_t * const on) {
-
-    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &on->need.array, &on->need.used, &on->need.size, &f_string_dynamics_delete_callback);
-    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &on->want.array, &on->want.used, &on->want.size, &f_string_dynamics_delete_callback);
-    f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &on->wish.array, &on->wish.used, &on->wish.size, &f_string_dynamics_delete_callback);
-  }
-#endif // _di_controller_rule_on_delete_simple_
-
-#ifndef _di_controller_rule_ons_delete_simple_
-  void controller_rule_ons_delete_simple(controller_rule_ons_t * const ons) {
-
-    ons->used = ons->size;
-
-    while (ons->used) {
-      controller_rule_on_delete_simple(&ons->array[--ons->used]);
-    } // while
-
-    f_memory_delete(ons->size, sizeof(controller_rule_on_t), (void **) & ons->array);
-    ons->size = 0;
-  }
-#endif // _di_controller_rule_ons_delete_simple_
-
-#ifndef _di_controller_rule_ons_increase_
-  f_status_t controller_rule_ons_increase(controller_rule_ons_t * const ons) {
-
-    if (ons->used + 1 > ons->size) {
-      f_number_unsigned_t length = ons->used + controller_common_allocation_small_d;
-
-      if (length > F_number_t_size_unsigned_d) {
-        if (ons->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
-
-        length = F_number_t_size_unsigned_d;
-      }
-
-      return controller_rule_ons_resize(length, ons);
-    }
-
-    return F_data_not;
-  }
-#endif // _di_controller_rule_ons_increase_
-
-#ifndef _di_controller_rule_ons_resize_
-  f_status_t controller_rule_ons_resize(const f_number_unsigned_t length, controller_rule_ons_t * const ons) {
-
-    for (f_number_unsigned_t i = length; i < ons->size; ++i) {
-      controller_rule_on_delete_simple(&ons->array[i]);
-    } // for
-
-    const f_status_t status = f_memory_resize(ons->size, length, sizeof(controller_rule_on_t), (void **) & ons->array);
-    if (F_status_is_error(status)) return status;
-
-    ons->size = length;
-
-    if (ons->used > ons->size) {
-      ons->used = length;
-    }
-
-    return F_okay;
-  }
-#endif // _di_controller_rule_ons_resize_
-
-#ifndef _di_controller_rules_delete_simple_
-  void controller_rules_delete_simple(controller_rules_t * const rules) {
-
-    controller_rules_resize(0, rules);
-  }
-#endif // _di_controller_rules_delete_simple_
-
-#ifndef _di_controller_rules_increase_
-  f_status_t controller_rules_increase(controller_rules_t * const rules) {
-
-    if (rules->used + 1 > rules->size) {
-      f_number_unsigned_t length = rules->used + controller_common_allocation_small_d;
-
-      if (length > F_number_t_size_unsigned_d) {
-        if (rules->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
-
-        length = F_number_t_size_unsigned_d;
-      }
-
-      return controller_rules_resize(length, rules);
-    }
-
-    return F_data_not;
-  }
-#endif // _di_controller_rules_increase_
-
-#ifndef _di_controller_rules_resize_
-  f_status_t controller_rules_resize(const f_number_unsigned_t length, controller_rules_t * const rules) {
-
-    for (f_number_unsigned_t i = length; i < rules->size; ++i) {
-      controller_rule_delete_simple(&rules->array[i]);
-    } // for
-
-    const f_status_t status = f_memory_resize(rules->size, length, sizeof(controller_rule_t), (void **) & rules->array);
-    if (F_status_is_error(status)) return status;
-
-    rules->size = length;
-
-    if (rules->used > rules->size) {
-      rules->used = length;
-    }
-
-    return F_okay;
-  }
-#endif // _di_controller_rules_resize_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 068e6c44fa129a0664067671194d8d8d13a8d649..f1e080ca77d5150ad520ac4ff23fed081b3971eb 100644 (file)
 extern "C" {
 #endif
 
-/**
- * The Rule "rerun" item for controlling re-execution.
- *
- * count: A count of the number of executions.
- * delay: The time to wait before attempting to re-run.
- * max:   The maximum number of times to re-run (with 0 representing re-run infinitely) for executions.
- */
-#ifndef _di_controller_rule_rerun_item_t_
-  typedef struct {
-    bool reset;
-
-    f_number_unsigned_t count;
-    f_number_unsigned_t delay;
-    f_number_unsigned_t max;
-  } controller_rule_rerun_item_t;
-
-  #define controller_rule_rerun_item_initialize { \
-    F_false, \
-    0, \
-    5000, \
-    0, \
-
-  #define macro_controller_rule_rerun_item_initialize(item) { \
-    item.reset = F_false; \
-    item.count = 0; \
-    item.delay = 5000; \
-    item.max = 0; \
-  }
-#endif // _di_controller_rule_rerun_item_t_
-
-/**
- * The Rule "rerun" values for controlling re-execution.
- *
- * controller_rule_rerun_is_*:
- *   - failure:       The success re-run is enabled.
- *   - failure_reset: Reset success counter when failure is returned.
- *   - success:       The success re-run is enabled.
- *   - success_reset: Reset failure counter when success is returned.
- *
- * is:            A bitwise set of options to designate whether rerun is enabled or not and other options.
- * count_failure: A count of the number of failed executions.
- * count_success: A count of the number of successful executions.
- * delay_failure: The time to wait before attempting to "rerun" for failed executions.
- * delay_success: The time to wait before attempting to "rerun" for successful executions.
- * max_failure:   The maximum number of times to "rerun" (with 0 representing "rerun" infinitely) for failed executions.
- * max_success:   The maximum number of times to "rerun" (with 0 representing "rerun" infinitely) for successful executions.
- */
-#ifndef _di_controller_rule_rerun_t_
-  #define controller_rule_rerun_is_failure_d       0x1
-  #define controller_rule_rerun_is_failure_reset_d 0x2
-  #define controller_rule_rerun_is_success_d       0x4
-  #define controller_rule_rerun_is_success_reset_d 0x8
-
-  typedef struct {
-    uint8_t is;
-
-    controller_rule_rerun_item_t failure;
-    controller_rule_rerun_item_t success;
-  } controller_rule_rerun_t;
-
-  #define controller_rule_rerun_initialize { \
-    0, \
-    controller_rule_rerun_item_initialize, \
-    controller_rule_rerun_item_initialize, \
-  }
-#endif // _di_controller_rule_rerun_t_
-
-/**
- * A Rule Action.
- *
- * controller_rule_action_method_*:
- *   - extended:      Designate that this Action is represented using FSS Extended.
- *   - extended_list: Designate that this Action is represented using FSS Extended List.
- *
- * type:       The Rule Action type.
- * line:       The line number where the Rule Action begins.
- * status:     The last execution status of the Rule Action.
- * parameters: All parameters associated with the Rule Action.
- */
-#ifndef _di_controller_rule_action_t_
-  #define CONTROLLER_rule_action_method_string_extended_s      "FSS-0001 (Extended)"
-  #define CONTROLLER_rule_action_method_string_extended_list_s "FSS-0003 (Extended List)"
-
-  #define CONTROLLER_rule_action_method_string_extended_s_length      19
-  #define CONTROLLER_rule_action_method_string_extended_list_s_length 24
-
-  extern const f_string_static_t controller_rule_action_method_string_extended_s;
-  extern const f_string_static_t controller_rule_action_method_string_extended_list_s;
-
-  enum {
-    controller_rule_action_method_extended_e = 1,
-    controller_rule_action_method_extended_list_e,
-  };
-
-  typedef struct {
-    uint8_t type;
-    f_number_unsigned_t line;
-    f_status_t status;
-
-    f_string_dynamics_t parameters;
-    f_iki_datas_t ikis;
-  } controller_rule_action_t;
-
-  #define controller_rule_action_t_initialize { \
-    0, \
-    0, \
-    F_known_not, \
-    f_string_dynamics_t_initialize, \
-    f_iki_datas_t_initialize, \
-  }
-#endif // _di_controller_rule_action_t_
-
-/**
- * The Rule Actions.
- *
- * array: An array of Rule Actions.
- * size:  Total amount of allocated space.
- * used:  Total number of allocated spaces used.
- */
-#ifndef _di_controller_rule_actions_t_
-  typedef struct {
-    controller_rule_action_t *array;
-
-    f_number_unsigned_t size;
-    f_number_unsigned_t used;
-  } controller_rule_actions_t;
-
-  #define controller_rule_actions_t_initialize { \
-    0, \
-    0, \
-    0, \
-  }
-#endif // _di_controller_rule_actions_t_
-
-/**
- * A Rule Item.
- *
- * controller_rule_item_type_*:
- *   - command: A Command to execute.
- *   - script:  A Script to execute.
- *   - service: A Service to execute.
- *   - setting: Settings associated with the Rule Item.
- *   - utility: A Utility to execute.
- *
- * type:    The type of the Rule Item.
- * with:    A bitwise number representing execute "with" options.
- * line:    The line number where the Rule Item begins.
- * reruns:  An array designating rerun settings for each execution type available.
- * actions: The actions associated with the Rule Item.
- */
-#ifndef _di_controller_rule_item_t_
-  typedef struct {
-    uint8_t type;
-    uint8_t with;
-    f_number_unsigned_t line;
-
-    f_string_dynamic_t pid_file;
-    controller_rule_rerun_t reruns[controller_rule_action_execute_type__enum_size_e];
-    controller_rule_actions_t actions;
-  } controller_rule_item_t;
-
-  #define controller_rule_item_t_initialize \
-    { \
-      0, \
-      0, \
-      0, \
-      f_string_dynamic_t_initialize, \
-      { \
-        controller_rule_rerun_t_initialize, \
-        controller_rule_rerun_t_initialize, \
-        controller_rule_rerun_t_initialize, \
-        controller_rule_rerun_t_initialize, \
-        controller_rule_rerun_t_initialize, \
-        controller_rule_rerun_t_initialize, \
-        controller_rule_rerun_t_initialize, \
-        controller_rule_rerun_t_initialize, \
-        controller_rule_rerun_t_initialize, \
-      }, \
-      controller_rule_actions_t_initialize, \
-    }
-#endif // _di_controller_rule_item_t_
-
-/**
- * The Rule Items.
- *
- * array: An array of Rule Items.
- * size:  Total amount of allocated space.
- * used:  Total number of allocated spaces used.
- */
-#ifndef _di_controller_rule_items_t_
-  typedef struct {
-    controller_rule_item_t *array;
-
-    f_number_unsigned_t size;
-    f_number_unsigned_t used;
-  } controller_rule_items_t;
-
-  #define controller_rule_items_initialize { \
-    0, \
-    0, \
-    0, \
-  }
-#endif // _di_controller_rule_items_t_
-
-/**
- * The Rule "on" values for designating dependencies.
- *
- * action: The Rule Action type this "on" dependencies are associated with.
- * need:   The Rule Alias for a required Rule.
- * want:   The Rule Alias for an optional Rule that is required to succeed if found.
- * wish:   The Rule Alias for an optional Rule that is not required.
- */
-#ifndef _di_controller_rule_on_t_
-  typedef struct {
-    uint8_t action;
-
-    f_string_dynamics_t need;
-    f_string_dynamics_t want;
-    f_string_dynamics_t wish;
-  } controller_rule_on_t;
-
-  #define controller_rule_on_initialize { \
-    0, \
-    f_string_dynamics_t_initialize, \
-    f_string_dynamics_t_initialize, \
-    f_string_dynamics_t_initialize, \
-  }
-#endif // _di_controller_rule_on_t_
-
-/**
- * The Rule "on" array.
- *
- * array: An array of Rule "on" values.
- * size:  Total amount of allocated space.
- * used:  Total number of allocated spaces used.
- */
-#ifndef _di_controller_rule_ons_t_
-  typedef struct {
-    controller_rule_on_t *array;
-
-    f_number_unsigned_t size;
-    f_number_unsigned_t used;
-  } controller_rule_ons_t;
-
-  #define controller_rule_ons_t_initialize { \
-    0, \
-    0, \
-    0, \
-  }
-#endif // _di_controller_rule_ons_t_
-
-/**
- * A Rule.
- *
- * controller_rule_setting_type_*:
- *   - affinity:         Setting type representing a affinity.
- *   - capability:       Setting type representing a capability.
- *   - cgroup:           Setting type representing a control group.
- *   - define:           Setting type representing a define.
- *   - engine:           Setting type representing a engine.
- *   - engine_arguments: Setting type representing a engine.
- *   - environment:      Setting type representing a environment.
- *   - group:            Setting type representing a group.
- *   - limit:            Setting type representing a limit.
- *   - name:             Setting type representing a name.
- *   - nice:             Setting type representing a nice.
- *   - on:               Setting type representing a on.
- *   - parameter:        Setting type representing a parameter.
- *   - path:             Setting type representing a path.
- *   - scheduler:        Setting type representing a scheduler.
- *   - user:             Setting type representing a user.
- *
- * controller_rule_has_*:
- *   - cgroup:    Has type representing a control group.
- *   - group:     Has type representing a group.
- *   - nice:      Has type representing a nice.
- *   - scheduler: Has type representing a scheduler.
- *   - user:      Has type representing a user.
- *
- * affinity:         The cpu affinity to be used when executing the Rule.
- * alias:            The distinct ID (machine name) of the Rule, such as "service/ssh".
- * capability:       The capability setting if the Rule "has" a capability.
- * cgroup:           The control group setting if the Rule "has" a control group.
- * define:           Any defines (environment variables) made available to the Rule for IKI substitution or just as environment variables.
- * engine:           The program or path to the program of the scripting engine to use when processing scripts in this Rule.
- * engine_arguments: Any arguments to pass to the engine program.
- * environment:      All environment variables allowed to be exposed to the Rule when processing.
- * group:            The group ID if the Rule "has" a group.
- * groups:           A set of group IDs to run the process with (first specified group is the primary group).
- * has:              Bitwise set of "has" codes representing what the Rule has.
- * items:            All items associated with the Rule.
- * limits:           The cpu/resource limits to use when executing the Rule.
- * name:             A human name for the Rule (does not have to be distinct), such as "Bash Script".
- * nice:             The niceness value if the Rule "has" nice.
- * on:               A set of parameters for defining dependencies and how they are needed, wanted, or wished for.
- * parameter:        Any parameters made available to the Rule for IKI substitution.
- * path:             The path to the Rule file.
- * scheduler:        The scheduler setting if the Rule "has" a scheduler.
- * status:           A set of action-specific success/failure status of the Rule. Each index represents a controller_rule_action_type_* enum value. Index 0 represents a global status.
- * timeout_exit:     The timeout to wait when exiting the Controller program after sending the terminate signal to send the kill signal.
- * timeout_kill:     The timeout to wait relating to using a kill signal.
- * timeout_start:    The timeout to wait relating to starting a process.
- * timeout_stop:     The timeout to wait relating to stopping a process.
- * timestamp:        The timestamp when the Rule was loaded.
- * user:             The User ID if the Rule "has" a user.
- */
-#ifndef _di_controller_rule_t_
-  enum {
-    controller_rule_setting_type_affinity_e = 1,
-    controller_rule_setting_type_capability_e,
-    controller_rule_setting_type_cgroup_e,
-    controller_rule_setting_type_define_e,
-    controller_rule_setting_type_engine_e,
-    controller_rule_setting_type_environment_e,
-    controller_rule_setting_type_group_e,
-    controller_rule_setting_type_limit_e,
-    controller_rule_setting_type_name_e,
-    controller_rule_setting_type_nice_e,
-    controller_rule_setting_type_on_e,
-    controller_rule_setting_type_parameter_e,
-    controller_rule_setting_type_path_e,
-    controller_rule_setting_type_scheduler_e,
-    controller_rule_setting_type_timeout_e,
-    controller_rule_setting_type_user_e,
-  };
-
-  // bitwise codes representing properties on controller_rule_t that have been found in the Rule file.
-  #define controller_rule_has_cgroup_d 0x1
-  #define controller_rule_has_environment_d   0x2
-  #define controller_rule_has_group_d         0x4
-  #define controller_rule_has_nice_d          0x8
-  #define controller_rule_has_scheduler_d     0x10
-  #define controller_rule_has_user_d          0x20
-
-  // Designate codes for timeout settings to be used during the loading of the Rule timeout settings.
-  #define controller_rule_timeout_code_kill_d  1
-  #define controller_rule_timeout_code_start_d 2
-  #define controller_rule_timeout_code_stop_d  3
-
-  typedef struct {
-    f_status_t status[controller_rule_action_type__enum_size_e];
-
-    f_number_unsigned_t timeout_kill;
-    f_number_unsigned_t timeout_start;
-    f_number_unsigned_t timeout_stop;
-
-    uint8_t has;
-    int nice;
-    uid_t user;
-    gid_t group;
-
-    f_time_spec_t timestamp;
-
-    f_string_dynamic_t alias;
-    f_string_dynamic_t engine;
-    f_string_dynamic_t name;
-    f_string_dynamic_t path;
-
-    f_string_maps_t define;
-    f_string_maps_t parameter;
-
-    f_string_dynamics_t engine_arguments;
-    f_string_dynamics_t environment;
-
-    f_int32s_t affinity;
-    f_capability_t capability;
-    f_control_group_t cgroup;
-    f_int32s_t groups;
-    f_limit_sets_t limits;
-    f_execute_scheduler_t scheduler;
-
-    controller_rule_ons_t ons;
-    controller_rule_items_t items;
-  } controller_rule_t;
-
-  #define controller_rule_t_initialize { \
-      { \
-        F_known_not, \
-        F_known_not, \
-        F_known_not, \
-        F_known_not, \
-        F_known_not, \
-        F_known_not, \
-        F_known_not, \
-        F_known_not, \
-        F_known_not, \
-        F_known_not, \
-        F_known_not, \
-        F_known_not, \
-        F_known_not, \
-        F_known_not, \
-        F_known_not, \
-      }, \
-    0, \
-    0, \
-    0, \
-    0, \
-    0, \
-    0, \
-    0, \
-    f_time_spec_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    f_string_maps_t_initialize, \
-    f_string_maps_t_initialize, \
-    f_string_dynamics_t_initialize, \
-    f_string_dynamics_t_initialize, \
-    f_int32s_t_initialize, \
-    f_capability_t_initialize, \
-    f_control_group_t_initialize, \
-    f_int32s_t_initialize, \
-    f_limit_sets_t_initialize, \
-    f_execute_scheduler_t_initialize, \
-    controller_rule_ons_initialize, \
-    controller_rule_items_initialize, \
-  }
-#endif // _di_controller_rule_t_
-
-/**
- * The Rules.
- *
- * array: An array of Rules.
- * size:  Total amount of allocated space.
- * used:  Total number of allocated spaces used.
- */
-#ifndef _di_controller_rules_t_
-  typedef struct {
-    controller_rule_t *array;
-
-    f_number_unsigned_t size;
-    f_number_unsigned_t used;
-  } controller_rules_t;
-
-  #define controller_rules_t_initialize { \
-    0, \
-    0, \
-    0, \
-  }
-#endif // _di_controller_rules_t_
-
-/**
- * Fully deallocate all memory for the given Rule Action without caring about return status.
- *
- * @param action
- *   The action to deallocate.
- *
- * @see f_memory_arrays_resize()
- */
-#ifndef _di_controller_rule_action_delete_simple_
-  extern void controller_rule_action_delete_simple(controller_rule_action_t * const action) F_attribute_visibility_internal_d;
-#endif // _di_controller_rule_action_delete_simple_
-
-/**
- * Fully deallocate all memory for the given Rule Actions without caring about return status.
- *
- * @param actions
- *   The rule_actions to deallocate.
- *
- * @see controller_rule_action_delete_simple()
- * @see f_memory_delete()
- */
-#ifndef _di_controller_rule_actions_delete_simple_
-  extern void controller_rule_actions_delete_simple(controller_rule_actions_t * const actions) F_attribute_visibility_internal_d;
-#endif // _di_controller_rule_actions_delete_simple_
-
-/**
- * Increase the size of the Rule Actions array by the specified amount, but only if necessary.
- *
- * This only increases size if the current used plus amount is greater than the currently allocated size.
- *
- * @param amount
- *   A positive number representing how much to increase the size by.
- * @param actions
- *   The actions to resize.
- *
- * @return
- *   F_okay on success.
- *   F_array_too_large (with error bit) if the resulting new size is bigger than the max array length.
- *
- *   Errors (with error bit) from: f_memory_resize().
- */
-#ifndef _di_controller_rule_actions_increase_by_
-  extern f_status_t controller_rule_actions_increase_by(const f_number_unsigned_t amount, controller_rule_actions_t * const actions) F_attribute_visibility_internal_d;
-#endif // _di_controller_rule_actions_increase_by_
-
-/**
- * Fully deallocate all memory for the given Rule without caring about return status.
- *
- * @param rule
- *   The rule to deallocate.
- *
- * @see controller_rule_items_delete_simple()
- * @see f_capability_delete()
- * @see f_memory_array_resize()
- * @see f_memory_arrays_resize()
- */
-#ifndef _di_controller_rule_delete_simple_
-  extern void controller_rule_delete_simple(controller_rule_t * const rule) F_attribute_visibility_internal_d;
-#endif // _di_controller_rule_delete_simple_
-
-/**
- * Fully deallocate all memory for the given Rule Item without caring about return status.
- *
- * @param item
- *   The item to deallocate.
- *
- * @see f_memory_array_resize()
- */
-#ifndef _di_controller_rule_item_delete_simple_
-  extern void controller_rule_item_delete_simple(controller_rule_item_t * const item) F_attribute_visibility_internal_d;
-#endif // _di_controller_rule_item_delete_simple_
-
-/**
- * Fully deallocate all memory for the given Rule Items without caring about return status.
- *
- * @param items
- *   The rule_items to deallocate.
- *
- * @see controller_rule_item_delete_simple()
- * @see f_memory_delete()
- */
-#ifndef _di_controller_rule_items_delete_simple_
-  extern void controller_rule_items_delete_simple(controller_rule_items_t * const items) F_attribute_visibility_internal_d;
-#endif // _di_controller_rule_items_delete_simple_
-
-/**
- * Fully deallocate all memory for the given Rule Item without caring about return status.
- *
- * @param on
- *   The on to deallocate.
- *
- * @see f_memory_array_resize()
- */
-#ifndef _di_controller_rule_on_delete_simple_
-  extern void controller_rule_on_delete_simple(controller_rule_on_t * const on) F_attribute_visibility_internal_d;
-#endif // _di_controller_rule_on_delete_simple_
-
-/**
- * Fully deallocate all memory for the given Rule Items without caring about return status.
- *
- * @param ons
- *   The rule_ons to deallocate.
- *
- * @see controller_rule_on_delete_simple()
- * @see f_memory_delete()
- */
-#ifndef _di_controller_rule_ons_delete_simple_
-  extern void controller_rule_ons_delete_simple(controller_rule_ons_t * const ons) F_attribute_visibility_internal_d;
-#endif // _di_controller_rule_ons_delete_simple_
-
-/**
- * Increase the size of the Rule array, but only if necessary.
- *
- * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d).
- * If already set to the maximum buffer size, then the resize will fail.
- *
- * @param ons
- *   The on array to resize.
- *
- * @return
- *   F_okay on success.
- *   F_data_not on success, but there is no reason to increase size (used + controller_common_allocation_small_d <= size).
- *
- *   F_array_too_large (with error bit) if the new array length is too large.
- *   F_memory_not (with error bit) on out of memory.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- * @see controller_rule_ons_resize()
- */
-#ifndef _di_controller_rule_ons_increase_
-  extern f_status_t controller_rule_ons_increase(controller_rule_ons_t * const ons) F_attribute_visibility_internal_d;
-#endif // _di_controller_rule_increase_
-
-/**
- * Resize the Rule array.
- *
- * @param length
- *   The new size to use.
- * @param ons
- *   The on array to resize.
- *
- * @return
- *   F_okay on success.
- *
- *   F_memory_not (with error bit) on out of memory.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- * @see f_memory_resize()
- */
-#ifndef _di_controller_rule_ons_resize_
-  extern f_status_t controller_rule_ons_resize(const f_number_unsigned_t length, controller_rule_ons_t * const ons) F_attribute_visibility_internal_d;
-#endif // _di_controller_rule_ons_resize_
-
-/**
- * Fully deallocate all memory for the given Rules without caring about return status.
- *
- * @param rules
- *   The rules to deallocate.
- *
- * @see controller_rules_resize()
- */
-#ifndef _di_controller_rules_delete_simple_
-  extern void controller_rules_delete_simple(controller_rules_t * const rules) F_attribute_visibility_internal_d;
-#endif // _di_controller_rules_delete_simple_
-
-/**
- * Increase the size of the Rule array, but only if necessary.
- *
- * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d).
- * If already set to the maximum buffer size, then the resize will fail.
- *
- * @param rules
- *   The rule array to resize.
- *
- * @return
- *   F_okay on success.
- *   F_data_not on success, but there is no reason to increase size (used + controller_common_allocation_small_d <= size).
- *
- *   F_array_too_large (with error bit) if the new array length is too large.
- *   F_memory_not (with error bit) on out of memory.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- * @see controller_rules_resize()
- */
-#ifndef _di_controller_rules_increase_
-  extern f_status_t controller_rules_increase(controller_rules_t * const rules) F_attribute_visibility_internal_d;
-#endif // _di_controller_rule_increase_
-
-/**
- * Resize the Rule array.
- *
- * @param length
- *   The new size to use.
- * @param rules
- *   The rule array to resize.
- *
- * @return
- *   F_okay on success.
- *
- *   F_memory_not (with error bit) on out of memory.
- *   F_parameter (with error bit) if a parameter is invalid.
- *
- * @see f_memory_resize()
- */
-#ifndef _di_controller_rules_resize_
-  extern f_status_t controller_rules_resize(const f_number_unsigned_t length, controller_rules_t * const rules) F_attribute_visibility_internal_d;
-#endif // _di_controller_rules_resize_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 94165b372926542cd9f965ec155228bf5e74c1b7..4f5eb4f436d03591b33c430c51dbbda827d452b1 100644 (file)
@@ -5,32 +5,6 @@
 extern "C" {
 #endif
 
-#ifndef _di_controller_setting_delete_simple_
-  void controller_setting_delete_simple(controller_setting_t * const setting) {
-
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &setting->name_entry.string, &setting->name_entry.used, &setting->name_entry.size);
-
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &setting->path_cgroup.string, &setting->path_cgroup.used, &setting->path_cgroup.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &setting->path_control.string, &setting->path_control.used, &setting->path_control.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &setting->path_current.string, &setting->path_current.used, &setting->path_current.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &setting->path_pid.string, &setting->path_pid.used, &setting->path_pid.size);
-    f_memory_array_resize(0, sizeof(f_char_t), (void **) &setting->path_setting.string, &setting->path_setting.used, &setting->path_setting.size);
-
-    controller_control_delete_simple(&setting->control);
-
-    status = f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &setting->entry.define.array, &setting->entry.define.used, &setting->entry.define.size, &f_string_maps_delete_callback);
-    status = f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &setting->entry.parameter.array, &setting->entry.parameter.used, &setting->entry.parameter.size, &f_string_maps_delete_callback);
-
-    status = f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &setting->exit.define.array, &setting->exit.define.used, &setting->exit.define.size, &f_string_maps_delete_callback);
-    status = f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &setting->exit.parameter.array, &setting->exit.parameter.used, &setting->exit.parameter.size, &f_string_maps_delete_callback);
-
-    controller_entry_items_delete_simple(&setting->entry.items);
-    controller_entry_items_delete_simple(&setting->exit.items);
-
-    controller_rules_delete_simple(&setting->rules);
-  }
-#endif // _di_controller_setting_delete_simple_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index f861cdb8f781974fb234291c621ac709c45d8d64..0837e5be44393a9f4a9bb564b11d32bcccf1749f 100644 (file)
 extern "C" {
 #endif
 
-/**
- * All setting data.
- *
- * controller_setting_ready_*:
- *   - no:    Entry/Exit is not ready.
- *   - wait:  Entry/Exit has "ready" somewhere in the file but is not yet ready.
- *   - yes:   Entry/Exit is now ready (Entry/Exit is still being processed).
- *   - done:  Entry/Exit is ready and processing is complete.
- *   - fail:  Entry/Exit processing failed.
- *   - abort: Abort received before finished processing Entry/Exit.
- *
- * controller_setting_mode_*:
- *   - helper:  Run as a helper, exiting when finished prrocess entry (and any respective exit).
- *   - program: Run as a program, exiting when finished prrocess entry (and any respective exit).
- *   - service: Run as a service, listening for requests after processing entry.
- *
- * controller_setting_flag_*:
- *   - interruptible: When specified, program responds to interrupt signals, otherwise block/ignore interrupt signals.
- *   - pid_created:   When specified, the program responds to interrupt signals, otherwise block/ignore interrupt signals.
- *   - failsafe:      When specified, failsafe mode is enabled, otherwise failsafe mode is disabled.
- *
- * flag:             Flags from controller_setting_flag_*.
- * ready:            State representing if the settings are all loaded and is ready to run program operations.
- * mode:             Controller setting mode based on the setting mode enumerator.
- * control:          The control socket data.
- * failsafe_item_id: The Entry Item ID to execute when failsafe execution is enabled.
- * path_cgroup:      Directory path to the cgroup directory.
- * path_control:     File path to the control socket (used for printing the path).
- * path_pid:         File path to the PID file.
- * path_setting:     File path to the setting directory.
- * entry:            The Entry settings.
- * rules:            All rules and their respective settings.
- */
-#ifndef _di_controller_setting_t_
-  enum {
-    controller_setting_ready_no_e = 0,
-    controller_setting_ready_wait_e,
-    controller_setting_ready_yes_e,
-    controller_setting_ready_done_e,
-    controller_setting_ready_fail_e,
-    controller_setting_ready_abort_e,
-  }; // enum
-
-  enum {
-    controller_setting_mode_service_e = 0,
-    controller_setting_mode_helper_e,
-    controller_setting_mode_program_e,
-  }; // enum
-
-  enum {
-    controller_setting_flag_interruptible_e = 0x1,
-    controller_setting_flag_pid_created_e   = 0x2,
-    controller_setting_flag_failsafe_e      = 0x4,
-  }; // enum
-
-  typedef struct {
-    uint8_t flag;
-    uint8_t ready;
-    uint8_t mode;
-
-    f_number_unsigned_t failsafe_item_id;
-
-    controller_control_t control;
-
-    f_string_dynamic_t path_cgroup;
-    f_string_dynamic_t path_control;
-    f_string_dynamic_t path_current;
-    f_string_dynamic_t path_pid;
-    f_string_dynamic_t path_setting;
-
-    f_string_dynamic_t name_entry;
-
-    controller_entry_t entry;
-    controller_entry_t exit;
-    controller_rules_t rules;
-  } controller_setting_t;
-
-  #define controller_setting_t_initialize { \
-    0, \
-    0, \
-    0, \
-    0, \
-    controller_control_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    f_string_dynamic_t_initialize, \
-    controller_entry_t_initialize, \
-    controller_entry_t_initialize, \
-    controller_rules_t_initialize, \
-  }
-#endif // _di_controller_setting_t_
-
-/**
- * Fully deallocate all memory for the given setting without caring about return status.
- *
- * @param setting
- *   The setting to deallocate.
- *
- * @see controller_entry_delete_simple()
- * @see controller_rules_delete_simple()
- *
- * @see f_memory_array_resize()
- */
-#ifndef _di_controller_setting_delete_simple_
-  extern void controller_setting_delete_simple(controller_setting_t * const setting) F_attribute_visibility_internal_d;
-#endif // _di_controller_setting_delete_simple_
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 2d66ea68745975f31fd9d60f4f0bc1b5f27d7a7a..77694726b68f2099b0c5401cdeb19db337f0e576 100644 (file)
@@ -13,78 +13,62 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_main_
-  f_status_t controller_main(controller_main_t * const main, const f_console_arguments_t arguments) {
-
-    f_status_t status = F_okay;
-
-    setting->state.step_small = controller_allocation_console_d;
-
-    status = f_console_parameter_process(arguments, &main->parameters, &setting->state, 0);
-
-    setting->state.step_small = controller_allocation_small_d;
+  void controller_main(controller_main_t * const main) {
 
     if (F_status_is_error(status)) return;
 
-    status = fll_program_parameter_process_context_standard(F_true, &main->program);
-
-    if (F_status_is_error(status)) {
-      fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_context_standard", fll_error_file_flag_fallback_e);
-
-      if (main->error.verbosity > f_console_verbosity_quiet_e) {
-        fll_print_dynamic_raw(f_string_eol_s, main->error);
-      }
-
-      return;
+    if ((main->setting.flag & controller_main_flag_print_first_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
+      fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
     }
 
-    status = fll_program_parameter_process_verbosity_standard(F_true, &main->program);
+    main->setting.state.status = F_okay;
 
-    if (F_status_is_error(status)) {
-      fll_error_print(main->error, F_status_set_fine(status), "fll_program_parameter_process_verbosity_standard", fll_error_file_flag_fallback_e);
+    if (main->setting.flag & controller_main_flag_version_copyright_help_e) {
+      if (main->setting.flag & controller_main_flag_help_e) {
+        controller_print_message_help(&main->program.message);
+      }
+      else if (main->setting.flag & controller_main_flag_version_e) {
+        fll_program_print_version(&main->program.message, controller_program_version_s);
+      }
+      else if (main->setting.flag & controller_main_flag_copyright_e) {
+        fll_program_print_copyright(&main->program.message);
+      }
 
-      if (main->error.verbosity > f_console_verbosity_quiet_e) {
-        fll_print_dynamic_raw(f_string_eol_s, main->error);
+      if ((main->setting.flag & controller_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
+        fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
       }
 
       return;
     }
 
-    if (main->parameters.array[f_console_standard_parameter_help_e].result & f_console_result_found_e) {
-      controller_print_help(main);
-
-      return F_okay;
-    }
-
-    if (main->parameters.array[f_console_standard_parameter_version_e].result & f_console_result_found_e) {
-      fll_program_print_version(main->message, controller_program_version_s);
+    if ((main->setting.flag & controller_main_flag_operation_build_e) && (main->setting.flag & controller_main_flag_operation_make_e)) {
+      main->setting.state.status = F_status_set_error(F_parameter);
 
-      return F_okay;
-    }
+      controller_print_error_parameter_operation_not_with(&main->program.error, controller_other_operation_build_s, controller_other_operation_make_s);
 
-    if (main->parameters.array[f_console_standard_parameter_copyright_e].result & f_console_result_found_e) {
-      fll_program_print_copyright(main->message);
+      if ((main->setting.flag & controller_main_flag_print_last_e) && main->program.message.verbosity > f_console_verbosity_error_e) {
+        fll_print_dynamic_raw(f_string_eol_s, main->program.message.to);
+      }
 
-      return F_okay;
+      return;
     }
 
-    status = F_okay;
-
     f_string_static_t * const argv = main->parameters.arguments.array;
 
-    controller_setting_t setting = controller_setting_t_initialize;
+    controller_process_t process = controller_process_t_initialize;
 
-    setting.control.server.address = (struct sockaddr *) &setting.control.address;
-    setting.control.server.domain = f_socket_protocol_family_local_e;
-    setting.control.server.type = f_socket_type_stream_d;
-    setting.control.server.length = sizeof(struct sockaddr_un);
+    process.control.server.address = (struct sockaddr *) &process.control.address;
+    process.control.server.domain = f_socket_protocol_family_local_e;
+    process.control.server.type = f_socket_type_stream_d;
+    process.control.server.length = sizeof(struct sockaddr_un);
 
-    memset(setting.control.server.address, 0, setting.control.server.length);
+    memset(process.control.server.address, 0, process.control.server.length);
 
     if (main->parameters.remaining.used) {
-      status = f_string_dynamic_append(argv[main->parameters.remaining.array[0]], &setting.name_entry);
+      status = f_string_dynamic_append(argv[main->parameters.remaining.array[0]], &process.name_entry);
     }
     else {
-      status = f_string_dynamic_append(controller_default_s, &setting.name_entry);
+      status = f_string_dynamic_append(controller_default_s, &process.name_entry);
     }
 
     if (F_status_is_error(status)) {
@@ -98,10 +82,10 @@ extern "C" {
     }
 
     if (main->as_init) {
-      setting.mode = controller_setting_mode_service_e;
+      process.mode = controller_setting_mode_service_e;
     }
 
-    status = f_path_current(F_false, &setting.path_current);
+    status = f_path_current(F_false, &process.path_current);
 
     if (F_status_is_error(status)) {
       fll_error_print(main->error, F_status_set_fine(status), "f_path_current", fll_error_file_flag_fallback_e);
@@ -123,20 +107,20 @@ extern "C" {
       else if (main->parameters.array[controller_parameter_settings_e].locations.used) {
         const f_number_unsigned_t index = main->parameters.array[controller_parameter_settings_e].values.array[main->parameters.array[controller_parameter_settings_e].values.used - 1];
 
-        status = controller_path_canonical_relative(&setting, argv[index], &setting.path_setting);
+        status = controller_path_canonical_relative(&process, argv[index], &process.path_setting);
 
         if (F_status_is_error(status)) {
           fll_error_file_print(main->error, F_status_set_fine(status), "controller_path_canonical_relative", fll_error_file_flag_fallback_e, argv[index], f_file_operation_verify_s, fll_error_file_type_path_e);
         }
       }
       else {
-        setting.path_setting.used = 0;
+        process.path_setting.used = 0;
 
         if (main->as_init) {
-          status = f_string_dynamic_append(*main->default_path_setting_init, &setting.path_setting);
+          status = f_string_dynamic_append(*main->default_path_setting_init, &process.path_setting);
         }
         else {
-          status = f_string_dynamic_append(*main->default_path_setting, &setting.path_setting);
+          status = f_string_dynamic_append(*main->default_path_setting, &process.path_setting);
         }
 
         if (F_status_is_error(status)) {
@@ -160,12 +144,12 @@ extern "C" {
         status = F_status_set_error(F_parameter);
       }
       else if (main->parameters.array[controller_parameter_pid_e].locations.used) {
-        setting.path_pid.used = 0;
+        process.path_pid.used = 0;
 
         const f_number_unsigned_t index = main->parameters.array[controller_parameter_pid_e].values.array[main->parameters.array[controller_parameter_pid_e].values.used - 1];
 
         if (argv[index].used) {
-          status = controller_path_canonical_relative(&setting, argv[index], &setting.path_pid);
+          status = controller_path_canonical_relative(&process, argv[index], &process.path_pid);
 
           if (F_status_is_error(status)) {
             fll_error_file_print(main->error, F_status_set_fine(status), "controller_path_canonical_relative", fll_error_file_flag_fallback_e, argv[index], f_file_operation_verify_s, fll_error_file_type_path_e);
@@ -174,28 +158,28 @@ extern "C" {
       }
     }
 
-    if (F_status_is_error_not(status) && !setting.path_pid.used && !main->parameters.array[controller_parameter_pid_e].locations.used) {
+    if (F_status_is_error_not(status) && !process.path_pid.used && !main->parameters.array[controller_parameter_pid_e].locations.used) {
       if (main->as_init) {
-        status = f_string_dynamic_append(*main->default_path_pid_init, &setting.path_pid);
+        status = f_string_dynamic_append(*main->default_path_pid_init, &process.path_pid);
       }
       else {
-        status = f_string_dynamic_append(*main->default_path_pid, &setting.path_pid);
+        status = f_string_dynamic_append(*main->default_path_pid, &process.path_pid);
       }
 
       if (F_status_is_error_not(status)) {
-        status = f_string_dynamic_append(f_path_separator_s, &setting.path_pid);
+        status = f_string_dynamic_append(f_path_separator_s, &process.path_pid);
       }
 
       if (F_status_is_error_not(status)) {
-        status = f_string_dynamic_append(*main->default_path_pid_prefix, &setting.path_pid);
+        status = f_string_dynamic_append(*main->default_path_pid_prefix, &process.path_pid);
       }
 
       if (F_status_is_error_not(status)) {
-        status = f_string_dynamic_append(setting.name_entry, &setting.path_pid);
+        status = f_string_dynamic_append(process.name_entry, &process.path_pid);
       }
 
       if (F_status_is_error_not(status)) {
-        status = f_string_dynamic_append(*main->default_path_pid_suffix, &setting.path_pid);
+        status = f_string_dynamic_append(*main->default_path_pid_suffix, &process.path_pid);
       }
 
       if (F_status_is_error(status)) {
@@ -221,13 +205,13 @@ extern "C" {
         const f_number_unsigned_t index = main->parameters.array[controller_parameter_cgroup_e].values.array[main->parameters.array[controller_parameter_cgroup_e].values.used - 1];
 
         if (argv[index].used) {
-          status = controller_path_canonical_relative(&setting, argv[index], &setting.path_cgroup);
+          status = controller_path_canonical_relative(&process, argv[index], &process.path_cgroup);
 
           if (F_status_is_error(status)) {
             fll_error_file_print(main->error, F_status_set_fine(status), "controller_path_canonical_relative", fll_error_file_flag_fallback_e, argv[index], f_file_operation_verify_s, fll_error_file_type_path_e);
           }
           else {
-            status = f_string_append_assure(F_path_separator_s, 1, &setting.path_cgroup);
+            status = f_string_append_assure(F_path_separator_s, 1, &process.path_cgroup);
 
             if (F_status_is_error(status)) {
               fll_error_print(main->error, F_status_set_fine(status), "f_string_append_assure", fll_error_file_flag_fallback_e);
@@ -267,22 +251,22 @@ extern "C" {
 
     // Handle defaults dependent on the "as init" execution state.
     if (main->as_init) {
-      setting.entry.pid = controller_entry_pid_disable_e;
-      setting.entry.show = controller_entry_show_init_e;
+      process.entry.pid = controller_entry_pid_disable_e;
+      process.entry.show = controller_entry_show_init_e;
 
       if (main->parameters.array[controller_parameter_interruptible_e].result & f_console_result_found_e) {
-        setting.flag |= controller_setting_flag_interruptible_e;
+        process.flag |= controller_setting_flag_interruptible_e;
       }
       else {
-        setting.flag &= ~controller_setting_flag_interruptible_e;
+        process.flag &= ~controller_setting_flag_interruptible_e;
       }
     }
     else {
       if (main->parameters.array[controller_parameter_uninterruptible_e].result & f_console_result_found_e) {
-        setting.flag &= ~controller_setting_flag_interruptible_e;
+        process.flag &= ~controller_setting_flag_interruptible_e;
       }
       else {
-        setting.flag |= controller_setting_flag_interruptible_e;
+        process.flag |= controller_setting_flag_interruptible_e;
       }
     }
 
@@ -302,18 +286,18 @@ extern "C" {
       }
 
       // A control file path is required.
-      if (!setting.path_cgroup.used) {
-        status = f_string_append_nulless(F_control_group_path_system_prefix_s, F_control_group_path_system_prefix_s_length, &setting.path_cgroup);
+      if (!process.path_cgroup.used) {
+        status = f_string_append_nulless(F_control_group_path_system_prefix_s, F_control_group_path_system_prefix_s_length, &process.path_cgroup);
 
         if (F_status_is_error_not(status)) {
-          status = f_string_append_nulless(F_control_group_path_system_default_s, F_control_group_path_system_default_s_length, &setting.path_cgroup);
+          status = f_string_append_nulless(F_control_group_path_system_default_s, F_control_group_path_system_default_s_length, &process.path_cgroup);
         }
 
         if (F_status_is_error(status)) {
           fll_error_print(main->error, F_status_set_fine(status), "f_string_append_nulless", fll_error_file_flag_fallback_e);
         }
         else {
-          status = f_string_append_assure(F_path_separator_s, 1, &setting.path_cgroup);
+          status = f_string_append_assure(F_path_separator_s, 1, &process.path_cgroup);
 
           if (F_status_is_error(status)) {
             fll_error_print(main->error, F_status_set_fine(status), "f_string_append_assure", fll_error_file_flag_fallback_e);
@@ -323,7 +307,7 @@ extern "C" {
     }
 
     if (F_status_is_error_not(status)) {
-      status = controller_thread_main(main, &setting);
+      status = controller_thread_main(main, &process);
     }
 
     // Ensure a newline is always put at the end of the program execution, unless in quiet mode.
@@ -335,15 +319,15 @@ extern "C" {
       fll_print_dynamic_raw(f_string_eol_s, main->output.to);
     }
 
-    if (status != F_child && (setting.flag & controller_setting_flag_pid_created_e)) {
-      const f_status_t status_delete = controller_file_pid_delete(main->pid, setting.path_pid);
+    if (status != F_child && (process.flag & controller_setting_flag_pid_created_e)) {
+      const f_status_t status_delete = controller_file_pid_delete(main->pid, process.path_pid);
 
       if (F_status_is_error(status_delete) && main->warning.verbosity == f_console_verbosity_debug_e) {
         if (F_status_set_fine(status_delete) == F_number_not) {
           controller_lock_print(main->warning.to, 0);
 
           fl_print_format("%r%[%QThe pid file '%]", main->warning.to, f_string_eol_s, main->warning.context, main->warning.prefix, main->warning.context);
-          fl_print_format(f_string_format_Q_single_s.string, main->warning.to, main->warning.notable, setting.path_pid, main->warning.notable);
+          fl_print_format(f_string_format_Q_single_s.string, main->warning.to, main->warning.notable, process.path_pid, main->warning.notable);
           fl_print_format("%[' must not be specified with the parameter '%]", main->warning.to, main->warning.context, main->warning.context);
           fl_print_format("%[%i%]", main->warning.to, main->warning.notable, main->pid, main->warning.notable);
           fl_print_format("%[' doesn't contain the expected number, not deleting file.%]%r", main->warning.to, main->warning.context, main->warning.context, f_string_eol_s);
@@ -351,25 +335,19 @@ extern "C" {
           controller_unlock_print_flush(main->warning.to, 0);
         }
         else if (F_status_set_fine(status_delete) != F_interrupt) {
-          fll_error_file_print(main->warning, F_status_set_fine(status_delete), "controller_file_pid_delete", fll_error_file_flag_fallback_e, setting.path_pid, f_file_operation_delete_s, fll_error_file_type_file_e);
+          fll_error_file_print(main->warning, F_status_set_fine(status_delete), "controller_file_pid_delete", fll_error_file_flag_fallback_e, process.path_pid, f_file_operation_delete_s, fll_error_file_type_file_e);
         }
       }
     }
 
-    if (status != F_child && setting.path_control.used) {
-      f_socket_disconnect(&setting.control.server, f_socket_close_read_write_e);
+    if (status != F_child && process.path_control.used) {
+      f_socket_disconnect(&process.control.server, f_socket_close_read_write_e);
 
-      if (!(setting.control.flag & controller_control_flag_readonly_e)) {
-        f_file_remove(setting.path_control);
+      if (!(process.control.flag & controller_control_flag_readonly_e)) {
+        f_file_remove(process.path_control);
       }
     }
 
-    controller_setting_delete_simple(&setting);
-
-    if (status == F_child) {
-      return status;
-    }
-
     return status;
   }
 #endif // _di_controller_main_
index 1328b58b8604c5755959c4b5e014865bdadc44b1..3abd99f2cbfd4954be90c1912e44cdc17a5be588 100644 (file)
@@ -88,9 +88,7 @@ extern "C" {
 /**
  * Execute main program.
  *
- * Be sure to call controller_main_delete() after executing this.
- *
- * If main.signal is non-zero, then this blocks and handles the following signals:
+ * If main.program.signal is non-zero, then this blocks and handles the following signals: @todo review and upadate this comment.
  *   - F_signal_abort
  *   - F_signal_broken_pipe
  *   - F_signal_hangup
@@ -99,22 +97,16 @@ extern "C" {
  *   - F_signal_termination
  *
  * @param main
- *   The main program data.
- * @param arguments
- *   The parameters passed to the process.
- *
- * @return
- *   F_okay on success.
- *   F_child if this is a child process returning.
- *
- *   F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal.
+ *   The main program and settings data.
  *
- *   Status codes (with error bit) are returned on any problem.
+ *   This alters main.setting.state.status:
+ *     F_okay on success.
+ *     F_child if this is a child process returning.
  *
- * @see controller_main_delete()
+ *     F_interrupt (with error bit) on interrupt signal received.
  */
 #ifndef _di_controller_main_
-  extern f_status_t controller_main(controller_main_t * const main, const f_console_arguments_t arguments);
+  extern void controller_main(controller_main_t * const main);
 #endif // _di_controller_main_
 
 #ifdef __cplusplus
index 9797b1ba4aed7a9eb0c458cafb7f3d6adef8aaa0..2d9e47fd89c84884dac848d457ec0b541e6b15c2 100644 (file)
@@ -365,7 +365,7 @@ extern "C" {
 #endif // _di_controller_get_id_group_
 
 #ifndef _di_controller_path_canonical_relative_
-  f_status_t controller_path_canonical_relative(const controller_setting_t * const setting, const f_string_static_t source, f_string_dynamic_t * const destination) {
+  f_status_t controller_path_canonical_relative(const controller_process_t * const setting, const f_string_static_t source, f_string_dynamic_t * const destination) {
 
     {
       const f_status_t status = fl_path_canonical(source, destination);
@@ -754,7 +754,7 @@ extern "C" {
 #endif // _di_controller_time_seconds_
 
 #ifndef _di_controller_time_sleep_nanoseconds_
-  int controller_time_sleep_nanoseconds(controller_main_t * const main, controller_setting_t * const setting, struct timespec time) {
+  int controller_time_sleep_nanoseconds(controller_main_t * const main, controller_process_t * const setting, struct timespec time) {
 
     // When sleep is a second or more, instead wait for terminating signals if interruptible.
     if ((setting->flag & controller_setting_flag_interruptible_e) && time.tv_sec) {
index 738ff201e2f348e6961bb73ee7d1a3724e273f75..7b05b6df5d1f7d84c43a037f5d82fbace9df1bda 100644 (file)
@@ -224,7 +224,7 @@ extern "C" {
  * @see fl_path_canonical()
  */
 #ifndef _di_controller_path_canonical_relative_
-  extern f_status_t controller_path_canonical_relative(const controller_setting_t * const global, const f_string_static_t source, f_string_dynamic_t * const destination) F_attribute_visibility_internal_d;
+  extern f_status_t controller_path_canonical_relative(const controller_process_t * const global, const f_string_static_t source, f_string_dynamic_t * const destination) F_attribute_visibility_internal_d;
 #endif // _di_controller_path_canonical_relative_
 
 /**
@@ -366,7 +366,7 @@ extern "C" {
  * @see nanosleep()
  */
 #ifndef _di_controller_time_sleep_nanoseconds_
-  extern int controller_time_sleep_nanoseconds(controller_main_t * const main, controller_setting_t * const setting, struct timespec time) F_attribute_visibility_internal_d;
+  extern int controller_time_sleep_nanoseconds(controller_main_t * const main, controller_process_t * const setting, struct timespec time) F_attribute_visibility_internal_d;
 #endif // _di_controller_time_sleep_nanoseconds_
 
 /**
index f4799986dbb50be61d125b90afcc7828e600333d..d0883a289ffa4b6f609ce2b7198d31619ccafad6 100644 (file)
@@ -1288,7 +1288,7 @@ extern "C" {
               options_process |= controller_process_option_asynchronous_d;
             }
 
-            status = controller_rule_process_begin(*global, options_force, alias_rule, controller_entry_action_type_to_rule_action_type(entry_action->type), options_process, is_entry ? controller_process_type_entry_e : controller_process_type_exit_e, stack, *cache);
+            status = controller_rule_process_begin(*global, options_force, alias_rule, controller_entry_action_type_to_rule_action_type(entry_action->type), options_process, is_entry ? controller_data_type_entry_e : controller_data_type_exit_e, stack, *cache);
 
             if (F_status_set_fine(status) == F_memory_not || status == F_child || F_status_set_fine(status) == F_interrupt) {
               break;
index 1c9228fede6b4895b67e6c0308b921d0d40c81f0..2b997686fae670d51961367bae238bc82f6154dd 100644 (file)
@@ -64,7 +64,7 @@ extern "C" {
 #endif // _di_controller_lock_read_
 
 #ifndef _di_controller_lock_read_process_
-  f_status_t controller_lock_read_process(controller_process_t * const process, controller_thread_t * const thread, f_thread_lock_t *lock) {
+  f_status_t controller_lock_read_process(controller_data_t * const process, controller_thread_t * const thread, f_thread_lock_t *lock) {
 
     return controller_lock_read_process_type(process->type, thread, lock);
   }
@@ -73,7 +73,7 @@ extern "C" {
 #ifndef _di_controller_lock_read_process_type_
   f_status_t controller_lock_read_process_type(const uint8_t type, controller_thread_t * const thread, f_thread_lock_t *lock) {
 
-    return controller_lock_read(type != controller_process_type_exit_e, thread, lock);
+    return controller_lock_read(type != controller_data_type_exit_e, thread, lock);
   }
 #endif // _di_controller_lock_read_process_type_
 
@@ -105,7 +105,7 @@ extern "C" {
 #endif // _di_controller_lock_write_
 
 #ifndef _di_controller_lock_write_process_
-  f_status_t controller_lock_write_process(controller_process_t * const process, controller_thread_t * const thread, f_thread_lock_t *lock) {
+  f_status_t controller_lock_write_process(controller_data_t * const process, controller_thread_t * const thread, f_thread_lock_t *lock) {
 
     return controller_lock_write_process_type(process->type, thread, lock);
   }
@@ -114,7 +114,7 @@ extern "C" {
 #ifndef _di_controller_lock_write_process_type_
   f_status_t controller_lock_write_process_type(const uint8_t type, controller_thread_t * const thread, f_thread_lock_t *lock) {
 
-    return controller_lock_write(type != controller_process_type_exit_e, thread, lock);
+    return controller_lock_write(type != controller_data_type_exit_e, thread, lock);
   }
 #endif // _di_controller_lock_write_process_type_
 
index 756406197d379497a913c005153c967c657cf265..8f216cca79a55f2b00e9caef9c88ee6184c7e9b7 100644 (file)
@@ -80,7 +80,7 @@ extern "C" {
  * @see controller_lock_read()
  */
 #ifndef _di_controller_lock_read_process_
-  extern f_status_t controller_lock_read_process(controller_process_t * const process, controller_thread_t * const thread, f_thread_lock_t *lock) F_attribute_visibility_internal_d;
+  extern f_status_t controller_lock_read_process(controller_data_t * const process, controller_thread_t * const thread, f_thread_lock_t *lock) F_attribute_visibility_internal_d;
 #endif // _di_controller_lock_read_process_
 
 /**
@@ -156,7 +156,7 @@ extern "C" {
  * @see controller_lock_write_process_type()
  */
 #ifndef _di_controller_lock_write_process_
-  extern f_status_t controller_lock_write_process(controller_process_t * const process, controller_thread_t * const thread, f_thread_lock_t *lock) F_attribute_visibility_internal_d;
+  extern f_status_t controller_lock_write_process(controller_data_t * const process, controller_thread_t * const thread, f_thread_lock_t *lock) F_attribute_visibility_internal_d;
 #endif // _di_controller_lock_write_process_
 
 /**
index 4c244e8e558913c600d5b34ae853993a6bed1267..75b40a5f6c2a78a284818d29ef2e236f71417e71 100644 (file)
@@ -7,62 +7,95 @@ int main(const int argc, const f_string_t *argv, const f_string_t *envp) {
 
   data.program.debug.flag |= controller_print_flag_debug_e | controller_print_flag_out_e;
   data.program.error.flag |= controller_print_flag_error_e | controller_print_flag_out_e;
-  data.program.output.flag |= controller_print_flag_out_e;
   data.program.message.flag |= controller_print_flag_message_e | controller_print_flag_out_e;
+  data.program.output.flag |= controller_print_flag_out_e;
   data.program.warning.flag |= controller_print_flag_warning_e | controller_print_flag_out_e;
-  data.program.error.custom = (void *) &data;
-  data.program.debug.custom = (void *) &data;
+
   data.program.message.custom = (void *) &data;
   data.program.output.custom = (void *) &data;
+  data.program.error.custom = (void *) &data;
   data.program.warning.custom = (void *) &data;
+  data.program.debug.custom = (void *) &data;
+
+  data.setting.state.data = (void *) &data;
+
+  data.setting.default_engine = &controller_default_engine_s;
+  data.setting.default_path_setting = &controller_path_settings_s;
+  data.setting.default_path_setting_init = &controller_path_settings_init_s;
+  data.setting.default_path_pid = &controller_path_pid_s;
+  data.setting.default_path_pid_init = &controller_path_pid_init_s;
+  data.setting.default_path_pid_prefix = &controller_path_pid_prefix_s;
+  data.setting.default_path_pid_suffix = &controller_path_pid_suffix_s;
+  data.setting.default_path_socket = &controller_path_socket_s;
+  data.setting.default_path_socket_init = &controller_path_socket_init_s;
+  data.setting.default_path_socket_prefix = &controller_path_socket_prefix_s;
+  data.setting.default_path_socket_suffix = &controller_path_socket_suffix_s;
+
+  data.setting.program_name = &controller_program_name_s;
+  data.setting.program_name_long = &controller_program_name_long_s;
+
+  // When run as "init" by default, provide the default system-level init path.
+  #ifdef _controller_as_init_
+    data.setting.as_init = F_true;
+  #else
+    data.setting.as_init = F_false;
+  #endif // _controller_as_init_
+
+  controller_process_t process = controller_process_t_initialize;
+  data.process = &process;
 
   f_console_parameter_t parameters[] = controller_console_parameter_t_initialize;
   data.program.parameters.array = parameters;
   data.program.parameters.used = controller_parameter_total_d;
   data.program.environment = envp;
 
+  data.program.pid = getpid();
+
   if (f_pipe_input_exists()) {
     data.program.pipe = fll_program_data_pipe_input_e;
   }
 
-  data.program.pid = getpid();
-
   fll_program_standard_set_up(&data.program);
 
   f_file_umask_get(&data.program.umask);
 
-  data.program.default_engine = &controller_default_engine_s;
-  data.program.default_path_setting = &controller_path_settings_s;
-  data.program.default_path_setting_init = &controller_path_settings_init_s;
-  data.program.default_path_pid = &controller_path_pid_s;
-  data.program.default_path_pid_init = &controller_path_pid_init_s;
-  data.program.default_path_pid_prefix = &controller_path_pid_prefix_s;
-  data.program.default_path_pid_suffix = &controller_path_pid_suffix_s;
-  data.program.default_path_socket = &controller_path_socket_s;
-  data.program.default_path_socket_init = &controller_path_socket_init_s;
-  data.program.default_path_socket_prefix = &controller_path_socket_prefix_s;
-  data.program.default_path_socket_suffix = &controller_path_socket_suffix_s;
-  data.program.program_name = &controller_program_name_s;
-  data.program.program_name_long = &controller_program_name_long_s;
+  #ifdef _di_thread_support_
+    {
+      const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize_1(argc, argv, envp);
 
-  // When run as "init" by default, provide the default system-level init path.
-  #ifdef _controller_as_init_
-    data.program.as_init = F_true;
+      controller_setting_load(arguments, &data);
+    }
+
+    controller_main(&data);
   #else
-    data.program.as_init = F_false;
-  #endif // _controller_as_init_
+    {
+      f_thread_id_t id_signal;
 
-  {
-    const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize_1(argc, argv, envp);
+      memset(&id_signal, 0, sizeof(f_thread_id_t));
 
-    controller_setting_load(arguments, &data);
-  }
+      data.setting.state.status = f_thread_create(0, &id_signal, &controller_thread_signal, (void *) &data);
+
+      if (F_status_is_error(data.setting.state.status)) {
+        controller_print_error(&data.program.error, macro_controller_f(f_thread_create));
+      }
+      else {
+        {
+          const f_console_arguments_t arguments = macro_f_console_arguments_t_initialize_1(argc, argv, envp);
+
+          controller_setting_load(arguments, &data);
+        }
 
-  controller_main(&data);
+        if (!controller_signal_check(&data)) {
+          controller_main(&data);
+        }
 
-  controller_setting_unload(&data);
+        f_thread_cancel(id_signal);
+        f_thread_join(id_signal, 0);
+      }
+    }
+  #endif // _di_thread_support_
 
-  controller_main_delete(&data.program);
+  controller_main_delete(&data);
 
   fll_program_standard_set_down(&data.program);
 
index 35861a943fc0f5bb0ffcb5ad0fcf676c5cea8aab..25053ced74abe8afc1df19b69271cc1938df1279 100644 (file)
@@ -6,15 +6,19 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_print_help_
-  f_status_t controller_print_help(controller_setting_t * const setting, const fl_print_t print) {
+  f_status_t controller_print_help(fl_print_t * const print) {
 
-    controller_lock_print(print.to, 0);
+    if (!print || !print->custom) return F_status_set_error(F_output_not);
 
-    fll_program_print_help_header(print, *main->program_name_long, controller_program_version_s);
+    controller_main_t * const main = (controller_main_t *) print->custom;
 
-    fll_program_print_help_option_standard(print.to, context);
+    f_file_stream_lock(print->to);
 
-    f_print_dynamic_raw(f_string_eol_s, print.to);
+    fll_program_print_help_header(print, main->setting.program_name_long, controller_program_version_s);
+
+    fll_program_print_help_option_standard(print);
+
+    f_print_dynamic_raw(f_string_eol_s, print->to);
 
     fll_program_print_help_option(print, controller_short_cgroup_s, controller_long_cgroup_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "         Specify a custom control group file path, such as '" F_control_group_path_system_prefix_s F_control_group_path_system_default_s "'.");
     fll_program_print_help_option(print, controller_short_daemon_s, controller_long_daemon_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "         Run in daemon only mode (do not process the entry).");
@@ -27,21 +31,19 @@ extern "C" {
     fll_program_print_help_option(print, controller_short_uninterruptible_s, controller_long_uninterruptible_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "Designate that this program cannot be interrupted by a signal.");
     fll_program_print_help_option(print, controller_short_validate_s, controller_long_validate_s, f_console_symbol_short_normal_s, f_console_symbol_long_normal_s, "       Validate the settings (entry and rules) without running (does not simulate).");
 
-    f_print_dynamic_raw(f_string_eol_s, print.to);
-    f_print_dynamic_raw(f_string_eol_s, print.to);
-
-    fll_program_print_help_usage(print, *main->program_name, controller_entry_s);
+    f_print_dynamic_raw(f_string_eol_s, print->to);
 
-    fl_print_format("%r  When both the %[%r%r%] parameter and the", print.to, f_string_eol_s, print.set->notable, f_console_symbol_long_normal_s, controller_long_simulate_s, print.set->notable);
-    fl_print_format(" %[%r%r%] parameter are specified, then additional information on each would be executed rule is printed but no simulation is performed.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, controller_long_validate_s, print.set->notable, f_string_eol_s, f_string_eol_s);
+    fll_program_print_help_usage(print, main->setting.program_name, f_string_empty_s);
 
-    const f_string_static_t interruptable = main->as_init ? controller_long_uninterruptible_s : controller_long_interruptible_s;
+    fl_print_format("%r  When both the %[%r%r%] parameter and the", print->to, f_string_eol_s, print->set->notable, f_console_symbol_long_normal_s, controller_long_simulate_s, print->set->notable);
+    fl_print_format(" %[%r%r%] parameter are specified, then additional information on each would be executed rule is printed but no simulation is performed.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, controller_long_validate_s, print->set->notable, f_string_eol_s, f_string_eol_s);
 
-    fl_print_format("  The default interrupt behavior is to operate as if the %[%r%r%] parameter is passed.%r%r", print.to, print.set->notable, f_console_symbol_long_normal_s, interruptable, print.set->notable, f_string_eol_s, f_string_eol_s);
+    fl_print_format("  The default interrupt behavior is to operate as if the %[%r%r%] parameter is passed.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, (main->setting.flag & controller_main_flag_init_e) ? controller_long_uninterruptible_s : controller_long_interruptible_s, print->set->notable, f_string_eol_s, f_string_eol_s);
 
-    fl_print_format("  Specify an empty string for the %[%r%r%] parameter to disable pid file creation for this program.%r", print.to, print.set->notable, f_console_symbol_long_normal_s, controller_long_pid_s, print.set->notable, f_string_eol_s);
+    fl_print_format("  Specify an empty string for the %[%r%r%] parameter to disable pid file creation for this program.%r", print->to, print->set->notable, f_console_symbol_long_normal_s, controller_long_pid_s, print->set->notable, f_string_eol_s);
 
-    controller_unlock_print_flush(print.to, 0);
+    f_file_stream_flush(print->to);
+    f_file_stream_unlock(print->to);
 
     return F_okay;
   }
index 867ad8f77b2dc1042673a676eb26505b4758ab58..9ee31643fed6f8cc7fe89c12777090600f765625 100644 (file)
@@ -27,7 +27,7 @@ extern "C" {
  *   F_output_not on success, but no printing is performed.
  */
 #ifndef _di_controller_print_help_
-  extern f_status_t controller_print_help(controller_setting_t * const setting, const fl_print_t print);
+  extern f_status_t controller_print_help(controller_process_t * const setting, const fl_print_t print);
 #endif // _di_controller_print_help_
 #ifdef __cplusplus
 } // extern "C"
index 977c15fd38480edf1199cec1b9c7d381df3f3d93..48aed2916c728e8a8b2dd019042e6ba02ecd3a6c 100644 (file)
@@ -50,7 +50,7 @@ extern "C" {
 
       if (F_status_is_error_not(status) && global.thread->processs.array[global.thread->processs.used]) {
 
-        controller_process_t *process = global.thread->processs.array[global.thread->processs.used];
+        controller_data_t *process = global.thread->processs.array[global.thread->processs.used];
 
         status = controller_lock_write(is_normal, global.thread, &process->lock);
 
@@ -96,12 +96,12 @@ extern "C" {
 #ifndef _di_controller_process_prepare_process_type_
   f_status_t controller_process_prepare_process_type(const controller_global_t global, const uint8_t type, const uint8_t action, const f_string_static_t alias, f_number_unsigned_t *id) {
 
-    return controller_process_prepare(global, type != controller_process_type_exit_e, action, alias, id);
+    return controller_process_prepare(global, type != controller_data_type_exit_e, action, alias, id);
   }
 #endif // _di_controller_process_prepare_process_type_
 
 #ifndef _di_controller_process_wait_
-  f_status_t controller_process_wait(const controller_global_t global, controller_process_t * const process) {
+  f_status_t controller_process_wait(const controller_global_t global, controller_data_t * const process) {
 
     if (!controller_thread_is_enabled_process(process, global.thread)) {
       return F_status_set_error(F_interrupt);
index ea273c8a6956b915743676e9696ce7a1d29a5ba3..d7b48bc18f3a8576ab72ec5f967a666ffe3aabc9 100644 (file)
@@ -134,7 +134,7 @@ extern "C" {
  * @see f_thread_condition_wait_timed()
  */
 #ifndef _di_controller_process_wait_
-  extern f_status_t controller_process_wait(const controller_global_t global, controller_process_t * const process) F_attribute_visibility_internal_d;
+  extern f_status_t controller_process_wait(const controller_global_t global, controller_data_t * const process) F_attribute_visibility_internal_d;
 #endif // _di_controller_process_wait_
 
 #ifdef __cplusplus
index 89a13e1338ab097be7efbe5f37ca958f9a8045e8..0daf7b06a01668afd9c61ec81b3dfc3b6a9214a9 100644 (file)
@@ -944,7 +944,7 @@ extern "C" {
 #endif // _di_controller_rule_copy_
 
 #ifndef _di_controller_rule_execute_
-  f_status_t controller_rule_execute(const controller_global_t global, const uint8_t action, const uint8_t options, controller_process_t * const process) {
+  f_status_t controller_rule_execute(const controller_global_t global, const uint8_t action, const uint8_t options, controller_data_t * const process) {
 
     f_status_t status = F_okay;
     f_status_t success = F_false;
@@ -1021,10 +1021,10 @@ extern "C" {
       // 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_process_type_entry_e) {
+      if (process->type == controller_data_type_entry_e) {
         entry = &global.setting->entry;
       }
-      else if (process->type == controller_process_type_exit_e) {
+      else if (process->type == controller_data_type_exit_e) {
         entry = &global.setting->exit;
       }
 
@@ -1112,10 +1112,10 @@ extern "C" {
     else {
       controller_entry_t *entry = 0;
 
-      if (process->type == controller_process_type_entry_e) {
+      if (process->type == controller_data_type_entry_e) {
         entry = &global.setting->entry;
       }
-      else if (process->type == controller_process_type_exit_e) {
+      else if (process->type == controller_data_type_exit_e) {
         entry = &global.setting->exit;
       }
 
@@ -1393,7 +1393,7 @@ extern "C" {
 #endif // _di_controller_rule_execute_
 
 #ifndef _di_controller_rule_execute_foreground_
-  f_status_t controller_rule_execute_foreground(const uint8_t type, const f_string_static_t program, const f_string_statics_t arguments, const uint8_t options, controller_execute_set_t * const execute_set, controller_process_t * const process) {
+  f_status_t controller_rule_execute_foreground(const uint8_t type, const f_string_static_t program, const f_string_statics_t arguments, const uint8_t options, controller_execute_set_t * const execute_set, controller_data_t * const process) {
 
     f_status_t status = F_okay;
     f_status_t status_lock = F_okay;
@@ -1461,7 +1461,7 @@ extern "C" {
       {
         const struct timespec delay = controller_time_milliseconds(controller_thread_simulation_timeout_d);
 
-        if (controller_time_sleep_nanoseconds(main, (controller_setting_t *) process->main_setting, delay) == -1) {
+        if (controller_time_sleep_nanoseconds(main, (controller_process_t *) process->main_setting, delay) == -1) {
           status = F_status_set_error(F_interrupt);
         }
       }
@@ -1606,7 +1606,7 @@ extern "C" {
 #endif // _di_controller_rule_execute_foreground_
 
 #ifndef _di_controller_rule_execute_pid_with_
-  f_status_t controller_rule_execute_pid_with(const f_string_dynamic_t pid_file, const uint8_t type, const f_string_static_t program, const f_string_statics_t arguments, const uint8_t options, const uint8_t with, controller_execute_set_t * const execute_set, controller_process_t * const process) {
+  f_status_t controller_rule_execute_pid_with(const f_string_dynamic_t pid_file, const uint8_t type, const f_string_static_t program, const f_string_statics_t arguments, const uint8_t options, const uint8_t with, controller_execute_set_t * const execute_set, controller_data_t * const process) {
 
     f_status_t status = F_okay;
     f_status_t status_lock = F_okay;
@@ -1717,7 +1717,7 @@ extern "C" {
       {
         const struct timespec delay = controller_time_milliseconds(controller_thread_simulation_timeout_d);
 
-        if (controller_time_sleep_nanoseconds(main, (controller_setting_t *) process->main_setting, delay) == -1) {
+        if (controller_time_sleep_nanoseconds(main, (controller_process_t *) process->main_setting, delay) == -1) {
           status = F_status_set_error(F_interrupt);
         }
       }
@@ -1863,7 +1863,7 @@ extern "C" {
 #endif // _di_controller_rule_execute_pid_with_
 
 #ifndef _di_controller_rule_execute_rerun_
-  int8_t controller_rule_execute_rerun(const uint8_t action, controller_process_t * const process, controller_rule_item_t * const item) {
+  int8_t controller_rule_execute_rerun(const uint8_t action, controller_data_t * const process, controller_rule_item_t * const item) {
 
     const int result = WIFEXITED(process->result) ? WEXITSTATUS(process->result) : 0;
 
@@ -1900,7 +1900,7 @@ extern "C" {
         if (rerun_item->delay) {
           const struct timespec delay = controller_time_milliseconds(rerun_item->delay);
 
-          if (controller_time_sleep_nanoseconds(main, (controller_setting_t *) process->main_setting, delay) == -1) {
+          if (controller_time_sleep_nanoseconds(main, (controller_process_t *) process->main_setting, delay) == -1) {
             return -1;
           }
 
@@ -1929,7 +1929,7 @@ extern "C" {
 #endif // _di_controller_rule_execute_rerun_
 
 #ifndef _di_controller_rule_expand_
-  f_status_t controller_rule_expand(const controller_global_t global, const controller_rule_action_t action, controller_process_t * const process) {
+  f_status_t controller_rule_expand(const controller_global_t global, const controller_rule_action_t action, controller_data_t * const process) {
 
     process->cache.expanded.used = 0;
 
@@ -2012,7 +2012,7 @@ extern "C" {
 #endif // _di_controller_rule_expand_
 
 #ifndef _di_controller_rule_expand_iki_
-  f_status_t controller_rule_expand_iki(controller_process_t * const process, const f_string_static_t source, const f_range_t vocabulary, const f_range_t content, f_string_dynamic_t * const destination) {
+  f_status_t controller_rule_expand_iki(controller_data_t * const process, const f_string_static_t source, const f_range_t vocabulary, const f_range_t content, f_string_dynamic_t * const destination) {
 
     if (vocabulary.start > vocabulary.stop) return F_okay;
     if (content.start > content.stop) return F_okay;
@@ -2034,7 +2034,7 @@ extern "C" {
       } // for
 
       if (i == process->rule.define.used) {
-        controller_entry_t * const entry = process->type == controller_process_type_entry_e ? &((controller_setting_t *) process->main_setting)->entry : &((controller_setting_t *) process->main_setting)->exit;
+        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;
 
         for (i = 0; i < entry->define.used; ++i) {
 
@@ -2083,7 +2083,7 @@ extern "C" {
       } // for
 
       if (i == process->rule.parameter.used) {
-        controller_entry_t * const entry = process->type == controller_process_type_entry_e ? &((controller_setting_t *) process->main_setting)->entry : &((controller_setting_t *) process->main_setting)->exit;
+        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;
 
         for (i = 0; i < entry->parameter.used; ++i) {
 
@@ -2547,7 +2547,7 @@ extern "C" {
 #endif // _di_controller_rule_items_increase_by_
 
 #ifndef _di_controller_rule_process_
-  f_status_t controller_rule_process(const controller_global_t global, controller_process_t * const process) {
+  f_status_t controller_rule_process(const controller_global_t global, controller_data_t * const process) {
 
     switch (process->action) {
       case controller_rule_action_type_freeze_e:
@@ -2629,7 +2629,7 @@ extern "C" {
 
       bool found = F_false;
 
-      controller_process_t *dependency = 0;
+      controller_data_t *dependency = 0;
 
       uint8_t options_process = 0;
 
@@ -3113,7 +3113,7 @@ extern "C" {
     f_status_t status = F_okay;
     f_status_t status_lock = F_okay;
 
-    controller_process_t *process = 0;
+    controller_data_t *process = 0;
 
     status = controller_lock_read_process_type(type, global.thread, &global.thread->lock.process);
 
@@ -3126,7 +3126,7 @@ extern "C" {
     {
       f_number_unsigned_t at = 0;
 
-      status = controller_process_prepare(global, type != controller_process_type_exit_e, action, alias_rule, &at);
+      status = controller_process_prepare(global, type != controller_data_type_exit_e, action, alias_rule, &at);
 
       if (F_status_is_error(status)) {
         f_thread_unlock(&global.thread->lock.process);
@@ -3272,7 +3272,7 @@ extern "C" {
 
     if (F_status_is_error_not(status)) {
       if (process->action && (options_force & controller_process_option_asynchronous_d)) {
-        if (process->type == controller_process_type_exit_e) {
+        if (process->type == controller_data_type_exit_e) {
           status = f_thread_create(0, &process->id_thread, controller_thread_process_other, (void *) process);
         }
         else {
@@ -3332,11 +3332,11 @@ extern "C" {
 #endif // _di_controller_rule_process_begin_
 
 #ifndef _di_controller_rule_process_do_
-  f_status_t controller_rule_process_do(const uint8_t options_force, controller_process_t * const process) {
+  f_status_t controller_rule_process_do(const uint8_t options_force, controller_data_t * const process) {
 
     f_status_t status_lock = F_okay;
 
-    controller_global_t global = macro_controller_global_t_initialize_1((controller_main_t *) process->main_data, (controller_setting_t *) process->main_setting, (controller_thread_t *) process->main_thread);
+    controller_global_t global = macro_controller_global_t_initialize_1((controller_main_t *) process->main_data, (controller_process_t *) process->main_setting, (controller_thread_t *) process->main_thread);
 
     // The process and active locks shall be held for the duration of this processing (aside from switching between read to/from write).
     if (options_force & controller_process_option_asynchronous_d) {
@@ -3942,7 +3942,7 @@ extern "C" {
 #endif // _di_controller_rule_read_
 
 #ifndef _di_controller_rule_setting_read_
-  f_status_t controller_rule_setting_read(const controller_global_t global, const bool is_normal, const controller_setting_t setting, controller_cache_t * const cache, controller_rule_t * const rule) {
+  f_status_t controller_rule_setting_read(const controller_global_t global, const bool is_normal, const controller_process_t setting, controller_cache_t * const cache, controller_rule_t * const rule) {
 
     f_status_t status = F_okay;
     f_status_t status_return = F_okay;
@@ -6203,7 +6203,7 @@ extern "C" {
 
     // Vuild a list of what to wait for so that anything new after this point will not be waited for.
     const f_number_unsigned_t process_total = global.thread->processs.used;
-    controller_process_t *process_list[process_total];
+    controller_data_t *process_list[process_total];
 
     for (; i < process_total; ++i) {
       process_list[i] = global.thread->processs.array[i];
@@ -6388,7 +6388,7 @@ extern "C" {
 #ifndef _di_controller_rule_wait_all_process_type_
   f_status_t controller_rule_wait_all_process_type(const controller_global_t global, const uint8_t type, const bool required) {
 
-    return controller_rule_wait_all(global, type != controller_process_type_exit_e, required);
+    return controller_rule_wait_all(global, type != controller_data_type_exit_e, required);
   }
 #endif // _di_controller_rule_wait_all_process_type_
 
index 35e43ce5dae276833051d976e6fce56a33aa6b65..fb127c5249b3d6bbde6505a3292b2428602c3b32 100644 (file)
@@ -232,7 +232,7 @@ extern "C" {
  *   On failure, the individual status for the rule is set to an appropriate error status.
  */
 #ifndef _di_controller_rule_execute_
-  extern f_status_t controller_rule_execute(const controller_global_t global, const uint8_t action, const uint8_t options, controller_process_t * const process) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_execute(const controller_global_t global, const uint8_t action, const uint8_t options, controller_data_t * const process) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_execute_
 
 /**
@@ -266,7 +266,7 @@ extern "C" {
  * @see fll_execute_program()
  */
 #ifndef _di_controller_rule_execute_foreground_
-  extern f_status_t controller_rule_execute_foreground(const uint8_t type, const f_string_static_t program, const f_string_statics_t arguments, const uint8_t options, controller_execute_set_t * const execute_set, controller_process_t * const process) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_execute_foreground(const uint8_t type, const f_string_static_t program, const f_string_statics_t arguments, const uint8_t options, controller_execute_set_t * const execute_set, controller_data_t * const process) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_execute_foreground_
 
 /**
@@ -308,7 +308,7 @@ extern "C" {
  * @see fll_execute_program()
  */
 #ifndef _di_controller_rule_execute_pid_with_
-  extern f_status_t controller_rule_execute_pid_with(const f_string_dynamic_t pid_file, const uint8_t type, const f_string_static_t program, const f_string_statics_t arguments, const uint8_t options, const uint8_t with, controller_execute_set_t * const execute_set, controller_process_t * const process) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_execute_pid_with(const f_string_dynamic_t pid_file, const uint8_t type, const f_string_static_t program, const f_string_statics_t arguments, const uint8_t options, const uint8_t with, controller_execute_set_t * const execute_set, controller_data_t * const process) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_execute_pid_with_
 
 /**
@@ -331,7 +331,7 @@ extern "C" {
  *   -2 to designate exit due to signal/disabled thread.
  */
 #ifndef _di_controller_rule_execute_rerun_
-  extern int8_t controller_rule_execute_rerun(const uint8_t action, controller_process_t * const process, controller_rule_item_t * const item) F_attribute_visibility_internal_d;
+  extern int8_t controller_rule_execute_rerun(const uint8_t action, controller_data_t * const process, controller_rule_item_t * const item) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_execute_rerun_
 
 /**
@@ -352,7 +352,7 @@ extern "C" {
  *   @see controller_rule_expand_iki()
  */
 #ifndef _di_controller_rule_expand_
-  extern f_status_t controller_rule_expand(const controller_global_t global, const controller_rule_action_t action, controller_process_t * const process) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_expand(const controller_global_t global, const controller_rule_action_t action, controller_data_t * const process) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_expand_
 
 /**
@@ -379,7 +379,7 @@ extern "C" {
  *   @see f_string_dynamic_append()
  */
 #ifndef _di_controller_rule_expand_iki_
-  extern f_status_t controller_rule_expand_iki(controller_process_t * const process, const f_string_static_t source, const f_range_t vocabulary, const f_range_t content, f_string_dynamic_t * const destination) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_expand_iki(controller_data_t * const process, const f_string_static_t source, const f_range_t vocabulary, const f_range_t content, f_string_dynamic_t * const destination) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_expand_iki_
 
 /**
@@ -525,7 +525,7 @@ extern "C" {
  *   Errors (with error bit) from: controller_lock_write().
  */
 #ifndef _di_controller_rule_process_
-  extern f_status_t controller_rule_process(const controller_global_t global, controller_process_t * const process) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_process(const controller_global_t global, controller_data_t * const process) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_process_
 
 /**
@@ -545,7 +545,7 @@ extern "C" {
  * @param options
  *   The process options to pass to the process.
  * @param type
- *   The process type, such as controller_process_type_entry_e.
+ *   The process type, such as controller_data_type_entry_e.
  * @param stack
  *   A stack representing the processes already running in this rule process dependency tree.
  *   This is used to prevent circular dependencies.
@@ -606,7 +606,7 @@ extern "C" {
  * @see controller_rule_process_begin()
  */
 #ifndef _di_controller_rule_process_do_
-  extern f_status_t controller_rule_process_do(const uint8_t options_force, controller_process_t * const process) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_process_do(const uint8_t options_force, controller_data_t * const process) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_process_do_
 
 /**
@@ -718,7 +718,7 @@ extern "C" {
  * @see controller_path_canonical_relative()
  */
 #ifndef _di_controller_rule_setting_read_
-  extern f_status_t controller_rule_setting_read(const controller_global_t global, const bool is_normal, const controller_setting_t setting, controller_cache_t * const cache, controller_rule_t * const rule) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_setting_read(const controller_global_t global, const bool is_normal, const controller_process_t setting, controller_cache_t * const cache, controller_rule_t * const rule) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_setting_read_
 
 /**
index f8e1aeedebd1100464665656650ed0bbd04e7a3e..08115ddbb7190a912eadbedf19c9b473a8910ffe 100644 (file)
@@ -78,7 +78,7 @@ extern "C" {
 #endif // _di_controller_rule_item_print_error_
 
 #ifndef _di_controller_rule_item_print_error_execute_
-  void controller_rule_item_print_error_execute(const bool script_is, const f_string_static_t name, const f_status_t status, controller_process_t * const process) {
+  void controller_rule_item_print_error_execute(const bool script_is, const f_string_static_t name, const f_status_t status, controller_data_t * const process) {
 
     if (((controller_main_t *) process->main_data)->error.verbosity != f_console_verbosity_quiet_e) {
       fl_print_t * const print = &((controller_main_t *) process->main_data)->error;
index 2350714b86fee6b75aa4f83c33b9793ad56dd9e9..6271042d6bdc6c1e5b2aa2a14c15399858751cf5 100644 (file)
@@ -116,7 +116,7 @@ extern "C" {
  *   The process to use.
  */
 #ifndef _di_controller_rule_item_print_error_execute_
-  extern void controller_rule_item_print_error_execute(const bool script_is, const f_string_static_t name, const f_status_t status, controller_process_t * const process) F_attribute_visibility_internal_d;
+  extern void controller_rule_item_print_error_execute(const bool script_is, const f_string_static_t name, const f_status_t status, controller_data_t * const process) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_item_print_error_execute_
 
 /**
index b707a1f69e35e38b420447f7558d8549f2c3b451..f821b7dc8307da67bc1cc1c9bc18977a6c89a855 100644 (file)
@@ -36,7 +36,7 @@ extern "C" {
       if (global->thread->enabled != controller_thread_enabled_e) break;
 
       if (f_thread_lock_write_try(&global->thread->lock.process) == F_okay) {
-        controller_process_t *process = 0;
+        controller_data_t *process = 0;
 
         f_number_unsigned_t i = 0;
 
@@ -182,7 +182,7 @@ extern "C" {
 #endif // _di_controller_thread_is_enabled_
 
 #ifndef _di_controller_thread_is_enabled_process_
-  f_status_t controller_thread_is_enabled_process(controller_process_t * const process, controller_thread_t * const thread) {
+  f_status_t controller_thread_is_enabled_process(controller_data_t * const process, controller_thread_t * const thread) {
 
     return controller_thread_is_enabled_process_type(process->type, thread);
   }
@@ -191,12 +191,12 @@ extern "C" {
 #ifndef _di_controller_thread_is_enabled_process_type_
   f_status_t controller_thread_is_enabled_process_type(const uint8_t type, controller_thread_t * const thread) {
 
-    return controller_thread_is_enabled(type != controller_process_type_exit_e, thread);
+    return controller_thread_is_enabled(type != controller_data_type_exit_e, thread);
   }
 #endif // _di_controller_thread_is_enabled_process_type_
 
 #ifndef _di_controller_thread_main_
-  f_status_t controller_thread_main(controller_main_t * const main, controller_setting_t * const setting) {
+  f_status_t controller_thread_main(controller_main_t * const main, controller_process_t * const setting) {
 
     f_status_t status = F_okay;
 
index ebfae6fb5b41a807e440a278a4468692f3247cdc..06b7297cb22bc69a3ba5437c32e15390094f5c93 100644 (file)
@@ -81,7 +81,7 @@ extern "C" {
  * @see controller_thread_is_enabled_process_type()
  */
 #ifndef _di_controller_thread_is_enabled_process_
-  extern f_status_t controller_thread_is_enabled_process(controller_process_t * const process, controller_thread_t * const thread) F_attribute_visibility_internal_d;
+  extern f_status_t controller_thread_is_enabled_process(controller_data_t * const process, controller_thread_t * const thread) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_is_enabled_process_
 
 /**
@@ -118,7 +118,7 @@ extern "C" {
  *   F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal.
  */
 #ifndef _di_controller_thread_main_
-  extern f_status_t controller_thread_main(controller_main_t * const main, controller_setting_t * const setting) F_attribute_visibility_internal_d;
+  extern f_status_t controller_thread_main(controller_main_t * const main, controller_process_t * const setting) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_main_
 
 /***
index a14ad14cd3dcc96cc13b08ffa49bd748fe72da0c..f1680d5d97d993ac8c614f50fa7c67cf23a85f95 100644 (file)
@@ -27,7 +27,7 @@ extern "C" {
       // It seems that this function doesn't return to the calling thread for a forked child process, even with the "return 0;" below.
       // Deallocate as much as possible.
       controller_thread_delete_simple(global->thread);
-      controller_setting_delete_simple(global->setting);
+      controller_process_delete(global->setting);
       controller_main_delete(global->main);
     }
 
index 6385b8e869e6d00590f0d507ea515983692d029d..dd0bc008874b2a49a3abfaa77efdbb22ab455aed 100644 (file)
@@ -136,7 +136,7 @@ extern "C" {
       // It seems that this function doesn't return to the calling thread for a forked child process, even with the "return 0;" below.
       // Deallocate as much as possible.
       controller_thread_delete_simple(entry->global->thread);
-      controller_setting_delete_simple(entry->global->setting);
+      controller_process_delete(entry->global->setting);
       controller_main_delete(entry->global->main);
 
       // According to the manpages, pthread_exit() calls exit(0), which is not good because a non-zero exit code may be returned.
@@ -254,7 +254,7 @@ extern "C" {
       // It seems that this function doesn't return to the calling thread for a forked child process, even with the "return 0;" below.
       // Deallocate as much as possible.
       controller_thread_delete_simple(entry->global->thread);
-      controller_setting_delete_simple(entry->global->setting);
+      controller_process_delete(entry->global->setting);
       controller_main_delete(entry->global->main);
 
       return 0;
index 37050a9a5783fdb80c00c1c36a0e87ea3e373f07..487fa3eab4e3483d89621cdf4f1f62f12aaad1f2 100644 (file)
@@ -13,7 +13,7 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_thread_process_
-  void controller_thread_process(const bool is_normal, controller_process_t * const process) {
+  void controller_thread_process(const bool is_normal, controller_data_t * const process) {
 
     {
       controller_thread_t *thread = (controller_thread_t *) process->main_thread;
@@ -29,11 +29,11 @@ extern "C" {
       // It seems that this function doesn't return to the calling thread for a forked child process, even with the "return 0;" below.
       // Deallocate as much as possible.
       controller_main_t *main = (controller_main_t *) process->main_data;
-      controller_setting_t *setting = (controller_setting_t *) process->main_setting;
+      controller_process_t *setting = (controller_process_t *) process->main_setting;
       controller_thread_t *thread = (controller_thread_t *) process->main_thread;
 
       controller_thread_delete_simple(thread);
-      controller_setting_delete_simple(setting);
+      controller_process_delete(setting);
       controller_main_delete(main);
 
       // According to the manpages, pthread_exit() calls exit(0), which is not good because a non-zero exit code may be returned.
@@ -57,7 +57,7 @@ extern "C" {
     struct timespec time;
 
     controller_entry_t *entry = 0;
-    controller_process_t *process = 0;
+    controller_data_t *process = 0;
 
     f_status_t status = F_okay;
     f_number_unsigned_t i = 0;
@@ -155,7 +155,7 @@ extern "C" {
       process = global.thread->processs.array[i];
 
       // Do not cancel exit processes, when not performing "execute" during exit.
-      if (process->type == controller_process_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) {
+      if (process->type == controller_data_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) {
         continue;
       }
 
@@ -188,7 +188,7 @@ extern "C" {
         process = global.thread->processs.array[i];
 
         // Do not wait for processes, when not performing "execute" during exit.
-        if (process->type == controller_process_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) {
+        if (process->type == controller_data_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) {
           continue;
         }
 
@@ -249,7 +249,7 @@ extern "C" {
       process = global.thread->processs.array[i];
 
       // Do not kill exit processes, when not performing "execute" during exit.
-      if (process->type == controller_process_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) continue;
+      if (process->type == controller_data_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) continue;
 
       if (process->id_thread) {
         if (process->childs.used) {
@@ -277,7 +277,7 @@ extern "C" {
         for (j = 0; j < process->childs.size; ++j) {
 
           // Do not kill exit processes, when not performing "execute" during exit.
-          if (process->type == controller_process_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) continue;
+          if (process->type == controller_data_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) continue;
 
           if (process->childs.array[j]) {
 
@@ -295,7 +295,7 @@ extern "C" {
         for (j = 0; j < process->path_pids.used; ++j) {
 
           // Do not kill exit processes, when not performing "execute" during exit.
-          if (process->type == controller_process_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) continue;
+          if (process->type == controller_data_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) continue;
 
           if (f_file_exists(process->path_pids.array[j], F_true) == F_true) {
             status = controller_file_pid_read(process->path_pids.array[j], &pid);
@@ -314,7 +314,7 @@ extern "C" {
       while (process->childs.used) {
 
         // Do not shrink below an exit processes, when not performing "execute" during exit.
-        if (process->type == controller_process_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) break;
+        if (process->type == controller_data_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) break;
         if (process->childs.array[j] > 0) break;
 
         --process->childs.used;
@@ -324,7 +324,7 @@ extern "C" {
       while (process->path_pids.used) {
 
         // Do not shrink below an exit processes, when not performing "execute" during exit.
-        if (process->type == controller_process_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) break;
+        if (process->type == controller_data_type_exit_e && global.thread->enabled != controller_thread_enabled_exit_execute_e) break;
         if (process->path_pids.array[j].used) break;
 
         --process->path_pids.used;
@@ -435,7 +435,7 @@ extern "C" {
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_thread_process(F_true, (controller_process_t *) arguments);
+    controller_thread_process(F_true, (controller_data_t *) arguments);
 
     return 0;
   }
@@ -446,7 +446,7 @@ extern "C" {
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_thread_process(F_false, (controller_process_t *) arguments);
+    controller_thread_process(F_false, (controller_data_t *) arguments);
 
     return 0;
   }
index 674637b8501098964ef2b121b54936edc4b38fd1..4938091d5a1cf74d363ce678f35c3a6ad2bfd538 100644 (file)
@@ -24,7 +24,7 @@ extern "C" {
  * @see controller_rule_process_do()
  */
 #ifndef _di_controller_thread_process_
-  extern void controller_thread_process(const bool is_normal, controller_process_t * const process) F_attribute_visibility_internal_d;
+  extern void controller_thread_process(const bool is_normal, controller_data_t * const process) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_process_
 
 /**
@@ -61,7 +61,7 @@ extern "C" {
  *
  * @param arguments
  *   The thread arguments.
- *   Must be of type controller_process_t.
+ *   Must be of type controller_data_t.
  *
  * @return
  *   0, always.
@@ -77,7 +77,7 @@ extern "C" {
  *
  * @param arguments
  *   The thread arguments.
- *   Must be of type controller_process_t.
+ *   Must be of type controller_data_t.
  *
  * @return
  *   0, always.