Skip to content

Commit dab0cd6

Browse files
committed
posix: manually define _POSIX_C_SOURCE in lib/posix
This PR adds declarations for the application conformance feature test macro _POSIX_C_SOURCE. It needs to be defined to value greater than or equal to 200112L by the appplication. However, Zephyr currently does not have a simple and consistent means of specifying this value for POSIX samples, tests, applications, and other libraries. Signed-off-by: Christopher Friedt <[email protected]>
1 parent b4c015d commit dab0cd6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/posix/shell/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Copyright (c) 2024 Meta
22
# SPDX-License-Identifier: Apache-2.0
33

4+
zephyr_library()
5+
# For setenv() and unsetenv()
6+
zephyr_library_compile_options(-U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L)
7+
# For getenv_r() visibility
8+
zephyr_library_compile_definitions(_BSD_SOURCE)
9+
410
zephyr_library_sources_ifdef(CONFIG_POSIX_SHELL posix_shell.c)
511
zephyr_library_sources_ifdef(CONFIG_POSIX_UNAME_SHELL uname.c)
612
zephyr_library_sources_ifdef(CONFIG_POSIX_ENV_SHELL env.c)

0 commit comments

Comments
 (0)