From: Kevin Day Date: Tue, 9 Apr 2024 02:55:01 +0000 (-0500) Subject: Progress: Continue migrating the project. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=2cf07ff7cf78df4080fdc994082908c69450b6a2;p=controller Progress: Continue migrating the project. --- diff --git a/data/build/defines b/data/build/defines index a5c6973..260609f 100644 --- a/data/build/defines +++ b/data/build/defines @@ -4,22 +4,15 @@ _di_libcap_ Disable libcap support, allow for compiling and linking without libc _di_thread_support_ Disables thread support. _libcap_legacy_only_ Disable functionality provided by later versions of libcap (2.43 and later). -_controller_as_init_ Build the program to run as if it were "init" by default, including displaying the program name as "Init Program" or "Init". This changes the main.c file only, leaving the library shareable between both "controller" and "init". _override_controller_default_engine_ Provide a custom scripting engine name string to execute (such as php). _override_controller_default_engine_length_ The number of bytes representing the string in _override_controller_default_engine_ (not including the terminating NULL). _override_controller_path_pid_ Use this as the default custom directory path representing the location of the controller program pid. -_override_controller_path_pid_init_ Provide a custom init path for the pid file rather than the default. -_override_controller_path_pid_init_length_ The number of bytes representing the string in _override_controller_path_pid_init_ (not including the terminating NULL). _override_controller_path_pid_length_ The number of bytes representing the string in _override_controller_path_pid_ (not including the terminating NULL). _override_controller_path_pid_prefix_ Use this as the default custom prefix prepended to the file name of the file representing the controller program pid. _override_controller_path_pid_prefix_length_ The number of bytes representing the string in _override_controller_path_pid_prefix_ (not including the terminating NULL). _override_controller_path_pid_suffix_ Use this as the default custom prefix prepended to the file name of the file representing the controller program pid. _override_controller_path_pid_suffix_length_ The number of bytes representing the string in _override_controller_path_pid_suffix_ (not including the terminating NULL). -_override_controller_path_settings_init_ Provide a custom init path for the settings file rather than the default. -_override_controller_path_settings_init_length_ The number of bytes representing the string in _override_controller_path_settings_init_ (not including the terminating NULL). _override_controller_path_socket_ Use this as the default custom directory path representing the location of the controller program socket. -_override_controller_path_socket_init_ Provide a custom init path for the socket file rather than the default. -_override_controller_path_socket_init_length_ The number of bytes representing the string in _override_controller_path_socket_init_ (not including the terminating NULL). _override_controller_path_socket_length_ The number of bytes representing the string in _override_controller_path_socket_ (not including the terminating NULL). _override_controller_path_socket_prefix_ Use this as the default custom prefix prepended to the file name of the file representing the controller program socket. _override_controller_path_socket_prefix_length_ The number of bytes representing the string in _override_controller_path_socket_prefix_ (not including the terminating NULL). diff --git a/data/build/settings.init b/data/build/settings.init index 7021bbd..822a60a 100644 --- a/data/build/settings.init +++ b/data/build/settings.init @@ -74,7 +74,7 @@ environment PATH LD_LIBRARY_PATH environment LANG LC_ALL LC_COLLATE LC_CTYPE LC_FASTMSG LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LOCPATH NLSPATH #defines -D_di_libcap_ -defines -D_controller_as_init_ -D_libcap_legacy_only_ +defines -D_libcap_legacy_only_ defines-threadless -D_di_thread_support_ defines-thread -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_ diff --git a/sources/c/controller/string.c b/sources/c/controller/string.c index 3bad69b..b14998d 100644 --- a/sources/c/controller/string.c +++ b/sources/c/controller/string.c @@ -9,6 +9,17 @@ extern "C" { const f_string_static_t controller_program_name_long_s = macro_f_string_static_t_initialize_1(CONTROLLER_program_name_long_s, 0, CONTROLLER_program_name_long_s_length); #endif // _di_controller_program_name_s_ +#ifndef _di_controller_default_s_ + const f_string_static_t controller_default_engine_s = macro_f_string_static_t_initialize_1(CONTROLLER_default_engine_s, 0, CONTROLLER_default_engine_s_length); + const f_string_static_t controller_default_path_pid_s = macro_f_string_static_t_initialize_1(CONTROLLER_default_path_pid_s, 0, CONTROLLER_default_path_pid_s_length); + const f_string_static_t controller_default_path_pid_prefix_s = macro_f_string_static_t_initialize_1(CONTROLLER_default_path_pid_prefix_s, 0, CONTROLLER_default_path_pid_prefix_s_length); + const f_string_static_t controller_default_path_pid_suffix_s = macro_f_string_static_t_initialize_1(CONTROLLER_default_path_pid_suffix_s, 0, CONTROLLER_default_path_pid_suffix_s_length); + const f_string_static_t controller_default_path_settings_s = macro_f_string_static_t_initialize_1(CONTROLLER_default_path_settings_s, 0, CONTROLLER_default_path_settings_s_length); + const f_string_static_t controller_default_path_socket_s = macro_f_string_static_t_initialize_1(CONTROLLER_default_path_socket_s, 0, CONTROLLER_default_path_socket_s_length); + const f_string_static_t controller_default_path_socket_prefix_s = macro_f_string_static_t_initialize_1(CONTROLLER_default_path_socket_prefix_s, 0, CONTROLLER_default_path_socket_prefix_s_length); + const f_string_static_t controller_default_path_socket_suffix_s = macro_f_string_static_t_initialize_1(CONTROLLER_default_path_socket_suffix_s, 0, CONTROLLER_default_path_socket_suffix_s_length); +#endif // _di_controller_default_s_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/sources/c/controller/string.h b/sources/c/controller/string.h index 2f7ed97..4870bc0 100644 --- a/sources/c/controller/string.h +++ b/sources/c/controller/string.h @@ -27,6 +27,13 @@ extern "C" { #define CONTROLLER_program_name_long_s_length 10 #endif // _di_controller_program_name_s_ +/** + * The program defaults. + */ +#ifndef _di_controller_default_s_ + // No custom program defaults. +#endif // _di_controller_default_s_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/sources/c/init/string.c b/sources/c/init/string.c index 2884a04..c34bf3e 100644 --- a/sources/c/init/string.c +++ b/sources/c/init/string.c @@ -9,6 +9,17 @@ extern "C" { const f_string_static_t controller_program_name_long_s = macro_f_string_static_t_initialize_1(CONTROLLER_program_name_long_s, 0, CONTROLLER_program_name_long_s_length); #endif // _di_controller_program_name_s_ +#ifndef _di_controller_default_s_ + const f_string_static_t controller_default_engine_s = macro_f_string_static_t_initialize_1(CONTROLLER_default_engine_s, 0, CONTROLLER_default_engine_s_length); + const f_string_static_t controller_default_path_pid_s = macro_f_string_static_t_initialize_1(CONTROLLER_init_default_path_pid_s, 0, CONTROLLER_init_default_path_pid_s_length); + const f_string_static_t controller_default_path_pid_prefix_s = macro_f_string_static_t_initialize_1(CONTROLLER_init_default_path_pid_prefix_s, 0, CONTROLLER_init_default_path_pid_prefix_s_length); + const f_string_static_t controller_default_path_pid_suffix_s = macro_f_string_static_t_initialize_1(CONTROLLER_default_path_pid_suffix_s, 0, CONTROLLER_default_path_pid_suffix_s_length); + const f_string_static_t controller_default_path_settings_s = macro_f_string_static_t_initialize_1(CONTROLLER_init_default_path_settings_s, 0, CONTROLLER_init_default_path_settings_s_length); + const f_string_static_t controller_default_path_socket_s = macro_f_string_static_t_initialize_1(CONTROLLER_init_default_path_socket_s, 0, CONTROLLER_init_default_path_socket_s_length); + const f_string_static_t controller_default_path_socket_prefix_s = macro_f_string_static_t_initialize_1(CONTROLLER_init_default_path_socket_prefix_s, 0, CONTROLLER_init_default_path_socket_prefix_s_length); + const f_string_static_t controller_default_path_socket_suffix_s = macro_f_string_static_t_initialize_1(CONTROLLER_default_path_socket_suffix_s, 0, CONTROLLER_default_path_socket_suffix_s_length); +#endif // _di_controller_default_s_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/sources/c/init/string.h b/sources/c/init/string.h index c9dd068..ee5598d 100644 --- a/sources/c/init/string.h +++ b/sources/c/init/string.h @@ -27,6 +27,58 @@ extern "C" { #define CONTROLLER_program_name_long_s_length 4 #endif // _di_controller_program_name_s_ +/** + * The program defaults. + */ +#ifndef _di_controller_default_s_ + + // The init pid path is a system-specific path and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_pid_) && defined(_override_controller_path_pid_length_) + #define CONTROLLER_default_path_pid_s _override_controller_path_pid_ + #define CONTROLLER_default_path_pid_s_length _override_controller_path_pid_length_ + #else + #define CONTROLLER_init_default_path_pid_s "/var/run/init" + #define CONTROLLER_init_default_path_pid_s_length 13 + #endif // defined(_override_controller_path_pid_) && defined(_override_controller_path_pid_length_) + + // The pid prefix is a system-specific path part and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_pid_prefix_) && defined(_override_controller_path_pid_prefix_length_) + #define CONTROLLER_default_path_pid_prefix_s _override_controller_path_pid_prefix_ + + #define CONTROLLER_default_path_pid_prefix_s_length _override_controller_path_pid_prefix_length_ + #else + #define CONTROLLER_init_default_path_pid_prefix_s "init-" + #define CONTROLLER_init_default_path_pid_prefix_s_length 5 + #endif // defined(_override_controller_name_pid_prefix_) && defined(_override_controller_name_pid_prefix_length_) + + // The init settings path is a system-specific path part and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_settings_) && defined(_override_controller_path_settings_length_) + #define CONTROLLER_default_path_settings_s _override_controller_path_settings_ + #define CONTROLLER_default_path_settings_s_length _override_controller_path_settings_length_ + #else + #define CONTROLLER_init_default_path_settings_s "/etc/init" + #define CONTROLLER_init_default_path_settings_s_length 9 + #endif // defined(_override_controller_path_settings_) && defined(_override_controller_path_settings_length_) + + // The socket path is a system-specific path and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_socket_) && defined(_override_controller_path_socket_length_) + #define CONTROLLER_default_path_socket_s _override_controller_path_socket_ + #define CONTROLLER_default_path_socket_s_length _override_controller_path_socket_length_ + #else + #define CONTROLLER_init_default_path_socket_s "/var/run/init" + #define CONTROLLER_init_default_path_socket_s_length 13 + #endif // defined(_override_controller_path_socket_) && defined(_override_controller_path_socket_length_) + + // The socket prefix path is a system-specific path part and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_socket_prefix_) && defined(_override_controller_path_socket_prefix_length_) + #define CONTROLLER_default_path_socket_prefix_s _override_controller_path_socket_prefix_ + #define CONTROLLER_default_path_socket_prefix_s_length _override_controller_path_socket_prefix_length_ + #else + #define CONTROLLER_init_default_path_socket_prefix_s "init-" + #define CONTROLLER_init_default_path_socket_prefix_s_length 5 + #endif // defined(_override_controller_path_socket_prefix_) && defined(_override_controller_path_socket_prefix_length_) +#endif // _di_controller_default_s_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/sources/c/main/common/string.h b/sources/c/main/common/string.h index 406c7b5..42d2f76 100644 --- a/sources/c/main/common/string.h +++ b/sources/c/main/common/string.h @@ -126,6 +126,123 @@ extern "C" { extern const f_string_static_t controller_long_validate_s; #endif // _di_controller_parameter_s_ +/** + * The program defaults. + */ +#ifndef _di_controller_default_s_ + + // The pid path is a system-specific path and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_pid_) && defined(_override_controller_path_pid_length_) + #define CONTROLLER_default_path_pid_s _override_controller_path_pid_ + #define CONTROLLER_default_path_pid_s_length _override_controller_path_pid_length_ + #else + #define CONTROLLER_default_path_pid_s "./run" + #define CONTROLLER_default_path_pid_s_length 5 + #endif // defined(_override_controller_path_pid_) && defined(_override_controller_path_pid_length_) + + // The init pid path is a system-specific path and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_pid_init_) && defined(_override_controller_path_pid_init_length_) + #define CONTROLLER_default_path_pid_init_s _override_controller_path_pid_init_ + #define CONTROLLER_default_path_pid_init_s_length _override_controller_path_pid_init_length_ + #else + #define CONTROLLER_default_path_pid_init_s "/var/run/controller" + #define CONTROLLER_default_path_pid_init_s_length 19 + #endif // defined(_override_controller_path_pid_init_) && defined(_override_controller_path_pid_init_length_) + + // The pid prefix is a system-specific path part and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_pid_prefix_) && defined(_override_controller_path_pid_prefix_length_) + #define CONTROLLER_default_path_pid_prefix_s _override_controller_path_pid_prefix_ + + #define CONTROLLER_default_path_pid_prefix_s_length _override_controller_path_pid_prefix_length_ + #else + #define CONTROLLER_default_path_pid_prefix_s "" + #define CONTROLLER_default_path_pid_prefix_s_length 0 + #endif // defined(_override_controller_name_pid_prefix_) && defined(_override_controller_name_pid_prefix_length_) + + // The socket suffix path is a system-specific path part and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_pid_suffix_) && defined(_override_controller_path_pid_suffix_length_) + #define CONTROLLER_default_path_pid_suffix_s _override_controller_path_pid_suffix_ + #define CONTROLLER_default_path_pid_suffix_s_length _override_controller_path_pid_suffix_length_ + #else + #define CONTROLLER_default_path_pid_suffix_s ".pid" + #define CONTROLLER_default_path_pid_suffix_s_length 4 + #endif // defined(_override_controller_name_pid_suffix_) && defined(_override_controller_name_pid_suffix_length_) + + // The settings path is a system-specific path part and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_settings_) && defined(_override_controller_path_settings_length_) + #define CONTROLLER_default_path_settings_s _override_controller_path_settings_ + #define CONTROLLER_default_path_settings_s_length _override_controller_path_settings_length_ + #else + #define CONTROLLER_default_path_settings_s "./" + #define CONTROLLER_default_path_settings_s_length 2 + #endif // defined(_override_controller_path_settings_) && defined(_override_controller_path_settings_length_) + + // The init settings path is a system-specific path part and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_settings_init_) && defined(_override_controller_path_settings_init_length_) + #define CONTROLLER_default_path_settings_init_s _override_controller_path_settings_init_ + #define CONTROLLER_default_path_settings_init_s_length _override_controller_path_settings_init_length_ + #else + #define CONTROLLER_default_path_settings_init_s "/etc/controller" + #define CONTROLLER_default_path_settings_init_s_length 15 + #endif // defined(_override_controller_path_settings_init_) && defined(_override_controller_path_settings_init_length_) + + // The socket path is a system-specific path and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_socket_) && defined(_override_controller_path_socket_length_) + #define CONTROLLER_default_path_socket_s _override_controller_path_socket_ + #define CONTROLLER_default_path_socket_s_length _override_controller_path_socket_length_ + #else + #define CONTROLLER_default_path_socket_s "./run" + #define CONTROLLER_default_path_socket_s_length 5 + #endif // defined(_override_controller_path_socket_) && defined(_override_controller_path_socket_length_) + + // The socket path is a system-specific path and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_socket_init_) && defined(_override_controller_path_socket_init_length_) + #define CONTROLLER_default_path_socket_init_s _override_controller_path_socket_init_ + #define CONTROLLER_default_path_socket_init_s_length _override_controller_path_socket_init_length_ + #else + #define CONTROLLER_default_path_socket_init_s "/var/run/controller" + #define CONTROLLER_default_path_socket_init_s_length 19 + #endif // defined(_override_controller_path_socket_init_) && defined(_override_controller_path_socket_init_length_) + + // The socket prefix path is a system-specific path part and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_socket_prefix_) && defined(_override_controller_path_socket_prefix_length_) + #define CONTROLLER_default_path_socket_prefix_s _override_controller_path_socket_prefix_ + #define CONTROLLER_default_path_socket_prefix_s_length _override_controller_path_socket_prefix_length_ + #else + #define CONTROLLER_default_path_socket_prefix_s "" + #define CONTROLLER_default_path_socket_prefix_s_length 0 + #endif // defined(_override_controller_path_socket_prefix_) && defined(_override_controller_path_socket_prefix_length_) + + // The socket suffix path is a system-specific path part and needs to be more easily controlled at compile time. + #if defined(_override_controller_path_socket_suffix_) && defined(_override_controller_path_socket_suffix_length_) + #define CONTROLLER_default_path_socket_suffix_s _override_controller_path_socket_suffix_ + #define CONTROLLER_default_path_socket_suffix_s_length _override_controller_path_socket_suffix_length_ + #else + #define CONTROLLER_default_path_socket_suffix_s ".socket" + #define CONTROLLER_default_path_socket_suffix_s_length 7 + #endif // defined(_override_controller_path_socket_suffix_) && defined(_override_controller_path_socket_suffix_length_) + + #if defined(_override_controller_default_program_script_) && defined(_override_controller_default_program_script_length_) + #define CONTROLLER_default_engine_s _override_controller_default_engine_ + #define CONTROLLER_default_engine_s_length _override_controller_default_engine_length_ + #else + #define CONTROLLER_default_engine_s "bash" + #define CONTROLLER_default_engine_s_length 4 + #endif // defined(_override_controller_default_program_script_) && defined(_override_controller_default_program_script_length_) + + extern const f_string_static_t controller_default_engine_s; + extern const f_string_static_t controller_default_path_pid_s; + extern const f_string_static_t controller_default_path_pid_init_s; + extern const f_string_static_t controller_default_path_pid_prefix_s; + extern const f_string_static_t controller_default_path_pid_suffix_s; + extern const f_string_static_t controller_default_path_settings_s; + extern const f_string_static_t controller_default_path_settings_init_s; + extern const f_string_static_t controller_default_path_socket_s; + extern const f_string_static_t controller_default_path_socket_init_s; + extern const f_string_static_t controller_default_path_socket_prefix_s; + extern const f_string_static_t controller_default_path_socket_suffix_s; +#endif // _di_controller_default_s_ + #ifdef __cplusplus } // extern "C" #endif diff --git a/sources/c/main/common/type.h b/sources/c/main/common/type.h index a3d3c4b..0bd3ca9 100644 --- a/sources/c/main/common/type.h +++ b/sources/c/main/common/type.h @@ -42,6 +42,9 @@ extern "C" { * * status_signal: A status used eclusively by the threaded signal handler. * state: The state data used when processing the FSS data. + * + * path_pid: The name of the program. + * path_setting: The long name of the program. */ #ifndef _di_controller_setting_t_ typedef struct { @@ -49,6 +52,9 @@ extern "C" { f_status_t status_signal; f_state_t state; + + f_string_dynamic_t path_pid; + f_string_dynamic_t path_setting; } controller_setting_t; #define controller_setting_t_initialize \ @@ -56,6 +62,8 @@ extern "C" { controller_main_flag_none_e, \ F_okay, \ f_state_t_initialize, \ + f_string_dynamic_t_initialize, \ + f_string_dynamic_t_initialize, \ } #endif // _di_controller_setting_t_