Skip to content

Commit e434fd6

Browse files
committed
posix: options: 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 04dfa77 commit e434fd6

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)
@@ -125,6 +126,9 @@ if (NOT CONFIG_TC_PROVIDES_POSIX_TIMERS)
125126
timespec_to_timeout.c
126127
)
127128
endif()
129+
if (CONFIG_POSIX_TIMERS)
130+
zephyr_compile_definitions(-D_POSIX_TIMERS=${POSIX_VERSION})
131+
endif()
128132

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

0 commit comments

Comments
 (0)