]> Kevux Git Server - fll/commitdiff
Feature: Implement fll_program_standard_signal_received_wait().
authorKevin Day <Kevin@kevux.org>
Thu, 23 Jan 2025 06:53:25 +0000 (00:53 -0600)
committerKevin Day <Kevin@kevux.org>
Thu, 23 Jan 2025 06:53:25 +0000 (00:53 -0600)
The `fll_program_standard_signal_received_wait()` is now added because a lot of this code is repeated forr every single FLL program.

The `fll_program_standard_signal_received()` is refactored to return a status code to match the newly added `ll_program_standard_signal_received_wait()`.

The `status_signal` can now be moved into the main program settings structure.
The `status_signal` is renamed to `signal_status` to keep the naming more consistent.

This also exposes and fixes a race condition in how the pre-existing threaded signal handling is being used.
The check for `program.signal.id` that then opens a signal via `f_signal_open()` in the thread is not necessary because the signal id from the parent thread is preserved.
The `f_signal_close()` in the thread ends up prematurely closing the signal because the parent thread signal id is passed to the child thread.
The `main->program.signal.id == -1` checks in the signal check functions end up preventing the interrupt cancel from being triggered because of the `f_signal_close()` being called in a separate thread that shares the same signal id.

48 files changed:
build/stand_alone/byte_dump.config.h
build/stand_alone/example.config.h
build/stand_alone/fake.config.h
build/stand_alone/firewall.config.h
build/stand_alone/utf8.config.h
level_2/fll_program/c/private-program.c
level_2/fll_program/c/private-program.h
level_2/fll_program/c/program.c
level_2/fll_program/c/program.h
level_2/fll_program/c/program/common.h
level_3/byte_dump/c/main/common/type.h
level_3/byte_dump/c/main/signal.c
level_3/byte_dump/c/main/signal.h
level_3/example/c/main/common/type.h
level_3/example/c/main/signal.c
level_3/example/c/main/signal.h
level_3/fake/c/main/build/skeleton.h
level_3/fake/c/main/common/type.h
level_3/fake/c/main/fake.h
level_3/fake/c/main/make/load_fakefile.h
level_3/fake/c/main/make/operate_process.c
level_3/fake/c/main/make/operate_process.h
level_3/fake/c/main/signal.c
level_3/fake/c/main/signal.h
level_3/firewall/c/main/common/type.h
level_3/firewall/c/main/signal.c
level_3/firewall/c/main/signal.h
level_3/fss_identify/c/main/common/type.h
level_3/fss_identify/c/main/signal.c
level_3/fss_identify/c/main/signal.h
level_3/fss_read/c/main/common/type.h
level_3/fss_read/c/main/signal.c
level_3/fss_read/c/main/signal.h
level_3/fss_write/c/main/common/type.h
level_3/fss_write/c/main/signal.c
level_3/fss_write/c/main/signal.h
level_3/iki_read/c/main/common/type.h
level_3/iki_read/c/main/signal.c
level_3/iki_read/c/main/signal.h
level_3/iki_write/c/main/common/type.h
level_3/iki_write/c/main/signal.c
level_3/iki_write/c/main/signal.h
level_3/status_code/c/main/common/type.h
level_3/status_code/c/main/signal.c
level_3/status_code/c/main/signal.h
level_3/utf8/c/main/common/type.h
level_3/utf8/c/main/signal.c
level_3/utf8/c/main/signal.h

index 5b5a939b5e9b110af9215c00206abafda629df93..a8afed6591fb9ae0b327cdbe839d2a719cb8ae63 100644 (file)
 //#define _di_fll_program_standard_set_up_
 //#define _di_fll_program_standard_signal_handle_
 //#define _di_fll_program_standard_signal_received_
+//#define _di_fll_program_standard_signal_received_wait_
 #define _di_private_inline_f_print_to_error_
 #define _di_private_inline_private_f_print_to_error_
index f489fc10656a0ac4a22f13ce920c7ef8af5797d3..89a196b6a8293bef016a1bb0dcc2436cf4458d66 100644 (file)
 //#define _di_fll_program_standard_set_up_
 //#define _di_fll_program_standard_signal_handle_
 //#define _di_fll_program_standard_signal_received_
+//#define _di_fll_program_standard_signal_received_wait_
 #define _di_private_inline_f_print_to_error_
 #define _di_private_inline_private_f_print_to_error_
 
index 2ba861872a52750ca41f4cf66da389e1d469c11c..09ee98022d7a7fada3d339cfdebfe154d14fc771 100644 (file)
 //#define _di_fll_program_standard_set_up_
 //#define _di_fll_program_standard_signal_handle_
 //#define _di_fll_program_standard_signal_received_
+//#define _di_fll_program_standard_signal_received_wait_
 #define _di_private_inline_f_print_to_error_
 #define _di_private_inline_private_f_print_to_error_
index 9e6d8e5876a059309221590dbd2997c9ccdeecff..efe20b77fb58d3bda4926402605aa9a23d745431 100644 (file)
 //#define _di_fll_program_standard_set_up_
 //#define _di_fll_program_standard_signal_handle_
 //#define _di_fll_program_standard_signal_received_
+//#define _di_fll_program_standard_signal_received_wait_
 #define _di_private_inline_f_print_to_error_
 #define _di_private_inline_private_f_print_to_error_
index 0be76fc8fd23532d90b6628334e0b8da365dc133..3fe348704ba2894a6f2293ec16692bd77f3a7d55 100644 (file)
 //#define _di_fll_program_standard_set_up_
 //#define _di_fll_program_standard_signal_handle_
 //#define _di_fll_program_standard_signal_received_
+//#define _di_fll_program_standard_signal_received_wait_
 #define _di_private_inline_f_print_to_error_
 #define _di_private_inline_private_f_print_to_error_
