From b64fb93d9322f63662ced3de4f5f60548bb1924d Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Mon, 21 Apr 2025 11:06:27 +1000 Subject: [PATCH] lib: posix: dedicated symbol for POSIX system headers Add a dedicated symbol for including the POSIX system headers path directly into the include path, enabling (for example) `#include ` instead of `#include `. Signed-off-by: Jordan Yates --- lib/posix/options/CMakeLists.txt | 2 +- lib/posix/options/Kconfig.profile | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/posix/options/CMakeLists.txt b/lib/posix/options/CMakeLists.txt index f12904aefb6..3df52af792f 100644 --- a/lib/posix/options/CMakeLists.txt +++ b/lib/posix/options/CMakeLists.txt @@ -6,7 +6,7 @@ zephyr_syscall_header_ifdef(CONFIG_POSIX_CLOCK_SELECTION posix_clock.h) zephyr_syscall_header_ifdef(CONFIG_POSIX_TIMERS posix_clock.h) zephyr_syscall_header_ifdef(CONFIG_XSI_SINGLE_PROCESS posix_clock.h) -if(CONFIG_POSIX_API) +if(CONFIG_POSIX_SYSTEM_HEADERS) zephyr_include_directories(${ZEPHYR_BASE}/include/zephyr/posix) endif() diff --git a/lib/posix/options/Kconfig.profile b/lib/posix/options/Kconfig.profile index 9fdbe71de74..b14a7d7c825 100644 --- a/lib/posix/options/Kconfig.profile +++ b/lib/posix/options/Kconfig.profile @@ -2,10 +2,18 @@ # # SPDX-License-Identifier: Apache-2.0 +config POSIX_SYSTEM_HEADERS + bool + depends on !NATIVE_APPLICATION + select NATIVE_LIBC_INCOMPATIBLE + help + Make POSIX headers available to the system without the "zephyr/posix" prefix. + config POSIX_API bool "POSIX APIs" depends on !NATIVE_APPLICATION select NATIVE_LIBC_INCOMPATIBLE + select POSIX_SYSTEM_HEADERS select POSIX_BASE_DEFINITIONS # clock_gettime(), pthread_create(), sem_get(), etc select POSIX_AEP_REALTIME_MINIMAL # CLOCK_MONOTONIC, pthread_attr_setstack(), etc select POSIX_NETWORKING if NETWORKING # inet_ntoa(), socket(), etc @@ -99,6 +107,7 @@ endchoice # POSIX_AEP_CHOICE # Base Definitions (System Interfaces) config POSIX_BASE_DEFINITIONS bool + select POSIX_SYSTEM_HEADERS select POSIX_ASYNCHRONOUS_IO select POSIX_BARRIERS select POSIX_CLOCK_SELECTION