From: Kevin Day Date: Mon, 8 Apr 2024 01:48:48 +0000 (-0500) Subject: Update: Add support for disable pthread mutex prioceiling for systems that do not... X-Git-Tag: 0.6.10~11 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=53f22a755badbe4ac9cc7e3ca59a4566d551c63c;p=fll Update: Add support for disable pthread mutex prioceiling for systems that do not support it. The pthread mutex prioceiling and pthread mutex attr prioceiling functions are not supported on PostmarketOS for Pinephone. The PostmarketOS for Pinephone is an A64 Arm system based on the Alpine Linux distribution. --- diff --git a/level_0/f_thread/c/thread.c b/level_0/f_thread/c/thread.c index 8b119c3..e75f23f 100644 --- a/level_0/f_thread/c/thread.c +++ b/level_0/f_thread/c/thread.c @@ -1308,7 +1308,16 @@ extern "C" { } #endif // _di_f_thread_mutex_attribute_delete_ -#ifndef _di_f_thread_mutex_attribute_priority_ceiling_get_ +#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_get_) + f_status_t f_thread_mutex_attribute_priority_ceiling_get(const f_thread_mutex_attribute_t * const attribute, int * const ceiling) { + #ifndef _di_level_0_parameter_checking_ + if (!attribute) return F_status_set_error(F_parameter); + if (!ceiling) 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_mutex_attribute_priority_ceiling_get_) f_status_t f_thread_mutex_attribute_priority_ceiling_get(const f_thread_mutex_attribute_t * const attribute, int * const ceiling) { #ifndef _di_level_0_parameter_checking_ if (!attribute) return F_status_set_error(F_parameter); @@ -1328,7 +1337,15 @@ extern "C" { } #endif // _di_f_thread_mutex_attribute_priority_ceiling_get_ -#ifndef _di_f_thread_mutex_attribute_priority_ceiling_set_ +#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_priority_ceiling_set_) + f_status_t f_thread_mutex_attribute_priority_ceiling_set(const int ceiling, f_thread_mutex_attribute_t * const 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_mutex_attribute_priority_ceiling_set_) f_status_t f_thread_mutex_attribute_priority_ceiling_set(const int ceiling, f_thread_mutex_attribute_t * const attribute) { #ifndef _di_level_0_parameter_checking_ if (!attribute) return F_status_set_error(F_parameter); @@ -1347,7 +1364,16 @@ extern "C" { } #endif // _di_f_thread_mutex_attribute_priority_ceiling_set_ -#ifndef _di_f_thread_mutex_attribute_protocol_get_ +#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_attribute_protocol_get_) + f_status_t f_thread_mutex_attribute_protocol_get(const f_thread_mutex_attribute_t * const attribute, int * const protocol) { + #ifndef _di_level_0_parameter_checking_ + if (!attribute) return F_status_set_error(F_parameter); + if (!protocol) 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_mutex_attribute_protocol_get_) f_status_t f_thread_mutex_attribute_protocol_get(const f_thread_mutex_attribute_t * const attribute, int * const protocol) { #ifndef _di_level_0_parameter_checking_ if (!attribute) return F_status_set_error(F_parameter); @@ -1549,7 +1575,16 @@ extern "C" { } #endif // _di_f_thread_mutex_lock_try_ -#ifndef _di_f_thread_mutex_priority_ceiling_get_ +#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_priority_ceiling_get_) + f_status_t f_thread_mutex_priority_ceiling_get(f_thread_mutex_t * const mutex, int * const ceiling) { + #ifndef _di_level_0_parameter_checking_ + if (!mutex) return F_status_set_error(F_parameter); + if (!ceiling) 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_mutex_priority_ceiling_get_) f_status_t f_thread_mutex_priority_ceiling_get(f_thread_mutex_t * const mutex, int * const ceiling) { #ifndef _di_level_0_parameter_checking_ if (!mutex) return F_status_set_error(F_parameter); @@ -1567,9 +1602,17 @@ extern "C" { return F_none; } -#endif // _di_f_thread_mutex_priority_ceiling_get_ +#endif // defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_priority_ceiling_get_) -#ifndef _di_f_thread_mutex_priority_ceiling_set_ +#if defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_priority_ceiling_set_) + f_status_t f_thread_mutex_priority_ceiling_set(const int ceiling, f_thread_mutex_t * const mutex, int * const previous) { + #ifndef _di_level_0_parameter_checking_ + if (!mutex) 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_mutex_priority_ceiling_set_) f_status_t f_thread_mutex_priority_ceiling_set(const int ceiling, f_thread_mutex_t * const mutex, int * const previous) { #ifndef _di_level_0_parameter_checking_ if (!mutex) return F_status_set_error(F_parameter); @@ -1590,7 +1633,7 @@ extern "C" { return F_none; } -#endif // _di_f_thread_mutex_priority_ceiling_set_ +#endif // defined(_pthread_mutex_prioceiling_unsupported_) && !defined(_di_f_thread_mutex_priority_ceiling_set_) #ifndef _di_f_thread_mutex_unlock_ f_status_t f_thread_mutex_unlock(f_thread_mutex_t * const mutex) { diff --git a/level_0/f_thread/data/build/defines b/level_0/f_thread/data/build/defines index 29febee..a7c99da 100644 --- a/level_0/f_thread/data/build/defines +++ b/level_0/f_thread/data/build/defines @@ -2,4 +2,5 @@ _di_thread_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_mutex_prioceiling_unsupported_ Disable mutex_prioceiling related functionality for systems that do not support it. _pthread_sigqueue_unsupported_ Disable GNU specific sigqueue().