Skip to content

Commit

Permalink
posix: manually define _POSIX_C_SOURCE in lib/posix
Browse files Browse the repository at this point in the history
This PR adds declarations for setenv and unsetenv, which require
the application conformance feature test macro _POSIX_C_SOURCE
to be defined to a value greater than or equal to 200112L.

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 <cfriedt@meta.com>
  • Loading branch information
cfriedt committed Feb 3, 2024
1 parent 3a46f2d commit eca8718
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/posix/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Copyright (c) 2024 Meta
# SPDX-License-Identifier: Apache-2.0

zephyr_library()
# For setenv() and unsetenv()
zephyr_library_compile_options(-U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L)
# For getenv_r() visibility
zephyr_library_compile_definitions(_BSD_SOURCE)

zephyr_library_sources_ifdef(CONFIG_POSIX_SHELL posix_shell.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_UNAME_SHELL uname.c)
zephyr_library_sources_ifdef(CONFIG_POSIX_ENV_SHELL env.c)

0 comments on commit eca8718

Please sign in to comment.