Skip to content

Commit ac859d0

Browse files
jukkarnashif
authored andcommitted
samples: net: Add relevant Posix headers for networking
We need certain network related Posix header files so that the network sample compiles ok. Previously the Posix symbols were introduced by network stack automatically even if user had not enabled Posix, but that is no longer the case. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 2fd1490 commit ac859d0

File tree

34 files changed

+140
-0
lines changed

34 files changed

+140
-0
lines changed

samples/drivers/modem/hello_hl78xx/src/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
#include <zephyr/net/conn_mgr_monitor.h>
1717
#include <zephyr/net/socket.h>
1818

19+
#include <zephyr/posix/sys/socket.h>
20+
#include <zephyr/posix/arpa/inet.h>
21+
#include <zephyr/posix/netdb.h>
22+
1923
/* Macros used to subscribe to specific Zephyr NET management events. */
2024
#if defined(CONFIG_NET_SAMPLE_COMMON_WAIT_DNS_SERVER_ADDITION)
2125
#define L4_EVENT_MASK (NET_EVENT_DNS_SERVER_ADD | NET_EVENT_L4_DISCONNECTED)

samples/drivers/video/tcpserversink/src/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
#include <zephyr/logging/log.h>
1414
#include <zephyr/net/socket.h>
1515

16+
#include <zephyr/posix/netinet/in.h>
17+
#include <zephyr/posix/sys/socket.h>
18+
#include <zephyr/posix/arpa/inet.h>
19+
#include <zephyr/posix/unistd.h>
20+
#include <zephyr/posix/poll.h>
21+
1622
LOG_MODULE_REGISTER(main, CONFIG_LOG_DEFAULT_LEVEL);
1723

1824
#define MY_PORT 5000

samples/net/cellular_modem/src/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
#include <zephyr/pm/device_runtime.h>
1414
#include <string.h>
1515

16+
#include <zephyr/posix/netinet/in.h>
17+
#include <zephyr/posix/sys/socket.h>
18+
#include <zephyr/posix/arpa/inet.h>
19+
#include <zephyr/posix/unistd.h>
20+
#include <zephyr/posix/poll.h>
21+
1622
#include <zephyr/drivers/cellular.h>
1723

1824
#define L4_EVENT_MASK \

samples/net/cloud/aws_iot_mqtt/src/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
#include <stdio.h>
1111
#include <stdlib.h>
1212

13+
#include <zephyr/posix/netinet/in.h>
14+
#include <zephyr/posix/sys/socket.h>
15+
#include <zephyr/posix/arpa/inet.h>
16+
#include <zephyr/posix/unistd.h>
17+
#include <zephyr/posix/netdb.h>
18+
#include <zephyr/posix/poll.h>
19+
1320
#include <zephyr/net/socket.h>
1421
#include <zephyr/net/dns_resolve.h>
1522
#include <zephyr/net/mqtt.h>

samples/net/cloud/mqtt_azure/src/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
#include <zephyr/logging/log.h>
88
LOG_MODULE_REGISTER(mqtt_azure, LOG_LEVEL_DBG);
99

10+
#include <zephyr/posix/netinet/in.h>
11+
#include <zephyr/posix/sys/socket.h>
12+
#include <zephyr/posix/arpa/inet.h>
13+
#include <zephyr/posix/unistd.h>
14+
#include <zephyr/posix/netdb.h>
15+
#include <zephyr/posix/poll.h>
16+
1017
#include <zephyr/kernel.h>
1118
#include <zephyr/net/net_if.h>
1219
#include <zephyr/net/socket.h>

samples/net/cloud/tagoio_http_post/src/sockets.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
#include <zephyr/logging/log.h>
88
LOG_MODULE_DECLARE(tagoio_http_post, CONFIG_TAGOIO_HTTP_POST_LOG_LEVEL);
99

10+
#include <zephyr/posix/netinet/in.h>
11+
#include <zephyr/posix/sys/socket.h>
12+
#include <zephyr/posix/arpa/inet.h>
13+
#include <zephyr/posix/unistd.h>
14+
#include <zephyr/posix/poll.h>
15+
#include <zephyr/posix/netdb.h>
16+
1017
#include <zephyr/net/net_ip.h>
1118
#include <zephyr/net/socket.h>
1219
#include <zephyr/net/socketutils.h>

samples/net/dsa/src/dsa_lldp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
#include <stdio.h>
99
#include <string.h>
1010

11+
#include <zephyr/posix/netinet/in.h>
12+
#include <zephyr/posix/sys/socket.h>
13+
#include <zephyr/posix/arpa/inet.h>
14+
#include <zephyr/posix/unistd.h>
15+
1116
#include <zephyr/net/socket.h>
1217
#include <zephyr/net/net_core.h>
1318
#include <zephyr/net/net_l2.h>

samples/net/latmon/src/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ LOG_MODULE_REGISTER(sample_latmon, LOG_LEVEL_DBG);
1313
#include <zephyr/net/socket.h>
1414
#include <zephyr/spinlock.h>
1515
#include <zephyr/sys/atomic.h>
16+
#include <zephyr/posix/unistd.h>
17+
1618
/*
1719
* Blink Control
1820
* DHCP: red

samples/net/mdns_responder/src/service.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#include <zephyr/net/dns_sd.h>
99
#include <zephyr/net/socket.h>
1010
#include <zephyr/posix/netinet/in.h>
11+
#include <zephyr/posix/sys/socket.h>
12+
#include <zephyr/posix/unistd.h>
13+
#include <zephyr/posix/arpa/inet.h>
1114
#include <stdint.h>
1215
#include <stdio.h>
1316
#include <string.h>

samples/net/mqtt_publisher/src/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#include <zephyr/logging/log.h>
88
LOG_MODULE_REGISTER(net_mqtt_publisher_sample, LOG_LEVEL_DBG);
99

10+
#include <zephyr/posix/poll.h>
11+
#include <zephyr/posix/arpa/inet.h>
12+
1013
#include <zephyr/kernel.h>
1114
#include <zephyr/net/socket.h>
1215
#include <zephyr/net/mqtt.h>

0 commit comments

Comments
 (0)