diff --git a/arch/arm64/src/common/arm64_arch_timer.c b/arch/arm64/src/common/arm64_arch_timer.c index 28e760c2cba77..ff1b97b92dc20 100644 --- a/arch/arm64/src/common/arm64_arch_timer.c +++ b/arch/arm64/src/common/arm64_arch_timer.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include diff --git a/include/nuttx/lib/lib.h b/include/nuttx/lib/lib.h index c6d7e7ada8dc0..8d9ddd18d98ec 100644 --- a/include/nuttx/lib/lib.h +++ b/include/nuttx/lib/lib.h @@ -28,9 +28,15 @@ ****************************************************************************/ #include -#include -#include - +#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__) +# include +#else +# include +#endif +#ifdef CONFIG_FILE_STREAM +# include +#endif +#include #include #include diff --git a/include/nuttx/streams.h b/include/nuttx/streams.h index 8ed689cf14a3e..0b1f73314849a 100644 --- a/include/nuttx/streams.h +++ b/include/nuttx/streams.h @@ -211,6 +211,7 @@ struct lib_rawoutstream_s int fd; }; +#ifndef CONFIG_DISABLE_MOUNTPOINT struct lib_fileinstream_s { struct lib_instream_s common; @@ -222,6 +223,7 @@ struct lib_fileoutstream_s struct lib_outstream_s common; struct file file; }; +#endif struct lib_rawsistream_s { @@ -428,12 +430,14 @@ void lib_stdsostream(FAR struct lib_stdsostream_s *stream, * ****************************************************************************/ +#ifndef CONFIG_DISABLE_MOUNTPOINT int lib_fileinstream_open(FAR struct lib_fileinstream_s *stream, FAR const char *path, int oflag, mode_t mode); void lib_fileinstream_close(FAR struct lib_fileinstream_s *stream); int lib_fileoutstream_open(FAR struct lib_fileoutstream_s *stream, FAR const char *path, int oflag, mode_t mode); void lib_fileoutstream_close(FAR struct lib_fileoutstream_s *stream); +#endif /**************************************************************************** * Name: lib_rawinstream, lib_rawoutstream, lib_rawsistream, and diff --git a/libs/libc/netdb/lib_getaddrinfo.c b/libs/libc/netdb/lib_getaddrinfo.c index 9b68bdcc4f36b..223b2f0826208 100644 --- a/libs/libc/netdb/lib_getaddrinfo.c +++ b/libs/libc/netdb/lib_getaddrinfo.c @@ -30,9 +30,15 @@ #include #include -#include -#include -#include +#ifdef CONFIG_NET_LOOPBACK +# include +#endif +#ifdef CONFIG_NET_RPMSG +# include +#endif +#ifdef CONFIG_NET_VSOCK +# include +#endif #include #include @@ -51,8 +57,12 @@ struct ai_s struct sockaddr_un sun; struct sockaddr_in sin; struct sockaddr_in6 sin6; +#ifdef CONFIG_NET_RPMSG struct sockaddr_rpmsg srp; +#endif +#ifdef CONFIG_NET_VSOCK struct sockaddr_vm svm; +#endif } sa; }; @@ -65,12 +75,13 @@ FAR static struct ai_s *alloc_ai(int family, int socktype, int protocol, { FAR struct ai_s *ai; - ai = lib_zalloc(sizeof(struct ai_s)); + ai = lib_malloc(sizeof(struct ai_s)); if (ai == NULL) { return ai; } + memset(ai, 0, sizeof(*ai)); ai->ai.ai_addr = (FAR struct sockaddr *)&ai->sa; ai->ai.ai_family = family; ai->ai.ai_socktype = socktype; @@ -187,12 +198,13 @@ int getaddrinfo(FAR const char *hostname, FAR const char *servname, { /* Force network byte order */ - port = HTONS(port); + port = htons(port); } else if ((flags & AI_NUMERICSERV) != 0) { return EAI_NONAME; } +#if defined(CONFIG_NET_IPv4) || defined(CONFIG_NET_IPv6) else if (getservbyname_r(servname, NULL, &ent, NULL, 0, &sp) == OK) { /* The s_port field of struct servent is required to @@ -201,6 +213,7 @@ int getaddrinfo(FAR const char *hostname, FAR const char *servname, port = sp->s_port; } +#endif else { return EAI_SERVICE; diff --git a/libs/libc/netdb/lib_gethostentbynamer.c b/libs/libc/netdb/lib_gethostentbynamer.c index 9edbead0d360b..f610b2c4f8ff2 100644 --- a/libs/libc/netdb/lib_gethostentbynamer.c +++ b/libs/libc/netdb/lib_gethostentbynamer.c @@ -39,7 +39,9 @@ #include #include -#include +#ifdef CONFIG_NET_LOOPBACK +# include +#endif #include "netdb/lib_dns.h" #include "netdb/lib_netdb.h" diff --git a/libs/libc/netdb/lib_netdb.h b/libs/libc/netdb/lib_netdb.h index 03bb762888cb8..4d97d7779f820 100644 --- a/libs/libc/netdb/lib_netdb.h +++ b/libs/libc/netdb/lib_netdb.h @@ -31,6 +31,7 @@ #include #include +#include #ifdef CONFIG_LIBC_NETDB