]> Kevux Git Server - controller/commitdiff
Progress: Continue migrating the project.
authorKevin Day <kevin@kevux.org>
Tue, 9 Apr 2024 02:55:01 +0000 (21:55 -0500)
committerKevin Day <kevin@kevux.org>
Tue, 9 Apr 2024 02:55:01 +0000 (21:55 -0500)
data/build/defines
data/build/settings.init
sources/c/controller/string.c
sources/c/controller/string.h
sources/c/init/string.c
sources/c/init/string.h
sources/c/main/common/string.h
sources/c/main/common/type.h

index a5c6973bf7f4c68f08bfe84acb5457d8edbf9923..260609fe23d6d2d924deb3ec32459943fc76c246 100644 (file)
@@ -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).
index 7021bbdc42d214189c525c7b30d99f8a93af51c9..822a60a0bda59e325edf8d760ef6c843038a2f92 100644 (file)
@@ -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_
 
index 3bad69b5877c0e4cffd2441029417e126579c023..b14998d09c93cea7defa2a608a5d23a7b161b5eb 100644 (file)
@@ -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
index 2f7ed971064889936127b819f900ce7219739909..4870bc01f3eedeb71ff2c01d55b1597e5aab25c4 100644 (file)
@@ -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
index 2884a041d7b0839e5d618c9e7070f64b07817b6a..c34bf3e58caa8d4bf773ceb582ede6ebac766751 100644 (file)
@@ -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
index c9dd068303b68cf73296b77299fcfd9342de0a04..ee5598d56d79115fc7475d8fc7846cbfb692f7f9 100644 (file)
@@ -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
index 406c7b57ccd865e716e75c7968217895b561a966..42d2f766e6f636a8f1c72b9df65cefb7836dbcbd 100644 (file)
@@ -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
index a3d3c4b5e40eb661285fb1ab37faed781c19678e..0bd3ca98cc790ff676e3ec6b0806b80857e38982 100644 (file)
@@ -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_