Browse Source

LibC: Stub out some addrinfo things

AnotherTest 4 years ago
parent
commit
0c07c005b5
2 changed files with 46 additions and 0 deletions
  1. 19 0
      Userland/Libraries/LibC/netdb.cpp
  2. 27 0
      Userland/Libraries/LibC/netdb.h

+ 19 - 0
Userland/Libraries/LibC/netdb.cpp

@@ -654,4 +654,23 @@ static bool fill_getproto_buffers(const char* line, ssize_t read)
 
     return true;
 }
+
+int getaddrinfo(const char* __restrict node, const char* __restrict service, const struct addrinfo* __restrict hints, struct addrinfo** __restrict res)
+{
+    (void)node;
+    (void)service;
+    (void)hints;
+    (void)res;
+    ASSERT_NOT_REACHED();
+}
+void freeaddrinfo(struct addrinfo* res)
+{
+    (void)res;
+    ASSERT_NOT_REACHED();
+}
+const char* gai_strerror(int errcode)
+{
+    (void)errcode;
+    return "Not yet implemented";
+}
 }

+ 27 - 0
Userland/Libraries/LibC/netdb.h

@@ -75,4 +75,31 @@ extern int h_errno;
 #define NO_RECOVERY 103
 #define TRY_AGAIN 104
 
+struct addrinfo {
+    int ai_flags;
+    int ai_family;
+    int ai_socktype;
+    int ai_protocol;
+    socklen_t ai_addrlen;
+    struct sockaddr* ai_addr;
+    char* ai_canonname;
+    struct addrinfo* ai_next;
+};
+
+#define EAI_ADDRFAMILY 1
+#define EAI_AGAIN 2
+#define EAI_BADFLAGS 3
+#define EAI_FAIL 4
+#define EAI_FAMILY 5
+#define EAI_MEMORY 6
+#define EAI_NODATA 7
+#define EAI_NONAME 8
+#define EAI_SERVICE 9
+#define EAI_SOCKTYPE 10
+#define EAI_SYSTEM 11
+
+int getaddrinfo(const char* __restrict node, const char* __restrict service, const struct addrinfo* __restrict hints, struct addrinfo** __restrict res);
+void freeaddrinfo(struct addrinfo* res);
+const char* gai_strerror(int errcode);
+
 __END_DECLS