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

[tyndur-devel] [PATCH 4/4] libc: POSIX: h_error



+ libc: POSIX: h_error und zugehoerige Statuscodes definieren

Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 src/modules/include/netdb.h |   11 +++++++++++
 src/modules/lib/posix/net.c |    2 ++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/modules/include/netdb.h b/src/modules/include/netdb.h
index 5fb2747..88cd98c 100644
--- a/src/modules/include/netdb.h
+++ b/src/modules/include/netdb.h
@@ -75,5 +75,16 @@ struct servent* getservbyname(const char* name, const char* protocol);
  */
 struct protoent* getprotobyname(const char* name);
 
+/** Fehlerstatus fuer gethostbyaddr() und gethostbyname() */
+extern int h_errno;
+
+/** Werte fuer h_error */
+enum {
+    HOST_NOT_FOUND,
+    NO_DATA,
+    NO_RECOVERY,
+    TRY_AGAIN,
+};
+
 #endif
 
diff --git a/src/modules/lib/posix/net.c b/src/modules/lib/posix/net.c
index 4832d29..44b45b5 100644
--- a/src/modules/lib/posix/net.c
+++ b/src/modules/lib/posix/net.c
@@ -34,6 +34,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+int h_errno;
+
 unsigned long int htonl(unsigned long int hostlong)
 {
     return big_endian_dword(hostlong);
-- 
1.6.0.2