Additional review and tests are still required but this fixes some additional problems encountered during testing.
Try to improve grammar by treating special variables as proper nouns, such as Entry, Exit, Rule, Item, etc...
Move the environment map onto the Instance.
I decided not to put it on the cache but I might change my mind as this is being added for cache purposes.
This should help reduce repeated allocations on every execute.
I may want to add features to the Controller program to better control when to clear or deallocate memory for more security at the cost of resources and performance.
This would allow for post-compile-time configuration.
A mistake exposed a lack of error reporting for when Items is an empty array.
Add controller_print_error_rule_item_execute_none() to account for this.
The bug is that "object" and "content" in controller_rule_parameters_read() are actually optional.
I was returning a parameter error when these were not defined.
Reduce the local allocation of f_state_t and pass it along as a parameter.
These particular functions should be being called sequentially and should be able to safely pass along the state between them.
The settings for the IKI read state is temporarily modified as appropriate and then restored when finished.
Don't assign enabled variable on lock failure to avoid potential race condition.
#endif
/**
- * Standard program entry point.
+ * Standard program Entry point.
*
* @param argc
* The number of arguments.
*
* Must not be NULL.
* @param entry
- * The entry data.
+ * The Entry data.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this operates as an entry.
- * If FALSE, then this operates as an exit.
+ * If TRUE, then this operates as an Entry.
+ * If FALSE, then this operates as an Exit.
*
* @return
* F_okay on success.
#endif
/**
- * Standard program entry point.
+ * Standard program Entry point.
*
* @param argc
* The number of arguments.
} // for
}
- // The first remaining argument represents the entry name.
+ // The first remaining argument represents the Entry name.
main->setting.state.status = f_string_dynamic_append(main->program.parameters.remaining.used ? args[main->program.parameters.remaining.array[0]] : controller_default_s, &main->process.name_entry);
if (F_status_is_error(main->setting.state.status)) {
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the common entry defines.
+ * Provides the common Entry defines.
*
* This is auto-included and should not need to be explicitly included.
*/
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the common rule defines.
+ * Provides the common Rule defines.
*
* This is auto-included and should not need to be explicitly included.
*/
* Designate codes for timeout settings to be used during the loading of the Rule timeout settings.
*
* controller_rule_timeout_code_*_d:
- * - kill: Forcibly stop a rule.
- * - start: Start a rule.
- * - stop: Stop a rule.
+ * - kill: Forcibly stop a Rule.
+ * - start: Start a Rule.
+ * - stop: Stop a Rule.
*/
#ifndef _di_controller_rule_timeout_code_d_
#define controller_rule_timeout_code_kill_d 1
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the common entry enumerations.
+ * Provides the common Entry enumerations.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* controller_entry_flag_*_e:
* - none: No flags are set.
- * - is: Designate that this is an entry rather than an exit.
+ * - is: Designate that this is an Entry rather than an Exit.
* - timeout_exit_no: The exit timeout is disabled.
* - timeout_kill_no: The kill timeout is disabled for Rules by default.
* - timeout_start_no: The start timeout is disabled for Rules by default.
* Controller Entry PID enumeration.
*
* controller_entry_pid_*_e:
- * - disable: Do not check for or create a PID file to represent the entry execution.
- * - require: Check to see if the PID file exists for an entry at startup and then when "ready" create a pid file, display error on pid file already exists or on failure and then fail.
+ * - disable: Do not check for or create a PID file to represent the Entry execution.
+ * - require: Check to see if the PID file exists for an Entry at startup and then when "ready" create a pid file, display error on pid file already exists or on failure and then fail.
* - ready: When "ready" create a pid file, display error on failure and then fail (does not check if PID file exists).
*/
#ifndef _di_controller_entry_pid_e_
*
* controller_entry_show_*_e:
* - normal: Do not print anything other than warnings and errors, but allow executed programs and scripts to output however they like.
- * - init: Print like an init program, printing status of entry and rules as they are being started, stopped, etc...
+ * - init: Print like an init program, printing status of Entry and Rules as they are being started, stopped, etc...
*/
#ifndef _di_controller_entry_show_e_
enum {
* Instance states.
*
* controller_instance_state_*_e:
- * - idle: No instance is running for this rule.
+ * - idle: No instance is running for this Rule.
* - busy: A instance is actively using this, and is running synchronously.
* - active: A instance is actively using this, and is running asynchronously.
* - done: A instance has finished running on this and there is a thread that needs to be cleaned up.
* Instance types.
*
* controller_instance_type_*_e:
- * - entry: The instance is started from an entry.
- * - exit: The instance is started from an exit.
+ * - entry: The instance is started from an Entry.
+ * - exit: The instance is started from an Exit.
* - control: The instance is started from a control operation.
*/
#ifndef _di_controller_instance_type_e_
* Controller process mode enumeration.
*
* controller_process_mode_*:
- * - helper: Run as a helper, exiting when finished prrocess entry (and any respective exit).
- * - program: Run as a program, exiting when finished prrocess entry (and any respective exit).
- * - service: Run as a service, listening for requests after processing entry.
+ * - helper: Run as a helper, exiting when finished prrocess Entry (and any respective Exit).
+ * - program: Run as a program, exiting when finished prrocess Entry (and any respective Exit).
+ * - service: Run as a service, listening for requests after processing Entry.
*/
#ifndef _di_controller_process_mode_e_
enum {
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the common rule enumerations.
+ * Provides the common Rule enumerations.
*
* This is auto-included and should not need to be explicitly included.
*/
* - enabled_not: The controller is no longer enabled, shut down and abort all work.
* - enabled: The controller is operating normally.
* - enabled_execute: The controller is executing another process, all running operations must terminate.
- * - enabled_exit: The controller is shutting down, only process exit rules.
+ * - enabled_exit: The controller is shutting down, only process Exit rules.
* - enabled_exit_execute: The controller is executing another process while in failsafe mode, all running operations must terminate.
- * - enabled_exit_ready: The controller is shutting down, only process exit rules, and now ready to send termination signals.
+ * - enabled_exit_ready: The controller is shutting down, only process Exit rules, and now ready to send termination signals.
*/
enum {
controller_thread_enabled_not_e = 0,
/**
* All special strings used within this program.
*
- * These are generally the names to match, representing some action or setting.
+ * These are generally the names to match, representing some Action or setting.
*/
#ifndef _di_controller_string_s_
#define CONTROLLER_action_s "action"
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the common rule string data.
+ * Provides the common Rule string data.
*
* This is auto-included and should not need to be explicitly included.
*/
/**
* The controller main program settings.
*
- * This is passed to the program-specific main entry point to designate program settings.
+ * This is passed to the program-specific main Entry point to designate program settings.
* These program settings are often processed from the program arguments (often called the command line arguments).
*
* Properties:
#endif // _di_controller_cache_delete_
/**
- * De-allocate the Controller action cache.
+ * De-allocate the Controller Action cache.
*
* @param action
- * The action cache.
+ * The Action cache.
*
* Must not be NULL.
*
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the common entry type structures.
+ * Provides the common Entry type structures.
*
* This is auto-included and should not need to be explicitly included.
*/
* A special macro_controller_entry_t_initialize_1() is provided to easily initialize with a specific set of flags.
*
* Properties:
- * - define: Any defines (environment variables) made available to all Rules in this entry for IKI substitution or just as environment variables.
- * - flag: A set of flags associated with the entry.
- * - items: The array of entry items.
- * - parameter: Any parameters made available to all Rules in this entry for IKI substitution.
+ * - define: Any defines (environment variables) made available to all Rules in this Entry for IKI substitution or just as environment variables.
+ * - flag: A set of flags associated with the Entry.
+ * - items: The array of Entry Items.
+ * - parameter: Any parameters made available to all Rules in this Entry for IKI substitution.
* - pid: The PID file generation setting.
* - session: The default session settings (when NULL, no default is specified).
- * - show: The show setting for controlling what to show when executing entry items and rules.
+ * - show: The show setting for controlling what to show when executing Entry Items and rules.
* - status: The overall status.
* - timeout_exit: The timeout to wait when exiting the Controller program after sending the terminate signal to send the kill signal.
* - timeout_kill: The timeout to wait relating to using a kill signal.
f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &instance->stack.array, &instance->stack.used, &instance->stack.size);
f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &instance->path_pids.array, &instance->path_pids.used, &instance->path_pids.size, &f_string_dynamics_delete_callback);
+ f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &instance->environment.array, &instance->environment.used, &instance->environment.size, &f_string_maps_delete_callback);
}
#endif // _di_controller_instance_delete_
* - id: The ID of this process relative to the processes array.
* - id_thread: The thread ID, a valid ID when state is "active", and an invalid ID when the state is "busy".
*
- * - action: The action being performed.
+ * - action: The Action being performed.
* - options: Configuration options for this thread.
* - state: The state of the process.
* - type: The currently active process type (from the controller_instance_type_*_e).
*
* - active: A read/write lock representing that something is currently using this (read locks = in use, write lock = begin deleting).
* - lock: A read/write lock on the structure.
- * - wait: A thread condition to tell a process waiting process that the rule has is done being processed.
+ * - wait: A thread condition to tell a process waiting process that the Rule has is done being processed.
* - wait_lock: A mutex lock for working with "wait".
*
- * - child: The process id of a child process, if one is running (when forking to execute a child process).
- * - path_pids: An array of paths representing PID files.
- * - stack: A stack used to represent dependencies as Rule ID's to avoid circular Rule dependencies (If Rule A waits on Rule B, then Rule B must not wait on Rule A).
+ * - child: The process id of a child process, if one is running (when forking to execute a child process).
+ * - path_pids: An array of paths representing PID files.
+ * - environment: Environment data used when executing the instance.
+ * - stack: A stack used to represent dependencies as Rule ID's to avoid circular Rule dependencies (If Rule A waits on Rule B, then Rule B must not wait on Rule A).
*
- * - rule: A copy of the rule actively being executed.
+ * - rule: A copy of the Rule actively being executed.
* - cache: The cache used by this Instance.
* - main: The main program data.
*/
f_pids_t childs;
f_string_dynamics_t path_pids;
+ f_string_maps_t environment;
f_number_unsigneds_t stack;
controller_rule_t rule;
f_thread_mutex_t_initialize, \
f_pids_t_initialize, \
f_string_dynamics_t_initialize, \
+ f_string_maps_t_initialize, \
f_number_unsigneds_t_initialize, \
controller_rule_t_initialize, \
controller_cache_t_initialize, \
* The cancel lock is intended for preventing double cancellation calls (which can happen due to interrupts).
* The print lock is intended to lock any activity printing to stdout/stderr.
* The instance lock is intended to lock any activity on the instance structure.
- * The rule lock is intended to lock any activity on the rules structure.
+ * The Rule lock is intended to lock any activity on the rules structure.
*
* Properties:
* - alert: The alert mutex lock for waking up on alerts.
* - cancel: The cancel mutex lock for locking the cancel operation.
* - print: The print mutex lock.
* - instance: The instance r/w lock.
- * - rule: The rule r/w lock.
+ * - rule: The Rule r/w lock.
* - alert_condition: The condition used to trigger alerts.
*/
#ifndef _di_controller_lock_t_
*
* - failsafe_item_id: The Entry Item ID to execute when failsafe execution is enabled.
*
- * - name_entry: The name of the entry file.
+ * - name_entry: The name of the Entry file.
* - path_cgroup: Directory path to the cgroup directory.
* - path_control: File path to the control socket (used for printing the path).
* - path_current: The current path.
* Fully de-allocate all memory for the given Rule without caring about return status.
*
* @param rule
- * The rule to de-allocate.
+ * The Rule to de-allocate.
*
* @see f_capability_delete()
* @see f_memory_array_resize()
#endif // _di_controller_convert_group_id_
/**
- * Convert the rule action execute type code to the string representation.
+ * Convert the Rule Action execute type code to the string representation.
*
* @param type
- * The rule action execute type code.
+ * The Rule Action execute type code.
*
* @return
* The string with used > 0 on success.
#endif // _di_controller_convert_rule_action_execute_type_string_
/**
- * Convert the rule action type code to the string representation.
+ * Convert the Rule Action type code to the string representation.
*
* @param type
- * The rule action type code.
+ * The Rule Action type code.
*
* @return
* The string with used > 0 on success.
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides entry functionality.
+ * Provides Entry functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* Must not be NULL.
* @param entry
- * The entry data.
+ * The Entry data.
*
* Must not be NULL.
*
* @return
* F_okay on success.
- * F_file_found_not on file not found for a an exit file (is_entry is FALSE).
+ * F_file_found_not on file not found for an Exit file (is_entry is FALSE).
*
* F_parameter (with error bit) if a parameter is invalid.
*
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the entry action functionality.
+ * Provides the Entry Action functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Read the entry list, loading all items and values.
+ * Read the Entry list, loading all Items and values.
*
* @param main
* The main program data.
*
* Must not be NULL.
* @param entry
- * The entry.
+ * The Entry.
*
* Must not be NULL.
* @param range
uint8_t error_has = F_false;
- // This effectively sets the read for an entry and resets the ready for an exit.
+ // This effectively sets the read for an Entry and resets the ready for an Exit.
main->process.ready = controller_process_ready_no_e;
cache->ats.used = 0;
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).
+ // 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] = 0;
cache->ats.array[1] = 0;
cache->ats.used = 2;
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the entry pre-process functionality.
+ * Provides the Entry pre-process functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Pre-process all items for the loaded entry.
+ * Pre-process all items for the loaded Entry.
*
* @param main
* The main program data.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this operates as an entry.
- * If FALSE, then this operates as an exit.
+ * If TRUE, then this operates as an Entry.
+ * If FALSE, then this operates as an Exit.
*
* @return
* F_okay on success.
* F_recurse (with error bit) on a recursion error.
- * F_valid_not (with error bit) on invalid entry item, Entry Item Action, or Entry Item Action value.
+ * F_valid_not (with error bit) on invalid Entry Item, Entry Item Action, or Entry Item Action value.
*
* Errors (with error bit) from: macro_f_number_unsigneds_t_increase_by().
* Errors (with error bit) from: f_string_dynamic_append().
controller_entry_action_t *entry_action = 0;
controller_entry_actions_t *entry_actions = 0;
- // An empty stack is used here because each rule here is the first rule run in the rule's scope.
+ // An empty stack is used here because each Rule here is the first Rule run in the Rule's scope.
const f_number_unsigneds_t stack = f_number_unsigneds_t_initialize;
cache->ats.used = 0;
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).
+ // Utilize the "ats" cache as an item execution stack (at_i is for item index, and at_j (at_i + 1) is for Action index).
cache->ats.array[0] = failsafe ? main->process.failsafe_item_id : 0;
cache->ats.array[1] = 0;
cache->ats.used = 2;
controller_print_message_entry_item_process(&main->program.message, is_entry, failsafe ? controller_failsafe_s : f_string_empty_s, cache->action.name_item);
}
- // The pre-process determines if ready is explicitly specified within the entry file and if it is not start as ready.
+ // The pre-process determines if ready is explicitly specified within the Entry file and if it is not start as ready.
if (main->process.ready == controller_process_ready_yes_e) {
status = controller_perform_ready(main, is_entry);
if (F_status_is_error(status)) return status;
if (!controller_thread_is_enabled(is_entry, &main->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.
controller_unlock_print_flush(main->program.error.to, &main->thread);
}
- // Designate the action as failed.
+ // Designate the Action as failed.
entry_action->status = controller_status_simplify_error(F_failure);
if (!(main->setting.flag & controller_main_flag_simulate_e)) {
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the entry process functionality.
+ * Provides the Entry process functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
* 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 operates as an entry.
- * If FALSE, then this operates as an exit.
+ * If TRUE, then this operates as an Entry.
+ * If FALSE, then this operates as an Exit.
*
* @return
* F_okay on success.
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the entry setting functionality.
+ * Provides the Entry setting functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Read the entry settings, loading all settings.
+ * Read the Entry settings, loading all settings.
*
* @param main
* The main program data.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param content_range
* The range in the list buffer representing the content.
*
/**
* Prepare the instance.
*
- * The instance is initialized with the instance id, the Rule alias, and the rule action type.
+ * The instance is initialized with the instance id, the Rule alias, and the Rule Action type.
* These are the necessary parts for uniquely identifying the instance.
*
* If a instance by the given Rule alias and Rule Action already exists, then nothing is done.
*
* Must not be NULL.
* @param is_normal
- * If TRUE, then instance as if this operates during a normal operation (entry and control).
- * If FALSE, then instance as if this operates during a an exit operation.
+ * If TRUE, then instance as if this operates during a normal operation (Entry and Control).
+ * If FALSE, then instance as if this operates during a an Exit operation.
* @param action
* The Rule Action to use.
* @param alias
/**
* Prepare the instance for some instance type.
*
- * The instance is initialized with the instance id, the Rule alias, and the rule action type.
+ * The instance is initialized with the instance id, the Rule alias, and the Rule Action type.
* These are the necessary parts for uniquely identifying the instance.
*
* If a instance by the given Rule alias and Rule Action already exists, then nothing is done.
* Given a r/w lock, periodically check to see if main thread is disabled while waiting.
*
* @param is_normal
- * If TRUE, then perform as if this operates during a normal operation (entry and control).
- * If FALSE, then perform as if this operates during a an exit operation.
+ * If TRUE, then perform as if this operates during a normal operation (Entry and Control).
+ * If FALSE, then perform as if this operates during a an Exit operation.
* @param thread
* The thread data used to determine if the main thread is disabled or not.
*
* Given a r/w lock, periodically check to see if main thread is disabled while waiting.
*
* @param is_normal
- * If TRUE, then perform as if this operates during a normal operation (entry and control).
- * If FALSE, then perform as if this operates during a an exit operation.
+ * If TRUE, then perform as if this operates during a normal operation (Entry and Control).
+ * If FALSE, then perform as if this operates during a an Exit operation.
* @param thread
* The thread data used to determine if the main thread is disabled or not.
*
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this operates as an entry.
- * If FALSE, then this operates as an exit.
+ * If TRUE, then this operates as an Entry.
+ * If FALSE, then this operates as an Exit.
*
* @return
* F_okay on success.
* @param function
* The name of the function associated with the error.
* @param is_entry
- * If TRUE, then this operates as an entry.
- * If FALSE, then this operates as an exit.
+ * If TRUE, then this operates as an Entry.
+ * If FALSE, then this operates as an Exit.
*
* @return
* F_okay on success.
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry action debug functionality.
+ * Provides the print Entry Action debug functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry action debug functionality.
+ * Provides the print Entry Action debug functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Print debug message about re-running the execution of some action.
+ * Print debug message about re-running the execution of some Action.
*
* @param print
* The output structure to print to.
*
* Must not be NULL.
* @param action
- * The ID of the action being re-run.
+ * The ID of the Action being re-run.
*
* @return
* F_okay on success.
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry error functionality.
+ * Provides the print Entry error functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Print the entry related error.
+ * Print the Entry related error.
*
* @param print
* The output structure to print to.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param status
* The status code to process.
* Make sure this has F_status_set_fine() called if the status code has any error or warning bits.
#endif // _di_controller_print_error_entry_
/**
- * Print additional error/warning information in addition to existing error that is found within the given action cache.
+ * Print additional error/warning information in addition to existing error that is found within the given Action cache.
*
* This is explicitly intended to be used in addition to the error message.
*
*
* Must not be NULL.
* @param action
- * The action cache.
+ * The Action cache.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
*
* @return
* F_okay on success.
#endif // _di_controller_print_error_entry_cache_
/**
- * Print the entry related file error.
+ * Print the Entry related file error.
*
* @param print
* The output structure to print to.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param status
* The status code to process.
* Make sure this has F_status_set_fine() called if the status code has any error or warning bits.
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry action error functionality.
+ * Provides the print Entry Action error functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param code
* The return code.
*
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param name
* The program or script name.
*
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param message
* (optional) An additional message to add.
*
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param message
* (optional) An additional message to add.
*
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param message
* A message describing which parameter is empty.
*
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param has
* The second parameter value.
* @param example
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param name
* The Action name.
* @param at_least
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param has
* The invalid value that is not supported.
*
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param item
* The reserved item that is not allowed to be used.
*
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry item error functionality.
+ * Provides the print Entry item error functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param name
* The item name.
* @param message
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param number
* The index position of the invalid item.
*
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param buffer
* The buffer containing the setting name.
* @param range
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry setting error functionality.
+ * Provides the print Entry setting error functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Print a message about an entry setting problem, with additional messages about the value.
+ * Print a message about an Entry setting problem, with additional messages about the value.
*
* This is intended to be explicitly called by controller_entry_settings_read().
* This is intended only to be used for simple messages.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param before
* The string to add to the message being printed (before the value).
* @param range
#endif // _di_controller_print_error_entry_setting_with_range_
/**
- * Print a message for when an entry setting is being ignored.
+ * Print a message for when an Entry setting is being ignored.
*
* @param print
* The output structure to print to.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
*
* @return
* F_okay on success.
#endif // _di_controller_print_error_entry_setting_ignored_
/**
- * Print a message for when an entry setting action has the incorrect number of parameters when the required amount is between a range.
+ * Print a message for when an Entry setting Action has the incorrect number of parameters when the required amount is between a range.
*
* @param print
* The output structure to print to.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param minimum
* The expected minimum number of arguments.
* @param maximum
#endif // _di_controller_print_error_entry_setting_requires_between_
/**
- * Print a message for when an entry setting action has the incorrect number of parameters when the required amount is fixed.
+ * Print a message for when an Entry setting Action has the incorrect number of parameters when the required amount is fixed.
*
* @param print
* The output structure to print to.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param total
* The expected number of arguments.
*
#endif // _di_controller_print_error_entry_setting_requires_exactly_
/**
- * Print an error message about an entry setting value not being a supported number.
+ * Print an error message about an Entry setting value not being a supported number.
*
* This utilizes the buffer and range because the number is not supported and therefore the string cannot be converted to a number.
*
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param buffer
* The buffer containing the settings.
* @param range
* @param function
* The name of the function associated with the error.
* @param is_entry
- * If TRUE, then this operates as an entry.
- * If FALSE, then this operates as an exit.
+ * If TRUE, then this operates as an Entry.
+ * If FALSE, then this operates as an Exit.
*
* @return
* F_okay on success.
}
if (action->name_item.used) {
- fl_print_format("rule %r '%]", print->to, item ? controller_item_s : controller_settings_s, print->context);
+ fl_print_format("Rule %r '%]", print->to, item ? controller_item_s : controller_settings_s, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, action->name_item, print->notable);
fl_print_format("%[' on line%] ", print->to, print->context, print->context);
fl_print_format(f_string_format_un_single_s.string, print->to, print->notable, action->line_item, print->notable);
}
if (action->name_file.used) {
- fl_print_format("rule file '%]%[%Q%]%['", print->to, print->context, print->notable, action->name_file, print->notable, print->context);
+ fl_print_format("Rule file '%]%[%Q%]%['", print->to, print->context, print->notable, action->name_file, print->notable, print->context);
}
fl_print_format(".%]%r", print->to, print->context, f_string_eol_s);
controller_lock_print(print->to, &main->thread);
- fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format("%r%[%QThe Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
fl_print_format("%[' is already on the execution dependency stack, this recursion is prohibited.%]%r", print->to, print->context, print->context, f_string_eol_s);
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print rule error functionality.
+ * Provides the print Rule error functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* Must not be NULL.
* @param action
- * The action cache.
+ * The Action cache.
*
* Must not be NULL.
* @param status
* Set to F_true to print the fallback error message for unknown errors.
* @param item
* If TRUE, then this error is associated with an item.
- * If FALSE, then this error is associated with a rule setting.
+ * If FALSE, then this error is associated with a Rule setting.
*
* @return
* F_okay on success.
*
* Must not be NULL.
* @param action
- * The action cache.
+ * The Action cache.
*
* This uses:
* - action.line_action
* Must not be NULL.
* @param item
* If TRUE, then this error is associated with an item.
- * If FALSE, then this error is associated with a rule setting.
+ * If FALSE, then this error is associated with a Rule setting.
*
* @return
* F_okay on success.
#endif // _di_controller_print_error_rule_cache_
/**
- * Print error regarding the rule already being on the execution stack.
+ * Print error regarding the Rule already being on the execution stack.
*
* @param print
* The output structure to print to.
*
* Must not be NULL.
* @param action
- * The action cache.
+ * The Action cache.
*
* Must not be NULL.
* @param name
- * The rule name.
+ * The Rule name.
* @param item
* If TRUE, then this error is associated with an item.
- * If FALSE, then this error is associated with a rule setting.
+ * If FALSE, then this error is associated with a Rule setting.
*
* @return
* F_okay on success.
controller_lock_print(print->to, &main->thread);
- fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format("%r%[%QThe Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, alias, print->notable);
- fl_print_format("%[' is not designating a pid file.%]%r", print->to, print->context, print->context, f_string_eol_s);
+ fl_print_format("%[' is not designating a PID file.%]%r", print->to, print->context, print->context, f_string_eol_s);
controller_print_error_rule_cache(print, action, F_true);
controller_lock_print(print->to, &main->thread);
- fl_print_format("%r%[%QUnsupported action type '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format("%r%[%QUnsupported Action type '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, type, print->notable);
fl_print_format("%[' while attempting to %S.%]%r", print->to, print->context, message, print->context, f_string_eol_s);
controller_lock_print(print->to, &main->thread);
if (total) {
- fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format("%r%[%QThe Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
fl_print_format("%[' has no '%]", print->to, print->context, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, type, print->notable);
- fl_print_format("%[' action to execute.%]%r", print->to, print->context, print->context, f_string_eol_s);
+ fl_print_format("%[' Action to execute.%]%r", print->to, print->context, print->context, f_string_eol_s);
}
else {
- fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format("%r%[%QThe Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, name, print->notable);
fl_print_format("%[ has no known '%]", print->to, print->context, print->context);
fl_print_format("%[%r %r%]", print->to, print->notable, controller_rule_s, controller_type_s, print->notable);
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry action error functionality.
+ * Provides the print Entry Action error functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
* @param buffer
* The buffer containing the setting name.
* @param range
- * The range within the buffer representing the unknown action name.
+ * The range within the buffer representing the unknown Action name.
*
* @return
* F_okay on success.
#endif // _di_controller_print_error_rule_action_fss_0003_unsupported_
/**
- * Print an error or warning message about some rule not having the PID file information.
+ * Print an error or warning message about some Rule not having the PID file information.
*
* @param print
* The output structure to print to.
*
* Must not be NULL.
* @param action
- * The action cache.
+ * The Action cache.
*
* Must not be NULL.
* @param type
* The Action type name.
* @param message
- * A specific message on what is being attempted by the action.
+ * A specific message on what is being attempted by the Action.
*
* @return
* F_okay on success.
* @param buffer
* The buffer containing the setting name.
* @param range
- * The range within the buffer representing the unknown action name.
+ * The range within the buffer representing the unknown Action name.
*
* @return
* F_okay on success.
*
* Must not be NULL.
* @param action
- * The action cache.
+ * The Action cache.
*
* Must not be NULL.
* @param name
}
#endif // _di_controller_print_error_rule_item_execute_
+#ifndef _di_controller_print_error_rule_item_execute_none_
+ f_status_t controller_print_error_rule_item_execute_none(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t alias) {
+
+ if (!print || !print->custom) return F_status_set_error(F_output_not);
+ if (print->verbosity < f_console_verbosity_error_e) return F_output_not;
+
+ controller_t * const main = (controller_t *) print->custom;
+
+ controller_lock_print(print->to, &main->thread);
+
+ fl_print_format("%r%[%QThe Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, alias, print->notable);
+ fl_print_format("%[' has no Items to execute.%]%r", print->to, print->context, print->context, f_string_eol_s);
+
+ controller_unlock_print_flush(print->to, &main->thread);
+ }
+#endif // _di_controller_print_error_rule_item_execute_none_
+
#ifndef _di_controller_print_error_rule_item_need_want_wish_
f_status_t controller_print_error_rule_item_need_want_wish(fl_print_t * const print, const f_string_static_t need_want_wish, const f_string_static_t value, const f_string_t why) {
if (print->verbosity == f_console_verbosity_quiet_e) return F_output_not;
- fl_print_format("%r%[%QThe %r rule '%]", print->to, f_string_eol_s, print->context, print->prefix, need_want_wish, print->context);
+ fl_print_format("%r%[%QThe %r Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, need_want_wish, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, value, print->notable);
fl_print_format("%[' %S.%]%r", print->to, print->context, why, print->context, f_string_eol_s);
controller_lock_print(print->to, &main->thread);
- fl_print_format("%r%[%QThe rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format("%r%[%QThe Rule '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, alias, print->notable);
fl_print_format("%[' is no longer loaded.%]%r", print->to, print->context, print->context, f_string_eol_s);
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry item error functionality.
+ * Provides the print Entry Item error functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
* Must not be NULL.
* @param item
* If TRUE, then this error is associated with an item.
- * If FALSE, then this error is associated with a rule setting.
+ * If FALSE, then this error is associated with a Rule setting.
* @param status
* The status code representing the failure (without the error bit set).
*
#endif // _di_controller_print_error_rule_item_execute_
/**
- * Print an error or warning message related to need/want/wish settings of some rule.
+ * Print an error about a Rule have no Items to execute.
+ *
+ * @param print
+ * The output structure to print to.
+ *
+ * This requires print.custom to be controller_t.
+ *
+ * This does not alter print.custom.setting.state.status.
+ *
+ * Must not be NULL.
+ * @param action
+ * The Action cache.
+ *
+ * Must not be NULL.
+ * @param alias
+ * The Rule alias of the Rule that has no Items.
+ *
+ * @return
+ * F_okay on success.
+ * F_output_not on success, but no printing is performed.
+ *
+ * F_output_not (with error bit) if setting is NULL.
+ */
+#ifndef _di_controller_print_error_rule_item_execute_none_
+ extern f_status_t controller_print_error_rule_item_execute_none(fl_print_t * const print, controller_cache_action_t * const action, const f_string_static_t alias);
+#endif // _di_controller_print_error_rule_item_execute_none_
+
+/**
+ * Print an error or warning message related to need/want/wish settings of some Rule.
*
* @param print
* The output structure to print to.
#endif // _di_controller_print_error_rule_item_need_want_wish_
/**
- * Print an error or warning message about some rule not being loaded.
+ * Print an error or warning message about some Rule not being loaded.
*
* @param print
* The output structure to print to.
controller_lock_print(print->to, &main->thread);
- fl_print_format("%r%[%QThe first value for the rule setting '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format("%r%[%QThe first value for the Rule setting '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, controller_on_s, print->notable);
fl_print_format("%[' has '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_range_single_s.string, print->to, print->notable, buffer, range, print->notable);
controller_lock_print(print->to, &main->thread);
- fl_print_format("%r%[%QThe second value for the rule setting '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format("%r%[%QThe second value for the Rule setting '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, controller_on_s, print->notable);
fl_print_format("%[' has '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_range_single_s.string, print->to, print->notable, buffer, range, print->notable);
controller_lock_print(print->to, &main->thread);
- fl_print_format("%r%[%QThe first value for the rule setting '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
+ fl_print_format("%r%[%QThe first value for the Rule setting '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_single_s.string, print->to, print->notable, controller_timeout_s, print->notable);
fl_print_format("%[' has '%]", print->to, f_string_eol_s, print->context, print->prefix, print->context);
fl_print_format(f_string_format_Q_range_single_s.string, print->to, print->notable, buffer, range, print->notable);
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry setting error functionality.
+ * Provides the print Entry setting error functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Print a message about a rule setting problem.
+ * Print a message about a Rule setting problem.
*
* This is intended to be explicitly called by controller_rule_setting_read().
* This is intended only to be used for simple messages.
#endif // _di_controller_print_error_rule_setting_
/**
- * Print a message about a rule setting problem given a specified reason and providing the setting name or value.
+ * Print a message about a Rule setting problem given a specified reason and providing the setting name or value.
*
* @param print
* The output structure to print to.
#endif // _di_controller_print_error_rule_setting_reason_name_
/**
- * Print a message about a rule setting problem, with additional messages about the value.
+ * Print a message about a Rule setting problem, with additional messages about the value.
*
* This is intended to be explicitly called by controller_rule_setting_read().
* This is intended only to be used for simple messages.
fll_program_print_help_usage(print, controller_program_name_s, f_string_empty_s);
fl_print_format("%r When both the %[%r%r%] parameter and the", print->to, f_string_eol_s, print->set->notable, f_console_symbol_long_normal_s, controller_long_simulate_s, print->set->notable);
- fl_print_format(" %[%r%r%] parameter are specified, then additional information on each would be executed rule is printed but no simulation is performed.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, controller_long_validate_s, print->set->notable, f_string_eol_s, f_string_eol_s);
+ fl_print_format(" %[%r%r%] parameter are specified, then additional information on each would be executed Rule is printed but no simulation is performed.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, controller_long_validate_s, print->set->notable, f_string_eol_s, f_string_eol_s);
fl_print_format(" The default interrupt behavior is to operate as if the %[%r%r%] parameter is passed.%r%r", print->to, print->set->notable, f_console_symbol_long_normal_s, uninterrupt ? controller_long_uninterruptible_s : controller_long_interruptible_s, print->set->notable, f_string_eol_s, f_string_eol_s);
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry message functionality.
+ * Provides the print Entry message functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Print message about the specified entry being in the given state.
+ * Print message about the specified Entry being in the given state.
*
* This generally only applies to the "ready" Entry Item Action.
*
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param name
* The name of the state.
*
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry action message functionality.
+ * Provides the print Entry Action message functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* Must not be NULL.
* @param action
- * The entry action.
+ * The Entry Action.
*
* Must not be NULL.
*
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param name
* The item name.
*
#endif // _di_controller_print_message_entry_action_ready_
/**
- * Print message about entry action state.
+ * Print message about Entry Action state.
*
* @param print
* The output structure to print to.
*
* Must not be NULL.
* @param action
- * The entry action.
+ * The Entry Action.
*
* Must not be NULL.
*
#endif // _di_controller_print_message_entry_action_state_
/**
- * Print message about entry action state having failed.
+ * Print message about Entry Action state having failed.
*
* @param print
* The output structure to print to.
*
* Must not be NULL.
* @param action
- * The entry action.
+ * The Entry Action.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
*
* @return
* F_okay on success.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param name
* The item name.
*
controller_lock_print(print->to, &main->thread);
- fl_print_format("%r%r %r item rule ", print->to, f_string_eol_s, action->type == controller_entry_action_type_consider_e ? controller_print_entry_considering_s : controller_print_entry_processing_s, is_entry ? controller_entry_s : controller_exit_s);
+ fl_print_format("%r%r %r Item Rule ", print->to, f_string_eol_s, action->type == controller_entry_action_type_consider_e ? controller_print_entry_considering_s : controller_print_entry_processing_s, is_entry ? controller_entry_s : controller_exit_s);
fl_print_format("'%[%Q%]'", print->to, print->set->title, alias_rule, print->set->title);
if (entry->show == controller_entry_show_init_e && !(main->setting.flag & controller_main_flag_simulate_e)) {
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry item message functionality.
+ * Provides the print Entry Item message functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* This does not alter print.custom.setting.state.status.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param failsafe
* If TRUE, then running in failsafe.
* If FALSE, then running normally.
#endif // _di_controller_print_message_entry_item_done_
/**
- * Print message about the entry item executing.
+ * Print message about the Entry Item executing.
*
* @param print
* The output structure to print to.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param parameters
* The array of parameters.
*
*
* This does not alter print.custom.setting.state.status.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param prepend
- * A string to prepend before entry string in the message.
- * When prepend.used is not 0, then a space is also printed between entry string and the prepend string.
+ * A string to prepend before Entry string in the message.
+ * When prepend.used is not 0, then a space is also printed between Entry string and the prepend string.
* Set prepend.used to 0 to disable.
* @param name
* The item name.
#endif // _di_controller_print_message_entry_item_process_
/**
- * Print message about a problem with an entry item.
+ * Print message about a problem with an Entry Item.
*
* @param print
* The output structure to print to.
*
* This does not alter print.custom.setting.state.status.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param name
* The item name.
* @param reason
- * The reason regarding the problem with the required entry item.
+ * The reason regarding the problem with the required Entry Item.
*
* @return
* F_okay on success.
*
* Must not be NULL.
* @param entry
- * The entry.
+ * The Entry.
*
* Must not be NULL.
* @param action
- * The entry action.
+ * The Entry Action.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param alias_rule
* The Rule alias name.
*
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry setting output functionality.
+ * Provides the print Entry setting output functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this operates as an entry.
- * If FALSE, then this operates as an exit.
+ * If TRUE, then this operates as an Entry.
+ * If FALSE, then this operates as an Exit.
* @param name
* The Object name of the setting being populated.
* @param name_sub
#endif // _di_controller_print_output_entry_setting_simulate_value_
/**
- * Print a simulated execution of the given entry.
+ * Print a simulated execution of the given Entry.
*
* @param print
* The output structure to print to.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this is an entry.
- * If FALSE, then this is an exit.
+ * If TRUE, then this is an Entry.
+ * If FALSE, then this is an Exit.
*
* @return
* F_okay on success.
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print output rule execute functionality.
+ * Provides the print output Rule execute functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print output rule "setting" functionality.
+ * Provides the print output Rule "setting" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
f_number_unsigned_t i = 0;
f_number_unsigned_t j = 0;
- // Find at least one of the requested action.
+ // Find at least one of the requested Action.
{
bool missing = F_true;
if (rule->items.used) {
fl_print_format("%rRule '", print->to, f_string_eol_s);
fl_print_format("%[%Q%]' has no '", print->to, print->set->title, rule->name, print->set->title);
- fl_print_format("%[%r%]' action to execute and would '", print->to, print->set->title, controller_convert_rule_action_type_string(action), print->set->title);
+ fl_print_format("%[%r%]' Action to execute and would '", print->to, print->set->title, controller_convert_rule_action_type_string(action), print->set->title);
fl_print_format("%[%r%]' because it is '", print->to, print->set->important, options & controller_instance_option_require_e ? controller_fail_s : controller_succeed_s, print->set->important);
fl_print_format("%[%r%]'.%r", print->to, print->set->important, options & controller_instance_option_require_e ? controller_required_s : controller_optional_s, print->set->important, f_string_eol_s);
}
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print output rule "validate" functionality.
+ * Provides the print output Rule "validate" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Perform a simulated execution of the given rule.
+ * Perform a simulated execution of the given Rule.
*
- * This simply prints information about the rule.
+ * This simply prints information about the Rule.
*
* This automatically sets the rule's status to F_complete.
*
*
* Must not be NULL.
* @param rule
- * The rule to process.
+ * The Rule to process.
*
* Must not be NULL.
* @param action
* @param options
* A number using bits to represent specific boolean options.
* If no bits set, then operate normally in a synchronous manner.
- * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
+ * If bit controller_instance_option_simulate_e, then the Rule execution is in simulation mode (printing a message that the Rule would be executed but does not execute the rule).
* If bit controller_instance_option_asynchronous_e, then run asynchronously.
*
* @return
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry action warning functionality.
+ * Provides the print Entry Action warning functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
*
* @return
* F_okay on success.
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param name
* The item name.
*
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry item warning functionality.
+ * Provides the print Entry Item warning functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param name
* The item name.
*
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print entry setting warning functionality.
+ * Provides the print Entry setting warning functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param name
* The parameter name whose value is unknown.
*
*
* Must not be NULL.
* @param is_entry
- * If TRUE, then this loads as an entry.
- * If FALSE, then this loads as an exit.
+ * If TRUE, then this loads as an Entry.
+ * If FALSE, then this loads as an Exit.
* @param name
* The parameter name whose value is unknown.
* @param buffer
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the print rule action warning functionality.
+ * Provides the print Rule action warning functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* Must not be NULL.
* @param action
- * The action cache.
+ * The Action cache.
*
* Must not be NULL.
* @param name
*
* Must not be NULL.
* @param action
- * The action cache.
+ * The Action cache.
*
* Must not be NULL.
* @param name
}
}
- // Only make the rule and control threads available once any/all pre-processing is complete.
+ // Only make the Rule and control threads available once any/all pre-processing is complete.
if (F_status_is_error_not(status) && status != F_failure && status != F_child && main->thread.enabled == controller_thread_enabled_e) {
if (!(main->setting.flag & controller_main_flag_validate_e)) {
- // Wait for the entry thread to complete before starting the rule thread.
+ // Wait for the Entry thread to complete before starting the Rule thread.
controller_thread_join(&main->thread.id_rule);
if (main->thread.enabled && main->process.mode == controller_process_mode_service_e) {
if (F_status_is_error(status)) {
controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status));
-
- return status;
}
return status;
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides rule functionality.
+ * Provides Rule functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
/**
* Copy a rule, allocating new space as necessary.
*
- * This does not do any locking or unlocking for the rule data, be sure to lock appropriately before and after calling this.
+ * This does not do any locking or unlocking for the Rule data, be sure to lock appropriately before and after calling this.
*
* @param source
- * The source rule to copy from.
+ * The source Rule to copy from.
* @param destination
- * The destination rule to copy to.
+ * The destination Rule to copy to.
*
* Must not be NULL.
*
* @param rules
* The rules to search through.
* @param at
- * (optional) The index the rule was found at.
+ * (optional) The index the Rule was found at.
*
* Set to NULL to disable.
*
* @return
* F_okay on success, but the id.used is 0.
- * F_true on success and rule was found, index is updated.
- * F_false on success and rule was not found.
+ * F_true on success and Rule was found, index is updated.
+ * F_false on success and Rule was not found.
*/
#ifndef _di_controller_rule_find_
extern f_status_t controller_rule_find(const f_string_static_t alias, const controller_rules_t rules, f_number_unsigned_t * const at);
* @param source
* The source string that both the directory and basename are copied from.
* @param directory
- * A range within the source representing the directory part of a rule id.
+ * A range within the source representing the directory part of a Rule id.
* @param basename
- * A range within the source representing the basename part of a rule id.
+ * A range within the source representing the basename part of a Rule id.
* @param alias
* The constructed alias.
*
#endif // _di_controller_rule_action_type_to_action_execute_type_
#ifndef _di_controller_rule_action_read_
- f_status_t controller_rule_action_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, const uint8_t type, const uint8_t method, controller_rule_item_t * const item, controller_rule_actions_t * const actions, f_range_t * const range) {
+ void controller_rule_action_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, const uint8_t type, const uint8_t method, controller_rule_item_t * const item, controller_rule_actions_t * const actions, f_range_t * const range, f_state_t * const state) {
- if (!main || !item || !actions || !range) return F_status_set_error(F_parameter);
+ if (!state) return;
- controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_normal, main);
- f_state_t state = macro_f_state_t_initialize_1(controller_allocation_large_d, controller_allocation_small_d, F_okay, 0, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
+ if (!main || !cache || !item || !actions || !range) {
+ state->status = F_status_set_error(F_parameter);
+
+ return;
+ }
f_number_unsigned_t i = 0;
cache->content_action.used = 0;
if (method == controller_rule_action_method_extended_list_e) {
- fl_fss_extended_list_content_read(cache->buffer_item, range, &cache->content_action, &cache->delimits, &cache->comments, &state);
+ fl_fss_extended_list_content_read(cache->buffer_item, range, &cache->content_action, &cache->delimits, &cache->comments, state);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(fl_fss_extended_list_content_read));
- return state.status;
+ return;
}
- if (state.status == F_fss_found_content) {
- f_fss_apply_delimit(cache->delimits, &cache->buffer_item, &state);
+ if (state->status == F_fss_found_content) {
+ f_fss_apply_delimit(cache->delimits, &cache->buffer_item, state);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(f_fss_apply_delimit));
- return state.status;
+ return;
}
// The "script" and "utility" types use the entire content and can be directly passed through at index 0.
if (item->type == controller_rule_item_type_script_e || item->type == controller_rule_item_type_utility_e) {
actions->array[actions->used].parameters.used = 0;
- state.status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &actions->array[actions->used].parameters.array, &actions->array[actions->used].parameters.used, &actions->array[actions->used].parameters.size);
+ state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &actions->array[actions->used].parameters.array, &actions->array[actions->used].parameters.used, &actions->array[actions->used].parameters.size);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase));
- return state.status;
+ return;
}
- state.status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size);
+ state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase));
- return state.status;
+ return;
}
actions->array[actions->used].type = type;
actions->array[actions->used].line = cache->action.line_action;
actions->array[actions->used].status = F_known_not;
- state.status = f_string_dynamic_partial_append_nulless(cache->buffer_item, cache->content_action.array[0], &actions->array[actions->used].parameters.array[0]);
+ state->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(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(f_string_dynamic_append_nulless));
- actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state.status));
+ actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state->status));
- return state.status;
+ return;
}
if (actions->array[actions->used].parameters.array[0].used) {
- state.step_large = controller_allocation_iki_large_d;
- state.step_small = controller_allocation_iki_small_d;
- state.interrupt = &controller_thread_signal_state_iki;
+ const uint16_t old_step_large = state->step_large;
+ const uint16_t old_step_small = state->step_small;
+ void * const old_interrupt = state->interrupt;
+
+ state->step_large = controller_allocation_iki_large_d;
+ state->step_small = controller_allocation_iki_small_d;
+ state->interrupt = &controller_thread_signal_state_iki;
f_range_t range_iki = macro_f_range_t_initialize_2(actions->array[actions->used].parameters.array[0].used);
- fl_iki_read(&actions->array[actions->used].parameters.array[0], &range_iki, &actions->array[actions->used].ikis.array[0], &state);
+ fl_iki_read(&actions->array[actions->used].parameters.array[0], &range_iki, &actions->array[actions->used].ikis.array[0], state);
+
+ state->step_large = old_step_large;
+ state->step_small = old_step_small;
+ state->interrupt = old_interrupt;
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(fl_iki_read));
- actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state.status));
+ actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state->status));
- return state.status;
+ return;
}
}
actions->array[actions->used].ikis.used = 1;
actions->array[actions->used++].parameters.used = 1;
- return state.status;
+ return;
}
cache->delimits.used = 0;
- // The object_actions and content_actions caches are being used for the purposes of getting the parameters a given the action.
- fll_fss_extended_read(cache->buffer_item, &cache->content_action.array[0], &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0, &state);
+ // The object_actions and content_actions caches are being used for the purposes of getting the parameters a given the Action.
+ fll_fss_extended_read(cache->buffer_item, &cache->content_action.array[0], &cache->object_actions, &cache->content_actions, 0, 0, &cache->delimits, 0, state);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(fll_fss_extended_read));
- return state.status;
+ return;
}
- f_fss_apply_delimit(cache->delimits, &cache->buffer_item, &state);
+ f_fss_apply_delimit(cache->delimits, &cache->buffer_item, state);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(f_fss_apply_delimit));
- return state.status;
+ return;
}
for (i = 0; i < cache->object_actions.used; ++i) {
- state.status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_rule_action_t), (void **) &actions->array, &actions->used, &actions->size);
+ state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_rule_action_t), (void **) &actions->array, &actions->used, &actions->size);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase));
- return state.status;
+ return;
}
- f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &actions->array[actions->used].line, &state);
+ f_fss_count_lines(cache->buffer_item, cache->object_actions.array[i].start, &actions->array[actions->used].line, state);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(f_fss_count_lines));
- return state.status;
+ return;
}
actions->array[actions->used].type = type;
actions->array[actions->used].line += ++item->line;
actions->array[actions->used].status = F_known_not;
- state.status = controller_rule_parameters_read(main, cache->buffer_item, &cache->object_actions.array[i], &cache->content_actions.array[i], &actions->array[actions->used], &state);
+ controller_rule_parameters_read(main, cache->buffer_item, &cache->object_actions.array[i], &cache->content_actions.array[i], &actions->array[actions->used], state);
- if (F_status_is_error(state.status)) {
- actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state.status));
+ if (F_status_is_error(state->status)) {
+ actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state->status));
- return state.status;
+ return;
}
- actions->array[actions->used++].status = state.status;
+ actions->array[actions->used++].status = state->status;
} // for
range->start = cache->content_action.array[0].start;
}
else {
- state.status = F_data_not;
+ state->status = F_data_not;
}
}
else {
- fl_fss_extended_content_read(cache->buffer_item, range, &cache->content_action, 0, &cache->delimits, &state);
+ fl_fss_extended_content_read(cache->buffer_item, range, &cache->content_action, 0, &cache->delimits, state);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(fll_fss_extended_content_read));
}
- else if (state.status == F_fss_found_content) {
- f_fss_apply_delimit(cache->delimits, &cache->buffer_item, &state);
+ else if (state->status == F_fss_found_content) {
+ f_fss_apply_delimit(cache->delimits, &cache->buffer_item, state);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(f_fss_apply_delimit));
}
else if (type == controller_rule_action_type_pid_file_e) {
item->pid_file.used = 0;
- state.status = f_rip_dynamic_partial(cache->buffer_item, cache->content_action.array[0], &item->pid_file);
+ state->status = f_rip_dynamic_partial(cache->buffer_item, cache->content_action.array[0], &item->pid_file);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(f_rip_dynamic_partial));
}
}
}
if (!type_rerun) {
+ state->status = F_status_set_error(F_valid_not);
+
controller_print_error_rule_action_first(&main->program.error, &cache->action, cache->buffer_item, cache->content_action.array[0]);
- return F_status_set_error(F_valid_not);
+ return;
}
controller_rule_rerun_item_t *rerun_item = 0;
}
}
else {
+ state->status = F_status_set_error(F_valid_not);
+
controller_print_error_rule_action_second(&main->program.error, &cache->action, cache->buffer_item, cache->content_action.array[1]);
- return F_status_set_error(F_valid_not);
+ return;
}
for (i = 2; i < cache->content_action.used; ++i) {
if (f_compare_dynamic_partial_string(controller_delay_s.string, cache->buffer_item, controller_delay_s.used, cache->content_action.array[i]) == F_equal_to) {
- state.status = controller_rule_action_read_rerun_number(main, cache, controller_delay_s, &i, &rerun_item->delay);
+ state->status = controller_rule_action_read_rerun_number(main, cache, controller_delay_s, &i, &rerun_item->delay);
}
else if (f_compare_dynamic_partial_string(controller_max_s.string, cache->buffer_item, controller_max_s.used, cache->content_action.array[i]) == F_equal_to) {
- state.status = controller_rule_action_read_rerun_number(main, cache, controller_max_s, &i, &rerun_item->max);
+ state->status = controller_rule_action_read_rerun_number(main, cache, controller_max_s, &i, &rerun_item->max);
}
else if (f_compare_dynamic_partial_string(controller_reset_s.string, cache->buffer_item, controller_reset_s.used, cache->content_action.array[i]) == F_equal_to) {
item->reruns[type_rerun].is |= rerun_item == &item->reruns[type_rerun].failure ? controller_rule_rerun_is_failure_reset_d : controller_rule_rerun_is_success_reset_d;
}
else {
+ state->status = F_status_set_error(F_valid_not);
+
controller_print_error_rule_action_unknown(&main->program.error, &cache->action, controller_rerun_s, cache->buffer_item, cache->content_action.array[i]);
- return F_status_set_error(F_valid_not);
+ return;
}
} // for
}
else {
controller_print_error_rule_action_unknown(&main->program.error, &cache->action, controller_with_s, cache->buffer_item, cache->content_action.array[i]);
- state.status = F_status_set_error(F_valid_not);
+ state->status = F_status_set_error(F_valid_not);
break;
}
} // for
}
else if (item->type == controller_rule_item_type_script_e || item->type == controller_rule_item_type_utility_e) {
- state.status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &actions->array[actions->used].parameters.array, &actions->array[actions->used].parameters.used, &actions->array[actions->used].parameters.size);
+ state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &actions->array[actions->used].parameters.array, &actions->array[actions->used].parameters.used, &actions->array[actions->used].parameters.size);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase));
- return state.status;
+ return;
}
- state.status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size);
+ state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &actions->array[actions->used].ikis.array, &actions->array[actions->used].ikis.used, &actions->array[actions->used].ikis.size);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(f_memory_array_increase));
- return state.status;
+ return;
}
// The "script" types use the entire content as a single string piped to the script, so merge all arguments together.
for (i = 0; i < cache->content_action.used; ++i) {
- state.status = f_string_dynamic_partial_mash_nulless(f_string_space_s, cache->buffer_item, cache->content_action.array[i], &actions->array[actions->used].parameters.array[0]);
- if (F_status_is_error(state.status)) break;
+ state->status = f_string_dynamic_partial_mash_nulless(f_string_space_s, cache->buffer_item, cache->content_action.array[i], &actions->array[actions->used].parameters.array[0]);
+ if (F_status_is_error(state->status)) break;
} // for
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(f_string_dynamic_partial_mash_nulless));
- actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state.status));
+ actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state->status));
- return state.status;
+ return;
}
if (actions->array[actions->used].parameters.array[0].used) {
- state.step_large = controller_allocation_iki_large_d;
- state.step_small = controller_allocation_iki_small_d;
- state.interrupt = &controller_thread_signal_state_iki;
+ const uint16_t old_step_large = state->step_large;
+ const uint16_t old_step_small = state->step_small;
+ void * const old_interrupt = state->interrupt;
+
+ state->step_large = controller_allocation_iki_large_d;
+ state->step_small = controller_allocation_iki_small_d;
+ state->interrupt = &controller_thread_signal_state_iki;
f_range_t range_iki = macro_f_range_t_initialize_2(actions->array[actions->used].parameters.array[0].used);
- fl_iki_read(&actions->array[actions->used].parameters.array[0], &range_iki, &actions->array[actions->used].ikis.array[0], &state);
+ fl_iki_read(&actions->array[actions->used].parameters.array[0], &range_iki, &actions->array[actions->used].ikis.array[0], state);
+
+ state->step_large = old_step_large;
+ state->step_small = old_step_small;
+ state->interrupt = old_interrupt;
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(fl_iki_read));
- actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state.status));
+ actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state->status));
- return state.status;
+ return;
}
}
actions->array[actions->used++].parameters.used = 1;
}
else {
- f_fss_count_lines(cache->buffer_item, range->start, &actions->array[actions->used].line, &state);
+ f_fss_count_lines(cache->buffer_item, range->start, &actions->array[actions->used].line, state);
- if (F_status_is_error(state.status)) {
+ if (F_status_is_error(state->status)) {
controller_print_error(&main->program.error, macro_controller_f(f_fss_count_lines));
- return state.status;
+ return;
}
actions->array[actions->used].type = type;
actions->array[actions->used].line += ++item->line;
actions->array[actions->used].status = F_known_not;
- state.status = controller_rule_parameters_read(main, cache->buffer_item, 0, &cache->content_action, &actions->array[actions->used], &state);
+ controller_rule_parameters_read(main, cache->buffer_item, 0, &cache->content_action, &actions->array[actions->used], state);
- if (F_status_is_error(state.status)) {
- actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state.status));
+ if (F_status_is_error(state->status)) {
+ actions->array[actions->used++].status = controller_error_simplify(F_status_set_fine(state->status));
- return state.status;
+ return;
}
- actions->array[actions->used++].status = state.status;
+ actions->array[actions->used++].status = state->status;
}
}
else {
- state.status = F_data_not;
+ state->status = F_data_not;
}
}
- if (F_status_is_error_not(state.status) && state.status == F_data_not) {
+ if (F_status_is_error_not(state->status) && state->status == F_data_not) {
controller_print_debug_rule_action_empty(&main->program.debug, cache);
}
-
- return state.status;
}
#endif // _di_controller_rule_action_read_
controller_print_error_rule_action_positive_number_not(&main->program.error, &cache->action, name, cache->buffer_item, cache->content_action, *index, status);
}
}
-
- return status;
+ }
+ else {
+ *number = (f_number_unsigned_t) parsed;
+ status = F_okay;
}
- *number = (f_number_unsigned_t) parsed;
-
- return F_okay;
+ return status;
}
#endif // _di_controller_rule_action_read_rerun_number_
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the rule "action" functionality.
+ * Provides the Rule "action" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Get a string representing the rule action method.
+ * Get a string representing the Rule Action method.
*
* @param type
- * The rule action type code.
+ * The Rule Action type code.
*
* @return
* The string with used > 0 on success.
#endif // _di_controller_rule_action_method_name_
/**
- * Convert the action type to an action execute type.
+ * Convert the Action type to an Action execute type.
*
* @param type
- * The action type to convert from.
+ * The Action type to convert from.
*
* @return
- * The converted action type, converted into an action execute type.
+ * The converted Action type, converted into an Action execute type.
*
* The code controller_rule_action_execute_type__enum_size_e is returned for unknown types.
*/
#endif // _di_controller_rule_action_type_to_action_execute_type_
/**
- * Read the content within the buffer, processing the action (or a set of within a list) for the given item.
+ * Read the content within the buffer, processing the Action (or a set of within a list) for the given item.
*
* This will automatically increase the size of the actions array as needed.
*
*
* Must not be NULL.
* @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.
+ * 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 type
- * The action type for this action or set of actions.
+ * The Action type for this Action or set of actions.
* @param method
- * The action method for this action or set of actions.
+ * The Action method for this Action or set of actions.
* @param item
* The processed item.
*
* This is expected to be set to a position immediately after a valid object read.
*
* Must not be NULL.
+ * @param state
+ * The state information.
*
- * @return
- * F_okay on success.
+ * This alters state.status:
+ * F_okay on success.
*
- * Errors (with error bit) from: controller_rule_parameters_read().
- * Errors (with error bit) from: f_fss_count_lines().
- * Errors (with error bit) from: f_memory_array_increase_by().
+ * Errors (with error bit) from: controller_rule_parameters_read().
+ * Errors (with error bit) from: f_fss_count_lines().
+ * Errors (with error bit) from: f_memory_array_increase_by().
+ *
+ * Must not be NULL.
*
* @see controller_rule_parameters_read()
* @see f_fss_count_lines()
* @see f_memory_array_increase_by()
*/
#ifndef _di_controller_rule_action_read_
- extern f_status_t controller_rule_action_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, const uint8_t type, const uint8_t method, controller_rule_item_t * const item, controller_rule_actions_t * const actions, f_range_t * const range);
+ extern void controller_rule_action_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, const uint8_t type, const uint8_t method, controller_rule_item_t * const item, controller_rule_actions_t * const actions, f_range_t * const range, f_state_t * const state);
#endif // _di_controller_rule_action_read_
/**
- * Process a number from a rule file, incrementing index as necessary.
+ * Process a number from a Rule file, incrementing index as necessary.
*
* This prints error messages as necessary.
*
* @param name
* The name representing the value whose number is being processed.
* @param index
- * The position within the content action array for some rule to process.
+ * The position within the content Action array for some Rule to process.
* @param number
* The processed number will be saved here.
*
f_signal_set_empty(&signals.block);
f_signal_set_fill(&signals.block_not);
- f_string_maps_t environment = f_string_maps_t_initialize;
+ instance->environment.used = 0;
- controller_execute_set_t execute_set = macro_controller_execute_set_t_initialize_1(0, 0, &environment, &signals, 0, fl_execute_as_t_initialize);
+ controller_execute_set_t execute_set = macro_controller_execute_set_t_initialize_1(0, 0, &instance->environment, &signals, 0, fl_execute_as_t_initialize);
if (instance->rule.affinity.used) {
execute_set.as.affinity = &instance->rule.affinity;
execute_set.as.id_user = &instance->rule.user;
}
- if (instance->rule.has & controller_rule_has_environment_d) {
- status = fl_environment_load_names(instance->rule.environment, &environment);
+ {
+ controller_entry_t * const entry = (instance->type == controller_instance_type_entry_e)
+ ? &main->process.entry
+ : (instance->type == controller_instance_type_exit_e)
+ ? &main->process.exit
+ : 0;
- if (F_status_is_error(status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(fl_environment_load_names), F_status_set_fine(status));
+ if (instance->rule.has & controller_rule_has_environment_d) {
+ status = fl_environment_load_names(instance->rule.environment, &instance->environment);
- return status;
- }
+ if (F_status_is_error(status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(fl_environment_load_names), F_status_set_fine(status));
- // When a "define" from the entry/exit is in the "environment", add it to the exported environments (and overwrite any existing environment variable of the same name).
- controller_entry_t *entry = 0;
+ return status;
+ }
- if (instance->type == controller_instance_type_entry_e) {
- entry = &main->process.entry;
- }
- else if (instance->type == controller_instance_type_exit_e) {
- entry = &main->process.exit;
- }
+ // When a "define" from the entry/exit is in the "environment", add it to the exported environments (and overwrite any existing environment variable of the same name).
+ if (entry) {
+ for (i = 0; i < entry->define.used; ++i) {
- if (entry) {
- for (i = 0; i < entry->define.used; ++i) {
+ for (j = 0; j < instance->rule.environment.used; ++j) {
- for (j = 0; j < instance->rule.environment.used; ++j) {
+ if (f_compare_dynamic(entry->define.array[i].key, instance->rule.environment.array[j]) == F_equal_to) {
+ for (k = 0; k < instance->environment.used; ++k) {
+
+ if (f_compare_dynamic(entry->define.array[i].key, instance->environment.array[k].key) == F_equal_to) {
+ instance->environment.array[k].value.used = 0;
+
+ status = f_string_dynamic_append(entry->define.array[i].value, &instance->environment.array[k].value);
+
+ if (F_status_is_error(status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
- if (f_compare_dynamic(entry->define.array[i].key, instance->rule.environment.array[j]) == F_equal_to) {
- for (k = 0; k < environment.used; ++k) {
+ return status;
+ }
- if (f_compare_dynamic(entry->define.array[i].key, environment.array[k].key) == F_equal_to) {
- environment.array[k].value.used = 0;
+ break;
+ }
+ } // for
- status = f_string_dynamic_append(entry->define.array[i].value, &environment.array[k].value);
+ if (k == instance->environment.used) {
+ status = f_string_maps_append(entry->define.array[i], &instance->environment);
if (F_status_is_error(status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
+ controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status));
return status;
}
-
- break;
}
- } // for
- if (k == environment.used) {
- status = f_string_maps_append(entry->define.array[i], &environment);
+ break;
+ }
+ } // for
+ } // for
+ }
- if (F_status_is_error(status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status));
+ // When a "define" is in the "environment", add it to the exported environments (and overwrite any existing environment variable of the same name).
+ for (i = 0; i < instance->rule.define.used; ++i) {
- return status;
- }
- }
+ for (j = 0; j < instance->rule.environment.used; ++j) {
- break;
- }
- } // for
- } // for
- }
+ if (f_compare_dynamic(instance->rule.define.array[i].key, instance->rule.environment.array[j]) == F_equal_to) {
- // When a "define" is in the "environment", add it to the exported environments (and overwrite any existing environment variable of the same name).
- for (i = 0; i < instance->rule.define.used; ++i) {
+ for (k = 0; k < instance->environment.used; ++k) {
- for (j = 0; j < instance->rule.environment.used; ++j) {
+ if (f_compare_dynamic(instance->rule.define.array[i].key, instance->environment.array[k].key) == F_equal_to) {
- if (f_compare_dynamic(instance->rule.define.array[i].key, instance->rule.environment.array[j]) == F_equal_to) {
+ instance->environment.array[k].value.used = 0;
- for (k = 0; k < environment.used; ++k) {
+ status = f_string_dynamic_append(instance->rule.define.array[i].value, &instance->environment.array[k].value);
- if (f_compare_dynamic(instance->rule.define.array[i].key, environment.array[k].key) == F_equal_to) {
+ if (F_status_is_error(status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
- environment.array[k].value.used = 0;
+ return status;
+ }
- status = f_string_dynamic_append(instance->rule.define.array[i].value, &environment.array[k].value);
+ break;
+ }
+ } // for
+
+ if (k == instance->environment.used) {
+ status = f_string_maps_append(instance->rule.define.array[i], &instance->environment);
if (F_status_is_error(status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_append), F_status_set_fine(status));
+ controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status));
return status;
}
-
- break;
}
- } // for
-
- if (k == environment.used) {
- status = f_string_maps_append(instance->rule.define.array[i], &environment);
-
- if (F_status_is_error(status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status));
- return status;
- }
+ break;
}
-
- break;
- }
+ } // for
} // for
- } // for
- }
- else {
- controller_entry_t *entry = 0;
-
- if (instance->type == controller_instance_type_entry_e) {
- entry = &main->process.entry;
- }
- else if (instance->type == controller_instance_type_exit_e) {
- entry = &main->process.exit;
}
+ else {
- // When a custom define is specified, it needs to be exported into the environment.
- if (entry->define.used || instance->rule.define.used) {
+ // When a custom define is specified, it needs to be exported into the environment.
+ if (entry->define.used || instance->rule.define.used) {
- // Copy all environment variables over when a custom define is used.
- status = f_environment_get_all(&environment);
+ // Copy all environment variables over when a custom define is used.
+ status = f_environment_get_all(&instance->environment);
- if (F_status_is_error(status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_environment_get_all), F_status_set_fine(status));
+ if (F_status_is_error(status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(f_environment_get_all), F_status_set_fine(status));
- return status;
- }
+ return status;
+ }
- for (i = 0; i < entry->define.used; ++i) {
+ for (i = 0; i < entry->define.used; ++i) {
- status = f_string_maps_append(entry->define.array[i], &environment);
+ status = f_string_maps_append(entry->define.array[i], &instance->environment);
- if (F_status_is_error(status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status));
+ if (F_status_is_error(status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status));
- return status;
- }
- } // for
+ return status;
+ }
+ } // for
- for (i = 0; i < instance->rule.define.used; ++i) {
+ for (i = 0; i < instance->rule.define.used; ++i) {
- status = f_string_maps_append(instance->rule.define.array[i], &environment);
+ status = f_string_maps_append(instance->rule.define.array[i], &instance->environment);
- if (F_status_is_error(status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status));
+ if (F_status_is_error(status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(f_string_maps_append), F_status_set_fine(status));
- return status;
- }
- } // for
- }
- else {
+ return status;
+ }
+ } // for
+ }
+ else {
- // When no custom environment variables are defined, just let the original environment pass through.
- execute_set.parameter.environment = 0;
+ // When no custom environment variables are defined, just let the original environment pass through.
+ execute_set.parameter.environment = 0;
+ }
}
}
}
} // for
- f_memory_arrays_resize(0, sizeof(f_string_map_t), (void **) &environment.array, &environment.used, &environment.size, &f_string_maps_delete_callback);
-
// Lock failed, attempt to re-establish lock before returning.
if (F_status_set_fine(status) == F_lock) {
status = controller_lock_read(instance->type != controller_instance_type_exit_e, &main->thread, &instance->lock);
success = F_false;
}
+ if (success == false && !instance->rule.items.used) {
+ controller_print_error_rule_item_execute_none(&main->program.error, &instance->cache.action, instance->rule.alias);
+ }
+
if (!controller_thread_is_enabled_instance(instance)) return F_status_set_error(F_interrupt);
if (status == F_child || F_status_is_error(status)) return status;
if (success == F_false || success == F_failure) return F_status_set_error(F_failure);
controller_print_error_lock_critical(&main->program.error, F_status_set_fine(status_lock), F_true);
}
- // The child instance should perform the change into background, therefore it is safe to wait for the child to exit (another instance is spawned).
+ // The child instance should perform the change into background, therefore it is safe to wait for the child to Exit (another instance is spawned).
if (F_status_set_fine(status_lock) != F_interrupt) {
waitpid(id_child, &result.status, 0);
}
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the rule "execute" functionality.
+ * Provides the Rule "execute" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Perform an execution of the given rule.
+ * Perform an execution of the given Rule.
*
* This requires that a read lock be set on process->lock before being called.
*
*
* This does not alter main.setting.state.status.
* @param action
- * The action to perform based on the action type codes.
+ * The Action to perform based on the Action type codes.
*
- * Only subset of the action type codes are supported:
+ * Only subset of the Action type codes are supported:
* - controller_rule_action_type_kill_e
* - controller_rule_action_type_pause_e
* - controller_rule_action_type_reload_e
* - controller_rule_action_type_stop_e
* @param options
* Process options to consider when executing.
- * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
+ * If bit controller_instance_option_simulate_e, then the Rule execution is in simulation mode (printing a message that the Rule would be executed but does not execute the rule).
* @param process
- * The process data for processing this rule.
+ * The process data for processing this Rule.
*
* @return
* F_okay on success.
* F_child on child process exiting.
- * F_ignore if the rule is unknown and nothing can be done.
+ * F_ignore if the Rule is unknown and nothing can be done.
*
* F_failure (with error bit) if failed to execute.
* F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal.
* F_lock (with error bit) if failed to re-establish read lock on process->lock while returning.
*
- * On success and the rule is run synchronously, then the individual status for the rule is set to F_complete.
- * On success and the rule is run asynchronously, then the individual status for the rule is set to F_busy.
- * On failure, the individual status for the rule is set to an appropriate error status.
+ * On success and the Rule is run synchronously, then the individual status for the Rule is set to F_complete.
+ * On success and the Rule is run asynchronously, then the individual status for the Rule is set to F_busy.
+ * On failure, the individual status for the Rule is set to an appropriate error status.
*/
#ifndef _di_controller_rule_execute_
extern f_status_t controller_rule_execute(controller_t * const main, const uint8_t action, const uint8_t options, controller_instance_t * const instance);
#endif // _di_controller_rule_execute_
/**
- * Perform an execution of the given rule in the foreground.
+ * Perform an execution of the given Rule in the foreground.
*
* This requires that a read lock be set on process->lock before being called.
*
* The arguments to pass to the program.
* @param options
* Process options to consider when executing.
- * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
+ * If bit controller_instance_option_simulate_e, then the Rule execution is in simulation mode (printing a message that the Rule would be executed but does not execute the rule).
* @param execute_set
* The execute parameter and as settings.
* @param process
- * The process data for processing this rule.
+ * The process data for processing this Rule.
*
* @return
* F_okay on success.
#endif // _di_controller_rule_execute_foreground_
/**
- * Perform an execution of the given rule in the foreground or background and creating a PID file.
+ * Perform an execution of the given Rule in the foreground or background and creating a PID file.
*
* This requires that a read lock be set on process->lock before being called.
*
* When this is synchronous, this will wait for the PID file to be generated before continuing.
- * When this is asynchronous, this will continue on adding the rule id and action to the asynchronous list.
+ * When this is asynchronous, this will continue on adding the Rule id and Action to the asynchronous list.
*
* @param pid_file
* The path to the PID file.
* The arguments to pass to the program.
* @param options
* Process options to consider when executing.
- * If bit controller_instance_option_simulate_e, then the rule execution is in simulation mode (printing a message that the rule would be executed but does not execute the rule).
+ * If bit controller_instance_option_simulate_e, then the Rule execution is in simulation mode (printing a message that the Rule would be executed but does not execute the rule).
* @param with
* The "with" option flags.
* @param execute_set
* The execute parameter and as settings.
* @param process
- * The process data for processing this rule.
+ * The process data for processing this Rule.
*
* @return
* F_okay on success.
#endif // _di_controller_rule_execute_pid_with_
/**
- * Determine whether or not an execute rule should be re-run, applying a delay as requested.
+ * Determine whether or not an execute Rule should be re-run, applying a delay as requested.
*
* @param instance
- * The instance data for processing this rule.
+ * The instance data for processing this Rule.
*
* Must not be NULL.
* @param item
*
* Must not be NULL.
* @param action
- * The action type.
+ * The Action type.
*
* @return
* A positive number to designate re-run.
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the rule "expand" functionality.
+ * Provides the Rule "expand" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* This does not alter main.setting.state.status.
* @param action
- * The rule action data.
+ * The Rule Action data.
* @param process
* The process information.
*
break;
default:
- controller_print_error_rule_action_type_unsupported(&main->program.error, &instance->cache.action, controller_convert_rule_action_type_string(instance->action), "validate rule execution");
+ controller_print_error_rule_action_type_unsupported(&main->program.error, &instance->cache.action, controller_convert_rule_action_type_string(instance->action), "validate Fule execution");
break;
}
if (found) {
- // The dependency may have write locks, which needs to be avoided, so copy the alias from the rule.
+ // The dependency may have write locks, which needs to be avoided, so copy the alias from the Rule.
f_string_static_t alias_other_buffer = f_string_static_t_initialize;
alias_other_buffer.used = main->process.rules.array[id_rule].alias.used;
if (!(instance->options & controller_instance_option_validate_e) && F_status_is_error_not(status)) {
- // Find at least one of the requested action when the rule is required.
+ // Find at least one of the requested Action when the Rule is required.
if (instance->options & controller_instance_option_require_e) {
bool missing = F_true;
return F_status_set_error(F_lock);
}
- // Update the rule status, which is stored separately from the rule status for this instance.
+ // Update the Rule status, which is stored separately from the Rule status for this instance.
if (controller_rule_find(instance->rule.alias, main->process.rules, &id_rule) == F_true) {
controller_rule_t * const rule = &main->process.rules.array[id_rule];
controller_rule_item_t *rule_item = 0;
- // Copy all Rule Item Action statuses from the rule instance to the rule.
+ // Copy all Rule Item Action statuses from the Rule instance to the Rule.
for (i = 0; i < rule->items.used; ++i) {
rule_item = &rule->items.array[i];
}
else if (!instance->action) {
- // This is a "consider" Action, so do not actually execute the rule.
+ // This is a "consider" Action, so do not actually execute the Rule.
f_thread_unlock(&instance->lock);
if (options_force & controller_instance_option_asynchronous_e) {
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the rule "instance" functionality.
+ * Provides the Rule "instance" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Process and execute the given rule.
+ * Process and execute the given Rule.
*
- * Any dependent rules are processed and executed as per "need", "want", and "wish" rule settings.
+ * Any dependent rules are processed and executed as per "need", "want", and "wish" Rule settings.
* All dependent rules must be already loaded, this function will not load any rules.
*
* This requires that a read lock be set on instance->lock before being called.
*
* This function is recursively called for each "need", "want", and "wish", and has a max recursion length of the max size of the f_number_unsigneds_t array.
*
- * The rule status will be updated by this function.
+ * The Rule status will be updated by this function.
*
* @param instance
- * The instance data for processing this rule.
+ * The instance data for processing this Rule.
*
* Must not be NULL.
*
#endif // _di_controller_rule_instance_
/**
- * Synchronously or asynchronously begin processing some rule.
+ * Synchronously or asynchronously begin processing some Rule.
*
* @param main
* The main program data.
* @param alias_rule
* The alias of the rule, such as "boot/init".
* @param action
- * The action to perform based on the action type codes.
+ * The Action to perform based on the Action type codes.
* @param options
* The instance options to pass to the instance.
* @param type
* The instance type, such as controller_instance_type_entry_e.
* @param stack
- * A stack representing the instances already running in this rule instance dependency tree.
+ * A stack representing the instances already running in this Rule instance dependency tree.
* This is used to prevent circular dependencies.
*
* @return
* F_okay on success.
* F_busy on success and the instance is found to already be running (nothing to do).
*
- * F_found_not (with error bit) if unable to for a instance for the given rule id.
+ * F_found_not (with error bit) if unable to for a instance for the given Rule ID.
* F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal.
* F_recurse (with error bit) on recursion error (the instance is already on the instance stack).
*
* Perform the work
*
* This does all the preparation work that needs to be synchronously performed within the same thread.
- * This will copy the rule by the alias to the instance structure.
+ * This will copy the Rule by the alias to the instance structure.
*
* @param options_force
* Force the given instance options, only supporting a subset of instance options.
* F_found on the instance was found to already be running (nothing to do).
* F_process_not if the instance was not executed because it is a "consider" Action.
*
- * F_found_not (with error bit) if unable to for a instance for the given rule id.
+ * F_found_not (with error bit) if unable to for a instance for the given Rule ID.
* F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal.
*
* Status from: controller_rule_instance().
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the rule "is" functionality.
+ * Provides the Rule "is" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
#ifndef _di_controller_rule_item_read_
- f_status_t controller_rule_item_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, controller_rule_item_t * const item) {
+ void controller_rule_item_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, controller_rule_item_t * const item, f_state_t * const state) {
- if (!main || !cache || !item) return F_status_set_error(F_parameter);
+ if (!state) return;
+
+ if (!main || !cache || !item) {
+ state->status = F_status_set_error(F_parameter);
+
+ return;
+ }
- controller_interrupt_t custom = macro_controller_interrupt_t_initialize_1(is_normal, main);
- f_state_t state = macro_f_state_t_initialize_1(controller_allocation_large_d, controller_allocation_small_d, F_okay, 0, 0, 0, &controller_thread_signal_state_fss, 0, (void *) &custom, 0);
f_range_t range = macro_f_range_t_initialize_2(cache->buffer_item.used);
f_number_unsigned_t last = 0;
uint8_t type = 0;
uint8_t method = 0;
- bool multiple = F_false;
+ uint8_t multiple = F_false;
item->actions.used = 0;
for (; range.start < cache->buffer_item.used && range.start <= range.stop; last = range.start, cache->delimits.used = 0, cache->comments.used = 0) {
- fl_fss_extended_list_object_read(cache->buffer_item, &range, &cache->range_action, &cache->delimits, &state);
+ fl_fss_extended_list_object_read(cache->buffer_item, &range, &cache->range_action, &cache->delimits, state);
- if (F_status_is_error(state.status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(fl_fss_extended_list_object_read), F_status_set_fine(state.status));
+ if (F_status_is_error(state->status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(fl_fss_extended_list_object_read), F_status_set_fine(state->status));
break;
}
- if (state.status == F_fss_found_object) {
+ if (state->status == F_fss_found_object) {
multiple = F_true;
}
else {
cache->delimits.used = 0;
// The current line is not an Extended List object, so the next possibility is a Basic List (and Extended List, both use the same Object structure).
- fl_fss_extended_object_read(cache->buffer_item, &range, &cache->range_action, 0, &cache->delimits, &state);
+ fl_fss_extended_object_read(cache->buffer_item, &range, &cache->range_action, 0, &cache->delimits, state);
- if (F_status_is_error(state.status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(fl_fss_extended_object_read), F_status_set_fine(state.status));
+ if (F_status_is_error(state->status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(fl_fss_extended_object_read), F_status_set_fine(state->status));
break;
}
// Nothing of importance here, so continue onto the next line.
- if (state.status != F_fss_found_object) continue;
+ if (state->status != F_fss_found_object) continue;
}
- f_fss_apply_delimit(cache->delimits, &cache->buffer_item, &state);
+ f_fss_apply_delimit(cache->delimits, &cache->buffer_item, state);
- if (F_status_is_error(state.status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_fss_apply_delimit), F_status_set_fine(state.status));
+ if (F_status_is_error(state->status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(f_fss_apply_delimit), F_status_set_fine(state->status));
break;
}
- f_fss_count_lines(cache->buffer_item, cache->range_action.start, &cache->action.line_action, &state);
+ f_fss_count_lines(cache->buffer_item, cache->range_action.start, &cache->action.line_action, state);
- if (F_status_is_error(state.status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_fss_count_lines), F_status_set_fine(state.status));
+ if (F_status_is_error(state->status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(f_fss_count_lines), F_status_set_fine(state->status));
break;
}
cache->action.line_action += ++item->line;
cache->action.name_action.used = 0;
- state.status = f_rip_dynamic_partial_nulless(cache->buffer_item, cache->range_action, &cache->action.name_action);
+ state->status = f_rip_dynamic_partial_nulless(cache->buffer_item, cache->range_action, &cache->action.name_action);
- if (F_status_is_error(state.status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(state.status));
+ if (F_status_is_error(state->status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(f_rip_dynamic_partial_nulless), F_status_set_fine(state->status));
break;
}
if (multiple) {
if (type == controller_rule_action_type_group_e || type == controller_rule_action_type_pid_file_e || type == controller_rule_action_type_user_e) {
- state.status = F_status_set_error(F_support_not);
+ state->status = F_status_set_error(F_support_not);
controller_print_error_rule_action_fss_0003_unsupported(&main->program.error, &cache->action, cache->action.name_action);
method = controller_rule_action_method_extended_e;
}
- state.status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_rule_action_t), (void **) &item->actions.array, &item->actions.used, &item->actions.size);
+ state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(controller_rule_action_t), (void **) &item->actions.array, &item->actions.used, &item->actions.size);
- if (F_status_is_error(state.status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(state.status));
+ if (F_status_is_error(state->status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(state->status));
break;
}
- state.status = controller_rule_action_read(main, cache, is_normal, type, method, item, &item->actions, &range);
- if (F_status_is_error(state.status)) break;
+ controller_rule_action_read(main, cache, is_normal, type, method, item, &item->actions, &range, state);
+ if (F_status_is_error(state->status)) break;
} // for
-
- return state.status;
}
#endif // _di_controller_rule_item_read_
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the rule "item" functionality.
+ * Provides the Rule "item" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Read the content within the buffer, extracting all valid items after determining their type for some rule file.
+ * Read the content within the buffer, extracting all valid items after determining their type for some Rule file.
*
* This will perform additional FSS read functions as appropriate.
*
*
* This does not alter main.setting.state.status.
* @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.
+ * 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 cache
* A structure for containing and caching relevant data.
* @param item
* The processed item.
+ * @param state
+ * The state information.
*
- * @return
- * F_okay on success.
- * F_valid_not (with error bit) on invalid data.
+ * This alters state.status:
+ * F_okay on success.
+ * F_valid_not (with error bit) on invalid data.
*
- * Errors (with error bit) from: f_fss_count_lines().
- * Errors (with error bit) from: f_string_dynamic_partial_append_nulless().
+ * Errors (with error bit) from: f_fss_count_lines().
+ * Errors (with error bit) from: f_string_dynamic_partial_append_nulless().
+ *
+ * Must not be NULL.
*
* @see controller_rule_action_read()
* @see f_fss_count_lines()
* @see f_string_dynamic_partial_append_nulless()
*/
#ifndef _di_controller_rule_item_read_
- extern f_status_t controller_rule_item_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, controller_rule_item_t * const item);
+ extern void controller_rule_item_read(controller_t * const main, controller_cache_t * const cache, const uint8_t is_normal, controller_rule_item_t * const item, f_state_t * const state);
#endif // _di_controller_rule_item_read_
#ifdef __cplusplus
#endif
#ifndef _di_controller_rule_parameters_read_
- f_status_t controller_rule_parameters_read(controller_t * const main, const f_string_static_t buffer, f_range_t * const object, f_ranges_t * const content, controller_rule_action_t * const action, f_state_t * const state) {
+ void controller_rule_parameters_read(controller_t * const main, const f_string_static_t buffer, f_range_t * const object, f_ranges_t * const content, controller_rule_action_t * const action, f_state_t * const state) {
- if (!main || !object || !content || !action || !state) return F_status_set_error(F_parameter);
+ if (!state) return;
- f_status_t status = F_okay;
+ if (!main || !action) {
+ state->status = F_status_set_error(F_parameter);
+
+ return;
+ }
action->parameters.used = 0;
action->ikis.used = 0;
if (object && object->start <= object->stop) {
if (content) {
- status = f_memory_array_increase_by(content->used + 1, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size);
+ state->status = f_memory_array_increase_by(content->used + 1, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size);
}
else {
- status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size);
+ state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size);
}
- if (F_status_is_error_not(status)) {
+ if (F_status_is_error_not(state->status)) {
if (content) {
- status = f_memory_array_increase_by(content->used + 1, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size);
+ state->status = f_memory_array_increase_by(content->used + 1, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size);
}
else {
- status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size);
+ state->status = f_memory_array_increase(controller_allocation_small_d, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size);
}
}
- if (F_status_is_error(status)) {
- controller_print_error_status(&main->program.error, content ? macro_controller_f(f_memory_array_increase_by) : macro_controller_f(f_memory_array_increase), F_status_set_fine(status));
+ if (F_status_is_error(state->status)) {
+ controller_print_error_status(&main->program.error, content ? macro_controller_f(f_memory_array_increase_by) : macro_controller_f(f_memory_array_increase), F_status_set_fine(state->status));
- return status;
+ return;
}
action->parameters.array[action->parameters.used].used = 0;
action->ikis.array[action->ikis.used].variable.used = 0;
action->ikis.array[action->ikis.used].vocabulary.used = 0;
- status = f_string_dynamic_partial_append_nulless(buffer, *object, &action->parameters.array[0]);
+ state->status = f_string_dynamic_partial_append_nulless(buffer, *object, &action->parameters.array[0]);
- if (F_status_is_error(status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status));
+ if (F_status_is_error(state->status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(state->status));
- return status;
+ return;
}
++action->parameters.used;
}
if (content && content->used) {
- status = f_memory_array_increase_by(content->used, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size);
+ state->status = f_memory_array_increase_by(content->used, sizeof(f_string_dynamic_t), (void **) &action->parameters.array, &action->parameters.used, &action->parameters.size);
- if (F_status_is_error_not(status)) {
- status = f_memory_array_increase_by(content->used, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size);
+ if (F_status_is_error_not(state->status)) {
+ state->status = f_memory_array_increase_by(content->used, sizeof(f_iki_data_t), (void **) &action->ikis.array, &action->ikis.used, &action->ikis.size);
}
- if (F_status_is_error(status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(status));
+ if (F_status_is_error(state->status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(f_memory_array_increase_by), F_status_set_fine(state->status));
- return status;
+ return;
}
+ const uint16_t old_step_large = state->step_large;
+ const uint16_t old_step_small = state->step_small;
+ void * const old_interrupt = state->interrupt;
+
+ state->step_large = controller_allocation_iki_large_d;
+ state->step_small = controller_allocation_iki_small_d;
+ state->interrupt = &controller_thread_signal_state_iki;
+
f_range_t range = f_range_t_initialize;
for (f_number_unsigned_t i = 0; i < content->used; ++i) {
action->ikis.array[action->ikis.used].variable.used = 0;
action->ikis.array[action->ikis.used].vocabulary.used = 0;
- status = f_string_dynamic_partial_append_nulless(buffer, content->array[i], &action->parameters.array[action->parameters.used]);
+ state->status = f_string_dynamic_partial_append_nulless(buffer, content->array[i], &action->parameters.array[action->parameters.used]);
- if (F_status_is_error(status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(status));
+ if (F_status_is_error(state->status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(f_string_dynamic_partial_append_nulless), F_status_set_fine(state->status));
- return status;
+ break;
}
if (action->parameters.array[action->parameters.used].used) {
fl_iki_read(&action->parameters.array[action->parameters.used], &range, &action->ikis.array[action->ikis.used], state);
- if (F_status_is_error(status)) {
- controller_print_error_status(&main->program.error, macro_controller_f(fl_iki_read), F_status_set_fine(status));
+ if (F_status_is_error(state->status)) {
+ controller_print_error_status(&main->program.error, macro_controller_f(fl_iki_read), F_status_set_fine(state->status));
action->parameters.array[action->parameters.used].used = 0;
- return status;
+ break;
}
}
++action->parameters.used;
++action->ikis.used;
} // for
+
+ state->step_large = old_step_large;
+ state->step_small = old_step_small;
+ state->interrupt = old_interrupt;
}
- return F_okay;
+ if (F_status_is_error_not(state->status)) {
+ state->status = F_okay;
+ }
}
#endif // _di_controller_rule_parameters_read_
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the rule "parameter" functionality.
+ * Provides the Rule "parameter" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Read the parameters for some rule action.
+ * Read the parameters for some Rule Action.
*
* The object and content ranges are merged together (in that order) as the action parameters.
*
* The buffer containing the content.
* @param object
* (optional) The range representing where the object is found within the buffer.
- * Set pointer address to 0 to disable.
+ *
+ * Set to NULL to disable.
* @param content
* (optional) The ranges representing where the content is found within the buffer.
- * Set pointer address to 0 to disable.
+ *
+ * Set to NULL to disable.
* @param action
- * The rule action.
+ * The Rule Action.
* @param state
* The state data for passing to fl_iki_read().
*
- * @return
- * F_okay on success.
+ * This alters state.status:
+ * F_okay on success.
*
- * Errors (with error bit) from: f_fss_count_lines().
- * Errors (with error bit) from: f_memory_array_increase().
- * Errors (with error bit) from: f_memory_array_increase_by().
- * Errors (with error bit) from: f_string_dynamic_partial_append_nulless().
- * Errors (with error bit) from: f_memory_array_increase().
- * Errors (with error bit) from: fl_iki_read().
+ * Errors (with error bit) from: f_fss_count_lines().
+ * Errors (with error bit) from: f_memory_array_increase().
+ * Errors (with error bit) from: f_memory_array_increase_by().
+ * Errors (with error bit) from: f_string_dynamic_partial_append_nulless().
+ * Errors (with error bit) from: f_memory_array_increase().
+ * Errors (with error bit) from: fl_iki_read().
*
* @see f_fss_count_lines()
* @see f_memory_array_increase()
* @see fl_iki_read()
*/
#ifndef _di_controller_rule_parameters_read_
- extern f_status_t controller_rule_parameters_read(controller_t * const main, const f_string_static_t buffer, f_range_t * const object, f_ranges_t * const content, controller_rule_action_t * const action, f_state_t * const state);
+ extern void controller_rule_parameters_read(controller_t * const main, const f_string_static_t buffer, f_range_t * const object, f_ranges_t * const content, controller_rule_action_t * const action, f_state_t * const state);
#endif // _di_controller_rule_parameters_read_
#ifdef __cplusplus
rule->items.array[rule->items.used].with |= controller_with_session_same_d;
}
- state.status = controller_rule_item_read(main, cache, is_normal, &rule->items.array[rule->items.used]);
+ controller_rule_item_read(main, cache, is_normal, &rule->items.array[rule->items.used], &state);
if (F_status_is_error(state.status)) break;
++rule->items.used;
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the rule "read" functionality.
+ * Provides the Rule "read" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
#endif
/**
- * Read the rule file, extracting all valid items.
+ * Read the Rule file, extracting all valid items.
*
* @param main
* The main program data.
*
* This does not alter main.setting.state.status.
* @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.
+ * 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 alias
- * The string identifying the rule.
+ * The string identifying the Rule.
* This is constructed from the path parts to the file without the file extension and without the settings directory prefix.
- * "/etc/controller/rules/example/my.rule" would have a rule id of "example/my".
+ * "/etc/controller/rules/example/my.rule" would have a Rule id of "example/my".
* @param cache
* A structure for containing and caching relevant data.
* @param entry
- * The entry containing the rule being read.
+ * The Entry containing the Rule being read.
* @param rule
- * The processed rule.
- * The rule status will be updated by this function.
+ * The processed Rule.
+ * The Rule status will be updated by this function.
*
* @return
* F_okay on success.
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the rule "setting" functionality.
+ * Provides the Rule "setting" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
* Identify the Rule Item code the given name represents.
*
* @param item
- * The string representing an rule action.
+ * The string representing an Rule Action.
*
* @return
* The Rule Item type code on success.
#endif // _di_controller_rule_setting_limit_type_identify_
/**
- * Get a string representing the rule setting limit type.
+ * Get a string representing the Rule setting limit type.
*
* @param type
- * The rule setting limit type code.
+ * The Rule setting limit type code.
*
* @return
* The string with used > 0 on success.
*
* This does not alter main.setting.state.status.
* @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.
+ * 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 cache
* A structure for containing and caching relevant data.
* @param rule
- * The processed rule.
+ * The processed Rule.
*
* @return
* F_okay on success.
* API Version: 0.7
* Licenses: lgpl-2.1-or-later
*
- * Provides the rule "wait" functionality.
+ * Provides the Rule "wait" functionality.
*
* This is auto-included and should not need to be explicitly included.
*/
*
* This does not alter main.setting.state.status.
* @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.
+ * If TRUE, then process as if this operates during a normal operation (Entry and Control).
+ * If FALSE, then process as if this operates during an Exit operation.
* This is ignored when caller is not NULL.
* @param required
- * If TRUE, then only process required rules and if a required rule has failed, return.
+ * If TRUE, then only process required rules and if a required Rule has failed, return.
* If FALSE, process all waits, returning normally (required rules still result in failure).
*
* @return
* F_okay on success.
* F_data_not on success and nothing to do.
- * F_require on success, but a required rule has not been run yet.
+ * F_require on success, but a required Rule has not been run yet.
*
* F_interrupt (with error bit) on receiving a process signal, such as an interrupt signal.
* F_require (with error bit set) if a required process is in failed status when required is TRUE.
* @param type
* The process type to use when checking if thread is enabled.
* @param required
- * If TRUE, then only process required rules and if a required rule has failed, return.
+ * If TRUE, then only process required rules and if a required Rule has failed, return.
* If FALSE, process all waits, returning normally.
*
* @return
#endif
/**
- * Thread for handling entry processing.
+ * Thread for handling Entry processing.
*
- * This acts as the main rule thread during entry processing.
- * This runs all synchronous rules or spawns asynchronous rules.
+ * This acts as the main Rule thread during Entry processing.
+ * This runs all synchronous Rules or spawns asynchronous rules.
*
* @param arguments
* The main program data.
#endif // _di_controller_thread_entry_
/**
- * Thread for handling exit file processing.
+ * Thread for handling Exit file processing.
*
- * This acts as the main rule thread during exit processing.
- * This runs all synchronous rules or spawns asynchronous rules.
+ * This acts as the main Rule thread during Exit processing.
+ * This runs all synchronous Rules or spawns asynchronous rules.
*
- * Do not confuse this with exiting a thread, this is the what process the exit files (similar to that of an entry file).
+ * Do not confuse this with exiting a thread, this is the what process the Exit files (similar to that of an Entry file).
* Exit files process the "stop" action, whereas the Entry files process the "start" Action
*
* @param argument
instance = main->thread.instances.array[i];
- // Do not cancel exit instances, when not performing "execute" during exit.
+ // Do not cancel Exit instances, when not performing "execute" during exit.
if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) {
continue;
}
instance = main->thread.instances.array[i];
- // Do not kill exit instances, when not performing "execute" during exit.
+ // Do not kill Exit instances, when not performing "execute" during exit.
if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) continue;
if (instance->id_thread) {
if (!(entry->flag & controller_entry_flag_timeout_exit_no_e)) {
for (j = 0; j < instance->childs.size; ++j) {
- // Do not kill exit processes, when not performing "execute" during exit.
+ // Do not kill Exit processes, when not performing "execute" during exit.
if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) continue;
if (instance->childs.array[j]) {
if (!(entry->flag & controller_entry_flag_timeout_exit_no_e)) {
for (j = 0; j < instance->path_pids.used; ++j) {
- // Do not kill exit processes, when not performing "execute" during exit.
+ // Do not kill Exit processes, when not performing "execute" during exit.
if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) continue;
if (f_file_exists(instance->path_pids.array[j], F_true) == F_true) {
// Shrink the child pids as much as possible.
while (instance->childs.used) {
- // Do not shrink below an exit instances, when not performing "execute" during exit.
+ // Do not shrink below an Exit instances, when not performing "execute" during exit.
if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) break;
if (instance->childs.array[j] > 0) break;
// Shrink the path pids as much as possible.
while (instance->path_pids.used) {
- // Do not shrink below an exit instances, when not performing "execute" during exit.
+ // Do not shrink below an Exit instances, when not performing "execute" during exit.
if (instance->type == controller_instance_type_exit_e && main->thread.enabled != controller_thread_enabled_exit_execute_e) break;
if (instance->path_pids.array[j].used) break;
if (main->process.ready == controller_process_ready_done_e) {
- // The exit processing runs using the entry thread.
+ // The Exit processing runs using the Entry thread.
if (main->thread.id_entry) {
f_thread_cancel(main->thread.id_entry);
f_thread_join(main->thread.id_entry, 0);
f_thread_mutex_unlock(&main->thread.lock.alert);
}
- else {
- main->thread.enabled = controller_thread_enabled_not_e;
- }
}
else {
f_time_spec_t time = f_time_spec_t_initialize;
do {
status = f_thread_mutex_lock(&main->thread.lock.alert);
-
- if (F_status_is_error(status)) {
- main->thread.enabled = controller_thread_enabled_not_e;
-
- break;
- }
+ if (F_status_is_error(status)) break;
controller_time_now(controller_thread_exit_ready_timeout_seconds_d, controller_thread_exit_ready_timeout_nanoseconds_d, &time);
f_thread_mutex_unlock(&main->thread.lock.alert);
}
- else {
- main->thread.enabled = controller_thread_enabled_not_e;
- }
}
}
f_thread_mutex_unlock(&main->thread.lock.alert);
}
- else {
- main->thread.enabled = controller_thread_enabled_not_e;
- }
}
}
#endif // _di_controller_thread_instance_exit_
* Asynchronously execute a Rule process.
*
* @param is_normal
- * If F_true, then process as if this operates during a normal operation (entry and control).
- * If F_false, then process as if this operates during a an exit operation.
+ * If F_true, then process as if this operates during a normal operation (Entry and Control).
+ * If F_false, then process as if this operates during an Exit operation.
* @param instance
* The instance data.
*
*
* This does not alter main.setting.state.status.
* @param is_normal
- * If F_true, then process as if this operates during a normal operation (entry and control).
- * If F_false, then process as if this operates during a an exit operation.
+ * If F_true, then process as if this operates during a normal operation (Entry and Control).
+ * If F_false, then process as if this operates during an Exit operation.
* @param by
* Designate the way in which the cancellation should operate.
*
#endif
/**
- * Check to see if thread is enabled for the normal operations like entry and control or for exit operations.
+ * Check to see if thread is enabled for the normal operations like Entry and Control or for Exit operations.
*
* @param is_normal
- * If TRUE, then instance as if this operates during a normal operation (entry and control).
- * If FALSE, then instance as if this operates during a an exit operation.
+ * If TRUE, then instance as if this operates during a normal operation (Entry and Control).
+ * If FALSE, then instance as if this operates during an Exit operation.
* @param thread
* The thread data.
*
#endif // _di_controller_thread_is_enabled_
/**
- * Check to see if thread is enabled for the normal operations like entry and control or for exit operations for some instance.
+ * Check to see if thread is enabled for the normal operations like Entry and Control or for Exit operations for some instance.
*
* @param instance
* The instance to use when checking if thread is enabled.
#endif // _di_controller_thread_is_enabled_instance_
/**
- * Check to see if thread is enabled for the normal operations like entry and control or for exit operations for some instance type.
+ * Check to see if thread is enabled for the normal operations like Entry and Control or for Exit operations for some instance type.
*
* @param type
* The instance type to use when checking if thread is enabled.
#endif
/**
- * Thread for handling rule processing.
+ * Thread for handling Rule processing.
*
- * This acts as the main rule thread after entry processing.
- * This runs all synchronous rules or spawns asynchronous rules.
+ * This acts as the main Rule thread after Entry processing.
+ * This runs all synchronous Rules or spawns asynchronous rules.
*
* @todo the control thread should send commands to this thread, somehow.
*
*
* Must not be NULL.
* @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.
+ * If TRUE, then process as if this operates during a normal operation (Entry and Control).
+ * If FALSE, then process as if this operates during an Exit operation.
*/
#ifndef _di_controller_thread_signal_
extern void controller_thread_signal(controller_t * const main, const uint8_t is_normal);