Skip to content

Commit 269729a

Browse files
ycsinnashif
authored andcommitted
net: socket: fix sys/_timespec.h not found error
When building `native_sim` with CPP & POSIX enabled, the POSIX's `unistd.h` header causes a compilation error as `sys/_timespec.h` doesn't exist in host gcc lib. Remove the 'zephyr/posix' prefix, and rely on `CMakeLists.txt`s to do the routing accordingly: - zephyr/lib/CMakeLists.txt:L11 - zephyr/lib/posix/options/CMakeLists.txt:L8 Signed-off-by: Yong Cong Sin <ycsin@meta.com>
1 parent 67544a6 commit 269729a

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

include/zephyr/net/socket.h

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,21 +1403,11 @@ struct net_socket_register {
14031403
* zephyr/net/socket.h header file.
14041404
*/
14051405
#if defined(CONFIG_POSIX_API)
1406-
#if !defined(ZEPHYR_INCLUDE_POSIX_ARPA_INET_H_)
1407-
#include <zephyr/posix/arpa/inet.h>
1408-
#endif
1409-
#if !defined(ZEPHYR_INCLUDE_POSIX_NETDB_H_)
1410-
#include <zephyr/posix/netdb.h>
1411-
#endif
1412-
#if !defined(ZEPHYR_INCLUDE_POSIX_UNISTD_H_)
1413-
#include <zephyr/posix/unistd.h>
1414-
#endif
1415-
#if !defined(ZEPHYR_INCLUDE_POSIX_POLL_H_)
1416-
#include <zephyr/posix/poll.h>
1417-
#endif
1418-
#if !defined(ZEPHYR_INCLUDE_POSIX_SYS_SOCKET_H_)
1419-
#include <zephyr/posix/sys/socket.h>
1420-
#endif
1406+
#include <arpa/inet.h>
1407+
#include <netdb.h>
1408+
#include <unistd.h>
1409+
#include <poll.h>
1410+
#include <sys/socket.h>
14211411
#endif /* CONFIG_POSIX_API */
14221412

14231413
#endif /* ZEPHYR_INCLUDE_NET_SOCKET_H_ */

0 commit comments

Comments
 (0)