Skip to content

Commit b64fb93

Browse files
JordanYateskartben
authored andcommitted
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 <time.h>` instead of `#include <zephyr/posix/time.h>`. Signed-off-by: Jordan Yates <jordan@embeint.com>
1 parent ba48d83 commit b64fb93

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/posix/options/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ zephyr_syscall_header_ifdef(CONFIG_POSIX_CLOCK_SELECTION posix_clock.h)
66
zephyr_syscall_header_ifdef(CONFIG_POSIX_TIMERS posix_clock.h)
77
zephyr_syscall_header_ifdef(CONFIG_XSI_SINGLE_PROCESS posix_clock.h)
88

9-
if(CONFIG_POSIX_API)
9+
if(CONFIG_POSIX_SYSTEM_HEADERS)
1010
zephyr_include_directories(${ZEPHYR_BASE}/include/zephyr/posix)
1111
endif()
1212

lib/posix/options/Kconfig.profile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
config POSIX_SYSTEM_HEADERS
6+
bool
7+
depends on !NATIVE_APPLICATION
8+
select NATIVE_LIBC_INCOMPATIBLE
9+
help
10+
Make POSIX headers available to the system without the "zephyr/posix" prefix.
11+
512
config POSIX_API
613
bool "POSIX APIs"
714
depends on !NATIVE_APPLICATION
815
select NATIVE_LIBC_INCOMPATIBLE
16+
select POSIX_SYSTEM_HEADERS
917
select POSIX_BASE_DEFINITIONS # clock_gettime(), pthread_create(), sem_get(), etc
1018
select POSIX_AEP_REALTIME_MINIMAL # CLOCK_MONOTONIC, pthread_attr_setstack(), etc
1119
select POSIX_NETWORKING if NETWORKING # inet_ntoa(), socket(), etc
@@ -99,6 +107,7 @@ endchoice # POSIX_AEP_CHOICE
99107
# Base Definitions (System Interfaces)
100108
config POSIX_BASE_DEFINITIONS
101109
bool
110+
select POSIX_SYSTEM_HEADERS
102111
select POSIX_ASYNCHRONOUS_IO
103112
select POSIX_BARRIERS
104113
select POSIX_CLOCK_SELECTION

0 commit comments

Comments
 (0)