Skip to content

Commit 103d90b

Browse files
committed
simplfy the fix further
1 parent ff4d071 commit 103d90b

4 files changed

Lines changed: 20 additions & 83 deletions

File tree

wolfcrypt/src/random.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3469,14 +3469,12 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
34693469
#endif
34703470
#endif
34713471

3472-
#ifndef _POSIX_C_SOURCE
3473-
#if KERNEL_VERSION_NUMBER >= 0x30100
3474-
#include <zephyr/posix/time.h>
3475-
#else
3476-
#include <posix/time.h>
3477-
#endif
3478-
#else
3472+
#if KERNEL_VERSION_NUMBER >= 0x40300
34793473
#include <time.h>
3474+
#elif KERNEL_VERSION_NUMBER >= 0x30100
3475+
#include <zephyr/posix/time.h>
3476+
#else
3477+
#include <posix/time.h>
34803478
#endif
34813479

34823480
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)

wolfssl/test.h

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -202,33 +202,10 @@
202202
#if KERNEL_VERSION_NUMBER >= 0x30100
203203
#include <zephyr/net/socket.h>
204204
#ifdef CONFIG_POSIX_API
205-
#ifdef __has_include
206-
#if __has_include(<zephyr/posix/poll.h>)
207-
#include <zephyr/posix/poll.h>
208-
#else
209-
#include <poll.h>
210-
#endif
211-
#if __has_include(<zephyr/posix/netdb.h>)
212-
#include <zephyr/posix/netdb.h>
213-
#else
214-
#include <netdb.h>
215-
#endif
216-
#if __has_include(<zephyr/posix/sys/socket.h>)
217-
#include <zephyr/posix/sys/socket.h>
218-
#else
219-
#include <sys/socket.h>
220-
#endif
221-
#if __has_include(<zephyr/posix/sys/select.h>)
222-
#include <zephyr/posix/sys/select.h>
223-
#else
224-
#include <sys/select.h>
225-
#endif
226-
#else
227-
#include <zephyr/posix/poll.h>
228-
#include <zephyr/posix/netdb.h>
229-
#include <zephyr/posix/sys/socket.h>
230-
#include <zephyr/posix/sys/select.h>
231-
#endif
205+
#include <zephyr/posix/poll.h>
206+
#include <zephyr/posix/netdb.h>
207+
#include <zephyr/posix/sys/socket.h>
208+
#include <zephyr/posix/sys/select.h>
232209
#endif
233210
#else
234211
#include <net/socket.h>

wolfssl/wolfcrypt/wc_port.h

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -310,28 +310,18 @@
310310
#else
311311
#include <version.h>
312312
#endif
313+
/* Include sys/types.h early so host libc sets __timer_t_defined
314+
* before Zephyr's posix_types.h can define a conflicting timer_t */
315+
#include <sys/types.h>
313316
#ifndef SINGLE_THREADED
314317
#if !defined(CONFIG_PTHREAD_IPC) && !defined(CONFIG_POSIX_THREADS)
315318
#error "Threading needs CONFIG_PTHREAD_IPC / CONFIG_POSIX_THREADS"
316319
#endif
317320
#if KERNEL_VERSION_NUMBER >= 0x30100
318321
#include <zephyr/kernel.h>
319322
#ifndef CONFIG_ARCH_POSIX
320-
#ifdef __has_include
321-
#if __has_include(<zephyr/posix/posix_types.h>)
322-
#include <zephyr/posix/posix_types.h>
323-
#else
324-
#include <sys/types.h>
325-
#endif
326-
#if __has_include(<zephyr/posix/pthread.h>)
327-
#include <zephyr/posix/pthread.h>
328-
#else
329-
#include <pthread.h>
330-
#endif
331-
#else
332-
#include <zephyr/posix/posix_types.h>
333-
#include <zephyr/posix/pthread.h>
334-
#endif
323+
#include <zephyr/posix/posix_types.h>
324+
#include <zephyr/posix/pthread.h>
335325
#endif
336326
#else
337327
#include <kernel.h>
@@ -1530,32 +1520,12 @@ WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
15301520
} /* extern "C" */
15311521
#endif
15321522

1533-
#ifdef __has_include
1534-
#if __has_include(<zephyr/version.h>)
1535-
#include <zephyr/version.h>
1536-
#else
1537-
#include <version.h>
1538-
#endif
1539-
#else
1540-
#include <version.h>
1541-
#endif
1542-
#include <sys/types.h>
1543-
#ifndef _POSIX_C_SOURCE
1544-
#if KERNEL_VERSION_NUMBER >= 0x30100
1545-
#ifdef __has_include
1546-
#if __has_include(<zephyr/posix/time.h>)
1547-
#include <zephyr/posix/time.h>
1548-
#else
1549-
#include <time.h>
1550-
#endif
1551-
#else
1552-
#include <zephyr/posix/time.h>
1553-
#endif
1554-
#else
1555-
#include <posix/time.h>
1556-
#endif
1557-
#else
1523+
#if KERNEL_VERSION_NUMBER >= 0x40300
15581524
#include <time.h>
1525+
#elif KERNEL_VERSION_NUMBER >= 0x30100
1526+
#include <zephyr/posix/time.h>
1527+
#else
1528+
#include <posix/time.h>
15591529
#endif
15601530

15611531
#ifndef CLOCK_REALTIME

wolfssl/wolfio.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,7 @@
192192
#if KERNEL_VERSION_NUMBER >= 0x30100
193193
#include <zephyr/net/socket.h>
194194
#ifdef CONFIG_POSIX_API
195-
#ifdef __has_include
196-
#if __has_include(<zephyr/posix/sys/socket.h>)
197-
#include <zephyr/posix/sys/socket.h>
198-
#else
199-
#include <sys/socket.h>
200-
#endif
201-
#else
202-
#include <zephyr/posix/sys/socket.h>
203-
#endif
195+
#include <zephyr/posix/sys/socket.h>
204196
#endif
205197
#else
206198
#include <net/socket.h>

0 commit comments

Comments
 (0)