From cb98974d5dcbc0ac50cc5e6e56fdff590b3c2fe3 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 22 Sep 2021 19:33:40 -0500 Subject: [PATCH] Update: Controller "as init" should use "init" over "controller" in more places. The default settings should be changed to /etc/init/. The default pid file path should be changed to /var/run/init/init-XXX.pid. --- level_3/controller/c/controller.c | 2 +- level_3/controller/c/controller.h | 8 ++++++++ level_3/controller/c/main.c | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/level_3/controller/c/controller.c b/level_3/controller/c/controller.c index db82e7c..48e59fe 100644 --- a/level_3/controller/c/controller.c +++ b/level_3/controller/c/controller.c @@ -250,7 +250,7 @@ extern "C" { status = f_string_append(controller_path_pid_init, controller_path_pid_init_length, &setting.path_pid); } else { - status = f_string_append(controller_path_pid, controller_path_pid_length, &setting.path_pid); + status = f_string_append(main->path_pid.string, main->path_pid.used, &setting.path_pid); } if (F_status_is_error_not(status)) { diff --git a/level_3/controller/c/controller.h b/level_3/controller/c/controller.h index 3bb0502..fc04756 100644 --- a/level_3/controller/c/controller.h +++ b/level_3/controller/c/controller.h @@ -114,6 +114,9 @@ extern "C" { #if defined(_override_controller_path_pid_init_) && defined(_override_controller_path_pid_init_length_) #define controller_path_pid_init _override_controller_path_pid_init_ #define controller_path_pid_init_length _override_controller_path_pid_init_length_ + #elif defined(_controller_as_init_) + #define controller_path_pid_init "/var/run/init/init-" + #define controller_path_pid_init_length 19 #else #define controller_path_pid_init "/var/run/controller/controller-" #define controller_path_pid_init_length 31 @@ -123,6 +126,9 @@ extern "C" { #if defined(_override_controller_path_settings_init_) && defined(_override_controller_path_settings_init_length_) #define controller_path_settings_init _override_controller_path_settings_init_ #define controller_path_settings_init_length _override_controller_path_settings_init_length_ + #elif defined(_controller_as_init_) + #define controller_path_settings_init "/etc/init" + #define controller_path_settings_init_length 9 #else #define controller_path_settings_init "/etc/controller" #define controller_path_settings_init_length 15 @@ -228,6 +234,7 @@ extern "C" { f_string_t program_name; f_string_t program_name_long; f_string_static_t setting_default; + f_string_static_t path_pid; f_color_context_t context; } controller_main_t; @@ -247,6 +254,7 @@ extern "C" { f_string_t_initialize, \ f_string_t_initialize, \ f_string_static_t_initialize, \ + f_string_static_t_initialize, \ f_color_context_t_initialize, \ } #endif // _di_controller_main_t_ diff --git a/level_3/controller/c/main.c b/level_3/controller/c/main.c index 3f930bb..d68197a 100644 --- a/level_3/controller/c/main.c +++ b/level_3/controller/c/main.c @@ -41,9 +41,13 @@ int main(const int argc, const f_string_t *argv) { data.program_name_long = controller_name_init_long; data.setting_default.string = controller_path_settings_init; data.setting_default.used = controller_path_settings_init_length; + data.path_pid.string = controller_path_pid_init; + data.path_pid.used = controller_path_pid_init_length; #else // _controller_as_init_ data.program_name = controller_name; data.program_name_long = controller_name_long; + data.path_pid.string = controller_path_pid; + data.path_pid.used = controller_path_pid_length; #endif // _controller_as_init_ status = controller_main(arguments, &data); -- 1.8.3.1