]> Kevux Git Server - fll/commitdiff
Update: don't use WUNTRACED | WCONTINUED by default, provide "wait".
authorKevin Day <thekevinday@gmail.com>
Sun, 4 Apr 2021 15:21:59 +0000 (10:21 -0500)
committerKevin Day <thekevinday@gmail.com>
Sun, 4 Apr 2021 15:31:24 +0000 (10:31 -0500)
Don't have waitpid return if child stopped or continued.
Instead, provide a "wait" property to pass to waitpid().

level_1/fl_execute/c/execute-common.h
level_2/fll_execute/c/private-execute.c
level_3/fake/c/private-build.c
level_3/fake/c/private-fake.c
level_3/fake/c/private-make.c

index dbfb96cbc76e4b72ac7e8a534e6cd243d075c505..16919084b2b39c10ee95c3d0ecae78cb2fe87ca0 100644 (file)
@@ -27,10 +27,11 @@ extern "C" {
  *
  * If thread support is disabled in the library, then fl_execute_parameter_option_threadsafe will fallback to non-threadsafe.
  *
- * option:      accepts the bitwise options
- * environment: the environment variable name and value pairs, set to 0 to not use.
- * signals:     the set of signals the child process should or should block, set to 0 to not use.
- * data:        the data to pipe to the child process, set to 0 to not use.
+ * option:      Accepts the bitwise options
+ * wait:        Represents options passed to waitpid(), such as WUNTRACED.
+ * environment: The environment variable name and value pairs, set to 0 to not use.
+ * signals:     The set of signals the child process should or should block, set to 0 to not use.
+ * data:        The data to pipe to the child process, set to 0 to not use.
  */
 #ifndef _di_fl_execute_parameter_t_
   #define fl_execute_parameter_option_exit       0x1
@@ -40,18 +41,20 @@ extern "C" {
 
   typedef struct {
     uint8_t option;
+    int wait;
 
     const f_string_maps_t *environment;
     const f_signal_how_t *signals;
     const f_string_static_t *data;
   } fl_execute_parameter_t;
 
-  #define fl_execute_parameter_t_initialize { 0, 0, 0, 0 }
+  #define fl_execute_parameter_t_initialize { 0, 0, 0, 0, 0 }
 
-  #define fl_macro_execute_parameter_t_initialize(option, environment, signals, data) { option, environment, signals, data }
+  #define fl_macro_execute_parameter_t_initialize(option, wait, environment, signals, data) { option, wait, environment, signals, data }
 
   #define fl_macro_execute_parameter_t_clear(set) \
     set.option = 0; \
+    set.wait = 0; \
     set.environment = 0; \
     set.signals = 0; \
     set.data = 0;
index 4669caa5329637e959993317eb8cea7cf35608e8..76bafd0901135c000a66d5271f80f9f12afabf4f 100644 (file)
@@ -318,7 +318,7 @@ extern "C" {
       }
 
       // have the parent wait for the child process to finish.
-      waitpid(id_process, (int *) result, WUNTRACED | WCONTINUED);
+      waitpid(id_process, (int *) result, parameter->wait);
 
       // this must explicitly check for 0 (as opposed to checking (!result)).
       if (result != 0) {
@@ -490,7 +490,7 @@ extern "C" {
       }
 
       // have the parent wait for the child process to finish.
-      waitpid(id_process, (int *) result, WUNTRACED | WCONTINUED);
+      waitpid(id_process, (int *) result, parameter->wait);
 
       // this must explicitly check for 0 (as opposed to checking (!result)).
       if (result != 0) {
index 1bd31a8fca21480d062c66e756ec37785225640b..4966cec3016bda44789905c5afa5e3c81b5c546f 100644 (file)
@@ -666,7 +666,7 @@ extern "C" {
       f_signal_set_empty(&signals.block);
       f_signal_set_fill(&signals.block_not);
 
-      fl_execute_parameter_t parameter = fl_macro_execute_parameter_t_initialize(fl_execute_parameter_option_path, &data_build.environment, &signals, 0);
+      fl_execute_parameter_t parameter = fl_macro_execute_parameter_t_initialize(fl_execute_parameter_option_path, 0, &data_build.environment, &signals, 0);
 
       *status = fll_execute_program(path.string, arguments, &parameter, 0, (void *) &return_code);
 
index 9d09ae7d93e12f8b0d2acf968869b8d012bd811d..68e4e6ab7bc79bda3faa5701dc47a7331f0e93ab 100644 (file)
@@ -41,7 +41,7 @@ extern "C" {
       f_signal_set_empty(&signals.block);
       f_signal_set_fill(&signals.block_not);
 
-      fl_execute_parameter_t parameter = fl_macro_execute_parameter_t_initialize(0, &environment, &signals, 0);
+      fl_execute_parameter_t parameter = fl_macro_execute_parameter_t_initialize(0, 0, &environment, &signals, 0);
 
       *status = fll_execute_program(program.string, arguments, &parameter, 0, (void *) &return_code);
 
index 96b7497df65f7923a4b835d7a5552edb83669333..72bd3b661c23675f525690455d2766871a9aeeaa 100644 (file)
@@ -3815,7 +3815,7 @@ extern "C" {
     f_signal_set_empty(&signals.block);
     f_signal_set_fill(&signals.block_not);
 
-    fl_execute_parameter_t parameter = fl_macro_execute_parameter_t_initialize(as_shell ? 0 : fl_execute_parameter_option_path, &data_make->environment, &signals, 0);
+    fl_execute_parameter_t parameter = fl_macro_execute_parameter_t_initialize(as_shell ? 0 : fl_execute_parameter_option_path, 0, &data_make->environment, &signals, 0);
 
     status = fll_execute_program(program.string, arguments, &parameter, 0, (void *) &return_code);