index 5194b128d00fa8ff193fd28b56c4e1626299a05d..66dbc31924984ef926ee581a5e9319c97fe0459e 100644 (file)
@@ -78,15 +78,18 @@ extern "C" {
 #endif // !defined(_di_fll_program_print_help_option_) || !defined(_di_fll_program_print_help_option_standard_)
 
 #if !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_handle_)
-  uint32_t private_fll_program_standard_signal_received(fll_program_data_t * const program) {
+  f_status_t private_fll_program_standard_signal_received(fll_program_data_t * const program) {
 
-    if (!program || program->signal.id == -1) return 0;
+    if (!program || program->signal.id == -1) return F_status_set_error(F_parameter);
 
     struct signalfd_siginfo information;
 
     memset(&information, 0, sizeof(struct signalfd_siginfo));
 
-    if (f_signal_read(program->signal, 0, &information) == F_signal) {
+    program->signal_status = f_signal_read(program->signal, 0, &information);
+    if (F_status_is_error(program->signal_status)) return program->signal_status;
+
+    if (program->signal_status == F_signal) {
       switch (information.ssi_signo) {
         case F_signal_abort:
         case F_signal_broken_pipe:
@@ -96,11 +99,11 @@ extern "C" {
         case F_signal_termination:
           program->signal_received = information.ssi_signo;
 
-          return information.ssi_signo;
+          return F_interrupt;
       }
     }
 
-    return 0;
+    return F_interrupt_not;
   }
 #endif // !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_handle_)
 
index 48913318df66e0e1626789042061b0f6da9fff46..3db7ba5b998d81929d802ced502f1d727cb08f98 100644 (file)
@@ -91,9 +91,15 @@ extern "C" {
  * @param program
  *   The program data.
  *
+ *   This alters program:
+ *     - signal_received: Stores the signal received if deemed appropraite.
+ *     - signal_status:   Stores the status of the signal checking function.
+ *
  * @return
- *   A positive number representing a valid signal on signal received.
- *   0 on no signal received or when main is NULL.
+ *   F_interrupt on success with interrupt received.
+ *   F_interrupt_not on success without interrupt received.
+ *
+ *   Errors (with error bit) from: f_signal_read().
  *
  * @see f_signal_read()
  *
@@ -101,7 +107,7 @@ extern "C" {
  * @see fll_program_standard_signal_handle()
  */
 #if !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_handle_)
-  uint32_t private_fll_program_standard_signal_received(fll_program_data_t * const program) F_attribute_visibility_internal_d;
+  f_status_t private_fll_program_standard_signal_received(fll_program_data_t * const program) F_attribute_visibility_internal_d;
 #endif // !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_handle_)
 
 /**
index ee6cb755d466a51999beb313e55144b57c6f0dfc..d8b438b574e4ba6ed329ede72246daa965e16427 100644 (file)
@@ -522,15 +522,68 @@ extern "C" {
 #endif // _di_fll_program_standard_set_up_
 
 #ifndef _di_fll_program_standard_signal_received_
-  uint32_t fll_program_standard_signal_received(fll_program_data_t * const program) {
+  f_status_t fll_program_standard_signal_received(fll_program_data_t * const program) {
     #ifndef _di_level_2_parameter_checking_
-      if (!program) return 0;
+      if (!program || program->signal.id == -1) return F_status_set_error(F_parameter);
     #endif // _di_level_2_parameter_checking_
 
     return private_fll_program_standard_signal_received(program);
   }
 #endif // _di_fll_program_standard_signal_received_
 
+#ifndef _di_fll_program_standard_signal_received_wait_
+  f_status_t fll_program_standard_signal_received_wait(fll_program_data_t * const program, const f_number_unsigned_t max) {
+    #ifndef _di_level_2_parameter_checking_
+      if (!program || program->signal.id == -1) return F_status_set_error(F_parameter);
+    #endif // _di_level_2_parameter_checking_
+
+    // This utilizes a local status to better control the status within this scope as this function is expected to be run in a threaded environment.
+    siginfo_t information;
+    f_number_unsigned_t failsafe = 0;
+    f_status_t status = F_okay;
+
+    memset(&information, 0, sizeof(siginfo_t));
+
+    program->signal_received = 0;
+
+    do {
+      memset(&information, 0, sizeof(siginfo_t));
+
+      program->signal_status = status = f_signal_wait(&program->signal.set, &information);
+
+      if (F_status_is_error(status) && F_status_set_fine(status) != F_interrupt) {
+        if (++failsafe >= max) {
+          status = F_status_set_error(F_maximum);
+
+          break;
+        }
+      }
+
+      switch (information.si_signo) {
+        case F_signal_abort:
+        case F_signal_broken_pipe:
+        case F_signal_hangup:
+        case F_signal_interrupt:
+        case F_signal_quit:
+        case F_signal_termination:
+          program->signal_received = information.si_signo;
+          program->signal_status = status = F_interrupt;
+
+          break;
+
+        default:
+          failsafe = 0;
+          program->signal_status = F_okay;
+
+          break;
+      }
+
+    } while (F_status_set_fine(status) != F_interrupt);
+
+    return status;
+  }
+#endif // _di_fll_program_standard_signal_received_wait_
+
 #ifndef _di_fll_program_standard_signal_handle_
   void fll_program_standard_signal_handle(f_state_t * const state, void * const internal) {
     #ifndef _di_level_2_parameter_checking_
@@ -545,14 +598,11 @@ extern "C" {
 
     fll_program_data_t * const program = (fll_program_data_t *) state->custom;
 
-    program->signal_received = private_fll_program_standard_signal_received(program);
+    const f_status_t status = program->signal.id == -1
+      ? F_interrupt_not
+      : private_fll_program_standard_signal_received(program);
 
-    if (program->signal_received == F_signal_abort || program->signal_received == F_signal_broken_pipe || program->signal_received == F_signal_hangup || program->signal_received == F_signal_interrupt || program->signal_received == F_signal_quit || program->signal_received == F_signal_termination) {
-      state->status = F_status_set_error(F_interrupt);
-    }
-    else {
-      state->status = F_interrupt_not;
-    }
+    state->status = F_status_set_fine(status) == F_interrupt ? F_status_set_error(F_interrupt) : status;
   }
 #endif // _di_fll_program_standard_signal_handle_
 
index ef0608e0765fc9511526624464e9d0da342d95b7..46bf7122064c57b342a1d950c8290578620f81b5 100644 (file)
@@ -367,25 +367,78 @@ extern "C" {
 /**
  * Check to see if a process signal is received.
  *
- * Only signals that are blocked via main.signal will be received.
+ * Only signals that are blocked via program.signal will be received.
  *
- * If no signals are blocked, then this always returns F_false.
+ * If no signals are blocked, then this always returns F_interrupt_not.
+ *
+ * This only reacts on the following signals:
+ *   - F_signal_abort
+ *   - F_signal_broken_pipe
+ *   - F_signal_hangup
+ *   - F_signal_interrupt
+ *   - F_signal_quit
+ *   - F_signal_termination
  *
  * @param program
  *   The program data.
- *   The program.signal must be used to designate blocked signals.
+ *
+ *   This alters program:
+ *     - signal_received: Stores the signal received if deemed appropraite.
+ *     - signal_status:   Stores the status of the signal checking function.
  *
  * @return
- *   A positive number representing a valid signal on signal received.
- *   0 on no signal received or when main is NULL.
+ *   F_interrupt on success with interrupt received.
+ *   F_interrupt_not on success without interrupt received.
+ *
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
+ *   Errors (with error bit) from: f_signal_read().
  *
  * @see f_signal_read()
  */
 #ifndef _di_fll_program_standard_signal_received_
-  extern uint32_t fll_program_standard_signal_received(fll_program_data_t * const program);
+  extern f_status_t fll_program_standard_signal_received(fll_program_data_t * const program);
 #endif // _di_fll_program_standard_signal_received_
 
 /**
+ * Check to see if a process signal is received, in a blocking manner.
+ *
+ * This will attempt to wait infinitely until a signal is received or enough sequential errors are greater than the given max.
+ *
+ * Only signals that are blocked via program.signal will be received.
+ *
+ * This only reacts on the following signals:
+ *   - F_signal_abort
+ *   - F_signal_broken_pipe
+ *   - F_signal_hangup
+ *   - F_signal_interrupt
+ *   - F_signal_quit
+ *   - F_signal_termination
+ *
+ * @param program
+ *   The program data.
+ *
+ *   This alters program:
+ *     - signal.id:       At start and on return.
+ *     - signal_received: Stores the signal received if deemed appropraite.
+ *     - signal_status:   Stores the status of the signal checking function.
+ *
+ * @return
+ *   F_interrupt on success with interrupt received.
+ *   F_interrupt_not on success without interrupt received.
+ *
+ *   F_maximum (with error bit) if max is reached on too many sequential errors.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ *
+ *   Errors (with error bit) from: f_signal_wait().
+ *
+ * @see f_signal_wait()
+ */
+#ifndef _di_fll_program_standard_signal_received_wait_
+  extern f_status_t fll_program_standard_signal_received_wait(fll_program_data_t * const program, const f_number_unsigned_t max);
+#endif // _di_fll_program_standard_signal_received_wait_
+
+/**
  * Standardized callback for checking for interrupts via the f_state_t interrupt callback.
  *
  * This only checks for the signals:
index ec352b874a7ae97ad2c3d6650fea65ee85c3f4da..5f3414b2b33ffed0d92bf072bceb2233d7514840 100644 (file)
@@ -98,6 +98,7 @@ extern "C" {
  *   - signal_check:    A counter used to map to for reducing the amount of actual signal check calls.
  *   - signal_received: The signal received (if 0, then no signal is received).
  *   - signal:          The process signal management structure.
+ *   - signal_status:   The status of the signal handler.
  *
  *   - message: The output file for normal output messages (often stdout).
  *   - output:  The output file for normal/non-message output, aka data output (often stdout or a file).
@@ -120,6 +121,7 @@ extern "C" {
     uint32_t signal_received;
     uint16_t signal_check;
     f_signal_t signal;
+    f_status_t signal_status;
 
     fl_print_t message;
     fl_print_t output;
@@ -141,6 +143,7 @@ extern "C" {
       0, \
       0, \
       f_signal_t_initialize, \
+      F_okay, \
       fl_print_t_initialize, \
       fl_print_t_initialize, \
       macro_fl_print_t_initialize_error_1(), \
@@ -159,6 +162,7 @@ extern "C" {
     signal_received, \
     signal_check, \
     signal, \
+    F_okay, \
     message, \
     output, \
     error, \
index 351fa6464d737bfe02a8ac5d215320bf72972182..a28672588044260fa7fc639db8c324005b4b32e5 100644 (file)
@@ -75,10 +75,8 @@ extern "C" {
  * These program settings are often processed from the program arguments (often called the command line arguments).
  *
  * Properties:
- *   - flag: Flags passed to the main function.
- *
- *   - status_signal: A status used eclusively by the threaded signal handler.
- *   - state:         The state data used when processing data.
+ *   - flag:  Flags passed to the main function.
+ *   - state: The state data used when processing data.
  *
  *   - first:        The first position.
  *   - last:         The last position.
@@ -91,8 +89,6 @@ extern "C" {
 #ifndef _di_byte_dump_setting_t_
   typedef struct {
     uint16_t flag;
-
-    f_status_t status_signal;
     f_state_t state;
 
     uint64_t first;
@@ -107,7 +103,6 @@ extern "C" {
   #define byte_dump_setting_t_initialize \
     { \
       byte_dump_main_flag_none_d, \
-      F_okay, \
       f_state_t_initialize, \
       0, \
       0, \
index f713b0229a9b4437f685fb336aeb45913a96ae04..6e064931933b1d590c046b28fc3ea7488161c09b 100644 (file)
@@ -7,10 +7,11 @@ extern "C" {
 #if !defined(_di_byte_dump_signal_check_) && defined(_di_thread_support_)
   f_status_t byte_dump_signal_check(byte_dump_main_t * const main) {
 
-    if (!main || main->program.signal.id == -1) return F_false;
+    if (!main) return F_false;
+    if (main->program.signal_received) return F_true;
 
     if (!((++main->program.signal_check) % byte_dump_signal_check_d)) {
-      if (fll_program_standard_signal_received(&main->program)) {
+      if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interrupt) {
         fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
 
         main->setting.state.status = F_status_set_error(F_interrupt);
@@ -28,7 +29,7 @@ extern "C" {
 #if !defined(_di_byte_dump_signal_check_) && !defined(_di_thread_support_)
   f_status_t byte_dump_signal_check(byte_dump_main_t * const main) {
 
-    if (!main || main->program.signal.id == -1) return F_false;
+    if (!main) return F_false;
 
     if (main->program.signal_received) {
       fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
@@ -47,13 +48,6 @@ extern "C" {
 
     if (!main) return;
 
-    siginfo_t information;
-    f_number_unsigned_t failsafe = 0;
-
-    memset(&information, 0, sizeof(siginfo_t));
-
-    main->program.signal_received = 0;
-
     f_signal_set_empty(&main->program.signal.set);
     f_signal_set_add(F_signal_abort, &main->program.signal.set);
     f_signal_set_add(F_signal_broken_pipe, &main->program.signal.set);
@@ -62,45 +56,9 @@ extern "C" {
     f_signal_set_add(F_signal_quit, &main->program.signal.set);
     f_signal_set_add(F_signal_termination, &main->program.signal.set);
 
-    if (main->program.signal.id == -1) {
-      main->setting.status_signal = f_signal_open(&main->program.signal);
-
-      if (F_status_is_error(main->setting.status_signal)) {
-        main->program.signal_received = F_signal_abort;
-
-        return;
-      }
-    }
-
-    do {
-      memset(&information, 0, sizeof(siginfo_t));
-
-      main->setting.status_signal = f_signal_wait(&main->program.signal.set, &information);
-
-      if (F_status_is_error(main->setting.status_signal) && F_status_set_fine(main->setting.status_signal) != F_interrupt) {
-        if (++failsafe >= byte_dump_signal_check_failsafe_d) break;
-      }
-
-      switch (information.si_signo) {
-        case F_signal_abort:
-        case F_signal_broken_pipe:
-        case F_signal_hangup:
-        case F_signal_interrupt:
-        case F_signal_quit:
-        case F_signal_termination:
-          main->program.signal_received = information.si_signo;
-
-          break;
-      }
-
-      failsafe = 0;
-      main->setting.status_signal = F_okay;
-
-    } while (!main->program.signal_received);
-
-    f_signal_close(&main->program.signal);
+    fll_program_standard_signal_received_wait(&main->program, byte_dump_signal_check_failsafe_d);
 
-    if (F_status_is_error(main->setting.status_signal)) {
+    if (F_status_is_error(main->program.signal_status) && F_status_set_fine(main->program.signal_status) != F_interrupt) {
       main->program.signal_received = F_signal_abort;
     }
   }
index 4a7f789a9d7bf6146bf9052b37c197e651bdd2cc..d2a8397c852226b8fdff67a5a52ad476023d1703 100644 (file)
@@ -66,14 +66,11 @@ extern "C" {
  *   The main program and settings data.
  *
  *   This alters main.program.signal_received, setting it to a received signal.
+ *   This alters main.program.signal_status.
  *
- *   This alters main.setting.state.status:
- *     Errors (with error bit) from: f_signal_open()
- *     Errors (with error bit) from: f_signal_wait()
+ *   This does not alter main.setting.state.status.
  *
- * @see f_signal_close()
- * @see f_signal_open()
- * @see f_signal_wait()
+ * @see fll_program_standard_signal_received_wait()
  */
 #if !defined(_di_byte_dump_signal_handler_) && !defined(_di_thread_support_)
   extern void byte_dump_signal_handler(byte_dump_main_t * const main);
index e920659e401f898a7a9a6f97c1baba58b744b929..63805e6e5fdf7a7318d3b686c7a05abcae72743d 100644 (file)
@@ -45,16 +45,16 @@ extern "C" {
  * 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).
  *
- * flag: Flags passed to the main function.
+ * Properties:
+ *   - flag:  Flags passed to the main function.
+ *   - state: The state data used when processing the FSS data.
  *
- * status_signal: A status used eclusively by the threaded signal handler.
- * state:         The state data used when processing the FSS data.
+ *   - program_name:      The short program name.
+ *   - program_name_long: The long program name.
  */
 #ifndef _di_example_setting_t_
   typedef struct {
     uint16_t flag;
-
-    f_status_t status_signal;
     f_state_t state;
 
     const f_string_static_t *program_name;
@@ -64,7 +64,6 @@ extern "C" {
   #define example_setting_t_initialize \
     { \
       example_main_flag_none_d, \
-      F_okay, \
       f_state_t_initialize, \
       0, \
       0, \
index 84969c85835a0c26eb4b190ae13c332e5f79117b..624db5f9a9f70b38c77ef731dbe866a959f590bf 100644 (file)
@@ -7,10 +7,11 @@ extern "C" {
 #if !defined(_di_example_signal_check_) && defined(_di_thread_support_)
   f_status_t example_signal_check(example_main_t * const main) {
 
-    if (!main || main->program.signal.id == -1) return F_false;
+    if (!main) return F_false;
+    if (main->program.signal_received) return F_true;
 
     if (!((++main->program.signal_check) % example_signal_check_d)) {
-      if (fll_program_standard_signal_received(&main->program)) {
+      if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interrupt) {
         fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
 
         main->setting.state.status = F_status_set_error(F_interrupt);
@@ -47,13 +48,6 @@ extern "C" {
 
     if (!main) return;
 
-    siginfo_t information;
-    f_number_unsigned_t failsafe = 0;
-
-    memset(&information, 0, sizeof(siginfo_t));
-
-    main->program.signal_received = 0;
-
     f_signal_set_empty(&main->program.signal.set);
     f_signal_set_add(F_signal_abort, &main->program.signal.set);
     f_signal_set_add(F_signal_broken_pipe, &main->program.signal.set);
@@ -62,45 +56,9 @@ extern "C" {
     f_signal_set_add(F_signal_quit, &main->program.signal.set);
     f_signal_set_add(F_signal_termination, &main->program.signal.set);
 
-    if (main->program.signal.id == -1) {
-      main->setting.status_signal = f_signal_open(&main->program.signal);
-
-      if (F_status_is_error(main->setting.status_signal)) {
-        main->program.signal_received = F_signal_abort;
-
-        return;
-      }
-    }
-
-    do {
-      memset(&information, 0, sizeof(siginfo_t));
-
-      main->setting.status_signal = f_signal_wait(&main->program.signal.set, &information);
-
-      if (F_status_is_error(main->setting.status_signal) && F_status_set_fine(main->setting.status_signal) != F_interrupt) {
-        if (++failsafe >= example_signal_check_failsafe_d) break;
-      }
-
-      switch (information.si_signo) {
-        case F_signal_abort:
-        case F_signal_broken_pipe:
-        case F_signal_hangup:
-        case F_signal_interrupt:
-        case F_signal_quit:
-        case F_signal_termination:
-          main->program.signal_received = information.si_signo;
-
-          break;
-      }
-
-      failsafe = 0;
-      main->setting.status_signal = F_okay;
-
-    } while (!main->program.signal_received);
-
-    f_signal_close(&main->program.signal);
+    fll_program_standard_signal_received_wait(&main->program, example_signal_check_failsafe_d);
 
-    if (F_status_is_error(main->setting.status_signal)) {
+    if (F_status_is_error(main->program.signal_status) && F_status_set_fine(main->program.signal_status) != F_interrupt) {
       main->program.signal_received = F_signal_abort;
     }
   }
index 5bbc6153e3e253ffa57cbed6c7d8e1e36b40bc07..d38c3e0c9f2e2ad95f23d54740994b581c6b29a3 100644 (file)
@@ -66,14 +66,11 @@ extern "C" {
  *   The main program and settings data.
  *
  *   This alters main.program.signal_received, setting it to a received signal.
+ *   This alters main.program.signal_status.
  *
- *   This alters main.setting.state.status:
- *     Errors (with error bit) from: f_signal_open()
- *     Errors (with error bit) from: f_signal_wait()
+ *   This does not alter main.setting.state.status.
  *
- * @see f_signal_close()
- * @see f_signal_open()
- * @see f_signal_wait()
+ * @see fll_program_standard_signal_received_wait()
  */
 #if !defined(_di_example_signal_handler_) && !defined(_di_thread_support_)
   extern void example_signal_handler(example_main_t * const main);
index b7c7f4f156af02289554e55ada9808927c0e095a..783009d368063ba80c49642ffc9cc5ee9ac985ff 100644 (file)
@@ -40,7 +40,6 @@ extern "C" {
  *
  * @see f_directory_create()
  * @see f_directory_exists()
- * @see fll_program_standard_signal_received()
  *
  * @see fake_build_touch()
  */
index 2cc113e7bd6cc13322cb7772ca5a59c32cf1e298..83683419c93e80b5e177025041294c9a4517ae38 100644 (file)
@@ -67,10 +67,8 @@ extern "C" {
  * These program settings are often processed from the program arguments (often called the command line arguments).
  *
  * Properties:
- *   - flag: Flags passed to the main function.
- *
- *   - status_signal: A status used eclusively by the threaded signal handler.
- *   - state:         The state data used when processing the FSS data.
+ *   - flag:  Flags passed to the main function.
+ *   - state: The state data used when processing the FSS data.
  *
  *   - build:    The build directory.
  *   - data:     The data directory.
@@ -89,8 +87,6 @@ extern "C" {
 #ifndef _di_fake_setting_t_
   typedef struct {
     uint32_t flag;
-
-    f_status_t status_signal;
     f_state_t state;
 
     f_string_dynamic_t build;
@@ -113,7 +109,6 @@ extern "C" {
   #define fake_setting_t_initialize \
     { \
       0, \
-      F_okay, \
       f_state_t_initialize, \
       f_string_dynamic_t_initialize, \
       f_string_dynamic_t_initialize, \
index 4716250c9dc551dc25dc9400f2a811a26f070fd0..b7aa6412c63ba316cb536654113d4608a8946df2 100644 (file)
@@ -175,7 +175,6 @@ extern "C" {
  *     Errors (with error bit) from: fake_validate_parameter_paths()
  *
  * @see f_string_dynamic_append()
- * @see fll_program_standard_signal_received()
  * @see fake_build_operate()
  * @see fake_clean_operate()
  * @see fake_make_operate()
@@ -214,7 +213,6 @@ extern "C" {
  *   A value of 1 is returned if status has the error bit set.
  *
  * @see fll_execute_program()
- * @see fll_program_standard_signal_received()
  */
 #ifndef _di_fake_execute_
   extern int fake_execute(fake_data_t * const data, const f_string_maps_t environment, const f_string_static_t program);
@@ -251,7 +249,6 @@ extern "C" {
  * @see f_file_stream_open()
  * @see f_file_stream_read()
  * @see f_memory_array_increase_by()
- * @see fll_program_standard_signal_received()
  */
 #ifndef _di_fake_file_buffer_
   extern void fake_file_buffer(fake_data_t * const data, const f_string_static_t path_file, const bool required, f_string_dynamic_t * const buffer);
@@ -275,7 +272,6 @@ extern "C" {
  *
  * @see f_file_stream_read_block()
  * @see f_memory_array_increase_by()
- * @see fll_program_standard_signal_received()
  */
 #ifndef _di_fake_pipe_buffer_
   extern void fake_pipe_buffer(fake_data_t * const data, f_string_dynamic_t * const buffer);
@@ -299,7 +295,6 @@ extern "C" {
  *
  * @see f_file_exists()
  * @see f_file_stat()
- * @see fll_program_standard_signal_received()
  */
 #ifndef _di_fake_validate_parameter_paths_
   extern void fake_validate_parameter_paths(fake_data_t * const data);
index b1757c352dc0f48246083f88ca3d3a2b5a6adcda..118ba52b95bd2bbced4820d7a4a70d13eba277ab 100644 (file)
@@ -57,7 +57,6 @@ extern "C" {
  * @see f_string_dynamic_partial_append()
  * @see fll_fss_basic_list_read()
  * @see fll_fss_extended_read()
- * @see fll_program_standard_signal_received()
  *
  * @see fake_build_load_setting()
  * @see fake_make_load_fakefile_setting_build()
index 8d655a06d25bafbdf9be0c6b804f90686becf54a..7f44affd9ca729dad71fdcfc5e546bf2282699e3 100644 (file)
@@ -290,13 +290,7 @@ extern "C" {
 
     fake_main_t * const main = data_make->main;
 
-    if (fll_program_standard_signal_received(&main->program)) {
-      fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
-
-      main->setting.state.status = F_status_set_error(F_interrupt);
-
-      return;
-    }
+    if (fake_signal_check(main)) return;
 
     // Reset the environment.
     for (f_number_unsigned_t i = 0; i < data_make->environment.used; ++i) {
@@ -339,13 +333,7 @@ extern "C" {
 
     main->setting.state.status = fll_execute_program(program, arguments, &parameter, 0, (void *) &return_code);
 
-    if (fll_program_standard_signal_received(&main->program)) {
-      fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
-
-      main->setting.state.status = F_status_set_error(F_interrupt);
-
-      return;
-    }
+    if (fake_signal_check(main)) return;
 
     if (F_status_is_error(main->setting.state.status)) {
       if (F_status_set_fine(main->setting.state.status) == F_interrupt) return;
index acc564654ffb658622f89afe570ac2d8908ef18a..2c0f7f1f13132504abd94b752c22bf63fce2b292 100644 (file)
@@ -183,7 +183,6 @@ extern "C" {
  * @see f_environment_get_all()
  * @see fl_environment_load_names()
  * @see fll_execute_program()
- * @see fll_program_standard_signal_received()
  *
  * @see fake_make_operate_process_return()
  */
index d8018432027f77d7840f2d9ba774fa45e5494b03..dfb48cc65d376b55abfd8d5906bf9f1cdf5ec2e7 100644 (file)
@@ -7,10 +7,11 @@ extern "C" {
 #if !defined(_di_fake_signal_check_) && defined(_di_thread_support_)
   f_status_t fake_signal_check(fake_main_t * const main) {
 
-    if (!main || main->program.signal.id == -1) return F_false;
+    if (!main) return F_false;
+    if (main->program.signal_received) return F_true;
 
     if (!((++main->program.signal_check) % fake_signal_check_d)) {
-      if (fll_program_standard_signal_received(&main->program)) {
+      if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interrupt) {
         fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
 
         main->setting.state.status = F_status_set_error(F_interrupt);
@@ -47,13 +48,6 @@ extern "C" {
 
     if (!main) return;
 
-    siginfo_t information;
-    f_number_unsigned_t failsafe = 0;
-
-    memset(&information, 0, sizeof(siginfo_t));
-
-    main->program.signal_received = 0;
-
     f_signal_set_empty(&main->program.signal.set);
     f_signal_set_add(F_signal_abort, &main->program.signal.set);
     f_signal_set_add(F_signal_broken_pipe, &main->program.signal.set);
@@ -62,45 +56,9 @@ extern "C" {
     f_signal_set_add(F_signal_quit, &main->program.signal.set);
     f_signal_set_add(F_signal_termination, &main->program.signal.set);
 
-    if (main->program.signal.id == -1) {
-      main->setting.status_signal = f_signal_open(&main->program.signal);
-
-      if (F_status_is_error(main->setting.status_signal)) {
-        main->program.signal_received = F_signal_abort;
-
-        return;
-      }
-    }
-
-    do {
-      memset(&information, 0, sizeof(siginfo_t));
-
-      main->setting.status_signal = f_signal_wait(&main->program.signal.set, &information);
-
-      if (F_status_is_error(main->setting.status_signal) && F_status_set_fine(main->setting.status_signal) != F_interrupt) {
-        if (++failsafe >= fake_signal_check_failsafe_d) break;
-      }
-
-      switch (information.si_signo) {
-        case F_signal_abort:
-        case F_signal_broken_pipe:
-        case F_signal_hangup:
-        case F_signal_interrupt:
-        case F_signal_quit:
-        case F_signal_termination:
-          main->program.signal_received = information.si_signo;
-
-          break;
-      }
-
-      failsafe = 0;
-      main->setting.status_signal = F_okay;
-
-    } while (!main->program.signal_received);
-
-    f_signal_close(&main->program.signal);
+    fll_program_standard_signal_received_wait(&main->program, fake_signal_check_failsafe_d);
 
-    if (F_status_is_error(main->setting.status_signal)) {
+    if (F_status_is_error(main->program.signal_status) && F_status_set_fine(main->program.signal_status) != F_interrupt) {
       main->program.signal_received = F_signal_abort;
     }
   }
index 0c3b7c4844e99d8042f8355d1f7361b5a12629e0..b349e9c380811180f365afc439d4a87fb3b417e6 100644 (file)
@@ -66,14 +66,11 @@ extern "C" {
  *   The main program and settings data.
  *
  *   This alters main.program.signal_received, setting it to a received signal.
+ *   This alters main.program.signal_status.
  *
- *   This alters main.setting.state.status:
- *     Errors (with error bit) from: f_signal_open()
- *     Errors (with error bit) from: f_signal_wait()
+ *   This does not alter main.setting.state.status.
  *
- * @see f_signal_close()
- * @see f_signal_open()
- * @see f_signal_wait()
+ * @see fll_program_standard_signal_received_wait()
  */
 #if !defined(_di_fake_signal_handler_) && !defined(_di_thread_support_)
   extern void fake_signal_handler(fake_main_t * const main);
index 3675ded0c4dde07d76fb1960e3df0d059df5453e..926c78baa776c95702416456ae68344d31502b66 100644 (file)
@@ -152,10 +152,8 @@ extern "C" {
  * These program settings are often processed from the program arguments (often called the command line arguments).
  *
  * Properties:
- *   - flag: Flags passed to the main function.
- *
- *   - status_signal: A status used eclusively by the threaded signal handler.
- *   - state:         The state information.
+ *   - flag:  Flags passed to the main function.
+ *   - state: The state information.
  *
  *   - chains:  An array of all chains. @todo probably should be moved into data.
  *   - devices: An array of all devices. @todo probably should be moved into data.
@@ -163,8 +161,6 @@ extern "C" {
 #ifndef _di_firewall_setting_t_
   typedef struct {
     uint16_t flag;
-
-    f_status_t status_signal;
     f_state_t state;
 
     f_string_dynamics_t chains;
@@ -174,7 +170,6 @@ extern "C" {
   #define firewall_setting_t_initialize \
     { \
       firewall_main_flag_none_d, \
-      F_okay, \
       f_state_t_initialize, \
       f_string_dynamics_t_initialize, \
       f_string_dynamics_t_initialize, \
index 76c63fc79eb4cd494499bb6fdc46914153f53f9a..e35882eefb7850c40927f8e6ef70f9b0b0fdaf42 100644 (file)
@@ -7,10 +7,11 @@ extern "C" {
 #if !defined(_di_firewall_signal_check_) && defined(_di_thread_support_)
   f_status_t firewall_signal_check(firewall_main_t * const main) {
 
-    if (!main || main->program.signal.id == -1) return F_false;
+    if (!main) return F_false;
+    if (main->program.signal_received) return F_true;
 
     if (!((++main->program.signal_check) % firewall_signal_check_d)) {
-      if (fll_program_standard_signal_received(&main->program)) {
+      if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interrupt) {
         fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
 
         main->setting.state.status = F_status_set_error(F_interrupt);
@@ -47,13 +48,6 @@ extern "C" {
 
     if (!main) return;
 
-    siginfo_t information;
-    f_number_unsigned_t failsafe = 0;
-
-    memset(&information, 0, sizeof(siginfo_t));
-
-    main->program.signal_received = 0;
-
     f_signal_set_empty(&main->program.signal.set);
     f_signal_set_add(F_signal_abort, &main->program.signal.set);
     f_signal_set_add(F_signal_broken_pipe, &main->program.signal.set);
@@ -62,45 +56,9 @@ extern "C" {
     f_signal_set_add(F_signal_quit, &main->program.signal.set);
     f_signal_set_add(F_signal_termination, &main->program.signal.set);
 
-    if (main->program.signal.id == -1) {
-      main->setting.status_signal = f_signal_open(&main->program.signal);
-
-      if (F_status_is_error(main->setting.status_signal)) {
-        main->program.signal_received = F_signal_abort;
-
-        return;
-      }
-    }
-
-    do {
-      memset(&information, 0, sizeof(siginfo_t));
-
-      main->setting.status_signal = f_signal_wait(&main->program.signal.set, &information);
-
-      if (F_status_is_error(main->setting.status_signal) && F_status_set_fine(main->setting.status_signal) != F_interrupt) {
-        if (++failsafe >= firewall_signal_check_failsafe_d) break;
-      }
-
-      switch (information.si_signo) {
-        case F_signal_abort:
-        case F_signal_broken_pipe:
-        case F_signal_hangup:
-        case F_signal_interrupt:
-        case F_signal_quit:
-        case F_signal_termination:
-          main->program.signal_received = information.si_signo;
-
-          break;
-      }
-
-      failsafe = 0;
-      main->setting.status_signal = F_okay;
-
-    } while (!main->program.signal_received);
-
-    f_signal_close(&main->program.signal);
+    fll_program_standard_signal_received_wait(&main->program, firewall_signal_check_failsafe_d);
 
-    if (F_status_is_error(main->setting.status_signal)) {
+    if (F_status_is_error(main->program.signal_status) && F_status_set_fine(main->program.signal_status) != F_interrupt) {
       main->program.signal_received = F_signal_abort;
     }
   }
index 49156e333037699bff2aaee0d0760e00daa71425..e078f107f14d4b36e08513600254eb720ae0710c 100644 (file)
@@ -66,14 +66,11 @@ extern "C" {
  *   The main program and settings data.
  *
  *   This alters main.program.signal_received, setting it to a received signal.
+ *   This alters main.program.signal_status.
  *
- *   This alters main.setting.state.status:
- *     Errors (with error bit) from: f_signal_open()
- *     Errors (with error bit) from: f_signal_wait()
+ *   This does not alter main.setting.state.status.
  *
- * @see f_signal_close()
- * @see f_signal_open()
- * @see f_signal_wait()
+ * @see fll_program_standard_signal_received_wait()
  */
 #if !defined(_di_firewall_signal_handler_) && !defined(_di_thread_support_)
   extern void firewall_signal_handler(firewall_main_t * const main);
index d4fc14533128119a602257e69cbd796c6fc8b192..a58c8bbe8ce39db8aa662d5480a6c1d3bfce5c21 100644 (file)
@@ -30,16 +30,14 @@ extern "C" {
  * These program settings are often processed from the program arguments (often called the command line arguments).
  *
  * Properties:
- *   - flag: Flags passed to the main function.
+ *   - flag:  Flags passed to the main function.
+ *   - state: The state information.
  *
  *   - current: The current position within the ids, used to determine when the line is matched.
  *   - line:    The line number to select.
  *   - total:   The total ids across all files.
  *
  *   - range: A range used for processing as needed.
- *   -
- *   - status_signal: A status used eclusively by the threaded signal handler.
- *   - state:         The state information.
  *
  *   - buffer: A buffer used for processing files.
  *   - ids:    A cache for FLL IDs.
@@ -49,6 +47,7 @@ extern "C" {
 #ifndef _di_fss_identify_setting_t_
   typedef struct {
     uint16_t flag;
+    f_state_t state;
 
     f_number_unsigned_t current;
     f_number_unsigned_t line;
@@ -56,9 +55,6 @@ extern "C" {
 
     f_range_t range;
 
-    f_status_t status_signal;
-    f_state_t state;
-
     f_file_t file;
 
     f_string_dynamic_t buffer;
@@ -70,12 +66,11 @@ extern "C" {
   #define fss_identify_setting_t_initialize \
     { \
       fss_identify_main_flag_none_d, \
+      f_state_t_initialize, \
       0, \
       0, \
       0, \
       f_range_t_initialize, \
-      F_okay, \
-      f_state_t_initialize, \
       f_file_t_initialize, \
       f_string_dynamic_t_initialize, \
       f_fll_ids_t_initialize, \
index 42ffca4af764172cffb563ef3e41632dc2597c15..61262d73280b98143b9268bd341e18a1a8677d6c 100644 (file)
@@ -7,10 +7,11 @@ extern "C" {
 #if !defined(_di_fss_identify_signal_check_) && defined(_di_thread_support_)
   f_status_t fss_identify_signal_check(fss_identify_main_t * const main) {
 
-    if (!main || main->program.signal.id == -1) return F_false;
+    if (!main) return F_false;
+    if (main->program.signal_received) return F_true;
 
     if (!((++main->program.signal_check) % fss_identify_signal_check_d)) {
-      if (fll_program_standard_signal_received(&main->program)) {
+      if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interrupt) {
         fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
 
         main->setting.state.status = F_status_set_error(F_interrupt);
@@ -47,13 +48,6 @@ extern "C" {
 
     if (!main) return;
 
-    siginfo_t information;
-    f_number_unsigned_t failsafe = 0;
-
-    memset(&information, 0, sizeof(siginfo_t));
-
-    main->program.signal_received = 0;
-
     f_signal_set_empty(&main->program.signal.set);
     f_signal_set_add(F_signal_abort, &main->program.signal.set);
     f_signal_set_add(F_signal_broken_pipe, &main->program.signal.set);
@@ -62,45 +56,9 @@ extern "C" {
     f_signal_set_add(F_signal_quit, &main->program.signal.set);
     f_signal_set_add(F_signal_termination, &main->program.signal.set);
 
-    if (main->program.signal.id == -1) {
-      main->setting.status_signal = f_signal_open(&main->program.signal);
-
-      if (F_status_is_error(main->setting.status_signal)) {
-        main->program.signal_received = F_signal_abort;
-
-        return;
-      }
-    }
-
-    do {
-      memset(&information, 0, sizeof(siginfo_t));
-
-      main->setting.status_signal = f_signal_wait(&main->program.signal.set, &information);
-
-      if (F_status_is_error(main->setting.status_signal) && F_status_set_fine(main->setting.status_signal) != F_interrupt) {
-        if (++failsafe >= fss_identify_signal_check_failsafe_d) break;
-      }
-
-      switch (information.si_signo) {
-        case F_signal_abort:
-        case F_signal_broken_pipe:
-        case F_signal_hangup:
-        case F_signal_interrupt:
-        case F_signal_quit:
-        case F_signal_termination:
-          main->program.signal_received = information.si_signo;
-
-          break;
-      }
-
-      failsafe = 0;
-      main->setting.status_signal = F_okay;
-
-    } while (!main->program.signal_received);
-
-    f_signal_close(&main->program.signal);
+    fll_program_standard_signal_received_wait(&main->program, fss_identify_signal_check_failsafe_d);
 
-    if (F_status_is_error(main->setting.status_signal)) {
+    if (F_status_is_error(main->program.signal_status) && F_status_set_fine(main->program.signal_status) != F_interrupt) {
       main->program.signal_received = F_signal_abort;
     }
   }
index 594492c74ede44dc8b183ae135025f45e2758a24..0aeba76be20faa4e4d3eaf03d733d024cf615788 100644 (file)
@@ -66,14 +66,11 @@ extern "C" {
  *   The main program and settings data.
  *
  *   This alters main.program.signal_received, setting it to a received signal.
+ *   This alters main.program.signal_status.
  *
- *   This alters main.setting.state.status:
- *     Errors (with error bit) from: f_signal_open()
- *     Errors (with error bit) from: f_signal_wait()
+ *   This does not alter main.setting.state.status.
  *
- * @see f_signal_close()
- * @see f_signal_open()
- * @see f_signal_wait()
+ * @see fll_program_standard_signal_received_wait()
  */
 #if !defined(_di_fss_identify_signal_handler_) && !defined(_di_thread_support_)
   extern void fss_identify_signal_handler(fss_identify_main_t * const main);
index 2dc576d3920d1e54d531a9294ee5a61728ab2015..6c56605d913d22acdfaa38e2205169a7386273ce 100644 (file)
@@ -226,9 +226,7 @@ extern "C" {
  * feature:      Flags not passed to the main function but instead assigned by individual standards to designate how they work.
  * flag:         Flags passed to the main function.
  * delimit_mode: The delimit mode.
- *
- * status_signal: A status used eclusively by the threaded signal handler.
- * state:         The state data used when processing the FSS data.
+ * state:        The state data used when processing the FSS data.
  *
  * delimit_depth: The delimit depth.
  * select:        The Content to select (column number).
@@ -258,8 +256,6 @@ extern "C" {
     uint16_t feature;
     uint32_t flag;
     uint8_t delimit_mode;
-
-    f_status_t status_signal;
     f_state_t state;
 
     f_number_unsigned_t delimit_depth;
@@ -293,7 +289,6 @@ extern "C" {
       fss_read_main_flag_none_d, \
       fss_read_feature_flag_none_d, \
       fss_read_delimit_mode_all_e, \
-      F_okay, \
       macro_f_state_t_initialize_1(fss_read_allocation_large_d, fss_read_allocation_small_d, F_okay, 0, 0, &fll_program_standard_signal_handle, 0, 0, 0, 0), \
       0, \
       0, \
index 78c45c8bcc1a0c8d105d70133301093d3af758ee..023cb5b6b6ef2315221e0685b283a097d74ecc1c 100644 (file)
@@ -7,10 +7,11 @@ extern "C" {
 #if !defined(_di_fss_read_signal_check_) && defined(_di_thread_support_)
   f_status_t fss_read_signal_check(fss_read_main_t * const main) {
 
-    if (!main || main->program.signal.id == -1) return F_false;
+    if (!main) return F_false;
+    if (main->program.signal_received) return F_true;
 
     if (!((++main->program.signal_check) % fss_read_signal_check_d)) {
-      if (fll_program_standard_signal_received(&main->program)) {
+      if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interrupt) {
         fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
 
         main->setting.state.status = F_status_set_error(F_interrupt);
@@ -47,13 +48,6 @@ extern "C" {
 
     if (!main) return;
 
-    siginfo_t information;
-    f_number_unsigned_t failsafe = 0;
-
-    memset(&information, 0, sizeof(siginfo_t));
-
-    main->program.signal_received = 0;
-
     f_signal_set_empty(&main->program.signal.set);
     f_signal_set_add(F_signal_abort, &main->program.signal.set);
     f_signal_set_add(F_signal_broken_pipe, &main->program.signal.set);
@@ -62,45 +56,9 @@ extern "C" {
     f_signal_set_add(F_signal_quit, &main->program.signal.set);
     f_signal_set_add(F_signal_termination, &main->program.signal.set);
 
-    if (main->program.signal.id == -1) {
-      main->setting.status_signal = f_signal_open(&main->program.signal);
-
-      if (F_status_is_error(main->setting.status_signal)) {
-        main->program.signal_received = F_signal_abort;
-
-        return;
-      }
-    }
-
-    do {
-      memset(&information, 0, sizeof(siginfo_t));
-
-      main->setting.status_signal = f_signal_wait(&main->program.signal.set, &information);
-
-      if (F_status_is_error(main->setting.status_signal) && F_status_set_fine(main->setting.status_signal) != F_interrupt) {
-        if (++failsafe >= fss_read_signal_check_failsafe_d) break;
-      }
-
-      switch (information.si_signo) {
-        case F_signal_abort:
-        case F_signal_broken_pipe:
-        case F_signal_hangup:
-        case F_signal_interrupt:
-        case F_signal_quit:
-        case F_signal_termination:
-          main->program.signal_received = information.si_signo;
-
-          break;
-      }
-
-      failsafe = 0;
-      main->setting.status_signal = F_okay;
-
-    } while (!main->program.signal_received);
-
-    f_signal_close(&main->program.signal);
+    fll_program_standard_signal_received_wait(&main->program, fss_read_signal_check_failsafe_d);
 
-    if (F_status_is_error(main->setting.status_signal)) {
+    if (F_status_is_error(main->program.signal_status) && F_status_set_fine(main->program.signal_status) != F_interrupt) {
       main->program.signal_received = F_signal_abort;
     }
   }
index 0b82211b5ff5fa4c8b1406c3f15a754ede795082..6925b980bae2d407417107dde30ee2f90d87aca9 100644 (file)
@@ -66,14 +66,11 @@ extern "C" {
  *   The main program and settings data.
  *
  *   This alters main.program.signal_received, setting it to a received signal.
+ *   This alters main.program.signal_status.
  *
- *   This alters main.setting.state.status:
- *     Errors (with error bit) from: f_signal_open()
- *     Errors (with error bit) from: f_signal_wait()
+ *   This does not alter main.setting.state.status.
  *
- * @see f_signal_close()
- * @see f_signal_open()
- * @see f_signal_wait()
+ * @see fll_program_standard_signal_received_wait()
  */
 #if !defined(_di_fss_read_signal_handler_) && !defined(_di_thread_support_)
   extern void fss_read_signal_handler(fss_read_main_t * const main);
index dcd3ec72271c0ddb6055c256527ad4eb6a407f54..f94dbaa26208692a36dcaa5f1e48a9cbc99ab531 100644 (file)
@@ -62,10 +62,8 @@ extern "C" {
  *
  * For all function pointers on this structure, the main variable must be of type fss_write_main_t.
  *
- * flag: Flags passed to the main function.
- *
- * status_signal: A status used eclusively by the threaded signal handler.
- * state:         The state data used when processing the FSS data.
+ * flag:  Flags passed to the main function.
+ * state: The state data used when processing the FSS data.
  *
  * range: A range used in conjunction with some buffer during processing.
  *
@@ -89,8 +87,6 @@ extern "C" {
 #ifndef _di_fss_write_setting_t_
   typedef struct {
     uint32_t flag;
-
-    f_status_t status_signal;
     f_state_t state;
 
     f_range_t range;
@@ -115,7 +111,6 @@ extern "C" {
   #define fss_write_setting_t_initialize \
     { \
       fss_write_main_flag_none_d, \
-      F_okay, \
       macro_f_state_t_initialize_1(fss_write_allocation_large_d, fss_write_allocation_small_d, F_okay, 0, 0, &fll_program_standard_signal_handle, 0, 0, 0, 0), \
       f_range_t_initialize, \
       f_string_static_t_initialize, \
index 4b71733896d2cb1cee8d11f19291fcb63c3fbc0d..2b45589371ffe2c9ad91651d75446b5f393902a8 100644 (file)
@@ -7,10 +7,11 @@ extern "C" {
 #if !defined(_di_fss_write_signal_check_) && defined(_di_thread_support_)
   f_status_t fss_write_signal_check(fss_write_main_t * const main) {
 
-    if (!main || main->program.signal.id == -1) return F_false;
+    if (!main) return F_false;
+    if (main->program.signal_received) return F_true;
 
     if (!((++main->program.signal_check) % fss_write_signal_check_d)) {
-      if (fll_program_standard_signal_received(&main->program)) {
+      if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interrupt) {
         fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
 
         main->setting.state.status = F_status_set_error(F_interrupt);
@@ -47,13 +48,6 @@ extern "C" {
 
     if (!main) return;
 
-    siginfo_t information;
-    f_number_unsigned_t failsafe = 0;
-
-    memset(&information, 0, sizeof(siginfo_t));
-
-    main->program.signal_received = 0;
-
     f_signal_set_empty(&main->program.signal.set);
     f_signal_set_add(F_signal_abort, &main->program.signal.set);
     f_signal_set_add(F_signal_broken_pipe, &main->program.signal.set);
@@ -62,45 +56,9 @@ extern "C" {
     f_signal_set_add(F_signal_quit, &main->program.signal.set);
     f_signal_set_add(F_signal_termination, &main->program.signal.set);
 
-    if (main->program.signal.id == -1) {
-      main->setting.status_signal = f_signal_open(&main->program.signal);
-
-      if (F_status_is_error(main->setting.status_signal)) {
-        main->program.signal_received = F_signal_abort;
-
-        return;
-      }
-    }
-
-    do {
-      memset(&information, 0, sizeof(siginfo_t));
-
-      main->setting.status_signal = f_signal_wait(&main->program.signal.set, &information);
-
-      if (F_status_is_error(main->setting.status_signal) && F_status_set_fine(main->setting.status_signal) != F_interrupt) {
-        if (++failsafe >= fss_write_signal_check_failsafe_d) break;
-      }
-
-      switch (information.si_signo) {
-        case F_signal_abort:
-        case F_signal_broken_pipe:
-        case F_signal_hangup:
-        case F_signal_interrupt:
-        case F_signal_quit:
-        case F_signal_termination:
-          main->program.signal_received = information.si_signo;
-
-          break;
-      }
-
-      failsafe = 0;
-      main->setting.status_signal = F_okay;
-
-    } while (!main->program.signal_received);
-
-    f_signal_close(&main->program.signal);
+    fll_program_standard_signal_received_wait(&main->program, fss_write_signal_check_failsafe_d);
 
-    if (F_status_is_error(main->setting.status_signal)) {
+    if (F_status_is_error(main->program.signal_status) && F_status_set_fine(main->program.signal_status) != F_interrupt) {
       main->program.signal_received = F_signal_abort;
     }
   }
index 9c5c310175e764e1d784b1462aba13d71d345638..b301fa178b40264605e5ec8418caf1743fabe284 100644 (file)
@@ -66,14 +66,11 @@ extern "C" {
  *   The main program and settings data.
  *
  *   This alters main.program.signal_received, setting it to a received signal.
+ *   This alters main.program.signal_status.
  *
- *   This alters main.setting.state.status:
- *     Errors (with error bit) from: f_signal_open()
- *     Errors (with error bit) from: f_signal_wait()
+ *   This does not alter main.setting.state.status.
  *
- * @see f_signal_close()
- * @see f_signal_open()
- * @see f_signal_wait()
+ * @see fll_program_standard_signal_received_wait()
  */
 #if !defined(_di_fss_write_signal_handler_) && !defined(_di_thread_support_)
   extern void fss_write_signal_handler(fss_write_main_t * const main);
index 631c22c925cca4ff5b0d090433a69d11d559bc82..f5c5abc75a8bea1d6be78d8b13be4c2d33b2494a 100644 (file)
@@ -91,10 +91,8 @@ extern "C" {
  * These program settings are often processed from the program arguments (often called the command line arguments).
  *
  * Properties:
- *   - flag: Flags passed to the main function.
- *
- *   - status_signal: A status used eclusively by the threaded signal handler.
- *   - state:         The state data used when processing the FSS data.
+ *   - flag:  Flags passed to the main function.
+ *   - state: The state data used when processing the FSS data.
  *
  *   - at:     The position representing the "at" index.
  *   - line:   The position representing the "line" index.
@@ -114,8 +112,6 @@ extern "C" {
 #ifndef _di_iki_read_setting_t_
   typedef struct {
     uint32_t flag;
-
-    f_status_t status_signal;
     f_state_t state;
 
     f_number_unsigned_t at;
@@ -137,7 +133,6 @@ extern "C" {
   #define iki_read_setting_t_initialize \
     { \
       iki_read_main_flag_none_d, \
-      F_okay, \
       macro_f_state_t_initialize_1(iki_read_allocation_large_d, iki_read_allocation_small_d, F_okay, 0, 0, 0, 0, 0, 0, 0), \
       0, \
       0, \
index 6ac504b478a8834660243efed75226bb1b16a9d7..56cc1ebe8715bdd5a85199131f7fe16b7f3b1e66 100644 (file)
@@ -7,10 +7,11 @@ extern "C" {
 #if !defined(_di_iki_read_signal_check_) && defined(_di_thread_support_)
   f_status_t iki_read_signal_check(iki_read_main_t * const main) {
 
-    if (!main || main->program.signal.id == -1) return F_false;
+    if (!main) return F_false;
+    if (main->program.signal_received) return F_true;
 
     if (!((++main->program.signal_check) % iki_read_signal_check_d)) {
-      if (fll_program_standard_signal_received(&main->program)) {
+      if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interrupt) {
         fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
 
         main->setting.state.status = F_status_set_error(F_interrupt);
@@ -47,13 +48,6 @@ extern "C" {
 
     if (!main) return;
 
-    siginfo_t information;
-    f_number_unsigned_t failsafe = 0;
-
-    memset(&information, 0, sizeof(siginfo_t));
-
-    main->program.signal_received = 0;
-
     f_signal_set_empty(&main->program.signal.set);
     f_signal_set_add(F_signal_abort, &main->program.signal.set);
     f_signal_set_add(F_signal_broken_pipe, &main->program.signal.set);
@@ -62,45 +56,9 @@ extern "C" {
     f_signal_set_add(F_signal_quit, &main->program.signal.set);
     f_signal_set_add(F_signal_termination, &main->program.signal.set);
 
-    if (main->program.signal.id == -1) {
-      main->setting.status_signal = f_signal_open(&main->program.signal);
-
-      if (F_status_is_error(main->setting.status_signal)) {
-        main->program.signal_received = F_signal_abort;
-
-        return;
-      }
-    }
-
-    do {
-      memset(&information, 0, sizeof(siginfo_t));
-
-      main->setting.status_signal = f_signal_wait(&main->program.signal.set, &information);
-
-      if (F_status_is_error(main->setting.status_signal) && F_status_set_fine(main->setting.status_signal) != F_interrupt) {
-        if (++failsafe >= iki_read_signal_check_failsafe_d) break;
-      }
-
-      switch (information.si_signo) {
-        case F_signal_abort:
-        case F_signal_broken_pipe:
-        case F_signal_hangup:
-        case F_signal_interrupt:
-        case F_signal_quit:
-        case F_signal_termination:
-          main->program.signal_received = information.si_signo;
-
-          break;
-      }
-
-      failsafe = 0;
-      main->setting.status_signal = F_okay;
-
-    } while (!main->program.signal_received);
-
-    f_signal_close(&main->program.signal);
+    fll_program_standard_signal_received_wait(&main->program, iki_read_signal_check_failsafe_d);
 
-    if (F_status_is_error(main->setting.status_signal)) {
+    if (F_status_is_error(main->program.signal_status) && F_status_set_fine(main->program.signal_status) != F_interrupt) {
       main->program.signal_received = F_signal_abort;
     }
   }
index bcec0e25d0f26e2effc224ef1ded693013648a59..a8ece07bc8cfb4480ad558a5f1a9129caccb4200 100644 (file)
@@ -66,14 +66,11 @@ extern "C" {
  *   The main program and settings data.
  *
  *   This alters main.program.signal_received, setting it to a received signal.
+ *   This alters main.program.signal_status.
  *
- *   This alters main.setting.state.status:
- *     Errors (with error bit) from: f_signal_open()
- *     Errors (with error bit) from: f_signal_wait()
+ *   This does not alter main.setting.state.status.
  *
- * @see f_signal_close()
- * @see f_signal_open()
- * @see f_signal_wait()
+ * @see fll_program_standard_signal_received_wait()
  */
 #if !defined(_di_iki_read_signal_handler_) && !defined(_di_thread_support_)
   extern void iki_read_signal_handler(iki_read_main_t * const main);
index 05e08fb9f129864331b5b92e0be088064644ff87..29f8a187382157c141e698264410673849a81d57 100644 (file)
@@ -83,10 +83,8 @@ extern "C" {
  * These program settings are often processed from the program arguments (often called the command line arguments).
  *
  * Properties:
- *   - flag: Flags passed to the main function.
- *
- *   - status_signal: A status used eclusively by the threaded signal handler.
- *   - state:         The state data used when processing the FSS data.
+ *   - flag:  Flags passed to the main function.
+ *   - state: The state data used when processing the FSS data.
  *
  *   - quote: This holds the quote used during processing.
  *
@@ -96,8 +94,6 @@ extern "C" {
 #ifndef _di_iki_write_setting_t_
   typedef struct {
     uint16_t flag;
-
-    f_status_t status_signal;
     f_state_t state;
 
     f_string_static_t quote;
@@ -109,7 +105,6 @@ extern "C" {
   #define iki_write_setting_t_initialize \
     { \
       iki_write_main_flag_none_d, \
-      F_okay, \
       f_state_t_initialize, \
       f_string_static_t_initialize, \
       f_string_dynamics_t_initialize, \
index d458450cffcb12770d2d171d1f0978944dbbf030..6357e754fd693d66923690b9d9480276f3e1f640 100644 (file)
@@ -7,10 +7,11 @@ extern "C" {
 #if !defined(_di_iki_write_signal_check_) && defined(_di_thread_support_)
   f_status_t iki_write_signal_check(iki_write_main_t * const main) {
 
-    if (!main || main->program.signal.id == -1) return F_false;
+    if (!main) return F_false;
+    if (main->program.signal_received) return F_true;
 
     if (!((++main->program.signal_check) % iki_write_signal_check_d)) {
-      if (fll_program_standard_signal_received(&main->program)) {
+      if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interrupt) {
         fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
 
         main->setting.state.status = F_status_set_error(F_interrupt);
@@ -47,13 +48,6 @@ extern "C" {
 
     if (!main) return;
 
-    siginfo_t information;
-    f_number_unsigned_t failsafe = 0;
-
-    memset(&information, 0, sizeof(siginfo_t));
-
-    main->program.signal_received = 0;
-
     f_signal_set_empty(&main->program.signal.set);
     f_signal_set_add(F_signal_abort, &main->program.signal.set);
     f_signal_set_add(F_signal_broken_pipe, &main->program.signal.set);
@@ -62,45 +56,9 @@ extern "C" {
     f_signal_set_add(F_signal_quit, &main->program.signal.set);
     f_signal_set_add(F_signal_termination, &main->program.signal.set);
 
-    if (main->program.signal.id == -1) {
-      main->setting.status_signal = f_signal_open(&main->program.signal);
-
-      if (F_status_is_error(main->setting.status_signal)) {
-        main->program.signal_received = F_signal_abort;
-
-        return;
-      }
-    }
-
-    do {
-      memset(&information, 0, sizeof(siginfo_t));
-
-      main->setting.status_signal = f_signal_wait(&main->program.signal.set, &information);
-
-      if (F_status_is_error(main->setting.status_signal) && F_status_set_fine(main->setting.status_signal) != F_interrupt) {
-        if (++failsafe >= iki_write_signal_check_failsafe_d) break;
-      }
-
-      switch (information.si_signo) {
-        case F_signal_abort:
-        case F_signal_broken_pipe:
-        case F_signal_hangup:
-        case F_signal_interrupt:
-        case F_signal_quit:
-        case F_signal_termination:
-          main->program.signal_received = information.si_signo;
-
-          break;
-      }
-
-      failsafe = 0;
-      main->setting.status_signal = F_okay;
-
-    } while (!main->program.signal_received);
-
-    f_signal_close(&main->program.signal);
+    fll_program_standard_signal_received_wait(&main->program, iki_write_signal_check_failsafe_d);
 
-    if (F_status_is_error(main->setting.status_signal)) {
+    if (F_status_is_error(main->program.signal_status) && F_status_set_fine(main->program.signal_status) != F_interrupt) {
       main->program.signal_received = F_signal_abort;
     }
   }
index 891877300cc15a2b530cc912a2cd521009cccc07..9940896d95deb3ee4f7769908a21218350cf2327 100644 (file)
@@ -66,14 +66,11 @@ extern "C" {
  *   The main program and settings data.
  *
  *   This alters main.program.signal_received, setting it to a received signal.
+ *   This alters main.program.signal_status.
  *
- *   This alters main.setting.state.status:
- *     Errors (with error bit) from: f_signal_open()
- *     Errors (with error bit) from: f_signal_wait()
+ *   This does not alter main.setting.state.status.
  *
- * @see f_signal_close()
- * @see f_signal_open()
- * @see f_signal_wait()
+ * @see fll_program_standard_signal_received_wait()
  */
 #if !defined(_di_iki_write_signal_handler_) && !defined(_di_thread_support_)
   extern void iki_write_signal_handler(iki_write_main_t * const main);
index fe08127cabf94c3f45f9ab2bdf4642402ebab221..4efd0eb98e014c91ff33179c749486639863b4a7 100644 (file)
@@ -29,10 +29,8 @@ extern "C" {
  * 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).
  *
- * flag: Flags passed to the main function.
- *
- * status_signal: A status used eclusively by the threaded signal handler.
- * state:         The state data used when processing the FSS data.
+ * flag:  Flags passed to the main function.
+ * state: The state data used when processing the FSS data.
  *
  * status_string_from:        A pointer to the status string function (usually either fl_status_string_from() or fll_fss_status_string_from()).
  * status_string_to:          A pointer to the status string function (usually either f_status_string_to() or fll_fss_status_string_to()).
@@ -41,8 +39,6 @@ extern "C" {
 #ifndef _di_status_code_setting_t_
   typedef struct {
     uint16_t flag;
-
-    f_status_t status_signal;
     f_state_t state;
 
     const f_string_static_t *program_name;
@@ -56,7 +52,6 @@ extern "C" {
   #define status_code_setting_t_initialize \
     { \
       status_code_main_flag_none_d, \
-      F_okay, \
       f_state_t_initialize, \
       0, \
       0, \
index e82931e01e5cb52dababef09b84e8d3470a6945e..183446b7ad74f152126f861e99c8d27d9a20694a 100644 (file)
@@ -7,10 +7,11 @@ extern "C" {
 #if !defined(_di_status_code_signal_check_) && defined(_di_thread_support_)
   f_status_t status_code_signal_check(status_code_main_t * const main) {
 
-    if (!main || main->program.signal.id == -1) return F_false;
+    if (!main) return F_false;
+    if (main->program.signal_received) return F_true;
 
     if (!((++main->program.signal_check) % status_code_signal_check_d)) {
-      if (fll_program_standard_signal_received(&main->program)) {
+      if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interrupt) {
         fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
 
         main->setting.state.status = F_status_set_error(F_interrupt);
@@ -47,13 +48,6 @@ extern "C" {
 
     if (!main) return;
 
-    siginfo_t information;
-    f_number_unsigned_t failsafe = 0;
-
-    memset(&information, 0, sizeof(siginfo_t));
-
-    main->program.signal_received = 0;
-
     f_signal_set_empty(&main->program.signal.set);
     f_signal_set_add(F_signal_abort, &main->program.signal.set);
     f_signal_set_add(F_signal_broken_pipe, &main->program.signal.set);
@@ -62,45 +56,9 @@ extern "C" {
     f_signal_set_add(F_signal_quit, &main->program.signal.set);
     f_signal_set_add(F_signal_termination, &main->program.signal.set);
 
-    if (main->program.signal.id == -1) {
-      main->setting.status_signal = f_signal_open(&main->program.signal);
-
-      if (F_status_is_error(main->setting.status_signal)) {
-        main->program.signal_received = F_signal_abort;
-
-        return;
-      }
-    }
-
-    do {
-      memset(&information, 0, sizeof(siginfo_t));
-
-      main->setting.status_signal = f_signal_wait(&main->program.signal.set, &information);
-
-      if (F_status_is_error(main->setting.status_signal) && F_status_set_fine(main->setting.status_signal) != F_interrupt) {
-        if (++failsafe >= status_code_signal_check_failsafe_d) break;
-      }
-
-      switch (information.si_signo) {
-        case F_signal_abort:
-        case F_signal_broken_pipe:
-        case F_signal_hangup:
-        case F_signal_interrupt:
-        case F_signal_quit:
-        case F_signal_termination:
-          main->program.signal_received = information.si_signo;
-
-          break;
-      }
-
-      failsafe = 0;
-      main->setting.status_signal = F_okay;
-
-    } while (!main->program.signal_received);
-
-    f_signal_close(&main->program.signal);
+    fll_program_standard_signal_received_wait(&main->program, status_code_signal_check_failsafe_d);
 
-    if (F_status_is_error(main->setting.status_signal)) {
+    if (F_status_is_error(main->program.signal_status) && F_status_set_fine(main->program.signal_status) != F_interrupt) {
       main->program.signal_received = F_signal_abort;
     }
   }
index 00134c2126a4a98ddf7d45e4906ae70456c0e515..bf9fb19e52c04d35d13fc0dafecdee48719560d1 100644 (file)
@@ -66,14 +66,11 @@ extern "C" {
  *   The main program and settings data.
  *
  *   This alters main.program.signal_received, setting it to a received signal.
+ *   This alters main.program.signal_status.
  *
- *   This alters main.setting.state.status:
- *     Errors (with error bit) from: f_signal_open()
- *     Errors (with error bit) from: f_signal_wait()
+ *   This does not alter main.setting.state.status.
  *
- * @see f_signal_close()
- * @see f_signal_open()
- * @see f_signal_wait()
+ * @see fll_program_standard_signal_received_wait()
  */
 #if !defined(_di_status_code_signal_handler_) && !defined(_di_thread_support_)
   extern void status_code_signal_handler(status_code_main_t * const main);
index 7c10c6a69e1567696fa5022dfaec654c89c1d8ce..fd8a089051f2c64adc0d020f3ab014dd3c69084e 100644 (file)
@@ -30,11 +30,9 @@ extern "C" {
  * These program settings are often processed from the program arguments (often called the command line arguments).
  *
  * Properties:
- *   - mode: The input/output mode (see utf8_modes_e).
- *   - flag: Flags passed to the main function.
- *
- *   - status_signal: A status used eclusively by the threaded signal handler.
- *   - state:         The state data used when processing the FSS data.
+ *   - mode:  The input/output mode (see utf8_modes_e).
+ *   - flag:  Flags passed to the main function.
+ *   - state: The state data used when processing the FSS data.
  *
  *   - valid:     Designate the output context set for valid characters.
  *   - valid_not: Designate the output context set for invalid characters.
@@ -53,8 +51,6 @@ extern "C" {
   typedef struct {
     uint8_t mode;
     uint16_t flag;
-
-    f_status_t status_signal;
     f_state_t state;
 
     f_color_set_t valid;
@@ -75,7 +71,6 @@ extern "C" {
     { \
       utf8_mode_from_bytesequence_e | utf8_mode_to_codepoint_e, \
       utf8_main_flag_none_d, \
-      F_okay, \
       f_state_t_initialize, \
       f_color_set_t_initialize, \
       f_color_set_t_initialize, \
index 35ea429fb40105dff534952ddf7335de5c83daeb..fbe1248ceec6d51c4d52bc5606d47095a950c943 100644 (file)
@@ -7,10 +7,11 @@ extern "C" {
 #if !defined(_di_utf8_signal_check_) && defined(_di_thread_support_)
   f_status_t utf8_signal_check(utf8_main_t * const main) {
 
-    if (!main || main->program.signal.id == -1) return F_false;
+    if (!main) return F_false;
+    if (main->program.signal_received) return F_true;
 
     if (!((++main->program.signal_check) % utf8_signal_check_d)) {
-      if (fll_program_standard_signal_received(&main->program)) {
+      if (F_status_set_fine(fll_program_standard_signal_received(&main->program)) == F_interrupt) {
         fll_program_print_signal_received(&main->program.warning, main->program.signal_received);
 
         main->setting.state.status = F_status_set_error(F_interrupt);
@@ -47,13 +48,6 @@ extern "C" {
 
     if (!main) return;
 
-    siginfo_t information;
-    f_number_unsigned_t failsafe = 0;
-
-    memset(&information, 0, sizeof(siginfo_t));
-
-    main->program.signal_received = 0;
-
     f_signal_set_empty(&main->program.signal.set);
     f_signal_set_add(F_signal_abort, &main->program.signal.set);
     f_signal_set_add(F_signal_broken_pipe, &main->program.signal.set);
@@ -62,45 +56,9 @@ extern "C" {
     f_signal_set_add(F_signal_quit, &main->program.signal.set);
     f_signal_set_add(F_signal_termination, &main->program.signal.set);
 
-    if (main->program.signal.id == -1) {
-      main->setting.status_signal = f_signal_open(&main->program.signal);
-
-      if (F_status_is_error(main->setting.status_signal)) {
-        main->program.signal_received = F_signal_abort;
-
-        return;
-      }
-    }
-
-    do {
-      memset(&information, 0, sizeof(siginfo_t));
-
-      main->setting.status_signal = f_signal_wait(&main->program.signal.set, &information);
-
-      if (F_status_is_error(main->setting.status_signal) && F_status_set_fine(main->setting.status_signal) != F_interrupt) {
-        if (++failsafe >= utf8_signal_check_failsafe_d) break;
-      }
-
-      switch (information.si_signo) {
-        case F_signal_abort:
-        case F_signal_broken_pipe:
-        case F_signal_hangup:
-        case F_signal_interrupt:
-        case F_signal_quit:
-        case F_signal_termination:
-          main->program.signal_received = information.si_signo;
-
-          break;
-      }
-
-      failsafe = 0;
-      main->setting.status_signal = F_okay;
-
-    } while (!main->program.signal_received);
-
-    f_signal_close(&main->program.signal);
+    fll_program_standard_signal_received_wait(&main->program, utf8_signal_check_failsafe_d);
 
-    if (F_status_is_error(main->setting.status_signal)) {
+    if (F_status_is_error(main->program.signal_status) && F_status_set_fine(main->program.signal_status) != F_interrupt) {
       main->program.signal_received = F_signal_abort;
     }
   }
index 0d5bb92c6ac7be258924e9036644b79e5537e79b..c18cf59f1ff15bedb152e03cdbbc774980590211 100644 (file)
@@ -66,14 +66,11 @@ extern "C" {
  *   The main program and settings data.
  *
  *   This alters main.program.signal_received, setting it to a received signal.
+ *   This alters main.program.signal_status.
  *
- *   This alters main.setting.state.status:
- *     Errors (with error bit) from: f_signal_open()
- *     Errors (with error bit) from: f_signal_wait()
+ *   This does not alter main.setting.state.status.
  *
- * @see f_signal_close()
- * @see f_signal_open()
- * @see f_signal_wait()
+ * @see fll_program_standard_signal_received_wait()
  */
 #if !defined(_di_utf8_signal_handler_) && !defined(_di_thread_support_)
   extern void utf8_signal_handler(utf8_main_t * const main);