Skip to content

Commit eda4e4f

Browse files
committed
net: sockets: fix fcntl.h usage
If we are using `CONFIG_ARCH_POSIX`, then include `<fcntl.h>`. Otherwise, include `<zephyr/posix/fcntl.h>` since there are no requirements to use `CONFIG_POSIX_API` internally. Signed-off-by: Chris Friedt <[email protected]>
1 parent 1f02f36 commit eda4e4f

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

subsys/net/lib/mqtt_sn/mqtt_sn_transport_udp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
#include <zephyr/net/net_ip.h>
1616
#include <zephyr/net/socket.h>
1717

18+
#ifdef CONFIG_ARCH_POSIX
1819
#include <fcntl.h>
20+
#else
21+
#include <zephyr/posix/fcntl.h>
22+
#endif
1923

2024
#include <zephyr/logging/log.h>
2125
LOG_MODULE_DECLARE(net_mqtt_sn, CONFIG_MQTT_SN_LOG_LEVEL);

subsys/net/lib/sockets/sockets_can.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
*/
77

88
#include <stdbool.h>
9+
#ifdef CONFIG_ARCH_POSIX
910
#include <fcntl.h>
11+
#else
12+
#include <zephyr/posix/fcntl.h>
13+
#endif
1014

1115
#include <zephyr/logging/log.h>
1216
LOG_MODULE_REGISTER(net_sock_can, CONFIG_NET_SOCKETS_LOG_LEVEL);

subsys/net/lib/sockets/sockets_net_mgmt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
*/
66

77
#include <stdbool.h>
8+
#ifdef CONFIG_ARCH_POSIX
89
#include <fcntl.h>
10+
#else
11+
#include <zephyr/posix/fcntl.h>
12+
#endif
913

1014
#include <zephyr/logging/log.h>
1115
LOG_MODULE_REGISTER(net_sock_mgmt, CONFIG_NET_SOCKETS_LOG_LEVEL);

subsys/net/lib/sockets/sockets_packet.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
*/
77

88
#include <stdbool.h>
9+
#ifdef CONFIG_ARCH_POSIX
910
#include <fcntl.h>
11+
#else
12+
#include <zephyr/posix/fcntl.h>
13+
#endif
1014

1115
#include <zephyr/logging/log.h>
1216
LOG_MODULE_REGISTER(net_sock_packet, CONFIG_NET_SOCKETS_LOG_LEVEL);

subsys/net/lib/sockets/sockets_tls.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
*/
77

88
#include <stdbool.h>
9+
#ifdef CONFIG_ARCH_POSIX
10+
#include <fcntl.h>
11+
#else
912
#include <zephyr/posix/fcntl.h>
13+
#endif
1014

1115
#include <zephyr/logging/log.h>
1216
LOG_MODULE_REGISTER(net_sock_tls, CONFIG_NET_SOCKETS_LOG_LEVEL);

0 commit comments

Comments
 (0)