Skip to content

Commit b1ddb9a

Browse files
committed
posix: remove zephyr/posix in header prefixes
If C libraries provide conformant POSIX headers, then use the headers provided by the C library. Otherwise, C library maintainers may add `include/zephyr/posix` to their standard search path. This change removes the requirement to have `<zephyr/posix/...>` prefixing all standard POSIX includes in Zephyr. The main reason that it was required was due to conflicts between C library time.h, signal.h and the fact that Zephyr posix headers were being somewhat ad-hoc mixed with libc posix headers. Now, any (even partially) POSIX-conformant C libraries are expected to provide their own types, constants, and headers, and Zephyr's implementation uses those definitions. If any definitions are missing, we define them on a per-libc basis. This can also be done out-of-tree, which allows for implementors to take advantage of the `CONFIG_TC_PROVIDES_POSIX..` options. This is likely the last major commit required before we deprecate the `CONFIG_POSIX_API` Kconfig option in favour of POSIX subprofiling \o/ Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
1 parent ea8f76d commit b1ddb9a

File tree

248 files changed

+2212
-1110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

248 files changed

+2212
-1110
lines changed

drivers/modem/ublox-sara-r4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LOG_MODULE_REGISTER(modem_ublox_sara_r4, CONFIG_MODEM_LOG_LEVEL);
1515
#include <zephyr/drivers/gpio.h>
1616
#include <zephyr/device.h>
1717
#include <zephyr/init.h>
18-
#include <zephyr/posix/fcntl.h>
18+
#include <fcntl.h>
1919

2020
#include <zephyr/net/net_if.h>
2121
#include <zephyr/net/net_offload.h>

drivers/net/nsos_fcntl.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
/*
2020
* When building for Zephyr, use Zephyr specific fcntl definitions.
2121
*/
22-
#ifdef __ZEPHYR__
23-
#include <zephyr/posix/fcntl.h>
24-
#else
2522
#include <fcntl.h>
26-
#endif
2723

2824
#include "nsi_errno.h"
2925
#include "nsos_fcntl.h"

drivers/net/nsos_sockets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ LOG_MODULE_REGISTER(nsos_sockets);
2424
#include <zephyr/net/net_ip.h>
2525
#include <zephyr/net/offloaded_netdev.h>
2626
#include <zephyr/net/socket_offload.h>
27-
#include <zephyr/posix/fcntl.h>
27+
#include <fcntl.h>
2828
#include <zephyr/sys/fdtable.h>
2929
#include <zephyr/sys/dlist.h>
3030

drivers/net/ppp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ LOG_MODULE_REGISTER(net_ppp, LOG_LEVEL);
2626
#include <zephyr/net_buf.h>
2727
#include <zephyr/net/net_pkt.h>
2828
#include <zephyr/net/net_if.h>
29+
#include <zephyr/net/if_arp.h>
2930
#include <zephyr/net/net_core.h>
3031
#include <zephyr/sys/ring_buffer.h>
3132
#include <zephyr/sys/crc.h>
3233
#include <zephyr/drivers/uart.h>
3334
#include <zephyr/random/random.h>
34-
#include <zephyr/posix/net/if_arp.h>
3535
#include <zephyr/net/ethernet.h>
3636
#include <zephyr/net/capture.h>
3737

drivers/wifi/simplelink/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ if(CONFIG_WIFI_SIMPLELINK)
99
simplelink_support.c
1010
simplelink.c
1111
)
12+
# TI's driver portability layer relies on POSIX for multi-threading and timers
13+
zephyr_library_compile_definitions(_POSIX_C_SOURCE=200809L)
1214
endif()
1315
zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_OFFLOAD simplelink_sockets.c)

drivers/wifi/simplelink/Kconfig.simplelink

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ menuconfig WIFI_SIMPLELINK
99
select WIFI_OFFLOAD
1010
select NET_L2_WIFI_MGMT
1111
select FDTABLE
12-
select POSIX_SEMAPHORES
12+
# TI's driver portability layer relies on POSIX for multi-threading and timers
13+
select POSIX_BASE_DEFINITIONS
14+
select POSIX_SYSTEM_INTERFACES
1315

1416
if WIFI_SIMPLELINK
1517

drivers/wifi/simplelink/simplelink_sockets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LOG_MODULE_DECLARE(LOG_MODULE_NAME);
99

1010
#include <stdlib.h>
1111
#include <limits.h>
12-
#include <zephyr/posix/fcntl.h>
12+
#include <fcntl.h>
1313

1414
#include <zephyr/kernel.h>
1515
/* Define sockaddr, etc, before simplelink.h */

include/zephyr/net/ethernet.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include <stdbool.h>
1919
#include <zephyr/sys/atomic.h>
2020

21-
#include <zephyr/net/net_ip.h>
22-
#include <zephyr/net/net_pkt.h>
2321
#include <zephyr/net/lldp.h>
2422
#include <zephyr/sys/util.h>
2523
#include <zephyr/net/net_if.h>
File renamed without changes.

include/zephyr/net/socket.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,19 +1280,19 @@ struct socket_op_vtable {
12801280
*/
12811281
#if defined(CONFIG_POSIX_API)
12821282
#if !defined(ZEPHYR_INCLUDE_POSIX_ARPA_INET_H_)
1283-
#include <zephyr/posix/arpa/inet.h>
1283+
#include <arpa/inet.h>
12841284
#endif
12851285
#if !defined(ZEPHYR_INCLUDE_POSIX_NETDB_H_)
1286-
#include <zephyr/posix/netdb.h>
1286+
#include <netdb.h>
12871287
#endif
12881288
#if !defined(ZEPHYR_INCLUDE_POSIX_UNISTD_H_)
1289-
#include <zephyr/posix/unistd.h>
1289+
#include <unistd.h>
12901290
#endif
12911291
#if !defined(ZEPHYR_INCLUDE_POSIX_POLL_H_)
1292-
#include <zephyr/posix/poll.h>
1292+
#include <poll.h>
12931293
#endif
12941294
#if !defined(ZEPHYR_INCLUDE_POSIX_SYS_SOCKET_H_)
1295-
#include <zephyr/posix/sys/socket.h>
1295+
#include <sys/socket.h>
12961296
#endif
12971297
#endif /* CONFIG_POSIX_API */
12981298

0 commit comments

Comments
 (0)