]> Kevux Git Server - fll/commitdiff
Update: Provide defines for disabling less-portable code exposed as a problem when...
authorKevin Day <thekevinday@gmail.com>
Fri, 7 May 2021 05:22:33 +0000 (00:22 -0500)
committerKevin Day <thekevinday@gmail.com>
Fri, 7 May 2021 05:22:33 +0000 (00:22 -0500)
The f_thread project utilizes several pthread functions that are non-portable.
Add some initial support for disabling these and do disable these by default.
I intend to expand upon this and adding more defines.
The current ones might be renamed.

15 files changed:
build/level_0/settings
build/level_1/settings
build/level_2/settings
build/monolithic/settings
level_0/f_thread/c/thread.c
level_0/f_thread/data/build/defines
level_0/f_thread/data/build/settings
level_2/fll_execute/data/build/defines
level_2/fll_execute/data/build/settings
level_3/controller/data/build/defines
level_3/controller/data/build/settings
level_3/fake/data/build/defines
level_3/fake/data/build/settings
level_3/firewall/data/build/defines
level_3/firewall/data/build/settings

index f990a2bbb33260141bd4726f4d3bb8c1e293a820..dc58b90022b6de3399accbafae3f169d14285787 100644 (file)
@@ -46,7 +46,8 @@ search_shared yes
 search_static yes
 
 #defines_all -D_di_libcap_
-defines_all -D_libcap_legacy_only_
+defines_all -D_libcap_legacy_only
+defines_all-level -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_
 defines_all-level_threadless -D_di_pthread_support_
 defines_static
 defines_shared
index 866da878f7259051b2b8bd54c6b391cf7028668c..844dfc1d16cd79218c41183c78d28448c449c578 100644 (file)
@@ -47,6 +47,7 @@ search_static yes
 
 #defines_all -D_di_libcap_
 defines_all
+defines_all-level -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_
 defines_all-level_threadless -D_di_pthread_support_
 defines_static
 defines_shared
index b1e85dfb41bb1749da8315b0e96be95269111702..22e1147cf68311388e1046e50d05c9e817f02e19 100644 (file)
@@ -47,6 +47,7 @@ search_static yes
 
 #defines_all -D_di_libcap_
 defines_all -D_libcap_legacy_only_
+defines_all-level -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_
 defines_all-level_threadless -D_di_pthread_support_
 defines_static
 defines_shared
index 7ef47321ae22bb30ba4495353eaf90c1ceae1b99..645ef84f4d35d1820df80ae7704d5f71cbbabacd 100644 (file)
@@ -47,6 +47,7 @@ search_static yes
 
 #defines_all -D_di_libcap_
 defines_all -D_libcap_legacy_only_
+defines_all-monolithic -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_
 defines_all-monolithic_threadless -D_di_pthread_support_
 defines_static
 defines_shared
index 1393298690d56575de06930621279793f7d5f6df..c12e634903f6f8d6bf5a8de8ae5928eb56359c8a 100644 (file)
@@ -25,7 +25,15 @@ extern "C" {
   }
 #endif // _di_f_thread_key_create_
 
