Skip to content

Commit 9e8d1d2

Browse files
committed
posix: options: enable define _POSIX_TIMERS when configured
Define _POSIX_TIMERS=200809L when so configured. This change is required to ensure that Newlib provides the necessary POSIX timer API definitions in toolchain headers. Signed-off-by: Chris Friedt <[email protected]>
1 parent a491836 commit 9e8d1d2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/zephyr/posix/posix_features.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,6 @@
177177
#define _POSIX_TIMEOUTS _POSIX_VERSION
178178
#endif
179179

180-
#ifdef CONFIG_POSIX_TIMERS
181-
#define _POSIX_TIMERS _POSIX_VERSION
182-
#endif
183-
184180
/* #define _POSIX_TRACE (-1L) */
185181
/* #define _POSIX_TRACE_EVENT_FILTER (-1L) */
186182
/* #define _POSIX_TRACE_INHERIT (-1L) */

lib/posix/options/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
set(POSIX_VERSION 200809L)
34
set(GEN_DIR ${ZEPHYR_BINARY_DIR}/include/generated)
45

56
zephyr_syscall_header_ifdef(CONFIG_POSIX_CLOCK_SELECTION posix_clock.h)
@@ -115,6 +116,9 @@ if (NOT CONFIG_TC_PROVIDES_POSIX_TIMERS)
115116
timespec_to_timeout.c
116117
)
117118
endif()
119+
if (CONFIG_POSIX_TIMERS)
120+
zephyr_compile_definitions(-D_POSIX_TIMERS=${POSIX_VERSION})
121+
endif()
118122

119123
if (NOT CONFIG_TC_PROVIDES_POSIX_READER_WRITER_LOCKS)
120124
# Note: the Option is _POSIX_READER_WRITER_LOCKS, while the Option Group is POSIX_RW_LOCKS.

0 commit comments

Comments
 (0)