about summary refs log tree commit diff stats
path: root/src/libtools/libc_net32.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-09-23 19:45:13 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-09-23 19:45:13 +0200
commit7317472b5f62316e5817f9e89ae2ddf99862412d (patch)
treefa07f9df10da8400097c372289ec58094de5f6e2 /src/libtools/libc_net32.c
parent9271684e5a9f356056a6038f652ec1c15ed16ed2 (diff)
downloadbox64-7317472b5f62316e5817f9e89ae2ddf99862412d.tar.gz
box64-7317472b5f62316e5817f9e89ae2ddf99862412d.zip
[BOX32][WRAPPER] More 32bits wrapped functions, and a few fixes on threads handling
Diffstat (limited to 'src/libtools/libc_net32.c')
-rw-r--r--src/libtools/libc_net32.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libtools/libc_net32.c b/src/libtools/libc_net32.c
index 14101aea..6bdbce82 100644
--- a/src/libtools/libc_net32.c
+++ b/src/libtools/libc_net32.c
@@ -174,3 +174,33 @@ EXPORT void* my32___h_errno_location(x64emu_t* emu)
     emu->libc_herr = h_errno;
     return &emu->libc_herr;
 }
+
+struct protoent_32
+{
+  ptr_t p_name; //char*
+  ptr_t p_aliases;// char**
+  int p_proto;
+};
+
+EXPORT void* my32_getprotobyname(x64emu_t* emu, void* name)
+{
+    static struct protoent_32 my_protoent = {0};
+    static ptr_t strings[256];
+    struct protoent *ret = getprotobyname(name);
+    if(!ret)
+        return NULL;
+    my_protoent.p_name = to_cstring(ret->p_name);
+    my_protoent.p_proto = ret->p_proto;
+    if(ret->p_aliases) {
+        my_protoent.p_aliases = to_ptrv(&strings);
+        int i = 0;
+        while(ret->p_aliases[i]) {
+            strings[i] = to_cstring(ret->p_aliases[i]);
+            ++i;
+        }
+        strings[i] = 0;
+    } else 
+        my_protoent.p_aliases = 0;
+
+    return &my_protoent;
+}
\ No newline at end of file