Skip to content

Commit 9e776e3

Browse files
keith-packardnashif
authored andcommitted
posix: Use picolibc's limits.h when building POSIX code
When building POSIX code, we need to use picolibc's limits.h instead of manually defining the POSIX values. This avoids duplicate definitions of these symbols. Signed-off-by: Keith Packard <[email protected]>
1 parent 3ea3f00 commit 9e776e3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/zephyr/posix/posix_features.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,13 @@
245245
/* #define _XOPEN_UNIX (-1L) */
246246
/* #define _XOPEN_UUCP (-1L) */
247247

248+
#if _POSIX_C_SOURCE >= 200809L && (__PICOLIBC__ > 1 || \
249+
(__PICOLIBC__ == 1 && (__PICOLIBC_MINOR__ > 8 || \
250+
__PICOLIBC_MINOR__ == 8 && __PICOLIBC_PATCHLEVEL__ >= 9)))
251+
/* Use picolibc's limits.h when building POSIX code */
252+
#include <limits.h>
253+
#else
254+
248255
/* Maximum values */
249256
#define _POSIX_CLOCKRES_MIN (20000000L)
250257

@@ -307,6 +314,8 @@
307314
#define _XOPEN_NAME_MAX (255)
308315
#define _XOPEN_PATH_MAX (1024)
309316

317+
#endif /* __PICOLIBC__ */
318+
310319
/* Other invariant values */
311320
#define NL_LANGMAX (14)
312321
#define NL_MSGMAX (32767)

0 commit comments

Comments
 (0)