]> xenbits.xensource.com Git - unikraft/libs/lwip.git/commitdiff
Fix compile error when enabling Operation mode (Mainloop (non-threaded).
authorFelipe Huici <felipe.huici@neclab.eu>
Fri, 14 Feb 2020 13:12:14 +0000 (14:12 +0100)
committerSimon Kuenzer <simon.kuenzer@neclab.eu>
Fri, 14 Feb 2020 13:24:25 +0000 (14:24 +0100)
Enabling operating mode non-threaded (aka CONFIG_LWIP_NOTHREADS)
disables the socket API from lwip. This commit makes it so that our
socket-related glue code isn't added to the build if this option is
enabled.

Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Makefile.uk
include/netdb.h
include/sys/socket.h

index 56ebcfcb24c191c495c89a2d257dba776f916b8b..5054ef4ba70e0f16c542f5aa1918bd480434a993 100644 (file)
@@ -80,6 +80,7 @@ LIBLWIP_SRCS-y += $(LIBLWIP_BASE)/proto.c
 LIBLWIP_SRCS-y += $(LIBLWIP_BASE)/host.c
 LIBLWIP_SRCS-y += $(LIBLWIP_BASE)/serv.c
 LIBLWIP_SRCS-y += $(LIBLWIP_BASE)/inet.c|unikraft
+LIBLWIP_SRCS-$(CONFIG_LWIP_DNS) += $(LIBLWIP_BASE)/getnameinfo.c|unikraft
 endif
 LIBLWIP_SRCS-$(CONFIG_LWIP_THREADS) += $(LIBLWIP_BASE)/mutex.c|unikraft
 LIBLWIP_SRCS-$(CONFIG_LWIP_THREADS) += $(LIBLWIP_BASE)/semaphore.c|unikraft
@@ -91,7 +92,6 @@ LIBLWIP_SRCS-y += $(LIBLWIP_BASE)/time.c|unikraft
 LIBLWIP_SRCS-y += $(LIBLWIP_BASE)/sendfile.c|unikraft
 LIBLWIP_SRCS-$(CONFIG_LWIP_SOCKET) += $(LIBLWIP_BASE)/sockets.c|unikraft
 LIBLWIP_SOCKETS_FLAGS-y += -Wno-cast-function-type
-LIBLWIP_SRCS-$(CONFIG_LWIP_DNS) += $(LIBLWIP_BASE)/getnameinfo.c|unikraft
 LIBLWIP_SRCS-y += $(LIBLWIP_EXTRACTED)/core/init.c
 LIBLWIP_SRCS-y += $(LIBLWIP_EXTRACTED)/core/def.c
 LIBLWIP_SRCS-y += $(LIBLWIP_EXTRACTED)/core/inet_chksum.c
index 7742012eb304b1a4c59f5846ea0fa422c0a127f9..b5ae70a4e08c1a4cde3fe0ac466a4a840304b1a3 100644 (file)
@@ -23,6 +23,9 @@ int getaddrinfo(const char *node, const char *service,
                struct addrinfo **res);
 void freeaddrinfo(struct addrinfo *res);
 
+int getnameinfo(const struct sockaddr *addr, socklen_t addrlen,
+               char *host, socklen_t hostlen,
+               char *serv, socklen_t servlen, int flags);
 
 #endif /* LWIP_DNS && LWIP_SOCKET && !(LWIP_COMPAT_SOCKETS) */
 
@@ -74,10 +77,6 @@ void setprotoent(int stayopen);
 #define EAI_SYSTEM     -11
 #define EAI_OVERFLOW   -12
 
-int getnameinfo(const struct sockaddr *addr, socklen_t addrlen,
-               char *host, socklen_t hostlen,
-               char *serv, socklen_t servlen, int flags);
-
 struct servent *getservbyname(const char *name, const char *proto);
 struct servent *getservbyport(int port, const char *proto);
 int getservbyport_r(int port, const char *prots, struct servent *se,
index 8007cb85897fe9718fcb087caf2c08946035c2b1..8f6ecbc0b6349bec5e670830d439cedaf16c53d7 100644 (file)
@@ -38,6 +38,7 @@ extern "C" {
 #endif
 
 #include <uk/config.h>
+#if CONFIG_LWIP_SOCKETS
 #if CONFIG_HAVE_LIBC
 #include <fcntl.h>
 #include <poll.h>
@@ -105,4 +106,5 @@ int socketpair(int domain, int type, int protocol, int sv[2]);
 }
 #endif
 
+#endif /* CONFIG_LWIP_SOCKETS */
 #endif /* _UK_LWIP_SOCKET_H_ */