-#ifndef _di_f_thread_attribute_affinity_get_
+#if defined(_pthread_attr_unsupported_) && !defined(_di_f_thread_attribute_affinity_get_)
+  f_status_t f_thread_attribute_affinity_get(const f_thread_attribute_t attribute, const size_t affinity_size, cpu_set_t *affinity_set) {
+    #ifndef _di_level_0_parameter_checking_
+      if (!affinity_set) return F_status_set_error(F_parameter);
+    #endif // _di_level_0_parameter_checking_
+
+    return F_status_set_error(F_implemented_not);
+  }
+#elif !defined(_di_f_thread_attribute_affinity_get_)
   f_status_t f_thread_attribute_affinity_get(const f_thread_attribute_t attribute, const size_t affinity_size, cpu_set_t *affinity_set) {
     #ifndef _di_level_0_parameter_checking_
       if (!affinity_set) return F_status_set_error(F_parameter);
@@ -41,9 +49,17 @@ extern "C" {
 
     return F_none;
   }
-#endif // _di_f_thread_attribute_affinity_get_
+#endif // defined(_pthread_attr_unsupported_) && !defined(_di_f_thread_attribute_affinity_get_)
 
-#ifndef _di_f_thread_attribute_affinity_set_
+#if defined(_pthread_attr_unsupported_) && !defined(_di_f_thread_attribute_affinity_set_)
+  f_status_t f_thread_attribute_affinity_set(const size_t affinity_size, const cpu_set_t *affinity_set, f_thread_attribute_t *attribute) {
+    #ifndef _di_level_0_parameter_checking_
+      if (!attribute) return F_status_set_error(F_parameter);
+    #endif // _di_level_0_parameter_checking_
+
+    return F_status_set_error(F_implemented_not);
+  }
+#elif !defined(_di_f_thread_attribute_affinity_set_)
   f_status_t f_thread_attribute_affinity_set(const size_t affinity_size, const cpu_set_t *affinity_set, f_thread_attribute_t *attribute) {
     #ifndef _di_level_0_parameter_checking_
       if (!attribute) return F_status_set_error(F_parameter);
@@ -60,7 +76,7 @@ extern "C" {
 
     return F_none;
   }
-#endif // _di_f_thread_attribute_affinity_set_
+#endif // defined(_pthread_attr_unsupported_) && !defined(_di_f_thread_attribute_affinity_set_)
 
 #ifndef _di_f_thread_attribute_clock_get_
   f_status_t f_thread_attribute_clock_get(const f_thread_condition_attribute_t *attribute, clockid_t *id) {
@@ -2978,7 +2994,12 @@ extern "C" {
   }
 #endif // _di_f_thread_signal_mask_
 
-#ifndef _di_f_thread_signal_queue_
+#if defined(_pthread_sigqueue_unsupported_) && !defined(_di_f_thread_signal_queue_)
+  f_status_t f_thread_signal_queue(const f_thread_id_t id, const int signal, const union sigval value) {
+
+    return F_status_set_error(F_implemented_not);
+  }
+#elif !defined(_di_f_thread_signal_queue_)
   f_status_t f_thread_signal_queue(const f_thread_id_t id, const int signal, const union sigval value) {
 
     const int error = pthread_sigqueue(id, signal, value);
@@ -2994,7 +3015,7 @@ extern "C" {
 
     return F_none;
   }
-#endif // _di_f_thread_signal_queue_
+#endif // defined(_pthread_sigqueue_unsupported_) && !defined(_di_f_thread_signal_queue_)
 
 #ifndef _di_f_thread_spin_create_
   f_status_t f_thread_spin_create(const int shared, f_thread_spin_t *spin) {
index aa6477b8abc7448c3f124e114d729a8de0ccf01d..bd9bb119d2703a82153a4b164b426825dd3eb285 100644 (file)
@@ -1,2 +1,5 @@
 # fss-0000
+
 _di_pthread_support_ disables thread support, which is intended to disable this entire f_thread project. This is not directly used by this library, but is instead used by other libraries to not include f_thread (such as special compilations like monolithic). Future versions may potentially support this, providing stubs.
+_pthread_attr_unsupported_ Disable non-portable functionality associated with pthread_attr.
+_pthread_sigqueue_unsupported_ Disable GNU specific sigqueue().
index 5d1fcb9aa7dfcc3c16e2cada4958df9cdac96f6a..374681d0f9139da6cf911d720eb8c6e562ac989c 100644 (file)
@@ -44,7 +44,7 @@ search_exclusive yes
 search_shared yes
 search_static yes
 
-defines_all
+defines_all -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_
 defines_static
 defines_shared
 
index 8a7625aaf6728926bd20b1eca180ab81bdda5039..6a045caf8162d2aa42f3a1d48e8913e5d99d8dca 100644 (file)
@@ -1,3 +1,6 @@
 # fss-0000
+
 _di_libcap_ Disable libcap support, allow for compiling and linking without libcap (-lcap).
 _di_pthread_support_ Disable support for compiling and depending on pthreads (and projects like f_thread).
+_pthread_attr_unsupported_ Disable non-portable functionality associated with pthread_attr.
+_pthread_sigqueue_unsupported_ Disable GNU specific sigqueue().
index 52d5c468058eed9b8109e2919768d0a539d308e3..6727fffaf4935ff4715b8a0cc14c7d89dacc9f91 100644 (file)
@@ -46,7 +46,7 @@ search_shared yes
 search_static yes
 
 #defines_all -D_di_libcap_
-defines_all -D_libcap_legacy_only_
+defines_all -D_libcap_legacy_only_ -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_
 defines_all-individual_threadless -D_di_pthread_support_
 defines_static
 defines_shared
index 0aedddbbe79be75bff60ff1c5f75e1732a8f8dd6..427a9c7f6e8260f06f0fa66ee81b02ef567747b2 100644 (file)
@@ -2,3 +2,5 @@
 
 _di_libcap_ Disable libcap support, allow for compiling and linking without libcap (-lcap).
 _libcap_legacy_only_ Disable functionality provided by later versions of libcap (2.43 and later).
+_pthread_attr_unsupported_ Disable non-portable functionality associated with pthread_attr.
+_pthread_sigqueue_unsupported_ Disable GNU specific sigqueue().
index c55c3ff52424b4a7e1a5018280c9e2970dc71a3f..9d3edd80a043e136175106f53b4da35ddac493e1 100644 (file)
@@ -47,7 +47,7 @@ search_shared yes
 search_static yes
 
 #defines_all -D_di_libcap_ -D_di_thread_support_
-defines_all -D_libcap_legacy_only_
+defines_all -D_libcap_legacy_only_ -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_
 defines_static
 defines_shared
 
index 0aedddbbe79be75bff60ff1c5f75e1732a8f8dd6..427a9c7f6e8260f06f0fa66ee81b02ef567747b2 100644 (file)
@@ -2,3 +2,5 @@
 
 _di_libcap_ Disable libcap support, allow for compiling and linking without libcap (-lcap).
 _libcap_legacy_only_ Disable functionality provided by later versions of libcap (2.43 and later).
+_pthread_attr_unsupported_ Disable non-portable functionality associated with pthread_attr.
+_pthread_sigqueue_unsupported_ Disable GNU specific sigqueue().
index ad1861467820e64a959efa49f403b325b08f368b..4d9529e5d3c8e051ea22d080eb84d62a29927e3f 100644 (file)
@@ -47,7 +47,7 @@ search_shared yes
 search_static yes
 
 #defines_all -D_di_libcap_ -D_di_thread_support_
-defines_all -D_libcap_legacy_only_
+defines_all -D_libcap_legacy_only_ -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_
 defines_static
 defines_shared
 
index 0aedddbbe79be75bff60ff1c5f75e1732a8f8dd6..427a9c7f6e8260f06f0fa66ee81b02ef567747b2 100644 (file)
@@ -2,3 +2,5 @@
 
 _di_libcap_ Disable libcap support, allow for compiling and linking without libcap (-lcap).
 _libcap_legacy_only_ Disable functionality provided by later versions of libcap (2.43 and later).
+_pthread_attr_unsupported_ Disable non-portable functionality associated with pthread_attr.
+_pthread_sigqueue_unsupported_ Disable GNU specific sigqueue().
index 001a23257305afeecf3b41e7973139ffe0c70de8..63320d7bd2c9eb605a0e8d5db68a1c5dd22a4545 100644 (file)
@@ -47,7 +47,7 @@ search_shared yes
 search_static yes
 
 #defines_all -D_di_libcap_ -D_di_thread_support_
-defines_all -D_libcap_legacy_only_
+defines_all -D_libcap_legacy_only_ -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_
 defines_static
 defines_shared