]> Kevux Git Server - fll/commitdiff
Progress: Continue working on the controller program's control functionality.
authorKevin Day <thekevinday@gmail.com>
Tue, 4 Jan 2022 04:23:29 +0000 (22:23 -0600)
committerKevin Day <thekevinday@gmail.com>
Tue, 4 Jan 2022 04:23:29 +0000 (22:23 -0600)
The f_socket_listen() seems to need its own process or thread.
Give it one.
Make this one as isolated as possible so that it can be forcible exited.
(Because listen() doesn't respect signal handlers.)

44 files changed:
level_3/controller/c/common/private-cache.c
level_3/controller/c/common/private-cache.h
level_3/controller/c/common/private-control.c [new file with mode: 0644]
level_3/controller/c/common/private-control.h [new file with mode: 0644]
level_3/controller/c/common/private-entry.c
level_3/controller/c/common/private-entry.h
level_3/controller/c/common/private-lock.c
level_3/controller/c/common/private-lock.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/common/private-task.c
level_3/controller/c/common/private-task.h
level_3/controller/c/common/private-thread.c
level_3/controller/c/common/private-thread.h
level_3/controller/c/private-common.h
level_3/controller/c/private-control.c
level_3/controller/c/private-control.h
level_3/controller/c/private-controller.c
level_3/controller/c/private-controller.h
level_3/controller/c/private-controller_print.c
level_3/controller/c/private-controller_print.h
level_3/controller/c/private-entry.c
level_3/controller/c/private-entry.h
level_3/controller/c/private-rule.c
level_3/controller/c/private-rule.h
level_3/controller/c/private-rule_print.c
level_3/controller/c/private-rule_print.h
level_3/controller/c/private-thread.c
level_3/controller/c/private-thread.h
level_3/controller/c/private-thread_control.c
level_3/controller/c/private-thread_control.h
level_3/controller/c/private-thread_entry.c
level_3/controller/c/private-thread_entry.h
level_3/controller/c/private-thread_process.c
level_3/controller/c/private-thread_process.h
level_3/controller/c/private-thread_rule.c
level_3/controller/c/private-thread_rule.h
level_3/controller/c/private-thread_signal.c
level_3/controller/c/private-thread_signal.h
level_3/controller/data/build/settings

index f3e90f3da2f699c5484061817153ee6cb7f37e49..883f43b6fe0b565cfd59404044cd1a57c305dd7c 100644 (file)
@@ -6,7 +6,7 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_cache_action_delete_simple_
-  void controller_cache_action_delete_simple(controller_cache_action_t *cache) {
+  void controller_cache_action_delete_simple(controller_cache_action_t * const cache) {
 
     f_string_dynamic_resize(0, &cache->name_action);
     f_string_dynamic_resize(0, &cache->name_file);
@@ -16,7 +16,7 @@ extern "C" {
 #endif // _di_controller_cache_action_delete_simple_
 
 #ifndef _di_controller_cache_delete_simple_
-  void controller_cache_delete_simple(controller_cache_t *cache) {
+  void controller_cache_delete_simple(controller_cache_t * const cache) {
 
     macro_f_array_lengths_t_delete_simple(cache->ats)
     macro_f_array_lengths_t_delete_simple(cache->stack)
index c637f92a0e05cc0b060be8e434c465b45ac01f3c..caf86a5eca8e269f1c53d3bcbd8dc8e715685466 100644 (file)
@@ -124,7 +124,7 @@ extern "C" {
  * @see f_string_dynamic_resize()
  */
 #ifndef _di_controller_cache_action_delete_simple_
-  extern void controller_cache_action_delete_simple(controller_cache_action_t *cache) F_attribute_visibility_internal_d;
+  extern void controller_cache_action_delete_simple(controller_cache_action_t * const cache) F_attribute_visibility_internal_d;
 #endif // _di_controller_cache_action_delete_simple_
 
 /**
@@ -142,7 +142,7 @@ extern "C" {
  * @see f_string_rangess_resize()
  */
 #ifndef _di_controller_cache_delete_simple_
-  extern void controller_cache_delete_simple(controller_cache_t *cache) F_attribute_visibility_internal_d;
+  extern void controller_cache_delete_simple(controller_cache_t * const cache) F_attribute_visibility_internal_d;
 #endif // _di_controller_cache_delete_simple_
 
 #ifdef __cplusplus
diff --git a/level_3/controller/c/common/private-control.c b/level_3/controller/c/common/private-control.c
new file mode 100644 (file)
index 0000000..5c6f562
--- /dev/null
@@ -0,0 +1,17 @@
+#include "../controller.h"
+#include "../private-common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _di_controller_packet_delete_simple_
+  void controller_packet_delete_simple(controller_packet_t * const packet) {
+
+    f_string_dynamic_resize(0, &packet->payload);
+  }
+#endif // _di_controller_packet_delete_simple_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_3/controller/c/common/private-control.h b/level_3/controller/c/common/private-control.h
new file mode 100644 (file)
index 0000000..3f5da51
--- /dev/null
@@ -0,0 +1,69 @@
+/**
+ * FLL - Level 3
+ *
+ * Project: Controller
+ * API Version: 0.5
+ * Licenses: lgpl-2.1-or-later
+ */
+#ifndef _PRIVATE_common_control_h
+#define _PRIVATE_common_control_h
+
+#ifdef __cplusplus
+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 size of the buffer in bytes when processing packets (must not be set smaller the packet headers).
+ *   - socket_header:  The minimum size 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.
+ */
+#ifndef _di_controller_control_defaults_
+  #define controller_control_default_socket_backlog_d 64
+  #define controller_control_default_socket_buffer_d  16384
+  #define controller_control_default_socket_header_d  33
+  #define controller_control_default_socket_linger_d  1
+  #define controller_control_default_socket_timeout_d 10000 // 0.01 seconds.
+#endif // _di_controller_defaults_
+
+/**
+ * A structure representing the packet payload.
+ *
+ * Payload structure: [uint32_t][char X].
+ *
+ * bytes:   The header repesenting the number of bytes in the character payload.
+ * payload: The character payload whose size is represented by the header bytes.
+ */
+#ifndef _di_controller_packet_t_
+  typedef struct {
+    uint32_t bytes;
+    f_string_dynamic_t payload;
+  } controller_packet_t;
+
+  #define controller_packet_t_initialize { 0, f_string_dynamic_t_initialize }
+
+  #define macro_controller_packet_t_initialize(bytes, payload) { \
+    bytes, \
+    payload, \
+  }
+#endif // _di_controller_main_t_
+
+/**
+ * Fully deallocate all memory for the given packet without caring about return status.
+ *
+ * @param packet
+ *   The packet to deallocate.
+ */
+#ifndef _di_controller_packet_delete_simple_
+  extern void controller_packet_delete_simple(controller_packet_t * const packet) F_attribute_visibility_internal_d;
+#endif // _di_controller_packet_delete_simple_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_common_control_h
index 424c2976ae661e03da77c8a4d2ef8008b60de1ff..9d79605b0b706d915a9525bcdc61645eab5327fe 100644 (file)
@@ -6,14 +6,14 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_entry_action_delete_simple_
-  void controller_entry_action_delete_simple(controller_entry_action_t *action) {
+  void controller_entry_action_delete_simple(controller_entry_action_t * const action) {
 
     f_string_dynamics_resize(0, &action->parameters);
   }
 #endif // _di_controller_entry_action_delete_simple_
 
 #ifndef _di_controller_entry_actions_delete_simple_
-  void controller_entry_actions_delete_simple(controller_entry_actions_t *actions) {
+  void controller_entry_actions_delete_simple(controller_entry_actions_t * const actions) {
 
     actions->used = actions->size;
 
@@ -27,7 +27,7 @@ extern "C" {
 #endif // _di_controller_entry_actions_delete_simple_
 
 #ifndef _di_controller_entry_actions_increase_by_
-  f_status_t controller_entry_actions_increase_by(const f_array_length_t amount, controller_entry_actions_t *actions) {
+  f_status_t controller_entry_actions_increase_by(const f_array_length_t amount, controller_entry_actions_t * const actions) {
 
     if (actions->used + amount > actions->size) {
       if (actions->used + amount > F_array_length_t_size_d) {
@@ -48,7 +48,7 @@ extern "C" {
 #endif // _di_controller_entry_actions_increase_by_
 
 #ifndef _di_controller_entry_item_delete_simple_
-  void controller_entry_item_delete_simple(controller_entry_item_t *item) {
+  void controller_entry_item_delete_simple(controller_entry_item_t * const item) {
 
     f_string_dynamic_resize(0, &item->name);
 
@@ -57,7 +57,7 @@ extern "C" {
 #endif // _di_controller_entry_item_delete_simple_
 
 #ifndef _di_controller_entry_items_delete_simple_
-  void controller_entry_items_delete_simple(controller_entry_items_t *items) {
+  void controller_entry_items_delete_simple(controller_entry_items_t * const items) {
 
     items->used = items->size;
 
@@ -71,7 +71,7 @@ extern "C" {
 #endif // _di_controller_entry_items_delete_simple_
 
 #ifndef _di_controller_entry_items_increase_by_
-  f_status_t controller_entry_items_increase_by(const f_array_length_t amount, controller_entry_items_t *items) {
+  f_status_t controller_entry_items_increase_by(const f_array_length_t amount, controller_entry_items_t * const items) {
 
     if (items->used + amount > items->size) {
       if (items->used + amount > F_array_length_t_size_d) {
index be9ac69ae96f8197602d0d023ff155b98217a92c..306121365392da2fad615bc6101773eabfed02b8 100644 (file)
@@ -247,7 +247,7 @@ extern "C" {
  * @see f_string_dynamics_resize()
  */
 #ifndef _di_controller_entry_action_delete_simple_
-  extern void controller_entry_action_delete_simple(controller_entry_action_t *action) F_attribute_visibility_internal_d;
+  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_
 
 /**
@@ -260,7 +260,7 @@ extern "C" {
  * @see f_memory_delete()
  */
 #ifndef _di_controller_entry_actions_delete_simple_
-  extern void controller_entry_actions_delete_simple(controller_entry_actions_t *actions) F_attribute_visibility_internal_d;
+  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_
 
 /**
@@ -282,7 +282,7 @@ extern "C" {
  * @see f_memory_resize()
  */
 #ifndef _di_controller_entry_actions_increase_by_
-  extern f_status_t controller_entry_actions_increase_by(const f_array_length_t amount, controller_entry_actions_t *actions) F_attribute_visibility_internal_d;
+  extern f_status_t controller_entry_actions_increase_by(const f_array_length_t amount, controller_entry_actions_t * const actions) F_attribute_visibility_internal_d;
 #endif // _di_controller_entry_actions_increase_by_
 
 /**
@@ -294,7 +294,7 @@ extern "C" {
  * @see f_string_dynamic_resize()
  */
 #ifndef _di_controller_entry_item_delete_simple_
-  extern void controller_entry_item_delete_simple(controller_entry_item_t *item) F_attribute_visibility_internal_d;
+  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_
 
 /**
@@ -307,7 +307,7 @@ extern "C" {
  * @see f_memory_delete()
  */
 #ifndef _di_controller_entry_items_delete_simple_
-  extern void controller_entry_items_delete_simple(controller_entry_items_t *items) F_attribute_visibility_internal_d;
+  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_
 
 /**
@@ -329,7 +329,7 @@ extern "C" {
  * @see f_memory_resize()
  */
 #ifndef _di_controller_entry_items_increase_by_
-  extern f_status_t controller_entry_items_increase_by(const f_array_length_t amount, controller_entry_items_t *items) F_attribute_visibility_internal_d;
+  extern f_status_t controller_entry_items_increase_by(const f_array_length_t amount, controller_entry_items_t * const items) F_attribute_visibility_internal_d;
 #endif // _di_controller_entry_items_increase_by_
 
 #ifdef __cplusplus
index 185379dd7b4a26c04b58fa1ad94f4131bc37447c..99178917a48447ec82f5518cdd3df94f161cdaf4 100644 (file)
@@ -42,7 +42,7 @@ extern "C" {
 #endif // _di_controller_lock_delete_rw_
 
 #ifndef _di_controller_lock_delete_simple_
-  void controller_lock_delete_simple(controller_lock_t *lock) {
+  void controller_lock_delete_simple(controller_lock_t * const lock) {
 
     controller_lock_delete_mutex(&lock->print);
     controller_lock_delete_mutex(&lock->alert);
index 260bc58d2113614da1f51badd8c0950636f44b9b..d5b9dbb8da9a72933f302a7fa93b76325628aee7 100644 (file)
@@ -78,7 +78,7 @@ extern "C" {
  * @see f_thread_mutex_delete()
  */
 #ifndef _di_controller_lock_delete_simple_
-  extern void controller_lock_delete_simple(controller_lock_t *lock) F_attribute_visibility_internal_d;
+  extern void controller_lock_delete_simple(controller_lock_t * const lock) F_attribute_visibility_internal_d;
 #endif // _di_controller_lock_delete_simple_
 
 #ifdef __cplusplus
index 26de3f5c3d89ada1450fa77780aee0da01116492..d01207f80be5c4835aa370a490e31cef6299a4ba 100644 (file)
@@ -6,7 +6,7 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_pids_increase_
-  f_status_t controller_pids_increase(controller_pids_t *pids) {
+  f_status_t controller_pids_increase(controller_pids_t * const pids) {
 
     if (pids->used + 1 > pids->size) {
       f_array_length_t size = pids->used + controller_common_allocation_small_d;
@@ -27,7 +27,7 @@ extern "C" {
 #endif // _di_controller_pids_increase_
 
 #ifndef _di_controller_pids_resize_
-  f_status_t controller_pids_resize(const f_array_length_t length, controller_pids_t *pids) {
+  f_status_t controller_pids_resize(const f_array_length_t length, controller_pids_t * const pids) {
 
     f_status_t status = F_none;
 
@@ -46,7 +46,7 @@ extern "C" {
 #endif // _di_controller_pids_resize_
 
 #ifndef _di_controller_process_delete_simple_
-  void controller_process_delete_simple(controller_process_t *process) {
+  void controller_process_delete_simple(controller_process_t * const process) {
 
     if (process->id_thread) {
       f_thread_signal(process->id_thread, F_signal_kill);
@@ -72,14 +72,14 @@ extern "C" {
 #endif // _di_controller_process_delete_simple_
 
 #ifndef _di_controller_processs_delete_simple_
-  void controller_processs_delete_simple(controller_processs_t *processs) {
+  void controller_processs_delete_simple(controller_processs_t * const processs) {
 
     controller_processs_resize(0, processs);
   }
 #endif // _di_controller_processs_delete_simple_
 
 #ifndef _di_controller_processs_increase_
-  f_status_t controller_processs_increase(controller_processs_t *processs) {
+  f_status_t controller_processs_increase(controller_processs_t * const processs) {
 
     if (processs->used + 1 > processs->size) {
       f_array_length_t size = processs->used + controller_common_allocation_small_d;
@@ -100,7 +100,7 @@ extern "C" {
 #endif // _di_controller_processs_increase_
 
 #ifndef _di_controller_processs_resize_
-  f_status_t controller_processs_resize(const f_array_length_t length, controller_processs_t *processs) {
+  f_status_t controller_processs_resize(const f_array_length_t length, controller_processs_t * const processs) {
 
     f_status_t status = F_none;
 
index 191e62d1860041c5651b16cb29bd9c19f4559512..92dca1f5e5e2c22a24b5abe3719bf217bf6a5b9f 100644 (file)
@@ -187,7 +187,7 @@ extern "C" {
  * @see controller_pids_resize()
  */
 #ifndef _di_controller_pids_increase_
-  extern f_status_t controller_pids_increase(controller_pids_t *pids) F_attribute_visibility_internal_d;
+  extern f_status_t controller_pids_increase(controller_pids_t * const pids) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_increase_
 
 /**
@@ -207,7 +207,7 @@ extern "C" {
  * @see f_memory_resize()
  */
 #ifndef _di_controller_pids_resize_
-  extern f_status_t controller_pids_resize(const f_array_length_t length, controller_pids_t *pids) F_attribute_visibility_internal_d;
+  extern f_status_t controller_pids_resize(const f_array_length_t length, controller_pids_t * const pids) F_attribute_visibility_internal_d;
 #endif // _di_controller_pids_resize_
 
 /**
@@ -221,7 +221,7 @@ extern "C" {
  * @see f_thread_mutex_delete()
  */
 #ifndef _di_controller_process_delete_simple_
-  extern void controller_process_delete_simple(controller_process_t *process) F_attribute_visibility_internal_d;
+  extern void controller_process_delete_simple(controller_process_t * const process) F_attribute_visibility_internal_d;
 #endif // _di_controller_process_delete_simple_
 
 /**
@@ -233,7 +233,7 @@ extern "C" {
  * @see controller_processs_resize()
  */
 #ifndef _di_controller_processs_delete_simple_
-  extern void controller_processs_delete_simple(controller_processs_t *processs) F_attribute_visibility_internal_d;
+  extern void controller_processs_delete_simple(controller_processs_t * const processs) F_attribute_visibility_internal_d;
 #endif // _di_controller_processs_delete_simple_
 
 /**
@@ -256,7 +256,7 @@ extern "C" {
  * @see controller_processs_resize()
  */
 #ifndef _di_controller_processs_increase_
-  extern f_status_t controller_processs_increase(controller_processs_t *processs) F_attribute_visibility_internal_d;
+  extern f_status_t controller_processs_increase(controller_processs_t * const processs) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_increase_
 
 /**
@@ -281,7 +281,7 @@ extern "C" {
  * @see f_thread_lock_create()
  */
 #ifndef _di_controller_processs_resize_
-  extern f_status_t controller_processs_resize(const f_array_length_t length, controller_processs_t *processs) F_attribute_visibility_internal_d;
+  extern f_status_t controller_processs_resize(const f_array_length_t length, controller_processs_t * const processs) F_attribute_visibility_internal_d;
 #endif // _di_controller_processs_resize_
 
 #ifdef __cplusplus
index 319385517855f54ab47358a11ba6bc324eb6f83f..6199fb517a2b29afb3562fe66f11fc98cdaef512 100644 (file)
@@ -6,14 +6,14 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_rule_action_delete_simple_
-  void controller_rule_action_delete_simple(controller_rule_action_t *action) {
+  void controller_rule_action_delete_simple(controller_rule_action_t * const action) {
 
     f_string_dynamics_resize(0, &action->parameters);
   }
 #endif // _di_controller_rule_action_delete_simple_
 
 #ifndef _di_controller_rule_actions_delete_simple_
-  void controller_rule_actions_delete_simple(controller_rule_actions_t *actions) {
+  void controller_rule_actions_delete_simple(controller_rule_actions_t * const actions) {
 
     actions->used = actions->size;
 
@@ -27,7 +27,7 @@ extern "C" {
 #endif // _di_controller_rule_actions_delete_simple_
 
 #ifndef _di_controller_rule_actions_increase_by_
-  f_status_t controller_rule_actions_increase_by(const f_array_length_t amount, controller_rule_actions_t *actions) {
+  f_status_t controller_rule_actions_increase_by(const f_array_length_t amount, controller_rule_actions_t * const actions) {
 
     if (actions->used + amount > actions->size) {
       if (actions->used + amount > F_array_length_t_size_d) {
@@ -75,7 +75,7 @@ extern "C" {
 #endif // _di_controller_rule_delete_simple_
 
 #ifndef _di_controller_rule_item_delete_simple_
-  void controller_rule_item_delete_simple(controller_rule_item_t *item) {
+  void controller_rule_item_delete_simple(controller_rule_item_t * const item) {
 
     f_string_dynamic_resize(0, &item->pid_file);
 
@@ -84,7 +84,7 @@ extern "C" {
 #endif // _di_controller_rule_item_delete_simple_
 
 #ifndef _di_controller_rule_items_delete_simple_
-  void controller_rule_items_delete_simple(controller_rule_items_t *items) {
+  void controller_rule_items_delete_simple(controller_rule_items_t * const items) {
 
     items->used = items->size;
 
@@ -98,7 +98,7 @@ extern "C" {
 #endif // _di_controller_rule_items_delete_simple_
 
 #ifndef _di_controller_rule_on_delete_simple_
-  void controller_rule_on_delete_simple(controller_rule_on_t *on) {
+  void controller_rule_on_delete_simple(controller_rule_on_t * const on) {
 
     f_string_dynamics_resize(0, &on->need);
     f_string_dynamics_resize(0, &on->want);
@@ -107,7 +107,7 @@ extern "C" {
 #endif // _di_controller_rule_on_delete_simple_
 
 #ifndef _di_controller_rule_ons_delete_simple_
-  void controller_rule_ons_delete_simple(controller_rule_ons_t *ons) {
+  void controller_rule_ons_delete_simple(controller_rule_ons_t * const ons) {
 
     ons->used = ons->size;
 
@@ -121,7 +121,7 @@ extern "C" {
 #endif // _di_controller_rule_ons_delete_simple_
 
 #ifndef _di_controller_rule_ons_increase_
-  f_status_t controller_rule_ons_increase(controller_rule_ons_t *ons) {
+  f_status_t controller_rule_ons_increase(controller_rule_ons_t * const ons) {
 
     if (ons->used + 1 > ons->size) {
       f_array_length_t size = ons->used + controller_common_allocation_small_d;
@@ -142,7 +142,7 @@ extern "C" {
 #endif // _di_controller_rule_ons_increase_
 
 #ifndef _di_controller_rule_ons_resize_
-  f_status_t controller_rule_ons_resize(const f_array_length_t length, controller_rule_ons_t *ons) {
+  f_status_t controller_rule_ons_resize(const f_array_length_t length, controller_rule_ons_t * const ons) {
 
     for (f_array_length_t i = length; i < ons->size; ++i) {
       controller_rule_on_delete_simple(&ons->array[i]);
@@ -163,14 +163,14 @@ extern "C" {
 #endif // _di_controller_rule_ons_resize_
 
 #ifndef _di_controller_rules_delete_simple_
-  void controller_rules_delete_simple(controller_rules_t *rules) {
+  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 *rules) {
+  f_status_t controller_rules_increase(controller_rules_t * const rules) {
 
     if (rules->used + 1 > rules->size) {
       f_array_length_t size = rules->used + controller_common_allocation_small_d;
@@ -191,7 +191,7 @@ extern "C" {
 #endif // _di_controller_rules_increase_
 
 #ifndef _di_controller_rules_resize_
-  f_status_t controller_rules_resize(const f_array_length_t length, controller_rules_t *rules) {
+  f_status_t controller_rules_resize(const f_array_length_t length, controller_rules_t * const rules) {
 
     for (f_array_length_t i = length; i < rules->size; ++i) {
       controller_rule_delete_simple(&rules->array[i]);
index eed262549539f3426865d9b2a7c78e93393e67f4..78d49aa1bbb9cb12615537495c0452f3602072d0 100644 (file)
@@ -507,7 +507,7 @@ extern "C" {
  * @see f_string_dynamics_resize()
  */
 #ifndef _di_controller_rule_action_delete_simple_
-  extern void controller_rule_action_delete_simple(controller_rule_action_t *action) F_attribute_visibility_internal_d;
+  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_
 
 /**
@@ -520,7 +520,7 @@ extern "C" {
  * @see f_memory_delete()
  */
 #ifndef _di_controller_rule_actions_delete_simple_
-  extern void controller_rule_actions_delete_simple(controller_rule_actions_t *actions) F_attribute_visibility_internal_d;
+  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_
 
 /**
@@ -540,7 +540,7 @@ extern "C" {
  *   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_array_length_t amount, controller_rule_actions_t *actions) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_actions_increase_by(const f_array_length_t amount, controller_rule_actions_t * const actions) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_actions_increase_by_
 
 /**
@@ -562,7 +562,7 @@ extern "C" {
  * @see f_string_dynamic_resize()
  */
 #ifndef _di_controller_rule_delete_simple_
-  extern void controller_rule_delete_simple(controller_rule_t *rule) F_attribute_visibility_internal_d;
+  extern void controller_rule_delete_simple(controller_rule_t * const rule) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_delete_simple_
 
 /**
@@ -574,7 +574,7 @@ extern "C" {
  * @see f_string_dynamic_resize()
  */
 #ifndef _di_controller_rule_item_delete_simple_
-  extern void controller_rule_item_delete_simple(controller_rule_item_t *item) F_attribute_visibility_internal_d;
+  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_
 
 /**
@@ -587,7 +587,7 @@ extern "C" {
  * @see f_memory_delete()
  */
 #ifndef _di_controller_rule_items_delete_simple_
-  extern void controller_rule_items_delete_simple(controller_rule_items_t *items) F_attribute_visibility_internal_d;
+  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_
 
 /**
@@ -599,7 +599,7 @@ extern "C" {
  * @see f_string_dynamic_resize()
  */
 #ifndef _di_controller_rule_on_delete_simple_
-  extern void controller_rule_on_delete_simple(controller_rule_on_t *on) F_attribute_visibility_internal_d;
+  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_
 
 /**
@@ -612,7 +612,7 @@ extern "C" {
  * @see f_memory_delete()
  */
 #ifndef _di_controller_rule_ons_delete_simple_
-  extern void controller_rule_ons_delete_simple(controller_rule_ons_t *ons) F_attribute_visibility_internal_d;
+  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_
 
 /**
@@ -635,7 +635,7 @@ extern "C" {
  * @see controller_rule_ons_resize()
  */
 #ifndef _di_controller_rule_ons_increase_
-  extern f_status_t controller_rule_ons_increase(controller_rule_ons_t *ons) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_ons_increase(controller_rule_ons_t * const ons) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_increase_
 
 /**
@@ -655,7 +655,7 @@ extern "C" {
  * @see f_memory_resize()
  */
 #ifndef _di_controller_rule_ons_resize_
-  extern f_status_t controller_rule_ons_resize(const f_array_length_t length, controller_rule_ons_t *ons) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_ons_resize(const f_array_length_t length, controller_rule_ons_t * const ons) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_ons_resize_
 
 /**
@@ -667,7 +667,7 @@ extern "C" {
  * @see controller_rules_resize()
  */
 #ifndef _di_controller_rules_delete_simple_
-  extern void controller_rules_delete_simple(controller_rules_t *rules) F_attribute_visibility_internal_d;
+  extern void controller_rules_delete_simple(controller_rules_t * const rules) F_attribute_visibility_internal_d;
 #endif // _di_controller_rules_delete_simple_
 
 /**
@@ -690,7 +690,7 @@ extern "C" {
  * @see controller_rules_resize()
  */
 #ifndef _di_controller_rules_increase_
-  extern f_status_t controller_rules_increase(controller_rules_t *rules) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rules_increase(controller_rules_t * const rules) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_increase_
 
 /**
@@ -710,7 +710,7 @@ extern "C" {
  * @see f_memory_resize()
  */
 #ifndef _di_controller_rules_resize_
-  extern f_status_t controller_rules_resize(const f_array_length_t length, controller_rules_t *rules) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rules_resize(const f_array_length_t length, controller_rules_t * const rules) F_attribute_visibility_internal_d;
 #endif // _di_controller_rules_resize_
 
 #ifdef __cplusplus
index 87bd64a841d146a95afa569f6abbb1c8cd002050..19f25e86972c3d36c691b1f6928ce15a755b7225 100644 (file)
@@ -6,7 +6,7 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_setting_delete_simple_
-  void controller_setting_delete_simple(controller_setting_t *setting) {
+  void controller_setting_delete_simple(controller_setting_t * const setting) {
 
     f_string_dynamic_resize(0, &setting->path_control);
     f_string_dynamic_resize(0, &setting->path_cgroup);
index ff1108e12df43fc85282ff0f7f3dce14de3b2b08..527d3e35bf20c02a6f7b499a8cf098c1ea23ecdc 100644 (file)
@@ -121,7 +121,7 @@ extern "C" {
  * @see f_string_dynamic_resize()
  */
 #ifndef _di_controller_setting_delete_simple_
-  extern void controller_setting_delete_simple(controller_setting_t *setting) F_attribute_visibility_internal_d;
+  extern void controller_setting_delete_simple(controller_setting_t * const setting) F_attribute_visibility_internal_d;
 #endif // _di_controller_setting_delete_simple_
 
 #ifdef __cplusplus
index b4b1b7d4e5f361335df38a64ffee8ed36110d060..0c4aea2a853017a4135f946fd8416ec549fc14ad 100644 (file)
@@ -6,7 +6,7 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_task_action_delete_simple_
-  void controller_task_action_delete_simple(controller_task_action_t *action) {
+  void controller_task_action_delete_simple(controller_task_action_t * const action) {
 
     f_string_dynamic_resize(0, &action->help);
     f_string_dynamics_resize(0, &action->parameters);
@@ -14,7 +14,7 @@ extern "C" {
 #endif // _di_controller_task_action_delete_simple_
 
 #ifndef _di_controller_task_actions_delete_simple_
-  void controller_task_actions_delete_simple(controller_task_actions_t *actions) {
+  void controller_task_actions_delete_simple(controller_task_actions_t * const actions) {
 
     actions->used = actions->size;
 
@@ -28,7 +28,7 @@ extern "C" {
 #endif // _di_controller_task_actions_delete_simple_
 
 #ifndef _di_controller_task_actions_increase_by_
-  f_status_t controller_task_actions_increase_by(const f_array_length_t amount, controller_task_actions_t *actions) {
+  f_status_t controller_task_actions_increase_by(const f_array_length_t amount, controller_task_actions_t * const actions) {
 
     if (actions->used + amount > actions->size) {
       if (actions->used + amount > F_array_length_t_size_d) {
@@ -77,14 +77,14 @@ extern "C" {
 #endif // _di_controller_task_delete_simple_
 
 #ifndef _di_controller_tasks_delete_simple_
-  void controller_tasks_delete_simple(controller_tasks_t *tasks) {
+  void controller_tasks_delete_simple(controller_tasks_t * const tasks) {
 
     controller_tasks_resize(0, tasks);
   }
 #endif // _di_controller_tasks_delete_simple_
 
 #ifndef _di_controller_tasks_increase_
-  f_status_t controller_tasks_increase(controller_tasks_t *tasks) {
+  f_status_t controller_tasks_increase(controller_tasks_t * const tasks) {
 
     if (tasks->used + 1 > tasks->size) {
       f_array_length_t size = tasks->used + controller_common_allocation_small_d;
@@ -105,7 +105,7 @@ extern "C" {
 #endif // _di_controller_tasks_increase_
 
 #ifndef _di_controller_tasks_resize_
-  f_status_t controller_tasks_resize(const f_array_length_t length, controller_tasks_t *tasks) {
+  f_status_t controller_tasks_resize(const f_array_length_t length, controller_tasks_t * const tasks) {
 
     for (f_array_length_t i = length; i < tasks->size; ++i) {
       controller_task_delete_simple(&tasks->array[i]);
index 01e4666cc39201eb7eec010add6e5f9dc2f8d04e..4d16fef06f386cbdd0de081bb8429b820ca71ba7 100644 (file)
@@ -242,7 +242,7 @@ extern "C" {
  * @see f_string_dynamics_resize()
  */
 #ifndef _di_controller_task_action_delete_simple_
-  extern void controller_task_action_delete_simple(controller_task_action_t *action) F_attribute_visibility_internal_d;
+  extern void controller_task_action_delete_simple(controller_task_action_t * const action) F_attribute_visibility_internal_d;
 #endif // _di_controller_task_action_delete_simple_
 
 /**
@@ -276,7 +276,7 @@ extern "C" {
  *   Errors (with error bit) from: f_memory_resize().
  */
 #ifndef _di_controller_task_actions_increase_by_
-  extern f_status_t controller_task_actions_increase_by(const f_array_length_t amount, controller_task_actions_t *actions) F_attribute_visibility_internal_d;
+  extern f_status_t controller_task_actions_increase_by(const f_array_length_t amount, controller_task_actions_t * const actions) F_attribute_visibility_internal_d;
 #endif // _di_controller_task_actions_increase_by_
 
 /**
@@ -299,7 +299,7 @@ extern "C" {
  * @see controller_task_items_delete_simple()
  */
 #ifndef _di_controller_task_delete_simple_
-  extern void controller_task_delete_simple(controller_task_t *task) F_attribute_visibility_internal_d;
+  extern void controller_task_delete_simple(controller_task_t * const task) F_attribute_visibility_internal_d;
 #endif // _di_controller_task_delete_simple_
 
 /**
@@ -311,7 +311,7 @@ extern "C" {
  * @see controller_tasks_resize()
  */
 #ifndef _di_controller_tasks_delete_simple_
-  extern void controller_tasks_delete_simple(controller_tasks_t *tasks) F_attribute_visibility_internal_d;
+  extern void controller_tasks_delete_simple(controller_tasks_t * const tasks) F_attribute_visibility_internal_d;
 #endif // _di_controller_tasks_delete_simple_
 
 /**
@@ -334,7 +334,7 @@ extern "C" {
  * @see controller_tasks_resize()
  */
 #ifndef _di_controller_tasks_increase_
-  extern f_status_t controller_tasks_increase(controller_tasks_t *tasks) F_attribute_visibility_internal_d;
+  extern f_status_t controller_tasks_increase(controller_tasks_t * const tasks) F_attribute_visibility_internal_d;
 #endif // _di_controller_task_increase_
 
 /**
@@ -354,7 +354,7 @@ extern "C" {
  * @see f_memory_resize()
  */
 #ifndef _di_controller_tasks_resize_
-  extern f_status_t controller_tasks_resize(const f_array_length_t length, controller_tasks_t *tasks) F_attribute_visibility_internal_d;
+  extern f_status_t controller_tasks_resize(const f_array_length_t length, controller_tasks_t * const tasks) F_attribute_visibility_internal_d;
 #endif // _di_controller_tasks_resize_
 
 #ifdef __cplusplus
index d77c8afa68f94f77879a26d73ae0810024db2bb0..62613b1d2018f885e4383c457c29e31956c140ee 100644 (file)
@@ -6,7 +6,7 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_thread_delete_simple_
-  void controller_thread_delete_simple(controller_thread_t *thread) {
+  void controller_thread_delete_simple(controller_thread_t * const thread) {
 
     controller_lock_delete_simple(&thread->lock);
     controller_processs_resize(0, &thread->processs);
index 01af260ef1c4b4f0185da1aa975a95a8ea7c1c73..68da8693503ed251c4a6f82ed2ae2cd777550b46 100644 (file)
@@ -25,6 +25,7 @@ extern "C" {
  * id_cleanup: The thread ID representing the Cleanup Process.
  * id_control: The thread ID representing the Control Process.
  * id_entry:   The thread ID representing the Entry or Exit Process.
+ * id_listen:  The thread ID representing the Control Process Listener.
  * id_rule:    The thread ID representing the Rule Process.
  * id_signal:  The thread ID representing the Signal Process.
  * lock:       A r/w lock for operating on this structure.
@@ -105,6 +106,7 @@ extern "C" {
     f_thread_id_t id_cleanup;
     f_thread_id_t id_control;
     f_thread_id_t id_entry;
+    f_thread_id_t id_listen;
     f_thread_id_t id_rule;
     f_thread_id_t id_signal;
 
@@ -122,6 +124,7 @@ extern "C" {
     f_thread_id_t_initialize, \
     f_thread_id_t_initialize, \
     f_thread_id_t_initialize, \
+    f_thread_id_t_initialize, \
     controller_lock_t_initialize, \
     controller_processs_t_initialize, \
     controller_cache_t_initialize, \
index 64f96d0ca6ce4e59f79c428c724fe6eb282e5c9a..586ffd0fb188ccb7b3572523a5b3489a00106a53 100644 (file)
@@ -23,6 +23,7 @@ extern "C" {
 #include "common/private-setting.h"
 #include "common/private-thread.h"
 #include "common/private-state.h"
+#include "common/private-control.h"
 
 /**
  * All special strings used within this program.
index 8008106e77d2f961e71ec34b93034354ede9f0e9..574988601408cad977ef7ec727d88ce1f2c3a0bb 100644 (file)
 #include "controller.h"
 #include "private-common.h"
 #include "private-control.h"
+#include "private-controller_print.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#ifndef _di_controller_control_configure_client_
+  f_status_t controller_control_configure_client(const controller_global_t *global, f_socket_t * const client) {
+
+    struct timeval time_out;
+    time_out.tv_sec = 0;
+    time_out.tv_usec = controller_control_default_socket_timeout_d;
+
+    f_status_t status = f_socket_option_set(client, 1, f_socket_option_time_out_receive_d, (void *) &time_out, sizeof(struct timeval));
+
+    if (F_status_is_error_not(status)) {
+      status = f_socket_option_set(client, 1, f_socket_option_time_out_send_d, (void *) &time_out, sizeof(struct timeval));
+    }
+
+    if (F_status_is_error(status)) {
+      controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_socket_option_set", F_true);
+    }
+
+    return status;
+  }
+#endif // _di_controller_control_configure_client_
+
+#ifndef _di_controller_control_configure_server_
+  f_status_t controller_control_configure_server(const controller_global_t *global, f_socket_t * const server) {
+
+    struct linger value = { 1, 1 };
+
+    f_status_t status = f_socket_option_set(server, controller_control_default_socket_linger_d, f_socket_option_linger_d, (void *) &value, sizeof(struct linger));
+
+    if (F_status_is_error(status)) {
+      controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_socket_option_set", F_true);
+    }
+
+    return status;
+  }
+#endif // _di_controller_control_configure_server_
+
+#ifndef _di_controller_control_accept_
+  f_status_t controller_control_accept(const controller_global_t *global, f_socket_t * const server, controller_packet_t * const packet) {
+
+    f_socket_t client = f_socket_t_initialize;
+
+    f_status_t status = f_socket_accept(&client, server->id);
+
+    if (F_status_is_error(status)) {
+      f_socket_disconnect(&client, f_socket_close_read_write_e);
+
+      controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_socket_accept", F_true);
+
+      return status;
+    }
+
+    controller_control_configure_client(global, &client);
+
+    char buffer[controller_control_default_socket_buffer_d + 1];
+    size_t length = 0;
+
+    memset(buffer, 0, controller_control_default_socket_buffer_d + 1);
+    packet->payload.used = 0;
+
+    // Pre-process the packet header.
+    client.size_read = controller_control_default_socket_header_d;
+    status = f_socket_read(&client, f_socket_flag_peek_d, buffer, &length);
+
+    if (F_status_is_error(status)) {
+      f_socket_disconnect(&client, f_socket_close_read_write_e);
+
+      controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_socket_read", F_true);
+
+      return status;
+    }
+
+    client.size_read = controller_control_default_socket_buffer_d;
+
+    // Get all remaining data.
+    //while (???) { // until done, based on expected length that should be described in the packet header.
+      //message_length = recv(&client, buffer, input_size, receive_flags);
+
+    //} // while
+
+    // process the data.
+
+    // send any responses.
+    // sent = send(&client, packet, output_size, send_flags);
+
+    f_socket_disconnect(&client, f_socket_close_read_write_e);
+
+    return F_none;
+  }
+#endif // _di_controller_control_accept_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index e8501e23d88a1ef79d47654a23eea12bdfa1ca5c..46987b64734cb58b12d59ec9c9adcf9fdc7a0f5f 100644 (file)
 extern "C" {
 #endif
 
+/**
+ * Configure client socket settings.
+ *
+ * @param global
+ *   The global data.
+ * @param client
+ *   The client socket structure.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_socket_option_set().
+ *
+ * @see f_socket_option_set()
+ */
+#ifndef _di_controller_control_configure_client_
+  extern f_status_t controller_control_configure_client(const controller_global_t *global, f_socket_t * const client) F_attribute_visibility_internal_d;
+#endif // _di_controller_control_configure_client_
+
+/**
+ * Configure server socket settings.
+ *
+ * @param global
+ *   The global data.
+ * @param server
+ *   The server socket structure.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_socket_option_set().
+ *
+ * @see f_socket_option_set()
+ */
+#ifndef _di_controller_control_configure_server_
+  extern f_status_t controller_control_configure_server(const controller_global_t *global, f_socket_t * const server) F_attribute_visibility_internal_d;
+#endif // _di_controller_control_configure_server_
+
+/**
+ * Accept connections from a control socket server.
+ *
+ * Connectons are processed and actions are performed.
+ *
+ * @param global
+ *   The global data.
+ * @param socket
+ *   The socket structure.
+ * @param packet
+ *   The control packet data structure.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_socket_accept().
+ *
+ * @see f_socket_accept()
+ */
+#ifndef _di_controller_control_accept_
+  extern f_status_t controller_control_accept(const controller_global_t *global, f_socket_t * const server, controller_packet_t * const packet) F_attribute_visibility_internal_d;
+#endif // _di_controller_control_accept_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index fcc3d4235a981e264bf4ce659e4c8135a84c93f6..34d85889697203b1c815ab79e54690ca8c14c8db 100644 (file)
@@ -4,6 +4,7 @@
 #include "private-controller_print.h"
 #include "private-entry_print.h"
 #include "private-lock_print.h"
+#include "private-thread_control.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -90,7 +91,7 @@ extern "C" {
 
     if (F_status_is_error(status)) {
       if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "f_string_append", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_append", F_true);
       }
 
       return status;
@@ -100,7 +101,7 @@ extern "C" {
 
     if (F_status_is_error(status)) {
       if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true);
       }
 
       return status;
@@ -128,7 +129,7 @@ extern "C" {
       }
 
       if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
-        controller_print_error_file(global.main->error, F_status_set_fine(status), "f_file_stream_open", F_true, path, "open", fll_error_file_type_file_e, global.thread);
+        controller_print_error_file(global.thread, global.main->error, F_status_set_fine(status), "f_file_stream_open", F_true, path, "open", fll_error_file_type_file_e);
       }
     }
     else {
@@ -136,7 +137,7 @@ extern "C" {
 
       if (F_status_is_error(status)) {
         if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
-          controller_print_error_file(global.main->error, F_status_set_fine(status), "f_file_stream_read", F_true, path, "read", fll_error_file_type_file_e, global.thread);
+          controller_print_error_file(global.thread, global.main->error, F_status_set_fine(status), "f_file_stream_read", F_true, path, "read", fll_error_file_type_file_e);
         }
       }
     }
@@ -150,7 +151,7 @@ extern "C" {
 
       if (F_status_is_error(status)) {
         if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
-          controller_print_error_file(global.main->error, F_status_set_fine(status), "f_file_stat", F_true, path, "stat", fll_error_file_type_file_e, global.thread);
+          controller_print_error_file(global.thread, global.main->error, F_status_set_fine(status), "f_file_stat", F_true, path, "stat", fll_error_file_type_file_e);
         }
       }
       else {
@@ -262,7 +263,7 @@ extern "C" {
 #endif // _di_controller_file_pid_delete_
 
 #ifndef _di_controller_file_pid_read_
-  f_status_t controller_file_pid_read(const f_string_static_t path, pid_t *pid) {
+  f_status_t controller_file_pid_read(const f_string_static_t path, pid_t * const pid) {
 
     *pid = 0;
 
@@ -312,22 +313,17 @@ extern "C" {
 #endif // _di_controller_file_pid_read_
 
 #ifndef _di_controller_get_id_user_
-  f_status_t controller_get_id_user(const f_string_static_t buffer, const f_string_range_t range, controller_cache_t * const cache, uid_t *id) {
+  f_status_t controller_get_id_user(const f_string_static_t buffer, const f_string_range_t range, controller_cache_t * const cache, uid_t * const id) {
 
     f_number_unsigned_t number = 0;
 
     f_status_t status = fl_conversion_string_to_number_unsigned(buffer.string, range, &number);
 
     if (F_status_is_error(status)) {
-      status = F_status_set_fine(status);
-
-      if (status == F_number) {
+      if (F_status_set_fine(status) == F_number) {
         cache->action.generic.used = 0;
 
-        status = f_string_dynamic_partial_append_nulless(buffer, range, &cache->action.generic);
-        if (F_status_is_error(status)) return status;
-
-        status = f_string_dynamic_terminate(&cache->action.generic);
+        status = controller_dynamic_rip_nulless_terminated(buffer, range, &cache->action.generic);
         if (F_status_is_error(status)) return status;
 
         status = f_account_id_user_by_name(cache->action.generic.string, id);
@@ -340,35 +336,28 @@ extern "C" {
         return F_none;
       }
 
-      return F_status_set_error(status);
+      return status;
     }
     else if (number > F_type_size_32_unsigned_d) {
       return F_status_set_error(F_number_too_large);
     }
 
-    *id = (uid_t) number;
-
     return status;
   }
 #endif // _di_controller_get_id_user_
 
 #ifndef _di_controller_get_id_group_
-  f_status_t controller_get_id_group(const f_string_static_t buffer, const f_string_range_t range, controller_cache_t * const cache, gid_t *id) {
+  f_status_t controller_get_id_group(const f_string_static_t buffer, const f_string_range_t range, controller_cache_t * const cache, gid_t * const id) {
 
     f_number_unsigned_t number = 0;
 
     f_status_t status = fl_conversion_string_to_number_unsigned(buffer.string, range, &number);
 
     if (F_status_is_error(status)) {
-      status = F_status_set_fine(status);
-
-      if (status == F_number) {
+      if (F_status_set_fine(status) == F_number) {
         cache->action.generic.used = 0;
 
-        status = f_string_dynamic_partial_append_nulless(buffer, range, &cache->action.generic);
-        if (F_status_is_error(status)) return status;
-
-        status = f_string_dynamic_terminate(&cache->action.generic);
+        status = controller_dynamic_rip_nulless_terminated(buffer, range, &cache->action.generic);
         if (F_status_is_error(status)) return status;
 
         status = f_account_id_group_by_name(cache->action.generic.string, id);
@@ -381,20 +370,18 @@ extern "C" {
         return F_none;
       }
 
-      return F_status_set_error(status);
+      return status;
     }
     else if (number > F_type_size_32_unsigned_d) {
       return F_status_set_error(F_number_too_large);
     }
 
-    *id = (gid_t) number;
-
     return status;
   }
 #endif // _di_controller_get_id_group_
 
 #ifndef _di_controller_perform_ready_
-  f_status_t controller_perform_ready(const controller_global_t global, const bool is_entry, controller_cache_t * const cache) {
+  f_status_t controller_perform_ready(const controller_global_t *global, controller_cache_t * const cache, const bool is_entry) {
 
     if (!is_entry) {
       return F_none;
@@ -402,9 +389,9 @@ extern "C" {
 
     f_status_t status = F_none;
 
-    if (global.setting->entry.pid != controller_entry_pid_disable_e && !global.setting->path_pid.used) {
-      if (global.main->parameters[controller_parameter_validate_e].result == f_console_result_additional_e) {
-        status = controller_file_pid_create(global.main->pid, global.setting->path_pid);
+    if (global->setting->entry.pid != controller_entry_pid_disable_e && !global->setting->path_pid.used) {
+      if (global->main->parameters[controller_parameter_validate_e].result == f_console_result_additional_e) {
+        status = controller_file_pid_create(global->main->pid, global->setting->path_pid);
       }
 
       // Report pid file error but because this could be an "init" program, consider the pid file as optional and continue on.
@@ -412,200 +399,227 @@ extern "C" {
 
         // Always return immediately on memory errors.
         if (F_status_set_fine(status) == F_memory_not) {
-          if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
-            controller_lock_print(global.main->error.to, global.thread);
+          if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+            controller_lock_print(global->main->error.to, global->thread);
 
-            controller_print_error_file(global.main->error, F_status_set_fine(status), "controller_file_pid_create", F_true, global.setting->path_pid.string, "create", fll_error_file_type_file_e, 0);
+            controller_print_error_file(0, global->main->error, F_status_set_fine(status), "controller_file_pid_create", F_true, global->setting->path_pid.string, "create", fll_error_file_type_file_e);
 
-            flockfile(global.main->error.to.stream);
+            flockfile(global->main->error.to.stream);
 
-            controller_entry_print_error_cache(is_entry, global.main->error, cache->action);
+            controller_entry_print_error_cache(is_entry, global->main->error, cache->action);
 
-            controller_unlock_print_flush(global.main->error.to, global.thread);
+            controller_unlock_print_flush(global->main->error.to, global->thread);
           }
 
           return status;
         }
 
-        if (global.main->warning.verbosity == f_console_verbosity_debug_e) {
-          controller_lock_print(global.main->warning.to, global.thread);
+        if (global->main->warning.verbosity == f_console_verbosity_debug_e) {
+          controller_lock_print(global->main->warning.to, global->thread);
 
           if (F_status_set_fine(status) == F_read_only) {
-            fl_print_format("%c%[%SThe pid file '%]", global.main->warning.to.stream, f_string_eol_s[0], global.main->warning.context, global.main->warning.prefix, global.main->warning.context);
-            fl_print_format("%[%Q%]", global.main->warning.to.stream, global.main->warning.notable, global.setting->path_pid, global.main->warning.notable);
-            fl_print_format("%[' could not be written because the destination is read only.%]%c", global.main->warning.to.stream, global.main->warning.context, global.main->warning.context, f_string_eol_s[0]);
+            fl_print_format("%c%[%SThe pid file '%]", global->main->warning.to.stream, f_string_eol_s[0], global->main->warning.context, global->main->warning.prefix, global->main->warning.context);
+            fl_print_format("%[%Q%]", global->main->warning.to.stream, global->main->warning.notable, global->setting->path_pid, global->main->warning.notable);
+            fl_print_format("%[' could not be written because the destination is read only.%]%c", global->main->warning.to.stream, global->main->warning.context, global->main->warning.context, f_string_eol_s[0]);
           }
           else {
-            controller_print_error_file(global.main->warning, F_status_set_fine(status), "controller_file_pid_create", F_true, global.setting->path_pid.string, "create", fll_error_file_type_file_e, 0);
+            controller_print_error_file(0, global->main->warning, F_status_set_fine(status), "controller_file_pid_create", F_true, global->setting->path_pid.string, "create", fll_error_file_type_file_e);
           }
 
-          controller_entry_print_error_cache(is_entry, global.main->warning, cache->action);
+          controller_entry_print_error_cache(is_entry, global->main->warning, cache->action);
 
-          controller_unlock_print_flush(global.main->warning.to, global.thread);
+          controller_unlock_print_flush(global->main->warning.to, global->thread);
         }
 
         status = F_none;
       }
       else {
-        global.setting->pid_created = F_true;
+        global->setting->pid_created = F_true;
 
-        if (global.main->output.verbosity == f_console_verbosity_debug_e) {
-          controller_lock_print(global.main->output.to, global.thread);
+        if (global->main->output.verbosity == f_console_verbosity_debug_e) {
+          controller_lock_print(global->main->output.to, global->thread);
 
-          fl_print_format("%cPID file '", global.main->output.to.stream, f_string_eol_s[0]);
-          fl_print_format("%[%Q%]", global.main->output.to.stream, global.main->context.set.notable, global.setting->path_pid, global.main->context.set.notable);
+          fl_print_format("%cPID file '", global->main->output.to.stream, f_string_eol_s[0]);
+          fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.notable, global->setting->path_pid, global->main->context.set.notable);
 
-          if (global.main->parameters[controller_parameter_validate_e].result == f_console_result_none_e) {
-            fl_print_format("' created.%c", global.main->output.to.stream, f_string_eol_s[0]);
+          if (global->main->parameters[controller_parameter_validate_e].result == f_console_result_none_e) {
+            fl_print_format("' created.%c", global->main->output.to.stream, f_string_eol_s[0]);
           }
           else {
-            fl_print_format("'.%c", global.main->output.to.stream, f_string_eol_s[0]);
+            fl_print_format("'.%c", global->main->output.to.stream, f_string_eol_s[0]);
           }
 
-          controller_unlock_print_flush(global.main->output.to, global.thread);
+          controller_unlock_print_flush(global->main->output.to, global->thread);
         }
       }
     }
 
-    if (global.setting->path_control.used) {
-      if (global.setting->control_readonly) {
-        if (f_file_exists(global.setting->path_control.string) != F_true) {
-          if (global.main->output.verbosity == f_console_verbosity_debug_e) {
-            controller_lock_print(global.main->output.to, global.thread);
+    if (global->setting->path_control.used) {
+      if (global->setting->control_readonly) {
+        if (f_file_exists(global->setting->path_control.string) != F_true) {
+          if (global->main->output.verbosity == f_console_verbosity_debug_e) {
+            controller_lock_print(global->main->output.to, global->thread);
 
-            fl_print_format("%c%[%SControl socket '%]", global.main->warning.to.stream, f_string_eol_s[0], global.main->warning.context, global.main->warning.prefix, global.main->warning.context);
-            fl_print_format("%[%Q%]", global.main->output.to.stream, global.main->context.set.notable, global.setting->path_control, global.main->context.set.notable);
-            fl_print_format("' .%c", global.main->output.to.stream, f_string_eol_s[0]);
-            fl_print_format("%[' cannot be found while read only mode is enabled and so the Control socket is unavailable.%]%c", global.main->output.to.stream, global.main->warning.context, global.main->warning.context, f_string_eol_s[0]);
+            fl_print_format("%c%[%SControl socket '%]", global->main->warning.to.stream, f_string_eol_s[0], global->main->warning.context, global->main->warning.prefix, global->main->warning.context);
+            fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.notable, global->setting->path_control, global->main->context.set.notable);
+            fl_print_format("' .%c", global->main->output.to.stream, f_string_eol_s[0]);
+            fl_print_format("%[' cannot be found while read only mode is enabled and so the Control socket is unavailable.%]%c", global->main->output.to.stream, global->main->warning.context, global->main->warning.context, f_string_eol_s[0]);
 
-            controller_unlock_print_flush(global.main->output.to, global.thread);
+            controller_unlock_print_flush(global->main->output.to, global->thread);
           }
 
           return status;
         }
       }
       else {
-        status = f_socket_create(&global.setting->control_socket);
+        status = f_socket_create(&global->setting->control_socket);
 
         if (F_status_is_error(status)) {
           if (F_status_set_fine(status) == F_memory_not) {
-            controller_print_error(global.main->error, F_status_set_fine(status), "f_socket_create", F_true, global.thread);
+            controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_socket_create", F_true);
 
             return status;
           }
 
-          if (global.main->output.verbosity == f_console_verbosity_debug_e) {
-            controller_lock_print(global.main->output.to, global.thread);
+          if (global->main->output.verbosity == f_console_verbosity_debug_e) {
+            controller_lock_print(global->main->output.to, global->thread);
 
-            fl_print_format("%c%[%SControl socket '%]", global.main->warning.to.stream, f_string_eol_s[0], global.main->warning.context, global.main->warning.prefix, global.main->warning.context);
-            fl_print_format("%[%Q%]", global.main->output.to.stream, global.main->context.set.notable, global.setting->path_control, global.main->context.set.notable);
-            fl_print_format("%[' could not be created, code %]", global.main->output.to.stream, global.main->warning.context, global.main->warning.context);
-            fl_print_format("%[%ui%]", global.main->output.to.stream, global.main->context.set.notable, F_status_set_fine(status), global.main->context.set.notable);
-            fl_print_format("%[.%]%c", global.main->output.to.stream, global.main->warning.context, global.main->warning.context, f_string_eol_s[0]);
+            fl_print_format("%c%[%SControl socket '%]", global->main->warning.to.stream, f_string_eol_s[0], global->main->warning.context, global->main->warning.prefix, global->main->warning.context);
+            fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.notable, global->setting->path_control, global->main->context.set.notable);
+            fl_print_format("%[' could not be created, code %]", global->main->output.to.stream, global->main->warning.context, global->main->warning.context);
+            fl_print_format("%[%ui%]", global->main->output.to.stream, global->main->context.set.notable, F_status_set_fine(status), global->main->context.set.notable);
+            fl_print_format("%[.%]%c", global->main->output.to.stream, global->main->warning.context, global->main->warning.context, f_string_eol_s[0]);
 
-            controller_unlock_print_flush(global.main->output.to, global.thread);
+            controller_unlock_print_flush(global->main->output.to, global->thread);
           }
         }
         else {
-          status = f_file_remove(global.setting->path_control.string);
+          status = f_file_remove(global->setting->path_control.string);
 
           if (F_status_set_fine(status) == F_memory_not) {
-            controller_print_error(global.main->error, F_status_set_fine(status), "f_file_remove", F_true, global.thread);
+            controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_file_remove", F_true);
 
             return status;
           }
 
-          global.setting->control_socket.name = global.setting->path_control.string;
+          global->setting->control_socket.name = global->setting->path_control.string;
 
-          status = f_socket_bind_file(global.setting->control_socket);
+          status = f_socket_bind_file(global->setting->control_socket);
 
           if (F_status_is_error(status)) {
-            f_socket_disconnect(&global.setting->control_socket, f_socket_close_fast_e);
+            f_socket_disconnect(&global->setting->control_socket, f_socket_close_fast_e);
 
             if (F_status_set_fine(status) == F_memory_not) {
-              controller_print_error(global.main->error, F_status_set_fine(status), "f_socket_bind_file", F_true, global.thread);
+              controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_socket_bind_file", F_true);
 
               return status;
             }
 
-            if (global.main->output.verbosity == f_console_verbosity_debug_e) {
-              controller_lock_print(global.main->output.to, global.thread);
+            if (global->main->output.verbosity == f_console_verbosity_debug_e) {
+              controller_lock_print(global->main->output.to, global->thread);
 
-              fl_print_format("%c%[%SControl socket '%]", global.main->warning.to.stream, f_string_eol_s[0], global.main->warning.context, global.main->warning.prefix, global.main->warning.context);
-              fl_print_format("%[%Q%]", global.main->output.to.stream, global.main->context.set.notable, global.setting->path_control, global.main->context.set.notable);
-              fl_print_format("%[' could not be bound, code %]", global.main->output.to.stream, global.main->warning.context, global.main->warning.context);
-              fl_print_format("%[%ui%]", global.main->output.to.stream, global.main->context.set.notable, F_status_set_fine(status), global.main->context.set.notable);
-              fl_print_format("%[.%]%c", global.main->output.to.stream, global.main->warning.context, global.main->warning.context, f_string_eol_s[0]);
+              fl_print_format("%c%[%SControl socket '%]", global->main->warning.to.stream, f_string_eol_s[0], global->main->warning.context, global->main->warning.prefix, global->main->warning.context);
+              fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.notable, global->setting->path_control, global->main->context.set.notable);
+              fl_print_format("%[' could not be bound, code %]", global->main->output.to.stream, global->main->warning.context, global->main->warning.context);
+              fl_print_format("%[%ui%]", global->main->output.to.stream, global->main->context.set.notable, F_status_set_fine(status), global->main->context.set.notable);
+              fl_print_format("%[.%]%c", global->main->output.to.stream, global->main->warning.context, global->main->warning.context, f_string_eol_s[0]);
 
-              controller_unlock_print_flush(global.main->output.to, global.thread);
+              controller_unlock_print_flush(global->main->output.to, global->thread);
             }
           }
           else {
-            status = f_file_role_change(global.setting->path_control.string, global.setting->control_user, global.setting->control_group, F_true);
+            status = f_file_role_change(global->setting->path_control.string, global->setting->control_user, global->setting->control_group, F_true);
 
             if (F_status_is_error(status)) {
-              f_socket_disconnect(&global.setting->control_socket, f_socket_close_fast_e);
+              f_socket_disconnect(&global->setting->control_socket, f_socket_close_fast_e);
 
               if (F_status_set_fine(status) == F_memory_not) {
-                controller_print_error(global.main->error, F_status_set_fine(status), "f_file_role_change", F_true, global.thread);
+                controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_file_role_change", F_true);
 
                 return status;
               }
 
-              if (global.main->output.verbosity == f_console_verbosity_debug_e) {
-                controller_lock_print(global.main->output.to, global.thread);
+              if (global->main->output.verbosity == f_console_verbosity_debug_e) {
+                controller_lock_print(global->main->output.to, global->thread);
 
-                fl_print_format("%c%[%SControl socket '%]", global.main->warning.to.stream, f_string_eol_s[0], global.main->warning.context, global.main->warning.prefix, global.main->warning.context);
-                fl_print_format("%[%Q%]", global.main->output.to.stream, global.main->context.set.notable, global.setting->path_control, global.main->context.set.notable);
-                fl_print_format("%[' failed to set file roles, code %]", global.main->output.to.stream, global.main->warning.context, global.main->warning.context);
-                fl_print_format("%[%ui%]", global.main->output.to.stream, global.main->context.set.notable, F_status_set_fine(status), global.main->context.set.notable);
-                fl_print_format("%[.%]%c", global.main->output.to.stream, global.main->warning.context, global.main->warning.context, f_string_eol_s[0]);
+                fl_print_format("%c%[%SControl socket '%]", global->main->warning.to.stream, f_string_eol_s[0], global->main->warning.context, global->main->warning.prefix, global->main->warning.context);
+                fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.notable, global->setting->path_control, global->main->context.set.notable);
+                fl_print_format("%[' failed to set file roles, code %]", global->main->output.to.stream, global->main->warning.context, global->main->warning.context);
+                fl_print_format("%[%ui%]", global->main->output.to.stream, global->main->context.set.notable, F_status_set_fine(status), global->main->context.set.notable);
+                fl_print_format("%[.%]%c", global->main->output.to.stream, global->main->warning.context, global->main->warning.context, f_string_eol_s[0]);
 
-                controller_unlock_print_flush(global.main->output.to, global.thread);
+                controller_unlock_print_flush(global->main->output.to, global->thread);
               }
             }
             else {
-              status = f_file_mode_set(global.setting->path_control.string, global.setting->control_mode);
+              status = f_file_mode_set(global->setting->path_control.string, global->setting->control_mode);
 
               if (F_status_is_error(status)) {
-                f_socket_disconnect(&global.setting->control_socket, f_socket_close_fast_e);
+                f_socket_disconnect(&global->setting->control_socket, f_socket_close_fast_e);
 
                 if (F_status_set_fine(status) == F_memory_not) {
-                  controller_print_error(global.main->error, F_status_set_fine(status), "f_file_role_change", F_true, global.thread);
+                  controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_file_role_change", F_true);
 
                   return status;
                 }
 
-                if (global.main->output.verbosity == f_console_verbosity_debug_e) {
-                  controller_lock_print(global.main->output.to, global.thread);
+                if (global->main->output.verbosity == f_console_verbosity_debug_e) {
+                  controller_lock_print(global->main->output.to, global->thread);
 
-                  fl_print_format("%c%[%SControl socket '%]", global.main->warning.to.stream, f_string_eol_s[0], global.main->warning.context, global.main->warning.prefix, global.main->warning.context);
-                  fl_print_format("%[%Q%]", global.main->output.to.stream, global.main->context.set.notable, global.setting->path_control, global.main->context.set.notable);
-                  fl_print_format("%[' failed to set file mode, code %]", global.main->output.to.stream, global.main->warning.context, global.main->warning.context);
-                  fl_print_format("%[%ui%]", global.main->output.to.stream, global.main->context.set.notable, F_status_set_fine(status), global.main->context.set.notable);
-                  fl_print_format("%[.%]%c", global.main->output.to.stream, global.main->warning.context, global.main->warning.context, f_string_eol_s[0]);
+                  fl_print_format("%c%[%SControl socket '%]", global->main->warning.to.stream, f_string_eol_s[0], global->main->warning.context, global->main->warning.prefix, global->main->warning.context);
+                  fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.notable, global->setting->path_control, global->main->context.set.notable);
+                  fl_print_format("%[' failed to set file mode, code %]", global->main->output.to.stream, global->main->warning.context, global->main->warning.context);
+                  fl_print_format("%[%ui%]", global->main->output.to.stream, global->main->context.set.notable, F_status_set_fine(status), global->main->context.set.notable);
+                  fl_print_format("%[.%]%c", global->main->output.to.stream, global->main->warning.context, global->main->warning.context, f_string_eol_s[0]);
 
-                  controller_unlock_print_flush(global.main->output.to, global.thread);
+                  controller_unlock_print_flush(global->main->output.to, global->thread);
                 }
               }
               else {
-                if (global.main->output.verbosity == f_console_verbosity_debug_e) {
-                  controller_lock_print(global.main->output.to, global.thread);
+                if (global->main->output.verbosity == f_console_verbosity_debug_e) {
+                  controller_lock_print(global->main->output.to, global->thread);
 
-                  fl_print_format("%cControl socket '", global.main->output.to.stream, f_string_eol_s[0]);
-                  fl_print_format("%[%Q%]", global.main->output.to.stream, global.main->context.set.notable, global.setting->path_control, global.main->context.set.notable);
+                  fl_print_format("%cControl socket '", global->main->output.to.stream, f_string_eol_s[0]);
+                  fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.notable, global->setting->path_control, global->main->context.set.notable);
 
-                  if (global.main->parameters[controller_parameter_validate_e].result == f_console_result_none_e) {
-                    fl_print_format("' created.%c", global.main->output.to.stream, f_string_eol_s[0]);
+                  if (global->main->parameters[controller_parameter_validate_e].result == f_console_result_none_e) {
+                    fl_print_format("' created.%c", global->main->output.to.stream, f_string_eol_s[0]);
                   }
                   else {
-                    fl_print_format("'.%c", global.main->output.to.stream, f_string_eol_s[0]);
+                    fl_print_format("'.%c", global->main->output.to.stream, f_string_eol_s[0]);
                   }
 
-                  controller_unlock_print_flush(global.main->output.to, global.thread);
+                  controller_unlock_print_flush(global->main->output.to, global->thread);
+                }
+
+                status = f_thread_create(0, &global->thread->id_listen, &controller_thread_control_listen, (void *) global);
+
+                if (status == F_child) {
+                  return status;
                 }
 
-                // @todo start the control thread.
+                if (F_status_is_error_not(status)) {
+                  status = f_thread_create(0, &global->thread->id_control, &controller_thread_control, (void *) global);
+
+                  if (status == F_child) {
+                    return status;
+                  }
+                }
+
+                if (F_status_is_error(status)) {
+                  if (global->thread->id_listen) {
+                    f_thread_cancel(global->thread->id_listen);
+                    f_thread_join(global->thread->id_listen, 0);
+
+                    global->thread->id_listen = 0;
+                  }
+
+                  global->thread->id_control = 0;
+
+                  if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+                    controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_thread_create", F_true);
+                  }
+                }
               }
             }
           }
@@ -699,17 +713,27 @@ extern "C" {
 #ifndef _di_controller_time_sleep_nanoseconds_
   int controller_time_sleep_nanoseconds(controller_main_t * const main, controller_setting_t * const setting, struct timespec time) {
 
-    if (setting->interruptible) {
-      f_signal_mask(SIG_UNBLOCK, &main->signal.set, 0);
-    }
+    // When sleep is a second or more, instead wait for terminating signals if interruptible.
+    if (setting->interruptible && time.tv_sec) {
+      siginfo_t information;
+      f_signal_t signal = f_signal_t_initialize;
+
+      memset(&information, 0, sizeof(siginfo_t));
 
-    const int result = nanosleep(&time, 0);
+      f_signal_set_empty(&signal.set);
+      f_signal_set_add(F_signal_abort, &signal.set);
+      f_signal_set_add(F_signal_interrupt, &signal.set);
+      f_signal_set_add(F_signal_quit, &signal.set);
+      f_signal_set_add(F_signal_termination, &signal.set);
 
-    if (setting->interruptible) {
-      f_signal_mask(SIG_BLOCK, &main->signal.set, 0);
+      if (F_status_is_error(f_signal_wait_until(&signal.set, &time, &information))) {
+        return -1;
+      }
+
+      return 0;
     }
 
-    return result;
+    return nanosleep(&time, 0);
   }
 #endif // _di_controller_time_sleep_nanoseconds_
 
index 872db43cec273c8a1c1ee1e6252e42326753b878..a0fd07bd9597f01acb3c3e0d76714e65e63202d7 100644 (file)
@@ -207,7 +207,7 @@ extern "C" {
  *   Errors (with error bit) from: fl_conversion_string_to_decimal_unsigned()
  */
 #ifndef _di_controller_file_pid_read_
-  f_status_t controller_file_pid_read(const f_string_static_t path, pid_t *pid) F_attribute_visibility_internal_d;
+  f_status_t controller_file_pid_read(const f_string_static_t path, pid_t * const pid) F_attribute_visibility_internal_d;
 #endif // _di_controller_file_pid_read_
 
 /**
@@ -234,7 +234,7 @@ extern "C" {
  * @see fl_conversion_string_to_number_unsigned()
  */
 #ifndef _di_controller_get_id_user_
-  f_status_t controller_get_id_user(const f_string_static_t buffer, const f_string_range_t range, controller_cache_t * const cache, uid_t *id) F_attribute_visibility_internal_d;
+  f_status_t controller_get_id_user(const f_string_static_t buffer, const f_string_range_t range, controller_cache_t * const cache, uid_t * const id) F_attribute_visibility_internal_d;
 #endif // _di_controller_get_id_user_
 
 /**
@@ -261,7 +261,7 @@ extern "C" {
  * @see fl_conversion_string_to_number_unsigned()
  */
 #ifndef _di_controller_get_id_group_
-  f_status_t controller_get_id_group(const f_string_static_t buffer, const f_string_range_t range, controller_cache_t * const cache, gid_t *id) F_attribute_visibility_internal_d;
+  f_status_t controller_get_id_group(const f_string_static_t buffer, const f_string_range_t range, controller_cache_t * const cache, gid_t * const id) F_attribute_visibility_internal_d;
 #endif // _di_controller_get_id_group_
 
 /**
@@ -273,11 +273,11 @@ extern "C" {
  *
  * @param global
  *   The global data.
+ * @param cache
+ *   The cache.
  * @param is_entry
  *   If TRUE, then this operate as an entry.
  *   If FALSE, then this operate as an exit.
- * @param cache
- *   The cache.
  *
  * @return
  *   F_none on success.
@@ -287,7 +287,7 @@ extern "C" {
  * @see controller_file_pid_create()
  */
 #ifndef _di_controller_perform_ready_
-  extern f_status_t controller_perform_ready(const controller_global_t global, const bool is_entry, controller_cache_t * const cache) F_attribute_visibility_internal_d;
+  extern f_status_t controller_perform_ready(const controller_global_t *global, controller_cache_t * const cache, const bool is_entry) F_attribute_visibility_internal_d;
 #endif // _di_controller_perform_ready_
 
 /**
@@ -353,11 +353,6 @@ extern "C" {
 /**
  * Sleep for a given number of nanoseconds.
  *
- * The nanosleep() function handles signals within itself.
- * Temporarily unblock signals so that the nanosleep can receive the signal and then restore the signals once done.
- *
- * The signals will not be unblocked when in uninterruptible mode.
- *
  * @param main
  *   The main program data.
  * @param setting
@@ -366,10 +361,9 @@ extern "C" {
  *   The number of nanoseconds to sleep.
  *
  * @return
- *   The results of nanosleep().
+ *   The result of nanosleep().
  *
  * @see nanosleep()
- * @see controller_time_milliseconds()
  */
 #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;
index 761145f715ab8ea02f8ff3cc8886920ba25f25ae..f4191bbb4900d0e2f8d4048369e4dd925df2c345 100644 (file)
@@ -8,7 +8,7 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_print_error_
-  void controller_print_error(const fl_print_t print, const f_status_t status, const f_string_t function, const bool fallback, controller_thread_t *thread) {
+  void controller_print_error(controller_thread_t * const thread, const fl_print_t print, const f_status_t status, const f_string_t function, const bool fallback) {
 
     if (print.verbosity == f_console_verbosity_quiet_e) return;
     if (status == F_interrupt) return;
@@ -27,9 +27,10 @@ extern "C" {
 #endif // _di_controller_print_error_
 
 #ifndef _di_controller_print_error_file_
-  void controller_print_error_file(const fl_print_t print, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t name, const f_string_t operation, const uint8_t type, controller_thread_t *thread) {
+  void controller_print_error_file(controller_thread_t * const thread, const fl_print_t print, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t name, const f_string_t operation, const uint8_t type) {
 
     if (print.verbosity == f_console_verbosity_quiet_e) return;
+    if (status == F_interrupt) return;
 
     // fll_error_print() automatically locks, so manually handle only the mutex locking and flushing rather than calling controller_lock_print().
     if (thread) {
index f23d60f3cc83496d7eed98cb9c196b5494a165d3..bbfd80e626b3297fce3eafba89a8e34fe584aac4 100644 (file)
@@ -15,6 +15,9 @@ extern "C" {
 /**
  * Print the error, locking the print mutex during the print.
  *
+ * @param thread
+ *   (optional) The thread data.
+ *   Set to NULL to disable locking on the thread (this should be done only if the lock is already in place).
  * @param print
  *   Designates how printing is to be performed.
  * @param status
@@ -25,19 +28,19 @@ extern "C" {
  *   Set to 0 to disable.
  * @param fallback
  *   Set to F_true to print the fallback error message for unknown errors.
- * @param thread
- *   (optional) The thread data.
- *   Set to NULL to disable locking on the thread (this should be done only if the lock is already in place).
  *
  * @see fll_error_print()
  */
 #ifndef _di_controller_print_error_
-  extern void controller_print_error(const fl_print_t print, const f_status_t status, const f_string_t function, const bool fallback, controller_thread_t *thread) F_attribute_visibility_internal_d;
+  extern void controller_print_error(controller_thread_t * const thread, const fl_print_t print, const f_status_t status, const f_string_t function, const bool fallback) F_attribute_visibility_internal_d;
 #endif // _di_controller_print_error_
 
 /**
  * Print the file error, locking the print mutex during the print.
  *
+ * @param thread
+ *   (optional) The thread data.
+ *   Set to NULL to disable locking on the thread (this should be done only if the lock is already in place).
  * @param print
  *   Designates how printing is to be performed.
  * @param status
@@ -54,14 +57,11 @@ extern "C" {
  *   The operation that fails, such as 'create' or 'access'.
  * @param type
  *   A valid file type code from the fll_error_file_type enum.
- * @param thread
- *   (optional) The thread data.
- *   Set to NULL to disable locking on the thread (this should be done only if the lock is already in place).
  *
  * @see fll_error_file_print()
  */
 #ifndef _di_controller_print_error_file_
-  extern void controller_print_error_file(const fl_print_t print, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t name, const f_string_t operation, const uint8_t type, controller_thread_t *thread) F_attribute_visibility_internal_d;
+  extern void controller_print_error_file(controller_thread_t * const thread, const fl_print_t print, const f_status_t status, const f_string_t function, const bool fallback, const f_string_t name, const f_string_t operation, const uint8_t type) F_attribute_visibility_internal_d;
 #endif // _di_controller_print_error_file_
 
 /**
index 7fe41dd81f649a07ebaa55273f8eac322bc111cd..b7ce5c3db22fd5d891dce2f3f797ac6c2eaaf222 100644 (file)
@@ -919,8 +919,6 @@ extern "C" {
     // If ready was never found in the entry, then default to always ready.
     if (global.setting->ready == controller_setting_ready_no_e) {
       global.setting->ready = controller_setting_ready_yes_e;
-
-      // @todo set socket file if applicable.
     }
 
     return status;
@@ -928,7 +926,7 @@ extern "C" {
 #endif // _di_controller_entry_preprocess_
 
 #ifndef _di_controller_entry_process_
-  f_status_t controller_entry_process(const controller_global_t global, const bool failsafe, const bool is_entry, controller_cache_t * const cache) {
+  f_status_t controller_entry_process(const controller_global_t *global, controller_cache_t * const cache, const bool failsafe, const bool is_entry) {
 
     f_status_t status = F_none;
     f_status_t status_lock = F_none;
@@ -942,7 +940,7 @@ extern "C" {
     uint8_t options_force = 0;
     uint8_t options_process = 0;
 
-    controller_entry_t *entry = is_entry ? &global.setting->entry : &global.setting->exit;
+    controller_entry_t *entry = is_entry ? &global->setting->entry : &global->setting->exit;
     controller_entry_action_t *entry_action = 0;
     controller_entry_actions_t *entry_actions = 0;
     controller_process_t *process = 0;
@@ -961,13 +959,13 @@ extern "C" {
     macro_f_array_lengths_t_increase_by(status, cache->ats, controller_common_allocation_small_d)
 
     if (F_status_is_error(status)) {
-      controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "macro_f_array_lengths_t_increase_by", F_true, global.thread);
+      controller_entry_print_error(is_entry, global->main->error, cache->action, F_status_set_fine(status), "macro_f_array_lengths_t_increase_by", F_true, global->thread);
 
       return status;
     }
 
     // utilize the ats cache as an item execution stack (at_i is for item index, and at_j (at_i + 1) is for action index).
-    cache->ats.array[0] = failsafe ? global.setting->failsafe_item_id : 0;
+    cache->ats.array[0] = failsafe ? global->setting->failsafe_item_id : 0;
     cache->ats.array[1] = 0;
     cache->ats.used = 2;
 
@@ -977,27 +975,33 @@ extern "C" {
     status = controller_dynamic_append_terminated(entry->items.array[cache->ats.array[0]].name, &cache->action.name_item);
 
     if (F_status_is_error(status)) {
-      controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true, global.thread);
+      controller_entry_print_error(is_entry, global->main->error, cache->action, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true, global->thread);
 
       return status;
     }
 
-    if (global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e || global.main->error.verbosity == f_console_verbosity_verbose_e || global.main->error.verbosity == f_console_verbosity_debug_e) {
-      if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
-        controller_lock_print(global.main->output.to, global.thread);
+    if (global->main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e || global->main->error.verbosity == f_console_verbosity_verbose_e || global->main->error.verbosity == f_console_verbosity_debug_e) {
+      if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+        controller_lock_print(global->main->output.to, global->thread);
 
-        fl_print_format("%cProcessing %s%s item '", global.main->output.to.stream, f_string_eol_s[0], failsafe ? "failsafe " : "", is_entry ? controller_entry_s : controller_exit_s);
-        fl_print_format("%[%Q%]'.%c", global.main->output.to.stream, global.main->context.set.notable, cache->action.name_item, global.main->context.set.notable, f_string_eol_s[0]);
+        fl_print_format("%cProcessing %s%s item '", global->main->output.to.stream, f_string_eol_s[0], failsafe ? "failsafe " : "", is_entry ? controller_entry_s : controller_exit_s);
+        fl_print_format("%[%Q%]'.%c", global->main->output.to.stream, global->main->context.set.notable, cache->action.name_item, global->main->context.set.notable, f_string_eol_s[0]);
 
-        controller_unlock_print_flush(global.main->output.to, global.thread);
+        controller_unlock_print_flush(global->main->output.to, global->thread);
       }
     }
 
-    while (controller_thread_is_enabled(is_entry, global.thread)) {
+    // The pre-process determines if ready is explicitly specified within the entry file and if it is not start as ready.
+    if (global->setting->ready == controller_setting_ready_yes_e) {
+      status = controller_perform_ready(global, cache, is_entry);
+      if (F_status_is_error(status)) return status;
+    }
+
+    while (controller_thread_is_enabled(is_entry, global->thread)) {
 
       entry_actions = &entry->items.array[cache->ats.array[at_i]].actions;
 
-      for (; cache->ats.array[at_j] < entry_actions->used && controller_thread_is_enabled(is_entry, global.thread); ++cache->ats.array[at_j]) {
+      for (; cache->ats.array[at_j] < entry_actions->used && controller_thread_is_enabled(is_entry, global->thread); ++cache->ats.array[at_j]) {
 
         entry_action = &entry_actions->array[cache->ats.array[at_j]];
 
@@ -1007,57 +1011,57 @@ extern "C" {
         status = controller_dynamic_append_terminated(controller_entry_action_type_name(entry_action->type), &cache->action.name_action);
 
         if (F_status_is_error(status)) {
-          controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true, global.thread);
+          controller_entry_print_error(is_entry, global->main->error, cache->action, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true, global->thread);
 
           return status;
         }
 
         if (F_status_is_error(entry_action->status)) {
-          if (global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e) {
-            if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
-              controller_lock_print(global.main->output.to, global.thread);
+          if (global->main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e) {
+            if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+              controller_lock_print(global->main->output.to, global->thread);
 
-              fl_print_format("%cThe %s item action '", global.main->output.to.stream, f_string_eol_s[0], is_entry ? controller_entry_s : controller_exit_s);
-              fl_print_format("%[%Q%]", global.main->output.to.stream, global.main->context.set.title, cache->action.name_action, global.main->context.set.title);
+              fl_print_format("%cThe %s item action '", global->main->output.to.stream, f_string_eol_s[0], is_entry ? controller_entry_s : controller_exit_s);
+              fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.title, cache->action.name_action, global->main->context.set.title);
 
               if (entry_action->parameters.used) {
-                fl_print_format(" %[", global.main->output.to.stream, global.main->context.set.notable);
+                fl_print_format(" %[", global->main->output.to.stream, global->main->context.set.notable);
 
-                controller_entry_action_parameters_print(global.main->output.to.stream, *entry_action);
+                controller_entry_action_parameters_print(global->main->output.to.stream, *entry_action);
 
-                fl_print_format("%]", global.main->output.to.stream, global.main->context.set.notable);
+                fl_print_format("%]", global->main->output.to.stream, global->main->context.set.notable);
               }
 
-              fl_print_format("' is %[%s%] and is in a ", global.main->output.to.stream, global.main->context.set.notable, entry_action->code & controller_entry_rule_code_require_d ? "required" : "optional", global.main->context.set.notable);
+              fl_print_format("' is %[%s%] and is in a ", global->main->output.to.stream, global->main->context.set.notable, entry_action->code & controller_entry_rule_code_require_d ? "required" : "optional", global->main->context.set.notable);
 
-              fl_print_format("%[failed%] state, skipping.%c", global.main->output.to.stream, global.main->context.set.notable, global.main->context.set.notable, global.main->context.set.notable, f_string_eol_s[0]);
+              fl_print_format("%[failed%] state, skipping.%c", global->main->output.to.stream, global->main->context.set.notable, global->main->context.set.notable, global->main->context.set.notable, f_string_eol_s[0]);
 
-              controller_unlock_print_flush(global.main->output.to, global.thread);
+              controller_unlock_print_flush(global->main->output.to, global->thread);
             }
           }
           else {
-            if ((entry_action->code & controller_entry_rule_code_require_d) && global.main->error.verbosity != f_console_verbosity_quiet_e || !(entry_action->code & controller_entry_rule_code_require_d) && (global.main->warning.verbosity == f_console_verbosity_verbose_e || global.main->warning.verbosity == f_console_verbosity_debug_e)) {
+            if ((entry_action->code & controller_entry_rule_code_require_d) && global->main->error.verbosity != f_console_verbosity_quiet_e || !(entry_action->code & controller_entry_rule_code_require_d) && (global->main->warning.verbosity == f_console_verbosity_verbose_e || global->main->warning.verbosity == f_console_verbosity_debug_e)) {
               fl_print_t *output = 0;
 
               if (entry_action->code & controller_entry_rule_code_require_d) {
-                output = &global.main->error;
+                output = &global->main->error;
               }
               else {
-                output = &global.main->warning;
+                output = &global->main->warning;
               }
 
-              controller_lock_print(output->to, global.thread);
+              controller_lock_print(output->to, global->thread);
 
               fl_print_format("%c%[%SThe %s item action '%]", output->to.stream, f_string_eol_s[0], output->context, output->prefix ? output->prefix : f_string_empty_s, is_entry ? controller_entry_s : controller_exit_s, output->context);
               fl_print_format("%[%Q%]", output->to.stream, output->notable, cache->action.name_action, output->notable);
 
 
               if (entry_action->parameters.used) {
-                fl_print_format(" %[", output->to.stream, global.main->context.set.notable);
+                fl_print_format(" %[", output->to.stream, global->main->context.set.notable);
 
                 controller_entry_action_parameters_print(output->to.stream, *entry_action);
 
-                fl_print_format("%]", output->to.stream, global.main->context.set.notable);
+                fl_print_format("%]", output->to.stream, global->main->context.set.notable);
               }
 
               if (entry_action->code & controller_entry_rule_code_require_d) {
@@ -1078,7 +1082,7 @@ extern "C" {
 
               controller_entry_print_error_cache(is_entry, *output, cache->action);
 
-              controller_unlock_print_flush(output->to, global.thread);
+              controller_unlock_print_flush(output->to, global->thread);
             }
 
             if (controller_entry_action_type_is_rule(entry_action->type) && entry_action->code & controller_entry_rule_code_require_d) {
@@ -1090,61 +1094,61 @@ extern "C" {
         }
 
         if (entry_action->type == controller_entry_action_type_ready_e) {
-          if ((entry_action->code & controller_entry_rule_code_wait_d) || global.setting->ready == controller_setting_ready_wait_e) {
-            if (global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e || global.main->error.verbosity == f_console_verbosity_verbose_e || global.main->error.verbosity == f_console_verbosity_debug_e || entry->show == controller_entry_show_init_e) {
-              if (global.main->output.verbosity != f_console_verbosity_quiet_e) {
-                controller_lock_print(global.main->output.to, global.thread);
+          if ((entry_action->code & controller_entry_rule_code_wait_d) || global->setting->ready == controller_setting_ready_wait_e) {
+            if (global->main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e || global->main->error.verbosity == f_console_verbosity_verbose_e || global->main->error.verbosity == f_console_verbosity_debug_e || entry->show == controller_entry_show_init_e) {
+              if (global->main->output.verbosity != f_console_verbosity_quiet_e) {
+                controller_lock_print(global->main->output.to, global->thread);
 
-                fl_print_format("%cWaiting before processing %s item action '", global.main->output.to.stream, f_string_eol_s[0], is_entry ? controller_entry_s : controller_exit_s);
-                fl_print_format("%[%s%]", global.main->output.to.stream, global.main->context.set.title, controller_ready_s, global.main->context.set.title);
-                fl_print_format("'.%c", global.main->output.to.stream, f_string_eol_s[0]);
+                fl_print_format("%cWaiting before processing %s item action '", global->main->output.to.stream, f_string_eol_s[0], is_entry ? controller_entry_s : controller_exit_s);
+                fl_print_format("%[%s%]", global->main->output.to.stream, global->main->context.set.title, controller_ready_s, global->main->context.set.title);
+                fl_print_format("'.%c", global->main->output.to.stream, f_string_eol_s[0]);
 
-                controller_unlock_print_flush(global.main->output.to, global.thread);
+                controller_unlock_print_flush(global->main->output.to, global->thread);
               }
             }
 
-            if (global.main->parameters[controller_parameter_validate_e].result == f_console_result_none_e) {
-              status = controller_rule_wait_all(global, is_entry, F_false, process);
+            if (global->main->parameters[controller_parameter_validate_e].result == f_console_result_none_e) {
+              status = controller_rule_wait_all(*global, is_entry, F_false, process);
               if (F_status_is_error(status)) return status;
             }
           }
 
-          if (global.setting->ready == controller_setting_ready_yes_e) {
-            if (global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e || global.main->error.verbosity == f_console_verbosity_verbose_e || global.main->error.verbosity == f_console_verbosity_debug_e) {
-              if (global.main->output.verbosity != f_console_verbosity_quiet_e) {
-                controller_lock_print(global.main->output.to, global.thread);
+          if (global->setting->ready == controller_setting_ready_yes_e) {
+            if (global->main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e || global->main->error.verbosity == f_console_verbosity_verbose_e || global->main->error.verbosity == f_console_verbosity_debug_e) {
+              if (global->main->output.verbosity != f_console_verbosity_quiet_e) {
+                controller_lock_print(global->main->output.to, global->thread);
 
-                fl_print_format("%cIgnoring %s item action '", global.main->output.to.stream, f_string_eol_s[0], is_entry ? controller_entry_s : controller_exit_s);
-                fl_print_format("%[%s%]", global.main->output.to.stream, global.main->context.set.title, controller_ready_s, global.main->context.set.title);
-                fl_print_format("', state already is ready.%c", global.main->output.to.stream, f_string_eol_s[0]);
+                fl_print_format("%cIgnoring %s item action '", global->main->output.to.stream, f_string_eol_s[0], is_entry ? controller_entry_s : controller_exit_s);
+                fl_print_format("%[%s%]", global->main->output.to.stream, global->main->context.set.title, controller_ready_s, global->main->context.set.title);
+                fl_print_format("', state already is ready.%c", global->main->output.to.stream, f_string_eol_s[0]);
 
-                controller_unlock_print_flush(global.main->output.to, global.thread);
+                controller_unlock_print_flush(global->main->output.to, global->thread);
               }
             }
           }
           else {
-            if (!failsafe && (global.main->error.verbosity == f_console_verbosity_verbose_e || entry->show == controller_entry_show_init_e) && global.main->parameters[controller_parameter_simulate_e].result == f_console_result_none_e) {
-              fl_print_format("%cState is now '%[%s%]'.%c", global.main->output.to.stream, f_string_eol_s[0], global.main->context.set.notable, controller_ready_s, global.main->context.set.notable, f_string_eol_s[0]);
+            if (!failsafe && (global->main->error.verbosity == f_console_verbosity_verbose_e || entry->show == controller_entry_show_init_e) && global->main->parameters[controller_parameter_simulate_e].result == f_console_result_none_e) {
+              fl_print_format("%cState is now '%[%s%]'.%c", global->main->output.to.stream, f_string_eol_s[0], global->main->context.set.notable, controller_ready_s, global->main->context.set.notable, f_string_eol_s[0]);
             }
 
-            status = controller_perform_ready(global, is_entry, cache);
+            status = controller_perform_ready(global, cache, is_entry);
             if (F_status_is_error(status)) return status;
           }
         }
         else if (entry_action->type == controller_entry_action_type_item_e) {
-          if (entry_action->number == 0 || entry_action->number >= entry->items.used || failsafe && entry_action->number == global.setting->failsafe_item_id) {
+          if (entry_action->number == 0 || entry_action->number >= entry->items.used || failsafe && entry_action->number == global->setting->failsafe_item_id) {
 
             // This should not happen if the pre-process is working as intended, but in case it doesn't, return a critical error to prevent infinite recursion and similar errors.
-            if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
-              controller_lock_print(global.main->error.to, global.thread);
+            if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+              controller_lock_print(global->main->error.to, global->thread);
 
-              fl_print_format("%c%[Invalid %s item index '%]", global.main->error.to.stream, f_string_eol_s[0], global.main->error.context, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
-              fl_print_format("%[%un%]", global.main->error.to.stream, global.main->error.notable, entry_action->number, global.main->error.notable);
-              fl_print_format("%[' detected.%]%c", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s[0]);
+              fl_print_format("%c%[Invalid %s item index '%]", global->main->error.to.stream, f_string_eol_s[0], global->main->error.context, is_entry ? controller_entry_s : controller_exit_s, global->main->error.context);
+              fl_print_format("%[%un%]", global->main->error.to.stream, global->main->error.notable, entry_action->number, global->main->error.notable);
+              fl_print_format("%[' detected.%]%c", global->main->error.to.stream, global->main->error.context, global->main->error.context, f_string_eol_s[0]);
 
-              controller_entry_print_error_cache(is_entry, global.main->error, cache->action);
+              controller_entry_print_error_cache(is_entry, global->main->error, cache->action);
 
-              controller_unlock_print_flush(global.main->error.to, global.thread);
+              controller_unlock_print_flush(global->main->error.to, global->thread);
             }
 
             return F_status_is_error(F_critical);
@@ -1153,7 +1157,7 @@ extern "C" {
           macro_f_array_lengths_t_increase_by(status, cache->ats, controller_common_allocation_small_d)
 
           if (F_status_is_error(status)) {
-            controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "macro_f_array_lengths_t_increase_by", F_true, global.thread);
+            controller_entry_print_error(is_entry, global->main->error, cache->action, F_status_set_fine(status), "macro_f_array_lengths_t_increase_by", F_true, global->thread);
 
             return status;
           }
@@ -1176,40 +1180,41 @@ extern "C" {
           status = controller_dynamic_append_terminated(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item);
 
           if (F_status_is_error(status)) {
-            controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true, global.thread);
+            controller_entry_print_error(is_entry, global->main->error, cache->action, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true, global->thread);
 
             return status;
           }
 
-          if (global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e || global.main->error.verbosity == f_console_verbosity_verbose_e || global.main->error.verbosity == f_console_verbosity_debug_e) {
-            if (global.main->output.verbosity != f_console_verbosity_quiet_e) {
-              controller_lock_print(global.main->output.to, global.thread);
+          if (global->main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e || global->main->error.verbosity == f_console_verbosity_verbose_e || global->main->error.verbosity == f_console_verbosity_debug_e) {
+            if (global->main->output.verbosity != f_console_verbosity_quiet_e) {
+              controller_lock_print(global->main->output.to, global->thread);
 
-              fl_print_format("%cProcessing %s item '", global.main->output.to.stream, f_string_eol_s[0], is_entry ? controller_entry_s : controller_exit_s);
-              fl_print_format("%[%Q%]", global.main->output.to.stream, global.main->context.set.title, cache->action.name_item, global.main->context.set.title);
-              fl_print_format("'.%c", global.main->output.to.stream, f_string_eol_s[0]);
+              fl_print_format("%cProcessing %s item '", global->main->output.to.stream, f_string_eol_s[0], is_entry ? controller_entry_s : controller_exit_s);
+              fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.title, cache->action.name_item, global->main->context.set.title);
+              fl_print_format("'.%c", global->main->output.to.stream, f_string_eol_s[0]);
 
-              controller_unlock_print_flush(global.main->output.to, global.thread);
+              controller_unlock_print_flush(global->main->output.to, global->thread);
             }
           }
 
-          // exit inner loop to force restarting and start processing the requested item.
+          // Exit inner loop to force restarting and start processing the requested item.
           break;
         }
         else if (entry_action->type == controller_entry_action_type_consider_e || controller_entry_action_type_is_rule(entry_action->type)) {
-          status_lock = controller_lock_write(is_entry, global.thread, &global.thread->lock.rule);
+          status_lock = controller_lock_write(is_entry, global->thread, &global->thread->lock.rule);
 
           if (F_status_is_error(status_lock)) {
-            controller_lock_print_error_critical(global.main->error, F_status_set_fine(status_lock), F_false, global.thread);
+            controller_lock_print_error_critical(global->main->error, F_status_set_fine(status_lock), F_false, global->thread);
+
             break;
           }
 
-          status = controller_rules_increase(&global.setting->rules);
+          status = controller_rules_increase(&global->setting->rules);
 
-          f_thread_unlock(&global.thread->lock.rule);
+          f_thread_unlock(&global->thread->lock.rule);
 
           if (F_status_is_error(status)) {
-            controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_rules_increase", F_true, global.thread);
+            controller_entry_print_error(is_entry, global->main->error, cache->action, F_status_set_fine(status), "controller_rules_increase", F_true, global->thread);
 
             return status;
           }
@@ -1224,48 +1229,49 @@ extern "C" {
           id_rule_name[entry_action->parameters.array[0].used] = f_path_separator_s[0];
           id_rule_name[id_rule_length] = 0;
 
-          status_lock = controller_lock_read(is_entry, global.thread, &global.thread->lock.rule);
+          status_lock = controller_lock_read(is_entry, global->thread, &global->thread->lock.rule);
 
           if (F_status_is_error(status_lock)) {
-            controller_lock_print_error_critical(global.main->error, F_status_set_fine(status_lock), F_true, global.thread);
+            controller_lock_print_error_critical(global->main->error, F_status_set_fine(status_lock), F_true, global->thread);
+
             break;
           }
 
-          status = controller_rule_find(alias_rule, global.setting->rules, 0);
+          status = controller_rule_find(alias_rule, global->setting->rules, 0);
 
-          f_thread_unlock(&global.thread->lock.rule);
+          f_thread_unlock(&global->thread->lock.rule);
 
-          if (global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e || global.main->error.verbosity == f_console_verbosity_verbose_e || global.main->error.verbosity == f_console_verbosity_debug_e || (entry->show == controller_entry_show_init_e && entry_action->type != controller_entry_action_type_consider_e)) {
-            if (global.main->output.verbosity != f_console_verbosity_quiet_e) {
-              controller_lock_print(global.main->output.to, global.thread);
+          if (global->main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e || global->main->error.verbosity == f_console_verbosity_verbose_e || global->main->error.verbosity == f_console_verbosity_debug_e || (entry->show == controller_entry_show_init_e && entry_action->type != controller_entry_action_type_consider_e)) {
+            if (global->main->output.verbosity != f_console_verbosity_quiet_e) {
+              controller_lock_print(global->main->output.to, global->thread);
 
-              fl_print_format("%c%s %s item rule ", global.main->output.to.stream, f_string_eol_s[0], entry_action->type == controller_entry_action_type_consider_e ? "Considering" : "Processing", is_entry ? controller_entry_s : controller_exit_s);
-              fl_print_format("'%[%Q%]'", global.main->output.to.stream, global.main->context.set.title, alias_rule, global.main->context.set.title);
+              fl_print_format("%c%s %s item rule ", global->main->output.to.stream, f_string_eol_s[0], entry_action->type == controller_entry_action_type_consider_e ? "Considering" : "Processing", is_entry ? controller_entry_s : controller_exit_s);
+              fl_print_format("'%[%Q%]'", global->main->output.to.stream, global->main->context.set.title, alias_rule, global->main->context.set.title);
 
-              if (entry->show == controller_entry_show_init_e && global.main->parameters[controller_parameter_simulate_e].result == f_console_result_none_e) {
-                fl_print_format(" [%[%s%]]", global.main->output.to.stream, global.main->context.set.notable, entry_action->code == controller_entry_rule_code_asynchronous_d ? controller_asynchronous_s : controller_synchronous_s, global.main->context.set.notable);
+              if (entry->show == controller_entry_show_init_e && global->main->parameters[controller_parameter_simulate_e].result == f_console_result_none_e) {
+                fl_print_format(" [%[%s%]]", global->main->output.to.stream, global->main->context.set.notable, entry_action->code == controller_entry_rule_code_asynchronous_d ? controller_asynchronous_s : controller_synchronous_s, global->main->context.set.notable);
 
                 if (entry_action->code == controller_entry_rule_code_wait_d) {
-                  fl_print_format(" [%[%s%]]", global.main->output.to.stream, global.main->context.set.notable, controller_wait_s, global.main->context.set.notable);
+                  fl_print_format(" [%[%s%]]", global->main->output.to.stream, global->main->context.set.notable, controller_wait_s, global->main->context.set.notable);
                 }
 
                 if (entry_action->code == controller_entry_rule_code_require_d) {
-                  fl_print_format(" [%[%s%]]", global.main->output.to.stream, global.main->context.set.notable, controller_required_s, global.main->context.set.notable);
+                  fl_print_format(" [%[%s%]]", global->main->output.to.stream, global->main->context.set.notable, controller_required_s, global->main->context.set.notable);
                 }
               }
 
-              fl_print_format(".%c", global.main->output.to.stream, f_string_eol_s[0]);
+              fl_print_format(".%c", global->main->output.to.stream, f_string_eol_s[0]);
 
-              controller_unlock_print_flush(global.main->output.to, global.thread);
+              controller_unlock_print_flush(global->main->output.to, global->thread);
             }
           }
 
-          if (!controller_thread_is_enabled(is_entry, global.thread)) break;
+          if (!controller_thread_is_enabled(is_entry, global->thread)) break;
 
-          // the rule is not yet loaded, ensure that it is loaded.
+          // The rule is not yet loaded, ensure that it is loaded.
           if (status != F_true) {
 
-            // rule execution will re-use the existing cache, so save the current cache.
+            // Rule execution will re-use the existing cache, so save the current cache.
             const f_array_length_t cache_line_action = cache->action.line_action;
             const f_array_length_t cache_line_item = cache->action.line_item;
 
@@ -1281,13 +1287,13 @@ extern "C" {
             memcpy(cache_name_item, cache->action.name_item.string, cache->action.name_item.used);
             memcpy(cache_name_file, cache->action.name_file.string, cache->action.name_file.used);
 
-            status_lock = controller_lock_write(is_entry, global.thread, &global.thread->lock.rule);
+            status_lock = controller_lock_write(is_entry, global->thread, &global->thread->lock.rule);
 
             if (F_status_is_fine(status_lock)) {
-              status = controller_rule_read(global, is_entry, alias_rule, cache, entry, &global.setting->rules.array[global.setting->rules.used]);
+              status = controller_rule_read(*global, is_entry, alias_rule, cache, entry, &global->setting->rules.array[global->setting->rules.used]);
             }
 
-            // restore cache.
+            // Restore cache.
             memcpy(cache->action.name_action.string, cache_name_action, cache_name_action_used);
             memcpy(cache->action.name_item.string, cache_name_item, cache_name_item_used);
             memcpy(cache->action.name_file.string, cache_name_file, cache_name_file_used);
@@ -1304,30 +1310,30 @@ extern "C" {
             cache->action.line_item = cache_line_item;
 
             if (F_status_is_error(status_lock)) {
-              controller_lock_print_error_critical(global.main->error, F_status_set_fine(status_lock), F_false, global.thread);
+              controller_lock_print_error_critical(global->main->error, F_status_set_fine(status_lock), F_false, global->thread);
               break;
             }
 
-            if (F_status_set_fine(status) == F_interrupt || !controller_thread_is_enabled(is_entry, global.thread)) {
-              f_thread_unlock(&global.thread->lock.rule);
+            if (F_status_set_fine(status) == F_interrupt || !controller_thread_is_enabled(is_entry, global->thread)) {
+              f_thread_unlock(&global->thread->lock.rule);
 
               break;
             }
 
             if (F_status_is_error(status)) {
-              if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
-                controller_lock_print(global.main->error.to, global.thread);
+              if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+                controller_lock_print(global->main->error.to, global->thread);
 
-                controller_entry_print_error_cache(is_entry, global.main->error, cache->action);
+                controller_entry_print_error_cache(is_entry, global->main->error, cache->action);
 
-                controller_unlock_print_flush(global.main->error.to, global.thread);
+                controller_unlock_print_flush(global->main->error.to, global->thread);
               }
 
               // Designate the action as failed.
               entry_action->status = F_status_set_error(F_failure);
 
-              if (global.main->parameters[controller_parameter_simulate_e].result == f_console_result_none_e) {
-                f_thread_unlock(&global.thread->lock.rule);
+              if (global->main->parameters[controller_parameter_simulate_e].result == f_console_result_none_e) {
+                f_thread_unlock(&global->thread->lock.rule);
 
                 if (entry_action->code & controller_entry_rule_code_require_d) {
                   return F_status_set_error(F_require);
@@ -1338,17 +1344,17 @@ extern "C" {
               }
             }
             else {
-              ++global.setting->rules.used;
+              ++global->setting->rules.used;
             }
 
-            f_thread_unlock(&global.thread->lock.rule);
+            f_thread_unlock(&global->thread->lock.rule);
           }
 
           if (F_status_is_error_not(status)) {
             options_force = 0;
             options_process = 0;
 
-            if (global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e) {
+            if (global->main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e) {
               options_process |= controller_process_option_simulate_d;
             }
 
@@ -1360,56 +1366,56 @@ extern "C" {
               options_process |= controller_process_option_wait_d;
             }
 
-            if (global.main->parameters[controller_parameter_validate_e].result == f_console_result_found_e) {
+            if (global->main->parameters[controller_parameter_validate_e].result == f_console_result_found_e) {
               options_process |= controller_process_option_validate_d;
             }
 
             if (entry_action->code & controller_entry_rule_code_asynchronous_d) {
-              if (global.main->parameters[controller_parameter_validate_e].result == f_console_result_none_e) {
+              if (global->main->parameters[controller_parameter_validate_e].result == f_console_result_none_e) {
                 options_force |= controller_process_option_asynchronous_d;
               }
 
               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_process_type_entry_e : controller_process_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;
             }
 
-            if (F_status_is_error(status) && global.main->parameters[controller_parameter_simulate_e].result == f_console_result_none_e && (entry_action->code & controller_entry_rule_code_require_d)) {
+            if (F_status_is_error(status) && global->main->parameters[controller_parameter_simulate_e].result == f_console_result_none_e && (entry_action->code & controller_entry_rule_code_require_d)) {
               return F_status_set_error(F_require);
             }
           }
         }
         else if (entry_action->type == controller_entry_action_type_execute_e) {
-          if (global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e || global.main->error.verbosity == f_console_verbosity_verbose_e || global.main->error.verbosity == f_console_verbosity_debug_e || entry->show == controller_entry_show_init_e) {
-            if (global.main->output.verbosity != f_console_verbosity_quiet_e) {
-              controller_lock_print(global.main->output.to, global.thread);
+          if (global->main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e || global->main->error.verbosity == f_console_verbosity_verbose_e || global->main->error.verbosity == f_console_verbosity_debug_e || entry->show == controller_entry_show_init_e) {
+            if (global->main->output.verbosity != f_console_verbosity_quiet_e) {
+              controller_lock_print(global->main->output.to, global->thread);
 
-              fl_print_format("%c%s is executing '", global.main->output.to.stream, f_string_eol_s[0], is_entry ? controller_entry_s : controller_exit_s);
+              fl_print_format("%c%s is executing '", global->main->output.to.stream, f_string_eol_s[0], is_entry ? controller_entry_s : controller_exit_s);
 
               for (f_array_length_t k = 0; k < entry_action->parameters.used; ++k) {
 
-                fl_print_format("%[%Q%]", global.main->output.to.stream, global.main->context.set.title, entry_action->parameters.array[k], global.main->context.set.title);
+                fl_print_format("%[%Q%]", global->main->output.to.stream, global->main->context.set.title, entry_action->parameters.array[k], global->main->context.set.title);
 
                 if (k + 1 < entry_action->parameters.used) {
-                  f_print_character(f_string_space_s[0], global.main->output.to.stream);
+                  f_print_character(f_string_space_s[0], global->main->output.to.stream);
                 }
               } // for
 
-              fl_print_format("'.%c", global.main->output.to.stream, f_string_eol_s[0]);
+              fl_print_format("'.%c", global->main->output.to.stream, f_string_eol_s[0]);
 
-              controller_unlock_print_flush(global.main->output.to, global.thread);
+              controller_unlock_print_flush(global->main->output.to, global->thread);
             }
           }
 
-          if (global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e) {
+          if (global->main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e) {
             return F_execute;
           }
 
-          controller_thread_process_cancel(global, is_entry, is_entry ? controller_thread_cancel_execute_e : controller_thread_cancel_exit_execute_e, process);
+          controller_thread_process_cancel(*global, is_entry, is_entry ? controller_thread_cancel_execute_e : controller_thread_cancel_exit_execute_e, process);
 
           int result = 0;
           int option = FL_execute_parameter_option_path_d;
@@ -1422,35 +1428,35 @@ extern "C" {
 
           if (F_status_is_error(status)) {
             if (F_status_set_fine(status) == F_file_found_not) {
-              if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
-                controller_lock_print(global.main->error.to, global.thread);
+              if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+                controller_lock_print(global->main->error.to, global->thread);
 
-                fl_print_format("%c%[%SExecution failed, unable to find program or script '%]", global.main->error.to.stream, f_string_eol_s[0], global.main->error.context, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, global.main->error.context);
-                fl_print_format("%[%Q%]", global.main->error.to.stream, global.main->error.notable, entry_action->parameters.array[0], global.main->error.notable);
-                fl_print_format("%['.%]%c", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s[0]);
+                fl_print_format("%c%[%SExecution failed, unable to find program or script '%]", global->main->error.to.stream, f_string_eol_s[0], global->main->error.context, global->main->error.prefix ? global->main->error.prefix : f_string_empty_s, global->main->error.context);
+                fl_print_format("%[%Q%]", global->main->error.to.stream, global->main->error.notable, entry_action->parameters.array[0], global->main->error.notable);
+                fl_print_format("%['.%]%c", global->main->error.to.stream, global->main->error.context, global->main->error.context, f_string_eol_s[0]);
 
-                controller_entry_print_error_cache(is_entry, global.main->error, cache->action);
+                controller_entry_print_error_cache(is_entry, global->main->error, cache->action);
 
-                controller_unlock_print_flush(global.main->error.to, global.thread);
+                controller_unlock_print_flush(global->main->error.to, global->thread);
               }
             }
             else {
-              controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "fll_execute_into", F_true, global.thread);
+              controller_entry_print_error(is_entry, global->main->error, cache->action, F_status_set_fine(status), "fll_execute_into", F_true, global->thread);
             }
 
             return F_status_set_error(F_execute);
           }
           else if (result != 0) {
-            if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
-              controller_lock_print(global.main->error.to, global.thread);
+            if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+              controller_lock_print(global->main->error.to, global->thread);
 
-              fl_print_format("%c%[%SExecution failed with return value of '%]", global.main->error.to.stream, f_string_eol_s[0], global.main->error.context, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, global.main->error.context);
-              fl_print_format("%[%i%]", global.main->error.to.stream, global.main->error.notable, result, global.main->error.notable);
-              fl_print_format("$['.%]%c", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s[0]);
+              fl_print_format("%c%[%SExecution failed with return value of '%]", global->main->error.to.stream, f_string_eol_s[0], global->main->error.context, global->main->error.prefix ? global->main->error.prefix : f_string_empty_s, global->main->error.context);
+              fl_print_format("%[%i%]", global->main->error.to.stream, global->main->error.notable, result, global->main->error.notable);
+              fl_print_format("$['.%]%c", global->main->error.to.stream, global->main->error.context, global->main->error.context, f_string_eol_s[0]);
 
-              controller_entry_print_error_cache(is_entry, global.main->error, cache->action);
+              controller_entry_print_error_cache(is_entry, global->main->error, cache->action);
 
-              controller_unlock_print_flush(global.main->error.to, global.thread);
+              controller_unlock_print_flush(global->main->error.to, global->thread);
             }
 
             return F_status_set_error(F_execute);
@@ -1464,55 +1470,55 @@ extern "C" {
           if (entry_action->code == controller_entry_timeout_code_kill_d) {
             entry->timeout_kill = entry_action->number;
 
-            controller_entry_preprocess_print_simulate_setting_value(global, is_entry, controller_timeout_s, controller_kill_s, entry->items.array[global.setting->failsafe_item_id].name, suffix);
+            controller_entry_preprocess_print_simulate_setting_value(*global, is_entry, controller_timeout_s, controller_kill_s, entry->items.array[global->setting->failsafe_item_id].name, suffix);
           }
           else if (entry_action->code == controller_entry_timeout_code_start_d) {
             entry->timeout_start = entry_action->number;
 
-            controller_entry_preprocess_print_simulate_setting_value(global, is_entry, controller_timeout_s, controller_start_s, entry->items.array[global.setting->failsafe_item_id].name, suffix);
+            controller_entry_preprocess_print_simulate_setting_value(*global, is_entry, controller_timeout_s, controller_start_s, entry->items.array[global->setting->failsafe_item_id].name, suffix);
           }
           else if (entry_action->code == controller_entry_timeout_code_stop_d) {
             entry->timeout_stop = entry_action->number;
 
-            controller_entry_preprocess_print_simulate_setting_value(global, is_entry, controller_timeout_s, controller_stop_s, entry->items.array[global.setting->failsafe_item_id].name, suffix);
+            controller_entry_preprocess_print_simulate_setting_value(*global, is_entry, controller_timeout_s, controller_stop_s, entry->items.array[global->setting->failsafe_item_id].name, suffix);
           }
         }
         else if (entry_action->type == controller_entry_action_type_failsafe_e) {
 
           if (failsafe) {
-            if (global.main->warning.verbosity == f_console_verbosity_debug_e) {
-              controller_lock_print(global.main->warning.to, global.thread);
+            if (global->main->warning.verbosity == f_console_verbosity_debug_e) {
+              controller_lock_print(global->main->warning.to, global->thread);
 
-              fl_print_format("%c%[%SFailsafe may not be specified when running in failsafe, ignoring.%]%c", global.main->warning.to.stream, f_string_eol_s[0], global.main->warning.context, global.main->warning.prefix, global.main->warning.context, f_string_eol_s[0]);
+              fl_print_format("%c%[%SFailsafe may not be specified when running in failsafe, ignoring.%]%c", global->main->warning.to.stream, f_string_eol_s[0], global->main->warning.context, global->main->warning.prefix, global->main->warning.context, f_string_eol_s[0]);
 
-              controller_entry_print_error_cache(is_entry, global.main->warning, cache->action);
+              controller_entry_print_error_cache(is_entry, global->main->warning, cache->action);
 
-              controller_unlock_print_flush(global.main->warning.to, global.thread);
+              controller_unlock_print_flush(global->main->warning.to, global->thread);
             }
           }
           else {
             if (entry_action->number == 0 || entry_action->number >= entry->items.used) {
 
               // This should not happen if the pre-process is working as designed, but in case it doesn't, return a critical error to prevent infinite recursion and similar errors.
-              if (global.main->error.verbosity != f_console_verbosity_quiet_e) {
-                controller_lock_print(global.main->error.to, global.thread);
+              if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
+                controller_lock_print(global->main->error.to, global->thread);
 
-                fl_print_format("%c%[%SInvalid %s item index '%]", global.main->error.to.stream, f_string_eol_s[0], global.main->error.context, global.main->error.prefix ? global.main->error.prefix : f_string_empty_s, is_entry ? controller_entry_s : controller_exit_s, global.main->error.context);
-                fl_print_format("%[%un%]", global.main->error.to.stream, global.main->error.notable, entry_action->number, global.main->error.notable);
-                fl_print_format("%[' detected.%]%c", global.main->error.to.stream, global.main->error.context, global.main->error.context, f_string_eol_s[0]);
+                fl_print_format("%c%[%SInvalid %s item index '%]", global->main->error.to.stream, f_string_eol_s[0], global->main->error.context, global->main->error.prefix ? global->main->error.prefix : f_string_empty_s, is_entry ? controller_entry_s : controller_exit_s, global->main->error.context);
+                fl_print_format("%[%un%]", global->main->error.to.stream, global->main->error.notable, entry_action->number, global->main->error.notable);
+                fl_print_format("%[' detected.%]%c", global->main->error.to.stream, global->main->error.context, global->main->error.context, f_string_eol_s[0]);
 
-                controller_entry_print_error_cache(is_entry, global.main->error, cache->action);
+                controller_entry_print_error_cache(is_entry, global->main->error, cache->action);
 
-                controller_unlock_print_flush(global.main->error.to, global.thread);
+                controller_unlock_print_flush(global->main->error.to, global->thread);
               }
 
               return F_status_is_error(F_critical);
             }
             else {
-              global.setting->failsafe_enabled = F_true;
-              global.setting->failsafe_item_id = entry_action->number;
+              global->setting->failsafe_enabled = F_true;
+              global->setting->failsafe_item_id = entry_action->number;
 
-              controller_entry_preprocess_print_simulate_setting_value(global, is_entry, controller_failsafe_s, 0, entry->items.array[global.setting->failsafe_item_id].name, 0);
+              controller_entry_preprocess_print_simulate_setting_value(*global, is_entry, controller_failsafe_s, 0, entry->items.array[global->setting->failsafe_item_id].name, 0);
             }
           }
         }
@@ -1529,10 +1535,10 @@ extern "C" {
         }
       }
 
-      // end of actions found, so drop to previous loop in stack.
+      // End of actions found, so drop to previous loop in stack.
       if (cache->ats.array[at_j] == entry_actions->used) {
 
-        // all actions for "main" are processed so there is nothing left to do.
+        // All actions for "main" are processed so there is nothing left to do.
         if (at_i == 0) break;
 
         at_i -= 2;
@@ -1547,14 +1553,14 @@ extern "C" {
         status = controller_dynamic_append_terminated(entry->items.array[cache->ats.array[at_i]].name, &cache->action.name_item);
 
         if (F_status_is_error(status)) {
-          controller_entry_print_error(is_entry, global.main->error, cache->action, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true, global.thread);
+          controller_entry_print_error(is_entry, global->main->error, cache->action, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true, global->thread);
 
           break;
         }
       }
     } // while
 
-    if (!controller_thread_is_enabled(is_entry, global.thread)) {
+    if (!controller_thread_is_enabled(is_entry, global->thread)) {
       return F_status_set_error(F_interrupt);
     }
 
@@ -1566,9 +1572,9 @@ extern "C" {
       return status_lock;
     }
 
-    // check to see if any required processes failed, but do not do this if already operating in failsafe.
-    if (F_status_is_error_not(status) && !failsafe && global.main->parameters[controller_parameter_validate_e].result == f_console_result_none_e) {
-      const f_status_t status_wait = controller_rule_wait_all(global, is_entry, F_true, 0);
+    // Check to see if any required processes failed, but do not do this if already operating in failsafe.
+    if (F_status_is_error_not(status) && !failsafe && global->main->parameters[controller_parameter_validate_e].result == f_console_result_none_e) {
+      const f_status_t status_wait = controller_rule_wait_all(*global, is_entry, F_true, 0);
 
       if (F_status_is_error(status_wait)) {
         return status_wait;
@@ -1579,19 +1585,19 @@ extern "C" {
       }
     }
 
-    if ((global.main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e && global.main->error.verbosity != f_console_verbosity_quiet_e) || global.main->error.verbosity == f_console_verbosity_verbose_e) {
-      controller_lock_print(global.main->output.to, global.thread);
+    if ((global->main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e && global->main->error.verbosity != f_console_verbosity_quiet_e) || global->main->error.verbosity == f_console_verbosity_verbose_e) {
+      controller_lock_print(global->main->output.to, global->thread);
 
-      fl_print_format("%cDone processing %s item '", global.main->output.to.stream, f_string_eol_s[0], is_entry ? controller_entry_s : controller_exit_s);
-      fl_print_format("%[%s%]", global.main->output.to.stream, global.main->context.set.title, controller_main_s, global.main->context.set.title);
-      fl_print_format("'.%c", global.main->output.to.stream, f_string_eol_s[0]);
+      fl_print_format("%cDone processing %s item '", global->main->output.to.stream, f_string_eol_s[0], is_entry ? controller_entry_s : controller_exit_s);
+      fl_print_format("%[%s%]", global->main->output.to.stream, global->main->context.set.title, controller_main_s, global->main->context.set.title);
+      fl_print_format("'.%c", global->main->output.to.stream, f_string_eol_s[0]);
 
       // failsafe should not print the extra newline because the failure exit from controller_main should handle this.
       if (!failsafe) {
-        f_print_terminated(f_string_eol_s, global.main->output.to.stream);
+        f_print_terminated(f_string_eol_s, global->main->output.to.stream);
       }
 
-      controller_unlock_print_flush(global.main->output.to, global.thread);
+      controller_unlock_print_flush(global->main->output.to, global->thread);
     }
 
     return status;
@@ -1670,7 +1676,7 @@ extern "C" {
         status = fll_fss_basic_list_read(cache->buffer_file, state, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments);
 
         if (F_status_is_error(status)) {
-          controller_print_error(global.main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, global.thread);
+          controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true);
         }
         else {
           status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file);
@@ -1813,7 +1819,7 @@ extern "C" {
           status = controller_dynamic_append_terminated(cache->action.name_item, &entry->items.array[at].name);
 
           if (F_status_is_error(status)) {
-            controller_print_error(global.main->error, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true, global.thread);
+            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true);
 
             break;
           }
@@ -1901,7 +1907,8 @@ extern "C" {
                     status = controller_dynamic_append_terminated(entry->items.array[i].name, &cache->action.name_item);
 
                     if (F_status_is_error(status)) {
-                      controller_print_error(global.main->error, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true, global.thread);
+                      controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true);
+
                       break;
                     }
 
@@ -2012,7 +2019,6 @@ extern "C" {
           continue;
         }
 
-        // @todo swap the generic with the path_control so that this can then be swapped again using canonical.
         cache->action.generic.used = 0;
         global.setting->path_control.used = 0;
 
index 40c701c6f4ef7b40c3919acb84ebc0e95f333619..f457ba574aefec83a7850bf56e9797f7032409d9 100644 (file)
@@ -130,14 +130,14 @@ extern "C" {
  *
  * @param global
  *   The global data.
+ * @param cache
+ *   The main/global cache to use.
  * @param failsafe
  *   If TRUE, operate in failsafe mode (starts at designated failsafe Item).
  *   If FALSE, operate in normal mode (starts at "main" Item).
  * @param is_entry
  *   If TRUE, then this operate as an entry.
  *   If FALSE, then this operate as an exit.
- * @param cache
- *   The main/global cache to use.
  *
  * @return
  *   F_none on success.
@@ -156,7 +156,7 @@ extern "C" {
  * @see controller_dynamic_append_terminated()
  */
 #ifndef _di_controller_entry_process_
-  extern f_status_t controller_entry_process(const controller_global_t global, const bool failsafe, const bool is_entry, controller_cache_t * const cache) F_attribute_visibility_internal_d;
+  extern f_status_t controller_entry_process(const controller_global_t *global, controller_cache_t * const cache, const bool failsafe, const bool is_entry) F_attribute_visibility_internal_d;
 #endif // _di_controller_entry_process_
 
 /**
index 4037eed4b55ceb24103b08dabf248cc6d2a89086..19caf0ed1b996de052ca1f8060fd705e147de297 100644 (file)
@@ -69,7 +69,7 @@ extern "C" {
       status = f_string_dynamics_increase(controller_common_allocation_small_d, parameters);
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true);
 
         return status;
       }
@@ -79,7 +79,7 @@ extern "C" {
       status = f_string_dynamic_partial_append_nulless(buffer, *object, &parameters->array[0]);
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true);
 
         return status;
       }
@@ -87,7 +87,7 @@ extern "C" {
       status = f_string_dynamic_terminate_after(&parameters->array[0]);
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true);
 
         return status;
       }
@@ -104,7 +104,7 @@ extern "C" {
         status = f_string_dynamics_increase(controller_common_allocation_small_d, parameters);
 
         if (F_status_is_error(status)) {
-          controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread);
+          controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true);
 
           return status;
         }
@@ -114,7 +114,7 @@ extern "C" {
         status = f_string_dynamic_partial_append_nulless(buffer, content->array[i], &parameters->array[parameters->used]);
 
         if (F_status_is_error(status)) {
-          controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, global.thread);
+          controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true);
 
           return status;
         }
@@ -122,7 +122,7 @@ extern "C" {
         status = f_string_dynamic_terminate_after(&parameters->array[parameters->used]);
 
         if (F_status_is_error(status)) {
-          controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread);
+          controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true);
 
           return status;
         }
@@ -343,13 +343,13 @@ extern "C" {
       }
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "fl_fss_extended_list_content_read", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_fss_extended_list_content_read", F_true);
       }
       else if (status == F_fss_found_content) {
         status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_item);
 
         if (F_status_is_error(status)) {
-          controller_print_error(global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread);
+          controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true);
         }
         else {
 
@@ -360,7 +360,7 @@ extern "C" {
             status = f_string_dynamics_increase(controller_common_allocation_small_d, &actions->array[actions->used].parameters);
 
             if (F_status_is_error(status)) {
-              controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread);
+              controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true);
             }
             else {
               actions->array[actions->used].type = type;
@@ -371,13 +371,13 @@ extern "C" {
               status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_action.array[0], &actions->array[actions->used].parameters.array[0]);
 
               if (F_status_is_error(status)) {
-                controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true, global.thread);
+                controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true);
               }
 
               status = f_string_dynamic_terminate_after(&actions->array[actions->used].parameters.array[0]);
 
               if (F_status_is_error(status)) {
-                controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread);
+                controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true);
               }
               else {
                 actions->array[actions->used++].parameters.used = 1;
@@ -398,13 +398,13 @@ extern "C" {
           }
 
           if (F_status_is_error(status)) {
-            controller_print_error(global.main->error, F_status_set_fine(status), "fll_fss_extended_read", F_true, global.thread);
+            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fll_fss_extended_read", F_true);
           }
           else {
             status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_item);
 
             if (F_status_is_error(status)) {
-              controller_print_error(global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread);
+              controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true);
             }
             else {
               f_array_length_t i = 0;
@@ -414,7 +414,7 @@ extern "C" {
                 status = controller_rule_actions_increase_by(controller_common_allocation_small_d, actions);
 
                 if (F_status_is_error(status)) {
-                  controller_print_error(global.main->error, F_status_set_fine(status), "controller_rule_actions_increase_by", F_true, global.thread);
+                  controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "controller_rule_actions_increase_by", F_true);
 
                   break;
                 }
@@ -422,7 +422,8 @@ extern "C" {
                 status = f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &actions->array[actions->used].line);
 
                 if (F_status_is_error(status)) {
-                  controller_print_error(global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread);
+                  controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true);
+
                   break;
                 }
 
@@ -434,9 +435,10 @@ extern "C" {
                 status = f_string_dynamics_increase(controller_common_allocation_small_d, &actions->array[actions->used].parameters);
 
                 if (F_status_is_error(status)) {
-                  controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread);
+                  controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true);
 
                   actions->array[actions->used].status = controller_status_simplify_error(F_status_set_fine(status));
+
                   break;
                 }
 
@@ -466,13 +468,13 @@ extern "C" {
       }
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "fll_fss_extended_content_read", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fll_fss_extended_content_read", F_true);
       }
       else if (status == F_fss_found_content) {
         status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_item);
 
         if (F_status_is_error(status)) {
-          controller_print_error(global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread);
+          controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true);
         }
         else if (type == controller_rule_action_type_pid_file_e) {
           item->pid_file.used = 0;
@@ -480,13 +482,13 @@ extern "C" {
           status = fl_string_dynamic_rip(cache->buffer_item, cache->content_action.array[0], &item->pid_file);
 
           if (F_status_is_error(status)) {
-            controller_print_error(global.main->error, F_status_set_fine(status), "fl_string_dynamic_rip", F_true, global.thread);
+            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_string_dynamic_rip", F_true);
           }
           else {
             status = f_string_dynamic_terminate_after(&item->pid_file);
 
             if (F_status_is_error(status)) {
-              controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread);
+              controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true);
             }
           }
         }
@@ -660,7 +662,7 @@ extern "C" {
           status = f_string_dynamics_increase(controller_common_allocation_small_d, &actions->array[actions->used].parameters);
 
           if (F_status_is_error(status)) {
-            controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread);
+            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true);
           }
           else {
 
@@ -677,13 +679,13 @@ extern "C" {
             } // for
 
             if (F_status_is_error(status)) {
-              controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_mash_nulless", F_true, global.thread);
+              controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_mash_nulless", F_true);
             }
             else {
               status = f_string_dynamic_terminate_after(&actions->array[actions->used].parameters.array[0]);
 
               if (F_status_is_error(status)) {
-                controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread);
+                controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true);
               }
               else {
                 actions->array[actions->used++].parameters.used = 1;
@@ -695,7 +697,7 @@ extern "C" {
           status = f_fss_count_lines(cache->buffer_item, range->start, &actions->array[actions->used].line);
 
           if (F_status_is_error(status)) {
-            controller_print_error(global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread);
+            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true);
           }
           else {
             actions->array[actions->used].type = type;
@@ -706,7 +708,7 @@ extern "C" {
             status = controller_rule_parameters_read(global, cache->buffer_item, 0, &cache->content_action, &actions->array[actions->used].parameters);
 
             if (F_status_is_error(status)) {
-              controller_print_error(global.main->error, F_status_set_fine(status), "controller_rule_parameters_read", F_true, global.thread);
+              controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "controller_rule_parameters_read", F_true);
 
               actions->array[actions->used++].status = controller_status_simplify_error(F_status_set_fine(status));
             }
@@ -738,7 +740,7 @@ extern "C" {
 #endif // _di_controller_rule_action_read_
 
 #ifndef _di_controller_rule_action_read_rerun_number_
-  f_status_t controller_rule_action_read_rerun_number(const controller_global_t global, const f_string_t name, controller_cache_t * const cache, f_array_length_t *index, f_number_unsigned_t *number) {
+  f_status_t controller_rule_action_read_rerun_number(const controller_global_t global, const f_string_t name, controller_cache_t * const cache, f_array_length_t * const index, f_number_unsigned_t * const number) {
 
     f_status_t status = F_none;
     f_number_unsigned_t parsed = 0;
@@ -763,7 +765,7 @@ extern "C" {
         status = F_status_set_fine(status);
 
         if (status != F_valid_not && status != F_number && status != F_number_decimal && status != F_number_overflow && status != F_number_underflow && status != F_number_negative) {
-          controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, global.thread);
+          controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true);
         }
         else {
           controller_lock_print(global.main->error.to, global.thread);
@@ -1058,7 +1060,7 @@ extern "C" {
         status = fll_control_group_prepare(process->rule.cgroup);
 
         if (F_status_is_error(status)) {
-          controller_print_error_file(global.main->error, F_status_set_fine(status), "fll_control_group_prepare", F_true, process->rule.cgroup.path.string, "prepare control groups for", fll_error_file_type_directory_e, global.thread);
+          controller_print_error_file(global.thread, global.main->error, F_status_set_fine(status), "fll_control_group_prepare", F_true, process->rule.cgroup.path.string, "prepare control groups for", fll_error_file_type_directory_e);
 
           return status;
         }
@@ -1092,7 +1094,7 @@ extern "C" {
     status = fl_environment_load_names(process->rule.environment, &environment);
 
     if (F_status_is_error(status)) {
-      controller_print_error(global.main->error, F_status_set_fine(status), "fl_environment_load_names", F_true, global.thread);
+      controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_environment_load_names", F_true);
 
       return status;
     }
@@ -1327,7 +1329,7 @@ extern "C" {
     status = controller_pids_increase(&process->childs);
 
     if (F_status_is_error(status)) {
-      controller_print_error(main->error, F_status_set_fine(status), "controller_pids_increase", F_true, thread);
+      controller_print_error(thread, main->error, F_status_set_fine(status), "controller_pids_increase", F_true);
 
       return status;
     }
@@ -1519,7 +1521,7 @@ extern "C" {
         controller_rule_item_print_error_execute(type == controller_rule_item_type_script_e, program ? program : arguments.used ? arguments.array[0].string : f_string_empty_s, status, process);
       }
       else {
-        controller_print_error(main->error, F_status_set_fine(status), "fll_execute_program", F_true, thread);
+        controller_print_error(thread, main->error, F_status_set_fine(status), "fll_execute_program", F_true);
       }
 
       status = F_status_set_error(status);
@@ -1543,7 +1545,7 @@ extern "C" {
     status = controller_pids_increase(&process->childs);
 
     if (F_status_is_error(status)) {
-      controller_print_error(main->error, F_status_set_fine(status), "controller_pids_increase", F_true, thread);
+      controller_print_error(thread, main->error, F_status_set_fine(status), "controller_pids_increase", F_true);
 
       return status;
     }
@@ -1551,7 +1553,7 @@ extern "C" {
     status = f_string_dynamics_increase(controller_common_allocation_small_d, &process->path_pids);
 
     if (F_status_is_error(status)) {
-      controller_print_error(main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true, thread);
+      controller_print_error(thread, main->error, F_status_set_fine(status), "f_string_dynamics_increase", F_true);
 
       return status;
     }
@@ -1586,13 +1588,13 @@ extern "C" {
     status = f_file_exists(pid_file.string);
 
     if (F_status_is_error(status)) {
-      controller_print_error_file(main->error, F_status_set_fine(status), "f_file_exists", F_true, pid_file.string, "find", fll_error_file_type_file_e, thread);
+      controller_print_error_file(thread, main->error, F_status_set_fine(status), "f_file_exists", F_true, pid_file.string, "find", fll_error_file_type_file_e);
 
       return status;
     }
 
     if (status == F_true) {
-      controller_print_error_file(main->error, F_file_found, "f_file_exists", F_true, pid_file.string, "find", fll_error_file_type_file_e, thread);
+      controller_print_error_file(thread, main->error, F_file_found, "f_file_exists", F_true, pid_file.string, "find", fll_error_file_type_file_e);
 
       return F_status_set_error(F_file_found);
     }
@@ -1600,7 +1602,7 @@ extern "C" {
     status = controller_dynamic_append_terminated(pid_file, child_pid_file);
 
     if (F_status_is_error(status)) {
-      controller_print_error(main->error, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true, thread);
+      controller_print_error(thread, main->error, F_status_set_fine(status), "controller_dynamic_append_terminated", F_true);
 
       return status;
     }
@@ -1775,7 +1777,7 @@ extern "C" {
         controller_rule_item_print_error_execute(type == controller_rule_item_type_utility_e, program ? program : arguments.used ? arguments.array[0].string : f_string_empty_s, status, process);
       }
       else {
-        controller_print_error(main->error, F_status_set_fine(status), "fll_execute_program", F_true, thread);
+        controller_print_error(thread, main->error, F_status_set_fine(status), "fll_execute_program", F_true);
       }
 
       return F_status_set_error(status);
@@ -1786,7 +1788,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 *item) {
+  int8_t controller_rule_execute_rerun(const uint8_t action, controller_process_t * const process, controller_rule_item_t * const item) {
 
     const int result = WIFEXITED(process->result) ? WEXITSTATUS(process->result) : 0;
 
@@ -1857,7 +1859,7 @@ extern "C" {
 #endif // _di_controller_rule_execute_rerun_
 
 #ifndef _di_controller_rule_id_construct_
-  f_status_t controller_rule_id_construct(const controller_global_t global, const f_string_static_t source, const f_string_range_t directory, const f_string_range_t basename, f_string_dynamic_t *alias) {
+  f_status_t controller_rule_id_construct(const controller_global_t global, const f_string_static_t source, const f_string_range_t directory, const f_string_range_t basename, f_string_dynamic_t * const alias) {
 
     f_status_t status = F_none;
 
@@ -1866,7 +1868,7 @@ extern "C" {
     status = f_string_dynamic_partial_append_nulless(source, directory, alias);
 
     if (F_status_is_error(status)) {
-      controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, global.thread);
+      controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true);
 
       return status;
     }
@@ -1874,7 +1876,7 @@ extern "C" {
     status = f_string_append(f_path_separator_s, F_path_separator_s_length, alias);
 
     if (F_status_is_error(status)) {
-      controller_print_error(global.main->error, F_status_set_fine(status), "f_string_append", F_true, global.thread);
+      controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_append", F_true);
 
       return status;
     }
@@ -1882,7 +1884,7 @@ extern "C" {
     status = f_string_dynamic_partial_append_nulless(source, basename, alias);
 
     if (F_status_is_error(status)) {
-      controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, global.thread);
+      controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true);
 
       return status;
     }
@@ -1890,7 +1892,7 @@ extern "C" {
     status = f_string_dynamic_terminate_after(alias);
 
     if (F_status_is_error(status)) {
-      controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread);
+      controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true);
     }
 
     return status;
@@ -1912,7 +1914,7 @@ extern "C" {
 #endif // _di_controller_rule_status_is_error_
 
 #ifndef _di_controller_rule_item_read_
-  f_status_t controller_rule_item_read(const controller_global_t global, const bool is_normal, controller_cache_t * const cache, controller_rule_item_t *item) {
+  f_status_t controller_rule_item_read(const controller_global_t global, const bool is_normal, controller_cache_t * const cache, controller_rule_item_t * const item) {
 
     f_status_t status = F_none;
     controller_state_interrupt_t custom = macro_controller_state_interrupt_t_initialize(is_normal, global.thread);
@@ -1931,7 +1933,7 @@ extern "C" {
       status = fl_fss_extended_list_object_read(cache->buffer_item, state, &range, &cache->range_action, &cache->delimits);
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "fl_fss_extended_list_object_read", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_fss_extended_list_object_read", F_true);
 
         break;
       }
@@ -1948,7 +1950,7 @@ extern "C" {
         status = fl_fss_extended_object_read(cache->buffer_item, state, &range, &cache->range_action, 0, &cache->delimits);
 
         if (F_status_is_error(status)) {
-          controller_print_error(global.main->error, F_status_set_fine(status), "fl_fss_extended_object_read", F_true, global.thread);
+          controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_fss_extended_object_read", F_true);
 
           break;
         }
@@ -1961,14 +1963,16 @@ extern "C" {
       status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_item);
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true);
+
         break;
       }
 
       status = f_fss_count_lines(cache->buffer_item, cache->range_action.start, &cache->action.line_action);
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true);
+
         break;
       }
 
@@ -1978,7 +1982,8 @@ extern "C" {
       status = controller_dynamic_rip_nulless_terminated(cache->buffer_item, cache->range_action, &cache->action.name_action);
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "controller_dynamic_rip_nulless_terminated", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "controller_dynamic_rip_nulless_terminated", F_true);
+
         break;
       }
 
@@ -2066,7 +2071,8 @@ extern "C" {
       status = controller_rule_actions_increase_by(controller_common_allocation_small_d, &item->actions);
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "controller_rule_actions_increase_by", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "controller_rule_actions_increase_by", F_true);
+
         break;
       }
 
@@ -2117,7 +2123,7 @@ extern "C" {
 #endif // _di_controller_rule_item_type_name_
 
 #ifndef _di_controller_rule_items_increase_by_
-  f_status_t controller_rule_items_increase_by(const f_array_length_t amount, controller_rule_items_t *items) {
+  f_status_t controller_rule_items_increase_by(const f_array_length_t amount, controller_rule_items_t * const items) {
 
     if (items->used + amount > items->size) {
       if (items->used + amount > F_array_length_t_size_d) {
@@ -2275,7 +2281,7 @@ extern "C" {
     }
 
     if (F_status_is_error(status)) {
-      controller_rule_print_error(global.main->error, process->cache.action, F_status_set_fine(status), "f_string_append", F_true, F_true, global.thread);
+      controller_rule_print_error(global.thread, global.main->error, process->cache.action, F_status_set_fine(status), "f_string_append", F_true, F_true);
 
       return status;
     }
@@ -2283,7 +2289,7 @@ extern "C" {
     status = f_string_dynamic_append(process->rule.alias, &process->cache.action.name_file);
 
     if (F_status_is_error(status)) {
-      controller_rule_print_error(global.main->error, process->cache.action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_true, global.thread);
+      controller_rule_print_error(global.thread, global.main->error, process->cache.action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_true);
 
       return status;
     }
@@ -2295,7 +2301,7 @@ extern "C" {
     }
 
     if (F_status_is_error(status)) {
-      controller_rule_print_error(global.main->error, process->cache.action, F_status_set_fine(status), "f_string_append", F_true, F_true, global.thread);
+      controller_rule_print_error(global.thread, global.main->error, process->cache.action, F_status_set_fine(status), "f_string_append", F_true, F_true);
 
       return status;
     }
@@ -2303,7 +2309,7 @@ extern "C" {
     status = f_string_dynamic_terminate_after(&process->cache.action.name_file);
 
     if (F_status_is_error(status)) {
-      controller_rule_print_error(global.main->error, process->cache.action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_true, global.thread);
+      controller_rule_print_error(global.thread, global.main->error, process->cache.action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_true);
 
       return status;
     }
@@ -2715,7 +2721,7 @@ extern "C" {
         }
 
         if (F_status_is_error(status)) {
-          controller_rule_item_print_error(global.main->error, process->cache.action, F_true, F_status_set_fine(status), global.thread);
+          controller_rule_item_print_error(global.thread, global.main->error, process->cache.action, F_true, F_status_set_fine(status));
         }
       }
     }
@@ -2847,7 +2853,7 @@ extern "C" {
 
       if (F_status_is_error(status)) {
         controller_lock_print_error_critical(global.main->error, F_status_set_fine(status), F_true, global.thread);
-        controller_rule_item_print_error(global.main->error, cache.action, F_false, F_status_set_fine(status), global.thread);
+        controller_rule_item_print_error(global.thread, global.main->error, cache.action, F_false, F_status_set_fine(status));
 
         f_thread_unlock(&global.thread->lock.process);
 
@@ -2939,7 +2945,7 @@ extern "C" {
       }
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "f_type_array_lengths_resize", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_type_array_lengths_resize", F_true);
       }
       else {
         for (f_array_length_t i = 0; i < stack.used; ++i) {
@@ -2961,7 +2967,7 @@ extern "C" {
         status = f_string_dynamic_append(cache.action.name_item, &process->cache.action.name_item);
       }
       else {
-        controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_append", F_true);
       }
     }
 
@@ -2977,7 +2983,7 @@ extern "C" {
         }
 
         if (F_status_is_error(status)) {
-          controller_print_error(global.main->error, F_status_set_fine(status), "f_thread_create", F_true, global.thread);
+          controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_thread_create", F_true);
         }
       }
       else {
@@ -3118,7 +3124,7 @@ extern "C" {
       f_thread_unlock(&global.thread->lock.rule);
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "controller_rule_copy", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "controller_rule_copy", F_true);
       }
       else if (!process->action) {
 
@@ -3168,7 +3174,7 @@ extern "C" {
           status = f_type_array_lengths_increase(controller_common_allocation_small_d, &process->stack);
 
           if (F_status_is_error(status)) {
-            controller_print_error(global.main->error, F_status_set_fine(status), "f_type_array_lengths_increase", F_true, global.thread);
+            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_type_array_lengths_increase", F_true);
           }
           else {
             f_thread_unlock(&process->lock);
@@ -3399,13 +3405,13 @@ extern "C" {
     status = f_string_dynamic_append_nulless(alias, &rule->alias);
 
     if (F_status_is_error(status)) {
-      controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true, global.thread);
+      controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true);
     }
     else {
       status = f_string_dynamic_terminate_after(&rule->alias);
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true);
       }
       else {
         status = controller_file_load(global, F_true, controller_rules_s, rule->alias, controller_rule_s, controller_rules_s_length, controller_rule_s_length, cache);
@@ -3423,13 +3429,13 @@ extern "C" {
         status = fll_fss_basic_list_read(cache->buffer_file, state, &range, &cache->object_items, &cache->content_items, &cache->delimits, 0, &cache->comments);
 
         if (F_status_is_error(status)) {
-          controller_print_error(global.main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true, global.thread);
+          controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fll_fss_basic_list_read", F_true);
         }
         else {
           status = fl_fss_apply_delimit(cache->delimits, &cache->buffer_file);
 
           if (F_status_is_error(status)) {
-            controller_print_error(global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true, global.thread);
+            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "fl_fss_apply_delimit", F_true);
           }
         }
       }
@@ -3439,7 +3445,7 @@ extern "C" {
       status = controller_rule_items_increase_by(cache->object_items.used, &rule->items);
 
       if (F_status_is_error(status)) {
-        controller_print_error(global.main->error, F_status_set_fine(status), "controller_rule_items_increase_by", F_true, global.thread);
+        controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "controller_rule_items_increase_by", F_true);
       }
       else {
         f_array_length_t i = 0;
@@ -3476,7 +3482,8 @@ extern "C" {
           status = f_fss_count_lines(cache->buffer_file, cache->object_items.array[i].start, &cache->action.line_item);
 
           if (F_status_is_error(status)) {
-            controller_print_error(global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true, global.thread);
+            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_fss_count_lines", F_true);
+
             break;
           }
 
@@ -3485,7 +3492,8 @@ extern "C" {
           status = controller_dynamic_rip_nulless_terminated(cache->buffer_file, cache->object_items.array[i], &cache->action.name_item);
 
           if (F_status_is_error(status)) {
-            controller_print_error(global.main->error, F_status_set_fine(status), "controller_dynamic_rip_nulless_terminated", F_true, global.thread);
+            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "controller_dynamic_rip_nulless_terminated", F_true);
+
             break;
           }
 
@@ -3523,14 +3531,16 @@ extern "C" {
           status = f_string_dynamic_partial_append(cache->buffer_file, cache->content_items.array[i].array[0], &cache->buffer_item);
 
           if (F_status_is_error(status)) {
-            controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append", F_true, global.thread);
+            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_partial_append", F_true);
+
             break;
           }
 
           status = f_string_dynamic_terminate_after(&cache->buffer_item);
 
           if (F_status_is_error(status)) {
-            controller_print_error(global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, global.thread);
+            controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true);
+
             break;
           }
 
@@ -3567,7 +3577,7 @@ extern "C" {
     }
 
     if (F_status_is_error(status)) {
-      controller_rule_item_print_error(global.main->error, cache->action, for_item, F_status_set_fine(status), global.thread);
+      controller_rule_item_print_error(global.thread, global.main->error, cache->action, for_item, F_status_set_fine(status));
 
       rule->status[0] = controller_status_simplify_error(F_status_set_fine(status));
 
@@ -3595,7 +3605,7 @@ extern "C" {
     }
 
     if (F_status_is_error(status)) {
-      controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, F_false, global.thread);
+      controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "fll_fss_extended_read", F_true, F_false);
 
       return status;
     }
@@ -3631,13 +3641,13 @@ extern "C" {
       status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->object_actions.array[i], &cache->action.name_item);
 
       if (F_status_is_error(status)) {
-        controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread);
+        controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
       }
       else {
         status = f_string_dynamic_terminate_after(&cache->action.name_item);
 
         if (F_status_is_error(status)) {
-          controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, global.thread);
+          controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false);
         }
       }
 
@@ -3657,7 +3667,7 @@ extern "C" {
 
         cache->action.line_action = ++cache->action.line_item;
 
-        controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+        controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
         continue;
       }
@@ -3743,13 +3753,13 @@ extern "C" {
         status = f_string_dynamic_partial_append_nulless(cache->buffer_item, range2, &cache->action.name_action);
 
         if (F_status_is_error(status)) {
-          controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread);
+          controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
         }
         else {
           status = f_string_dynamic_terminate_after(&cache->action.name_action);
 
           if (F_status_is_error(status)) {
-            controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, global.thread);
+            controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false);
           }
         }
 
@@ -3761,7 +3771,7 @@ extern "C" {
 
           cache->action.line_action = ++cache->action.line_item;
 
-          controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+          controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
           if (F_status_set_fine(status) == F_memory_not) {
             status_return = status;
@@ -3836,7 +3846,7 @@ extern "C" {
           }
 
           if (F_status_is_error(status)) {
-            controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "macro_f_int32s_t_resize", F_true, F_false, global.thread);
+            controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "macro_f_int32s_t_resize", F_true, F_false);
             break;
           }
 
@@ -3872,7 +3882,7 @@ extern "C" {
               }
             }
             else {
-              controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_signed", F_true, F_false, global.thread);
+              controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_signed", F_true, F_false);
 
               status = F_status_set_error(status);
 
@@ -3913,7 +3923,7 @@ extern "C" {
         status = f_string_maps_increase(controller_common_allocation_small_d, setting_maps);
 
         if (F_status_is_error(status)) {
-          controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_maps_increase", F_true, F_false, global.thread);
+          controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_maps_increase", F_true, F_false);
 
           if (F_status_set_fine(status) == F_memory_not) {
             status_return = status;
@@ -3930,7 +3940,7 @@ extern "C" {
 
           cache->action.line_action = ++cache->action.line_item;
 
-          controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+          controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
           continue;
         }
@@ -3941,7 +3951,7 @@ extern "C" {
         status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], &setting_maps->array[setting_maps->used].name);
 
         if (F_status_is_error(status)) {
-          controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread);
+          controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
 
           if (F_status_set_fine(status) == F_memory_not) {
             status_return = status;
@@ -3958,7 +3968,7 @@ extern "C" {
 
           cache->action.line_action = ++cache->action.line_item;
 
-          controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+          controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
           continue;
         }
@@ -3966,19 +3976,20 @@ extern "C" {
         status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[1], &setting_maps->array[setting_maps->used].value);
 
         if (F_status_is_error(status)) {
-          controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread);
+          controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
         }
         else {
           status = f_string_dynamic_terminate_after(&setting_maps->array[setting_maps->used].value);
 
           if (F_status_is_error(status)) {
-            controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, global.thread);
+            controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false);
           }
         }
 
         if (F_status_is_error(status)) {
           if (F_status_set_fine(status) == F_memory_not) {
             status_return = status;
+
             break;
           }
 
@@ -3992,7 +4003,7 @@ extern "C" {
 
           cache->action.line_action = ++cache->action.line_item;
 
-          controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+          controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
           continue;
         }
@@ -4036,7 +4047,7 @@ extern "C" {
         status = f_string_dynamic_append(global.setting->path_cgroup, &rule->cgroup.path);
 
         if (F_status_is_error(status)) {
-          controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_false, global.thread);
+          controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_append", F_true, F_false);
         }
         else {
           rule->cgroup.groups.used = 0;
@@ -4046,7 +4057,7 @@ extern "C" {
             status = f_string_dynamics_increase(controller_common_allocation_small_d, &rule->cgroup.groups);
 
             if (F_status_is_error(status)) {
-              controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase", F_true, F_false, global.thread);
+              controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase", F_true, F_false);
               break;
             }
 
@@ -4055,7 +4066,7 @@ extern "C" {
             status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[j], &rule->cgroup.groups.array[rule->cgroup.groups.used]);
 
             if (F_status_is_error(status)) {
-              controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread);
+              controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
               break;
             }
 
@@ -4081,7 +4092,7 @@ extern "C" {
 
           cache->action.line_action = ++cache->action.line_item;
 
-          controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+          controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
           continue;
         }
@@ -4212,7 +4223,7 @@ extern "C" {
         macro_f_limit_sets_t_increase(status, controller_common_allocation_small_d, rule->limits);
 
         if (F_status_is_error(status)) {
-          controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_limit_sets_increase", F_true, F_false, global.thread);
+          controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_limit_sets_increase", F_true, F_false);
 
           if (F_status_set_fine(status) == F_memory_not) {
             status_return = status;
@@ -4229,7 +4240,7 @@ extern "C" {
 
           cache->action.line_action = ++cache->action.line_item;
 
-          controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+          controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
           continue;
         }
@@ -4270,7 +4281,7 @@ extern "C" {
               }
             }
             else {
-              controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_signed", F_true, F_false, global.thread);
+              controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "fl_conversion_string_to_number_signed", F_true, F_false);
 
               status = F_status_set_error(status);
 
@@ -4342,7 +4353,7 @@ extern "C" {
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+            controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
             continue;
           }
@@ -4379,13 +4390,13 @@ extern "C" {
             else {
 
               // this function should only return F_complete_not_utf on error.
-              controller_rule_print_error(global.main->error, cache->action, F_complete_not_utf, "controller_validate_has_graph", F_true, F_false, global.thread);
+              controller_rule_print_error(global.thread, global.main->error, cache->action, F_complete_not_utf, "controller_validate_has_graph", F_true, F_false);
 
               if (F_status_is_error_not(status_return)) {
                 status_return = status;
               }
 
-              controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+              controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
             }
 
             setting_value->used = 0;
@@ -4399,13 +4410,13 @@ extern "C" {
           status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[0], setting_value);
 
           if (F_status_is_error(status)) {
-            controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread);
+            controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
           }
           else {
             status = f_string_dynamic_terminate_after(setting_value);
 
             if (F_status_is_error(status)) {
-              controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, global.thread);
+              controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false);
             }
           }
 
@@ -4427,7 +4438,7 @@ extern "C" {
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+            controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
             continue;
           }
@@ -4539,7 +4550,7 @@ extern "C" {
               }
             }
             else {
-              controller_rule_print_error(global.main->error, cache->action, status, "fl_conversion_string_to_number_signed", F_true, F_false, global.thread);
+              controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_string_to_number_signed", F_true, F_false);
               status = F_status_set_error(status);
 
               if (F_status_is_error_not(status_return)) {
@@ -4639,7 +4650,7 @@ extern "C" {
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_rule_print_error(global.main->error, cache->action, status, "fl_conversion_string_to_number_signed", F_true, F_false, global.thread);
+            controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_string_to_number_signed", F_true, F_false);
           }
 
           if (F_status_is_error_not(status_return)) {
@@ -4672,7 +4683,8 @@ extern "C" {
             status = controller_dynamic_rip_nulless_terminated(cache->buffer_item, cache->content_actions.array[i].array[1], &cache->action.generic);
 
             if (F_status_is_error(status)) {
-              controller_print_error(global.main->error, F_status_set_fine(status), "controller_dynamic_rip_nulless_terminated", F_true, global.thread);
+              controller_print_error(global.thread, global.main->error, F_status_set_fine(status), "controller_dynamic_rip_nulless_terminated", F_true);
+
               break;
             }
 
@@ -4709,7 +4721,7 @@ extern "C" {
 
             controller_lock_print(global.main->error.to, global.thread);
 
-            controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread);
+            controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
 
             controller_rule_print_error_cache(global.main->error, cache->action, F_false);
 
@@ -4737,7 +4749,7 @@ extern "C" {
 
             controller_lock_print(global.main->error.to, global.thread);
 
-            controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, global.thread);
+            controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false);
 
             controller_rule_print_error_cache(global.main->error, cache->action, F_false);
 
@@ -4766,7 +4778,7 @@ extern "C" {
 
               controller_lock_print(global.main->error.to, global.thread);
 
-              controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_capability_from_text", F_true, F_false, global.thread);
+              controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_capability_from_text", F_true, F_false);
 
               controller_rule_print_error_cache(global.main->error, cache->action, F_false);
 
@@ -4833,7 +4845,7 @@ extern "C" {
               }
             }
             else {
-              controller_rule_print_error(global.main->error, cache->action, status, "fl_conversion_string_to_number_signed", F_true, F_false, global.thread);
+              controller_rule_print_error(global.thread, global.main->error, cache->action, status, "fl_conversion_string_to_number_signed", F_true, F_false);
               status = F_status_set_error(status);
 
               if (F_status_is_error_not(status_return)) {
@@ -4864,7 +4876,7 @@ extern "C" {
 
                 controller_lock_print(global.main->error.to, global.thread);
 
-                controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), cache->action.generic.used ? "f_string_dynamic_partial_append_nulless" : "f_string_dynamic_terminate_after", F_true, F_false, global.thread);
+                controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), cache->action.generic.used ? "f_string_dynamic_partial_append_nulless" : "f_string_dynamic_terminate_after", F_true, F_false);
 
                 controller_rule_print_error_cache(global.main->error, cache->action, F_false);
 
@@ -4911,9 +4923,9 @@ extern "C" {
 
               cache->action.line_action = ++cache->action.line_item;
 
-              controller_rule_print_error(global.main->error, cache->action, status, "controller_get_id_user", F_true, F_false, global.thread);
+              controller_rule_print_error(global.thread, global.main->error, cache->action, status, "controller_get_id_user", F_true, F_false);
 
-              controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+              controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
             }
 
             if (F_status_is_error_not(status_return)) {
@@ -4961,7 +4973,7 @@ extern "C" {
           macro_f_int32s_t_increase_by(status, rule->groups, controller_common_allocation_small_d)
 
           if (F_status_is_error(status)) {
-            controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "macro_f_array_lengths_t_increase_by", F_true, F_false, global.thread);
+            controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "macro_f_array_lengths_t_increase_by", F_true, F_false);
 
             if (F_status_set_fine(status) == F_memory_not) {
               status_return = status;
@@ -4978,7 +4990,7 @@ extern "C" {
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+            controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
             continue;
           }
@@ -5005,9 +5017,9 @@ extern "C" {
 
               cache->action.line_action = ++cache->action.line_item;
 
-              controller_rule_print_error(global.main->error, cache->action, status, "f_account_id_group_by_name", F_true, F_false, global.thread);
+              controller_rule_print_error(global.thread, global.main->error, cache->action, status, "f_account_id_group_by_name", F_true, F_false);
 
-              controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+              controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
             }
 
             if (F_status_is_error_not(status_return)) {
@@ -5038,7 +5050,7 @@ extern "C" {
           status = f_string_dynamics_increase(controller_common_allocation_small_d, setting_values);
 
           if (F_status_is_error(status)) {
-            controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase", F_true, F_false, global.thread);
+            controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase", F_true, F_false);
 
             if (F_status_set_fine(status) == F_memory_not) {
               status_return = status;
@@ -5055,7 +5067,7 @@ extern "C" {
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+            controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
             continue;
           }
@@ -5065,13 +5077,13 @@ extern "C" {
           status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_actions.array[i].array[j], &setting_values->array[setting_values->used]);
 
           if (F_status_is_error(status)) {
-            controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false, global.thread);
+            controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_partial_append_nulless", F_true, F_false);
           }
           else {
             status = f_string_dynamic_terminate_after(&setting_values->array[setting_values->used]);
 
             if (F_status_is_error(status)) {
-              controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false, global.thread);
+              controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamic_terminate_after", F_true, F_false);
             }
           }
 
@@ -5093,7 +5105,7 @@ extern "C" {
 
             cache->action.line_action = ++cache->action.line_item;
 
-            controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+            controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
             continue;
           }
@@ -5128,7 +5140,7 @@ extern "C" {
             else {
 
               // This function should only return F_complete_not_utf on error.
-              controller_rule_print_error(global.main->error, cache->action, F_complete_not_utf, "controller_validate_environment_name", F_true, F_false, global.thread);
+              controller_rule_print_error(global.thread, global.main->error, cache->action, F_complete_not_utf, "controller_validate_environment_name", F_true, F_false);
 
               if (F_status_is_error_not(status_return)) {
                 status_return = status;
@@ -5137,7 +5149,7 @@ extern "C" {
 
             setting_values->array[setting_values->used].used = 0;
 
-            controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+            controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
             continue;
           }
@@ -5240,7 +5252,7 @@ extern "C" {
       }
 
       if (F_status_is_error(status)) {
-        controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "controller_rule_ons_increase", F_true, F_false, global.thread);
+        controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "controller_rule_ons_increase", F_true, F_false);
       }
       else {
         if (fl_string_dynamic_partial_compare_string(controller_need_s, cache->buffer_item, controller_need_s_length, cache->content_actions.array[i].array[1]) == F_equal_to) {
@@ -5282,7 +5294,7 @@ extern "C" {
         status = f_string_dynamics_increase_by(controller_common_allocation_small_d, setting_values);
 
         if (F_status_is_error(status)) {
-          controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true, F_false, global.thread);
+          controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_string_dynamics_increase_by", F_true, F_false);
         }
       }
 
@@ -5302,7 +5314,7 @@ extern "C" {
 
         cache->action.line_action = ++cache->action.line_item;
 
-        controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+        controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
         continue;
       }
@@ -5327,7 +5339,7 @@ extern "C" {
 
         cache->action.line_action = ++cache->action.line_item;
 
-        controller_rule_item_print_error(global.main->error, cache->action, F_false, F_status_set_fine(status), global.thread);
+        controller_rule_item_print_error(global.thread, global.main->error, cache->action, F_false, F_status_set_fine(status));
 
         continue;
       }
@@ -5339,7 +5351,7 @@ extern "C" {
       if (F_status_is_error(status)) {
         setting_values->array[setting_values->used].used = 0;
 
-        controller_rule_print_error(global.main->error, cache->action, F_status_set_fine(status), "f_file_name_base", F_true, F_false, global.thread);
+        controller_rule_print_error(global.thread, global.main->error, cache->action, F_status_set_fine(status), "f_file_name_base", F_true, F_false);
 
         if (F_status_set_fine(status) == F_memory_not) {
           status_return = status;
index 379d552094a076a3cdff328ab90318350db9a150..a5f19a938176209b2f6c79440ff9abf798288081 100644 (file)
@@ -332,7 +332,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 *item) F_attribute_visibility_internal_d;
+  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;
 #endif // _di_controller_rule_execute_rerun_
 
 /**
@@ -360,7 +360,7 @@ extern "C" {
  * @see f_string_dynamic_terminate_after()
  */
 #ifndef _di_controller_rule_id_construct_
-  extern f_status_t controller_rule_id_construct(const controller_global_t global, const f_string_static_t source, const f_string_range_t directory, const f_string_range_t basename, f_string_dynamic_t *alias) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_id_construct(const controller_global_t global, const f_string_static_t source, const f_string_range_t directory, const f_string_range_t basename, f_string_dynamic_t * const alias) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_id_construct_
 
 /**
@@ -428,7 +428,7 @@ extern "C" {
  * @see f_string_dynamic_terminate_after()
  */
 #ifndef _di_controller_rule_item_read_
-  extern f_status_t controller_rule_item_read(const controller_global_t global, const bool is_normal, controller_cache_t * const cache, controller_rule_item_t *item) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_item_read(const controller_global_t global, const bool is_normal, controller_cache_t * const cache, controller_rule_item_t * const item) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_item_read_
 
 /**
@@ -464,7 +464,7 @@ extern "C" {
  * @see f_memory_resize()
  */
 #ifndef _di_controller_rule_items_increase_by_
-  extern f_status_t controller_rule_items_increase_by(const f_array_length_t amount, controller_rule_items_t *items) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_items_increase_by(const f_array_length_t amount, controller_rule_items_t * const items) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_items_increase_by_
 
 /**
@@ -661,7 +661,7 @@ extern "C" {
  * @see fl_conversion_string_to_number_signed()
  */
 #ifndef _di_controller_rule_action_read_rerun_number_
-  extern f_status_t controller_rule_action_read_rerun_number(const controller_global_t global, const f_string_t name, controller_cache_t * const cache, f_array_length_t *index, f_number_unsigned_t *number) F_attribute_visibility_internal_d;
+  extern f_status_t controller_rule_action_read_rerun_number(const controller_global_t global, const f_string_t name, controller_cache_t * const cache, f_array_length_t * const index, f_number_unsigned_t * const number) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_action_read_rerun_number_
 
 /**
@@ -704,7 +704,7 @@ extern "C" {
  * @see fll_path_canonical()
  */
 #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_setting_t setting, controller_cache_t * const cache, controller_rule_t * const rule) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_setting_read_
 
 /**
index 2155a64f4655af8da40aac2c0a86b4ad1e42e1c5..5d491ef6067f577474605be697c715284cde5b46 100644 (file)
@@ -8,7 +8,7 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_rule_print_error_
-  void controller_rule_print_error(const fl_print_t print, const controller_cache_action_t cache, const f_status_t status, const f_string_t function, const bool fallback, const bool item, controller_thread_t *thread) {
+  void controller_rule_print_error(controller_thread_t * const thread, const fl_print_t print, const controller_cache_action_t cache, const f_status_t status, const f_string_t function, const bool fallback, const bool item) {
 
     if (print.verbosity == f_console_verbosity_quiet_e) return;
     if (status == F_interrupt) return;
@@ -58,7 +58,7 @@ extern "C" {
 #endif // _di_controller_rule_print_error_cache_
 
 #ifndef _di_controller_rule_item_print_error_
-  void controller_rule_item_print_error(const fl_print_t print, const controller_cache_action_t cache, const bool item, const f_status_t status, controller_thread_t *thread) {
+  void controller_rule_item_print_error(controller_thread_t * const thread, const fl_print_t print, const controller_cache_action_t cache, const bool item, const f_status_t status) {
 
     if (print.verbosity == f_console_verbosity_quiet_e) return;
     if (status == F_interrupt) return;
index 69227724dedf17e268ec54c01e13d7aba7b0459a..144642a9d3054ed9f9e67a0214a8a03b4799e37f 100644 (file)
@@ -17,6 +17,8 @@ extern "C" {
  *
  * This is essentially a wrapper to fll_error_print() that includes locking.
  *
+ * @param thread
+ *   The thread data.
  * @param print
  *   Designates how printing is to be performed.
  * @param cache
@@ -29,8 +31,6 @@ extern "C" {
  *   Set to 0 to disable.
  * @param fallback
  *   Set to F_true to print the fallback error message for unknown errors.
- * @param thread
- *   The thread data.
  * @param item
  *   If TRUE, then this error is associated with an item.
  *   If FALSE, then this error is associated with a rule setting.
@@ -39,7 +39,7 @@ extern "C" {
  * @see controller_rule_print_error_cache()
  */
 #ifndef _di_controller_rule_print_error_
-  extern void controller_rule_print_error(const fl_print_t print, const controller_cache_action_t cache, const f_status_t status, const f_string_t function, const bool fallback, const bool item, controller_thread_t *thread) F_attribute_visibility_internal_d;
+  extern void controller_rule_print_error(controller_thread_t * const thread, const fl_print_t print, const controller_cache_action_t cache, const f_status_t status, const f_string_t function, const bool fallback, const bool item) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_print_error_
 
 /**
@@ -72,6 +72,8 @@ extern "C" {
  *
  * This is explicitly intended to be used in addition to the error message.
  *
+ * @param thread
+ *   The thread data.
  * @param print
  *   The error or warning print structure.
  * @param cache
@@ -81,13 +83,11 @@ extern "C" {
  *   If FALSE, then this error is associated with a rule setting.
  * @param status
  *   The status code representing the failure (without the error bit set).
- * @param thread
- *   The thread data.
  *
  * @see controller_rule_print_error_cache()
  */
 #ifndef _di_controller_rule_item_print_error_
-  extern void controller_rule_item_print_error(const fl_print_t print, const controller_cache_action_t cache, const bool item, const f_status_t status, controller_thread_t *thread) F_attribute_visibility_internal_d;
+  extern void controller_rule_item_print_error(controller_thread_t * const thread, const fl_print_t print, const controller_cache_action_t cache, const bool item, const f_status_t status) F_attribute_visibility_internal_d;
 #endif // _di_controller_rule_item_print_error_
 
 /**
index 0c9530708e87f8c0e7a605f2560bc0b08fed1f91..15110fb78d1e1453f1b75d5e4f53cb7939725327 100644 (file)
@@ -17,7 +17,7 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_thread_cleanup_
-  void * controller_thread_cleanup(void *arguments) {
+  void * controller_thread_cleanup(void * const arguments) {
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
@@ -31,7 +31,7 @@ extern "C" {
 
     while (global->thread->enabled == controller_thread_enabled_e) {
 
-      controller_time_sleep_nanoseconds(global->main, global->setting, delay);
+      nanosleep(&delay, 0);
 
       if (global->thread->enabled != controller_thread_enabled_e) break;
 
@@ -155,7 +155,7 @@ extern "C" {
 #endif // _di_controller_thread_cleanup_
 
 #ifndef _di_controller_thread_is_enabled_
-  f_status_t controller_thread_is_enabled(const bool is_normal, controller_thread_t *thread) {
+  f_status_t controller_thread_is_enabled(const bool is_normal, controller_thread_t * const thread) {
 
     if (is_normal) {
       return thread->enabled == controller_thread_enabled_e;
@@ -166,21 +166,21 @@ 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 *thread) {
+  f_status_t controller_thread_is_enabled_process(controller_process_t * const process, controller_thread_t * const thread) {
 
     return controller_thread_is_enabled_process_type(process->type, thread);
   }
 #endif // _di_controller_thread_is_enabled_process_
 
 #ifndef _di_controller_thread_is_enabled_process_type_
-  f_status_t controller_thread_is_enabled_process_type(const uint8_t type, controller_thread_t *thread) {
+  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);
   }
 #endif // _di_controller_thread_is_enabled_process_type_
 
 #ifndef _di_controller_thread_main_
-  f_status_t controller_thread_main(controller_main_t *main, controller_setting_t *setting) {
+  f_status_t controller_thread_main(controller_main_t * const main, controller_setting_t * const setting) {
 
     f_status_t status = F_none;
 
@@ -199,7 +199,7 @@ extern "C" {
       status = controller_processs_increase(&thread.processs);
 
       if (F_status_is_error(status)) {
-        controller_print_error(main->error, F_status_set_fine(status), "controller_processs_increase", F_true, &thread);
+        controller_print_error(&thread, main->error, F_status_set_fine(status), "controller_processs_increase", F_true);
       }
     }
 
@@ -211,7 +211,7 @@ extern "C" {
       thread.id_signal = 0;
 
       if (main->error.verbosity != f_console_verbosity_quiet_e) {
-        controller_print_error(main->error, F_status_set_fine(status), "f_thread_create", F_true, &thread);
+        controller_print_error(&thread, main->error, F_status_set_fine(status), "f_thread_create", F_true);
       }
     }
     else {
@@ -240,7 +240,7 @@ extern "C" {
 
         if (F_status_is_error(status)) {
           if (main->error.verbosity != f_console_verbosity_quiet_e) {
-            controller_print_error(main->error, F_status_set_fine(status), "f_thread_create", F_true, &thread);
+            controller_print_error(&thread, main->error, F_status_set_fine(status), "f_thread_create", F_true);
           }
         }
         else {
@@ -266,13 +266,6 @@ extern "C" {
             thread.id_rule = 0;
           }
           else {
-            status = f_thread_create(0, &thread.id_control, &controller_thread_control, (void *) &global);
-          }
-
-          if (F_status_is_error(status)) {
-            thread.id_control = 0;
-          }
-          else {
             status = f_thread_create(0, &thread.id_cleanup, &controller_thread_cleanup, (void *) &global);
           }
 
@@ -280,7 +273,7 @@ extern "C" {
             thread.id_cleanup = 0;
 
             if (main->error.verbosity != f_console_verbosity_quiet_e) {
-              controller_print_error(main->error, F_status_set_fine(status), "f_thread_create", F_true, &thread);
+              controller_print_error(&thread, main->error, F_status_set_fine(status), "f_thread_create", F_true);
             }
           }
         }
@@ -307,14 +300,21 @@ extern "C" {
 
     controller_thread_process_exit(&global);
 
+    if (thread.id_listen) {
+      f_thread_cancel(thread.id_listen);
+    }
+
     if (thread.id_signal) f_thread_join(thread.id_signal, 0);
     if (thread.id_cleanup) f_thread_join(thread.id_cleanup, 0);
     if (thread.id_control) f_thread_join(thread.id_control, 0);
+    if (thread.id_listen) f_thread_join(thread.id_listen, 0);
     if (thread.id_entry) f_thread_join(thread.id_entry, 0);
     if (thread.id_rule) f_thread_join(thread.id_rule, 0);
 
     thread.id_cleanup = 0;
     thread.id_control = 0;
+    thread.id_listen = 0;
+    thread.id_entry = 0;
     thread.id_rule = 0;
     thread.id_signal = 0;
 
@@ -339,7 +339,7 @@ extern "C" {
 #endif // _di_controller_thread_main_
 
 #ifndef _di_controller_thread_join_
-  f_status_t controller_thread_join(f_thread_id_t *id) {
+  f_status_t controller_thread_join(f_thread_id_t * const id) {
 
     if (!id || !*id) return F_data_not;
 
index ff56595f5760366b7825153f452347b1607a7345..cc632920720b145cc6893cb842497d12b0a7825f 100644 (file)
@@ -23,7 +23,7 @@ extern "C" {
  *   0, always.
  */
 #ifndef _di_controller_thread_cleanup_
-  extern void * controller_thread_cleanup(void *arguments) F_attribute_visibility_internal_d;
+  extern void * controller_thread_cleanup(void * const arguments) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_cleanup_
 
 /**
@@ -40,7 +40,7 @@ extern "C" {
  *   FALSE when disabled.
  */
 #ifndef _di_controller_thread_is_enabled_
-  extern f_status_t controller_thread_is_enabled(const bool is_normal, controller_thread_t *thread) F_attribute_visibility_internal_d;
+  extern f_status_t controller_thread_is_enabled(const bool is_normal, controller_thread_t * const thread) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_is_enabled_
 
 /**
@@ -58,7 +58,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 *thread) F_attribute_visibility_internal_d;
+  extern f_status_t controller_thread_is_enabled_process(controller_process_t * const process, controller_thread_t * const thread) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_is_enabled_process_
 
 /**
@@ -76,7 +76,7 @@ extern "C" {
  * @see controller_thread_is_enabled()
  */
 #ifndef _di_controller_thread_is_enabled_process_type_
-  extern f_status_t controller_thread_is_enabled_process_type(const uint8_t type, controller_thread_t *thread) F_attribute_visibility_internal_d;
+  extern f_status_t controller_thread_is_enabled_process_type(const uint8_t type, controller_thread_t * const thread) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_is_enabled_process_type_
 
 /**
@@ -95,7 +95,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 *main, controller_setting_t *setting) F_attribute_visibility_internal_d;
+  extern f_status_t controller_thread_main(controller_main_t * const main, controller_setting_t * const setting) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_main_
 
 /***
@@ -116,7 +116,7 @@ extern "C" {
  * @see f_thread_join()
  */
 #ifndef _di_controller_thread_join_
-  extern f_status_t controller_thread_join(f_thread_id_t *id) F_attribute_visibility_internal_d;
+  extern f_status_t controller_thread_join(f_thread_id_t * const id) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_join_
 
 #ifdef __cplusplus
index a22cbc1e91f18b5484f07e557269f1c7eeb6e006..cb651839ba6f7159f0d9c841a64c4a0cebf8c8e1 100644 (file)
@@ -1,5 +1,7 @@
 #include "controller.h"
 #include "private-common.h"
+#include "private-control.h"
+#include "private-controller_print.h"
 #include "private-thread.h"
 #include "private-thread_control.h"
 
@@ -8,18 +10,55 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_thread_control_
-  void * controller_thread_control(void *arguments) {
+  void * controller_thread_control(void * const arguments) {
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_global_t *global = (controller_global_t *) arguments;
+    const controller_global_t *global = (controller_global_t *) arguments;
 
     if (global->thread->enabled != controller_thread_enabled_e) return 0;
 
+    f_status_t status = F_none;
+    f_socket_t * const server = &global->setting->control_socket;
+    controller_packet_t packet = controller_packet_t_initialize;
+
+    controller_control_configure_server(global, server);
+
+    do {
+      status = controller_control_accept(global, server, &packet);
+    } while (F_status_is_fine(status) && status != F_child && global->thread->enabled == controller_thread_enabled_e);
+
+    controller_packet_delete_simple(&packet);
+
     return 0;
   }
 #endif // _di_controller_thread_control_
 
+#ifndef _di_controller_thread_control_listen_
+  void * controller_thread_control_listen(void * const arguments) {
+
+    f_thread_cancel_state_set(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
+
+    const controller_global_t *global = (controller_global_t *) arguments;
+
+    if (global->thread->enabled != controller_thread_enabled_e) return 0;
+
+    if (global->setting->interruptible) {
+      f_signal_mask(SIG_UNBLOCK, &global->main->signal.set, 0);
+    }
+
+    f_socket_t * const server = &global->setting->control_socket;
+
+    const f_status_t status = f_socket_listen(server, controller_control_default_socket_backlog_d);
+
+    if (F_status_is_error(status)) {
+      controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_socket_listen", F_true);
+    }
+
+    return 0;
+  }
+#endif // _di_controller_thread_control_listen_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 5f0e225e2aebdfc6fbeaa37852b9a289377549e8..b8f49d2e2d88e3ea56eff780be47f737be9a06f2 100644 (file)
@@ -23,9 +23,26 @@ extern "C" {
  *   0, always.
  */
 #ifndef _di_controller_thread_control_
-  extern void * controller_thread_control(void *arguments) F_attribute_visibility_internal_d;
+  extern void * controller_thread_control(void * const arguments) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_control_
 
+/**
+ * Thread for handling the control listener.
+ *
+ * This runs on a separate thread entirely to be interuptable and closable distinctly from the main control thread.
+ * This is simple and has nothing that needs to be cleaned up and so immediately exits on cancel.
+ *
+ * @param arguments
+ *   The thread arguments.
+ *   Must be of type controller_global_t.
+ *
+ * @return
+ *   0, always.
+ */
+#ifndef _di_controller_thread_control_listen_
+  extern void * controller_thread_control_listen(void * const arguments) F_attribute_visibility_internal_d;
+#endif // _di_controller_thread_control_listen_
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
index e2a76a6a886ab73716dd3862cbae036fc065d750..12fb524854cb56bd5bb3a584a81ef4aeeb7b4e55 100644 (file)
@@ -11,7 +11,7 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_thread_entry_
-  void * controller_thread_entry(void *arguments) {
+  void * controller_thread_entry(void * const arguments) {
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
@@ -53,7 +53,7 @@ extern "C" {
           *status = F_status_set_error(F_available_not);
         }
         else {
-          *status = controller_entry_process(*entry->global, F_false, F_true, cache);
+          *status = controller_entry_process(entry->global, cache, F_false, F_true);
 
           if (F_status_is_error(*status)) {
             entry->setting->ready = controller_setting_ready_fail_e;
@@ -75,7 +75,7 @@ extern "C" {
                 f_thread_create(0, &entry->global->thread->id_signal, &controller_thread_signal_normal, (void *) entry->global);
               }
 
-              const f_status_t status_failsafe = controller_entry_process(*entry->global, F_true, F_true, cache);
+              const f_status_t status_failsafe = controller_entry_process(entry->global, cache, F_true, F_true);
 
               if (F_status_is_error(status_failsafe)) {
                 if (main->error.verbosity != f_console_verbosity_quiet_e) {
@@ -137,7 +137,7 @@ extern "C" {
 #endif // _di_controller_thread_entry_
 
 #ifndef _di_controller_thread_exit_
-  void * controller_thread_exit(void *arguments) {
+  void * controller_thread_exit(void * const arguments) {
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
@@ -165,7 +165,7 @@ extern "C" {
     if (F_status_is_error_not(*status) && *status != F_child && *status != F_file_found_not) {
       if (main->parameters[controller_parameter_validate_e].result == f_console_result_none_e || main->parameters[controller_parameter_simulate_e].result == f_console_result_found_e) {
 
-        *status = controller_entry_process(*entry->global, F_false, F_false, cache);
+        *status = controller_entry_process(entry->global, cache, F_false, F_false);
 
         if (F_status_is_error(*status)) {
           entry->setting->ready = controller_setting_ready_fail_e;
@@ -190,7 +190,7 @@ extern "C" {
               }
             }
 
-            const f_status_t status_failsafe = controller_entry_process(*entry->global, F_true, F_false, cache);
+            const f_status_t status_failsafe = controller_entry_process(entry->global, cache, F_true, F_false);
 
             if (F_status_is_error(status_failsafe)) {
               if (main->error.verbosity != f_console_verbosity_quiet_e) {
index bd9074f23cd9ab679b0641fa5162dca99fc10b3f..553096ef55bcebd33ade78b233dda8448a55ecc1 100644 (file)
@@ -26,7 +26,7 @@ extern "C" {
  *   0, always.
  */
 #ifndef _di_controller_thread_entry_
-  extern void * controller_thread_entry(void *arguments) F_attribute_visibility_internal_d;
+  extern void * controller_thread_entry(void * const arguments) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_entry_
 
 /**
@@ -46,7 +46,7 @@ extern "C" {
  *   0, always.
  */
 #ifndef _di_controller_thread_exit_
-  extern void * controller_thread_exit(void *arguments) F_attribute_visibility_internal_d;
+  extern void * controller_thread_exit(void * const arguments) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_exit_
 
 #ifdef __cplusplus
index 37756344611e0ca3587ebc74181e58107a360111..a254215ce8cad70739730a4ad976b03fbee16476 100644 (file)
@@ -177,6 +177,7 @@ extern "C" {
                   time.tv_nsec = controller_thread_exit_process_cancel_wait_d;
 
                   nanosleep(&time, 0);
+
                   continue;
                 }
                 else {
@@ -250,7 +251,7 @@ extern "C" {
 #endif // _di_controller_thread_process_cancel_
 
 #ifndef _di_controller_thread_process_exit_
-  void controller_thread_process_exit(controller_global_t *global) {
+  void controller_thread_process_exit(controller_global_t * const global) {
 
     if (global->thread->enabled != controller_thread_enabled_exit_e) {
       return;
@@ -277,7 +278,7 @@ extern "C" {
 
       if (F_status_is_error(status)) {
         if (global->main->error.verbosity != f_console_verbosity_quiet_e) {
-          controller_print_error(global->main->error, F_status_set_fine(status), "f_thread_create", F_true, global->thread);
+          controller_print_error(global->thread, global->main->error, F_status_set_fine(status), "f_thread_create", F_true);
         }
 
         if (F_status_is_error_not(f_thread_mutex_lock(&global->thread->lock.alert))) {
@@ -345,7 +346,7 @@ extern "C" {
 #endif // _di_controller_thread_process_exit_
 
 #ifndef _di_controller_thread_process_normal_
-  void * controller_thread_process_normal(void *arguments) {
+  void * controller_thread_process_normal(void * const arguments) {
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
@@ -356,7 +357,7 @@ extern "C" {
 #endif // _di_controller_thread_process_normal_
 
 #ifndef _di_controller_thread_process_other_
-  void * controller_thread_process_other(void *arguments) {
+  void * controller_thread_process_other(void * const arguments) {
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
index 3411b6ffb9480d1e6a096660070a79b0ea3aa98f..2e9cbf5027c423709cec502fd52bf861fa734640 100644 (file)
@@ -56,7 +56,7 @@ extern "C" {
  *   The global thread data.
  */
 #ifndef _di_controller_thread_process_exit_
-  extern void controller_thread_process_exit(controller_global_t *global) F_attribute_visibility_internal_d;
+  extern void controller_thread_process_exit(controller_global_t * const global) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_process_exit_
 
 /**
@@ -72,7 +72,7 @@ extern "C" {
  * @see controller_thread_process()
  */
 #ifndef _di_controller_thread_process_normal_
-  extern void * controller_thread_process_normal(void *arguments) F_attribute_visibility_internal_d;
+  extern void * controller_thread_process_normal(void * const arguments) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_process_normal_
 
 /**
@@ -88,7 +88,7 @@ extern "C" {
  * @see controller_thread_process()
  */
 #ifndef _di_controller_thread_process_other_
-  extern void * controller_thread_process_other(void *arguments) F_attribute_visibility_internal_d;
+  extern void * controller_thread_process_other(void * const arguments) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_process_other_
 
 #ifdef __cplusplus
index d747f39620c819b5414147da74ca882aec8a1574..c8a065542fe5a1aaf982037e1f52ffb7c8a5e303 100644 (file)
@@ -8,11 +8,11 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_thread_rule_
-  void * controller_thread_rule(void *arguments) {
+  void * controller_thread_rule(void * const arguments) {
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_global_t *global = (controller_global_t *) arguments;
+    const controller_global_t *global = (controller_global_t *) arguments;
 
     if (!controller_thread_is_enabled(F_true, global->thread)) return 0;
 
index 4ff6bde6ee25f8b52c0c26bf03c55f2dd54a6fc2..61cf96d96848a1ff82ea95271f5ac0f25f0985b0 100644 (file)
@@ -28,7 +28,7 @@ extern "C" {
  *   0, always.
  */
 #ifndef _di_controller_thread_rule_
-  extern void * controller_thread_rule(void *arguments) F_attribute_visibility_internal_d;
+  extern void * controller_thread_rule(void * const arguments) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_rule_
 
 #ifdef __cplusplus
index cabdff173c0abb2c8e3b5fd90c2699dd52fa5b37..d216ab5c4ab3eb190b1fd6bc5e30411039bff346 100644 (file)
@@ -11,7 +11,7 @@ extern "C" {
 #endif
 
 #ifndef _di_controller_thread_signal_
-  void controller_thread_signal(const bool is_normal, controller_global_t *global) {
+  void controller_thread_signal(controller_global_t * const global, const bool is_normal) {
 
     if (!controller_thread_is_enabled(is_normal, global->thread)) return;
 
@@ -43,7 +43,7 @@ extern "C" {
 #endif // _di_controller_thread_signal_
 
 #ifndef _di_controller_thread_signal_state_fss_
-  f_status_t controller_thread_signal_state_fss(void *state, void *internal) {
+  f_status_t controller_thread_signal_state_fss(void * const state, void * const internal) {
 
     if (!state) {
       return F_interrupt_not;
@@ -71,7 +71,7 @@ extern "C" {
 #endif // _di_controller_thread_signal_state_fss_
 
 #ifndef _di_controller_thread_signal_state_iki_
-  f_status_t controller_thread_signal_state_iki(void *state, void *internal) {
+  f_status_t controller_thread_signal_state_iki(void * const state, void * const internal) {
 
     if (!state) {
       return F_interrupt_not;
@@ -99,22 +99,22 @@ extern "C" {
 #endif // _di_controller_thread_signal_state_iki_
 
 #ifndef _di_controller_thread_signal_normal_
-  void * controller_thread_signal_normal(void *arguments) {
+  void * controller_thread_signal_normal(void * const arguments) {
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_thread_signal(F_true, (controller_global_t *) arguments);
+    controller_thread_signal((controller_global_t *) arguments, F_true);
 
     return 0;
   }
 #endif // _di_controller_thread_signal_normal_
 
 #ifndef _di_controller_thread_signal_other_
-  void * controller_thread_signal_other(void *arguments) {
+  void * controller_thread_signal_other(void * const arguments) {
 
     f_thread_cancel_state_set(PTHREAD_CANCEL_DEFERRED, 0);
 
-    controller_thread_signal(F_false, (controller_global_t *) arguments);
+    controller_thread_signal((controller_global_t *) arguments, F_false);
 
     return 0;
   }
index 298465976299044f0161ca1dca72bf34baab68f6..e0fefd60fbdca6887610360319609376fc3c14c4 100644 (file)
@@ -15,14 +15,14 @@ extern "C" {
 /**
  * Thread for handling signals/interrupts.
  *
+ * @param global
+ *   The global data.
  * @param is_normal
  *   If TRUE, then process as if this operates during a normal operation (entry and control).
  *   If FALSE, then process as if this operates during a an exit operation.
- * @param global
- *   The global data.
  */
 #ifndef _di_controller_thread_signal_
-  extern void controller_thread_signal(const bool is_normal, controller_global_t *global) F_attribute_visibility_internal_d;
+  extern void controller_thread_signal(controller_global_t * const global, const bool is_normal) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_signal_
 
 /**
@@ -39,7 +39,7 @@ extern "C" {
  *   F_interrupt (with error bit) if interrupted.
  */
 #ifndef _di_controller_thread_signal_state_fss_
-  extern f_status_t controller_thread_signal_state_fss(void *state, void *internal) F_attribute_visibility_internal_d;
+  extern f_status_t controller_thread_signal_state_fss(void * const state, void * const internal) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_signal_state_fss_
 
 /**
@@ -56,7 +56,7 @@ extern "C" {
  *   F_interrupt (with error bit) if interrupted.
  */
 #ifndef _di_controller_thread_signal_state_iki_
-  extern f_status_t controller_thread_signal_state_iki(void *state, void *internal) F_attribute_visibility_internal_d;
+  extern f_status_t controller_thread_signal_state_iki(void * const state, void * const internal) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_signal_state_iki_
 
 /**
@@ -74,7 +74,7 @@ extern "C" {
  * @see controller_thread_signal()
  */
 #ifndef _di_controller_thread_signal_normal_
-  extern void * controller_thread_signal_normal(void *arguments) F_attribute_visibility_internal_d;
+  extern void * controller_thread_signal_normal(void * const arguments) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_signal_normal_
 
 /**
@@ -92,7 +92,7 @@ extern "C" {
  * @see controller_thread_signal()
  */
 #ifndef _di_controller_thread_signal_other_
-  extern void * controller_thread_signal_other(void *arguments) F_attribute_visibility_internal_d;
+  extern void * controller_thread_signal_other(void * const arguments) F_attribute_visibility_internal_d;
 #endif // _di_controller_thread_signal_other_
 
 #ifdef __cplusplus
index 3ef7dd09b4dc0b7e8a4032d7eaf0b86d4188be30..84190ab34b9b67177a470573923e4381ebf4ae40 100644 (file)
@@ -31,7 +31,7 @@ build_libraries-monolithic -lfll
 build_libraries_shared
 build_libraries_static
 build_sources_library controller.c private-common.c private-process.c
-build_sources_library common/private-cache.c common/private-lock.c common/private-rule.c common/private-task.c common/private-process.c common/private-entry.c common/private-setting.c common/private-thread.c
+build_sources_library common/private-cache.c common/private-control.c common/private-entry.c common/private-lock.c common/private-process.c common/private-rule.c common/private-setting.c common/private-task.c common/private-thread.c
 build_sources_library private-control.c private-controller.c private-entry.c private-rule.c private-task.c
 build_sources_library private-control_print.c private-controller_print.c private-entry_print.c private-lock.c private-lock_print.c private-rule_print.c private-task_print.c
 build_sources_library private-thread.c private-thread_control.c private-thread_entry.c private-thread_process.c private-thread_rule.c private-thread_signal.c