This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch feature/uclibc_support
in repository https://gitbox.apache.org/repos/asf/celix.git

commit d2c83501c03ca75459d11df1d9eae086d9dddd6c
Author: PengZheng <[email protected]>
AuthorDate: Thu Dec 1 19:59:29 2022 +0800

    Switch off features unsupported by uclibc.
    
    pthread_setname_np and backtrace are not supported by uclibc.
---
 libs/utils/src/celix_log_utils.c | 4 ++++
 libs/utils/src/celix_threads.c   | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libs/utils/src/celix_log_utils.c b/libs/utils/src/celix_log_utils.c
index 78267255..215b58ac 100644
--- a/libs/utils/src/celix_log_utils.c
+++ b/libs/utils/src/celix_log_utils.c
@@ -21,7 +21,9 @@
 
 #include <stdbool.h>
 #include <stdarg.h>
+#ifndef __UCLIBC__
 #include <execinfo.h>
+#endif
 #include <stdlib.h>
 #include <stdio.h>
 #include <time.h>
@@ -95,6 +97,7 @@ celix_log_level_e 
celix_logUtils_logLevelFromStringWithCheck(const char *str, ce
 }
 
 static inline void celix_logUtils_inlinePrintBacktrace(FILE *stream) {
+#ifndef __UCLIBC__
     void *bbuf[64];
     int nrOfTraces = backtrace(bbuf, 64);
     char **lines = backtrace_symbols(bbuf, nrOfTraces);
@@ -104,6 +107,7 @@ static inline void celix_logUtils_inlinePrintBacktrace(FILE 
*stream) {
     }
     free(lines);
     fflush(stream);
+#endif
 }
 
 void celix_logUtils_printBacktrace(FILE* stream) {
diff --git a/libs/utils/src/celix_threads.c b/libs/utils/src/celix_threads.c
index 9d0a422c..4ad291d3 100644
--- a/libs/utils/src/celix_threads.c
+++ b/libs/utils/src/celix_threads.c
@@ -45,7 +45,7 @@ celix_status_t celixThread_create(celix_thread_t *new_thread, 
celix_thread_attr_
     return status;
 }
 
-#if defined(_GNU_SOURCE) && defined(__linux__)
+#if defined(_GNU_SOURCE) && defined(__linux__) && !defined(__UCLIBC__)
 void celixThread_setName(celix_thread_t *thread, const char *threadName) {
     pthread_setname_np(thread->thread, threadName);
 }

Reply via email to