]> 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 f990a2b..dc58b90 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 866da87..844dfc1 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 b1e85df..22e1147 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 7ef4732..645ef84 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 1393298..c12e634 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 aa6477b..bd9bb11 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 5d1fcb9..374681d 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 8a7625a..6a045ca 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 52d5c46..6727fff 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 0aedddb..427a9c7 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 c55c3ff..9d3edd8 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 0aedddb..427a9c7 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 ad18614..4d9529e 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 0aedddb..427a9c7 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 001a232..63320d7 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