[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT/LWIP PATCH 1/5] Revisit netdb.h declarations


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Wed, 4 Sep 2019 22:09:08 +0300
  • Cc: felipe.huici@xxxxxxxxx, simon.kuenzer@xxxxxxxxx, vlad_andrei.badoiu@xxxxxxxxxxxxxxx
  • Delivery-date: Wed, 04 Sep 2019 19:09:37 +0000
  • Ironport-phdr: 9a23:/Gw4nx1DXduo4TlvsmDT+DRfVm0co7zxezQtwd8ZseMQL/ad9pjvdHbS+e9qxAeQG9mCsbQd1Led6vqxEUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCejbb9oMRm7rwXcusYLjYd8Lqs61wfErGZPd+lK321jOEidnwz75se+/Z5j9zpftvc8/MNeUqv0Yro1Q6VAADspL2466svrtQLeTQSU/XsTTn8WkhtTDAfb6hzxQ4r8vTH7tup53ymaINH2QLUpUjms86tnVBnlgzoBOjUk8m/Yl9Zwgbpbrhy/uhJxzY3aboaXO/pwZa7RYc8WSHBdUstLSyBNHoWxZJYPAeobOuZYqpHwqkUJrRulGQmsBeXvwSJOiH/rxa06zvkqHAba0wwnBNIOrHXUrNPvOKcWTOC11LTIwC7fYPNNwzv98JXIfQs7rfGWWrJ9aMzcwlQsGQPdllictIPoMy6P2ukOs2WX9fRsWfythmI9pQx9uiWjy8gxhoXThY8YykrI+Tt3zYs7P9G0VUF2bcCiHZBNrS+VLZF2TdknQ2xwvSY6zaAJtoCjcSgRzZQn2wbfa/uac4iU+h7jVPieITN/hH99ZrK/ggy98UmkyuHmSsa0y0xGrjJYktbXrHwNzRvT5tCGSvt74EihxS6C2x3c5+1ZO0w5lqrWJ4Q/zrIulJcfq0rOEjfzmErsja+Wcksk+vKv6+TierjpupicN5RoigH/NKQigMi/AfkgMggTRGWU5f+82Kf7/U3kW7pGlOc2kq7BvJDAOcsbvrK5AxNS0os77ha/DjGm0NUfnXkcNV5KZQyIj5b3NFHKO/34Cfa/g0+wkDdw3fzHMaPuApPXInjEirfhcq5361RAxwor0dBf+5VUB6kPIP3tXk/xtcTYAQEjPwy03ubnCcly1oIFVGKJHKCWLKfSvkWT6e41PeaMeZcfuCzhJPg9+/7ukXg5lEcGfamo2JsXb3a4Eu5lI0WEf3XshNYAHnkQvgclSuzllkGNUTpJaHmpRa4z+Cw7Apq8DYjfXoCtnKCB3CCjE51IYmBJEE2DHm/yeIWCRvgMcjydIs57njMfT7euVogh1RCztALh0LpnMvfU9TACuZ35yNd1/PfflQwq9TNvFcidyWaNHClImTYNRjk327s6rUFjx1Or1aljn+ceBdFVofRTXVQUL5nZmsd9EMzzXErlY8+UAAKtRc66ADd3Ss8p3vcFeABlBt/klBeVjHniOKMci7HeXM98yanbxXWkf8s=
  • Ironport-sdr: FUSIBxy9AfKhY2XLmi9d4d6AvqhS1WLa8XRo9/iZv3RrfjWNPEzWMUP7A/ggKKqagarkkXe2/i XHNeqc0ouO4A==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

* As we did in commit b0dc593d, we use function wrappers instead of macros for
gethostbyname() and gethostbyname_r()
* Add missing declarations of functions implemented or stubbed in glue code

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 exportsyms.uk   |  1 +
 host.c          | 19 +++++++++++++++++++
 include/netdb.h | 23 ++++++++++++++++++-----
 3 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/exportsyms.uk b/exportsyms.uk
index 6fe95ec..1ca43f8 100644
--- a/exportsyms.uk
+++ b/exportsyms.uk
@@ -7,6 +7,7 @@ freeaddrinfo
 gai_strerror
 getaddrinfo
 gethostbyaddr
+gethostbyname
 getnameinfo
 getpeername
 getprotobyname
diff --git a/host.c b/host.c
index 559d186..9c4c8ea 100644
--- a/host.c
+++ b/host.c
@@ -33,10 +33,29 @@
 
 #include <unistd.h>
 #include <sys/socket.h>
+#include <netdb.h>
+
+
+#if LWIP_DNS && LWIP_SOCKET
+
+#if !(LWIP_COMPAT_SOCKETS)
+struct hostent *gethostbyname(const char *name)
+{
+       return lwip_gethostbyname(name);
+}
+
+int gethostbyname_r(const char *name,
+               struct hostent *ret, char *buf, size_t buflen,
+               struct hostent **result, int *h_errnop)
+{
+       return lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop);
+}
+#endif
 
 struct hostent *gethostbyaddr(const void *addr __unused,
        socklen_t len __unused, int type __unused)
 {
        return NULL;
 }
+#endif
 
diff --git a/include/netdb.h b/include/netdb.h
index 0856a49..b100136 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -1,10 +1,16 @@
 #include <compat/posix/netdb.h>
 
-#if LWIP_DNS && LWIP_SOCKET && !(LWIP_COMPAT_SOCKETS)
+#if LWIP_DNS && LWIP_SOCKET
 
-#define gethostbyname(name) lwip_gethostbyname(name)
-#define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \
-               lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop)
+#if !(LWIP_COMPAT_SOCKETS)
+struct hostent *gethostbyname(const char *name);
+int gethostbyname_r(const char *name,
+               struct hostent *ret, char *buf, size_t buflen,
+               struct hostent **result, int *h_errnop);
+#endif
+
+struct hostent *gethostbyaddr(const void *addr __unused,
+               socklen_t len __unused, int type __unused);
 
 int getaddrinfo(const char *node, const char *service,
                const struct addrinfo *hints,
@@ -13,6 +19,9 @@ void freeaddrinfo(struct addrinfo *res);
 
 #endif /* LWIP_DNS && LWIP_SOCKET && !(LWIP_COMPAT_SOCKETS) */
 
+const char *gai_strerror(int errcode);
+
+
 struct servent {
        char    *s_name;        /* official service name */
        char    **s_aliases;    /* alias list */
@@ -26,7 +35,11 @@ struct protoent {
        int     p_proto;        /* protocol # */
 };
 
-const char *gai_strerror(int errcode);
+struct protoent *getprotoent(void);
+struct protoent *getprotobyname(const char *name);
+struct protoent *getprotobynumber(int num);
+void endprotoent(void);
+void setprotoent(int stayopen);
 
 /*
  * Constants for getnameinfo()
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.