-
Notifications
You must be signed in to change notification settings - Fork 969
Allow Zephyr build w/o having posix api enabled #10325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -142,9 +142,8 @@ static memoryStats ourMemStats; | |||||||||
| WOLFSSL_API extern memoryStats *wc_MemStats_Ptr; | ||||||||||
|
|
||||||||||
| #ifdef DO_MEM_LIST | ||||||||||
| #include <pthread.h> | ||||||||||
| static memoryList ourMemList; | ||||||||||
| static pthread_mutex_t memLock = PTHREAD_MUTEX_INITIALIZER; | ||||||||||
| static wolfSSL_Mutex memLock WOLFSSL_MUTEX_INITIALIZER_CLAUSE(memLock); | ||||||||||
| #endif | ||||||||||
|
|
||||||||||
| #ifdef WOLFSSL_DEBUG_MEMORY | ||||||||||
|
|
@@ -182,7 +181,7 @@ static WC_INLINE void* TrackMalloc(size_t sz) | |||||||||
| #endif | ||||||||||
| #endif | ||||||||||
| #if !defined(SINGLE_THREADED) && (defined(DO_MEM_LIST) || defined(DO_MEM_STATS)) | ||||||||||
| if (pthread_mutex_lock(&memLock) == 0) | ||||||||||
| if (wc_LockMutex(&memLock) == 0) | ||||||||||
| { | ||||||||||
|
Comment on lines
+184
to
185
|
||||||||||
| #endif | ||||||||||
|
|
||||||||||
|
|
@@ -228,7 +227,7 @@ static WC_INLINE void* TrackMalloc(size_t sz) | |||||||||
| ourMemList.count++; | ||||||||||
| #endif | ||||||||||
| #if !defined(SINGLE_THREADED) && (defined(DO_MEM_LIST) || defined(DO_MEM_STATS)) | ||||||||||
| pthread_mutex_unlock(&memLock); | ||||||||||
| wc_UnLockMutex(&memLock); | ||||||||||
| } | ||||||||||
| #endif /* DO_MEM_LIST */ | ||||||||||
|
|
||||||||||
|
|
@@ -255,7 +254,7 @@ static WC_INLINE void TrackFree(void* ptr) | |||||||||
| sz = header->thisSize; | ||||||||||
|
|
||||||||||
| #if !defined(SINGLE_THREADED) && (defined(DO_MEM_LIST) || defined(DO_MEM_STATS)) | ||||||||||
| if (pthread_mutex_lock(&memLock) == 0) | ||||||||||
| if (wc_LockMutex(&memLock) == 0) | ||||||||||
| { | ||||||||||
| #endif | ||||||||||
|
|
||||||||||
|
|
@@ -289,7 +288,7 @@ static WC_INLINE void TrackFree(void* ptr) | |||||||||
| #endif | ||||||||||
|
|
||||||||||
| #if !defined(SINGLE_THREADED) && (defined(DO_MEM_LIST) || defined(DO_MEM_STATS)) | ||||||||||
| pthread_mutex_unlock(&memLock); | ||||||||||
| wc_UnLockMutex(&memLock); | ||||||||||
| } | ||||||||||
| #endif | ||||||||||
|
|
||||||||||
|
|
@@ -369,7 +368,10 @@ static WC_INLINE int InitMemoryTracker(void) | |||||||||
| } | ||||||||||
|
|
||||||||||
| #ifdef DO_MEM_LIST | ||||||||||
| if (pthread_mutex_lock(&memLock) == 0) | ||||||||||
| #ifndef WOLFSSL_MUTEX_INITIALIZER | ||||||||||
| wc_InitMutex(&memLock); | ||||||||||
| #endif | ||||||||||
| if (wc_LockMutex(&memLock) == 0) | ||||||||||
|
Comment on lines
+371
to
+374
|
||||||||||
| #endif | ||||||||||
| { | ||||||||||
| #ifdef DO_MEM_STATS | ||||||||||
|
|
@@ -388,7 +390,7 @@ static WC_INLINE int InitMemoryTracker(void) | |||||||||
| XMEMSET(&ourMemList, 0, sizeof(ourMemList)); | ||||||||||
| ourMemStats.memList = &ourMemList; | ||||||||||
|
|
||||||||||
| pthread_mutex_unlock(&memLock); | ||||||||||
| wc_UnLockMutex(&memLock); | ||||||||||
| #endif | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
@@ -400,7 +402,7 @@ static WC_INLINE int InitMemoryTracker(void) | |||||||||
| static WC_INLINE void ShowMemoryTracker(void) | ||||||||||
| { | ||||||||||
| #ifdef DO_MEM_LIST | ||||||||||
| if (pthread_mutex_lock(&memLock) == 0) | ||||||||||
| if (wc_LockMutex(&memLock) == 0) | ||||||||||
| #endif | ||||||||||
| { | ||||||||||
| #ifdef DO_MEM_STATS | ||||||||||
|
|
@@ -430,13 +432,16 @@ static WC_INLINE void ShowMemoryTracker(void) | |||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| pthread_mutex_unlock(&memLock); | ||||||||||
| wc_UnLockMutex(&memLock); | ||||||||||
| #endif | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| static WC_INLINE int CleanupMemoryTracker(void) | ||||||||||
| { | ||||||||||
| #ifndef WOLFSSL_MUTEX_INITIALIZER | ||||||||||
| wc_FreeMutex(&memLock); | ||||||||||
|
||||||||||
| wc_FreeMutex(&memLock); | |
| if (wc_MemStats_Ptr != NULL) { | |
| wc_FreeMutex(&memLock); | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -314,16 +314,12 @@ | |||||||||||||
| * before Zephyr's posix_types.h can define a conflicting timer_t */ | ||||||||||||||
| #include <sys/types.h> | ||||||||||||||
| #ifndef SINGLE_THREADED | ||||||||||||||
| #if !defined(CONFIG_PTHREAD_IPC) && !defined(CONFIG_POSIX_THREADS) | ||||||||||||||
| #error "Threading needs CONFIG_PTHREAD_IPC / CONFIG_POSIX_THREADS" | ||||||||||||||
| #endif | ||||||||||||||
| #if KERNEL_VERSION_NUMBER >= 0x30100 | ||||||||||||||
| #include <zephyr/kernel.h> | ||||||||||||||
| #ifndef CONFIG_ARCH_POSIX | ||||||||||||||
| #include <zephyr/posix/posix_types.h> | ||||||||||||||
| #include <zephyr/posix/pthread.h> | ||||||||||||||
| #endif | ||||||||||||||
| #else | ||||||||||||||
| #if !defined(CONFIG_PTHREAD_IPC) && !defined(CONFIG_POSIX_THREADS) | ||||||||||||||
| #error "Threading needs CONFIG_PTHREAD_IPC / CONFIG_POSIX_THREADS" | ||||||||||||||
| #endif | ||||||||||||||
| #include <kernel.h> | ||||||||||||||
| #ifndef CONFIG_ARCH_POSIX | ||||||||||||||
| #include <posix/posix_types.h> | ||||||||||||||
|
|
@@ -1557,12 +1553,12 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void); | |||||||||||||
| #include <posix/time.h> | ||||||||||||||
| #endif | ||||||||||||||
|
|
||||||||||||||
| #ifndef CLOCK_REALTIME | ||||||||||||||
| #ifdef SYS_CLOCK_REALTIME | ||||||||||||||
| #ifdef SYS_CLOCK_REALTIME | ||||||||||||||
| #ifndef CLOCK_REALTIME | ||||||||||||||
| #define CLOCK_REALTIME SYS_CLOCK_REALTIME | ||||||||||||||
| #define clock_gettime sys_clock_gettime | ||||||||||||||
| #define clock_settime sys_clock_settime | ||||||||||||||
| #endif | ||||||||||||||
| #define clock_gettime sys_clock_gettime | ||||||||||||||
| #define clock_settime sys_clock_settime | ||||||||||||||
|
Comment on lines
1559
to
+1561
|
||||||||||||||
| #endif | |
| #define clock_gettime sys_clock_gettime | |
| #define clock_settime sys_clock_settime | |
| #define clock_gettime sys_clock_gettime | |
| #define clock_settime sys_clock_settime | |
| #endif |
Uh oh!
There was an error while loading. Please reload this page.