about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-12-12 10:48:14 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-12-12 10:48:14 +0100
commitbb60cc8568d592535d3f9195aa40a4377e13a69c (patch)
treea4cc7adba1e49ffb860537da761ff64a25e83f99 /src
parent857c4600dcfd521f22c1aacd3d3e58214fd28776 (diff)
downloadbox64-bb60cc8568d592535d3f9195aa40a4377e13a69c.tar.gz
box64-bb60cc8568d592535d3f9195aa40a4377e13a69c.zip
[BOX32][WRAPPER] Added more libc and libresolv 32bits wrapped functions
Diffstat (limited to 'src')
-rwxr-xr-xsrc/include/myalign32.h12
-rw-r--r--src/libtools/libc_net32.c70
-rw-r--r--src/wrapped32/generated/functions_list.txt13
-rw-r--r--src/wrapped32/generated/wrappedlibctypes32.h6
-rw-r--r--src/wrapped32/generated/wrapper32.c14
-rw-r--r--src/wrapped32/generated/wrapper32.h7
-rwxr-xr-xsrc/wrapped32/wrappedlibc_private.h34
-rw-r--r--src/wrapped32/wrappedlibresolv_private.h4
8 files changed, 141 insertions, 19 deletions
diff --git a/src/include/myalign32.h b/src/include/myalign32.h
index 3f4ae6a5..d363ff4a 100755
--- a/src/include/myalign32.h
+++ b/src/include/myalign32.h
@@ -493,6 +493,13 @@ struct i386_hostent {
     ptr_t  h_addr_list;// char **
 };
 
+struct i386_servent {
+    ptr_t  s_name;     // char  *
+    ptr_t  s_aliases;  // char **
+    int    s_port;
+    ptr_t  s_proto;     // char *
+};
+
 struct i386_iovec
 {
   ptr_t     iov_base; // void *
@@ -510,6 +517,11 @@ struct i386_msghdr
   int msg_flags;
 } __attribute__((packed, aligned(4)));
 
+struct i386_mmsghdr {
+    struct i386_msghdr msg_hdr;
+    unsigned int       msg_len;
+};
+
 struct i386_cmsghdr
 {
   ulong_t cmsg_len;
diff --git a/src/libtools/libc_net32.c b/src/libtools/libc_net32.c
index 0b6ae083..3ad95202 100644
--- a/src/libtools/libc_net32.c
+++ b/src/libtools/libc_net32.c
@@ -60,6 +60,50 @@ EXPORT ssize_t my32_sendmsg(x64emu_t* emu, int socket, struct i386_msghdr* msg,
     return ret;
 }
 
+EXPORT int my32_recvmmsg(x64emu_t* emu, int socket, struct i386_mmsghdr* msgs, uint32_t vlen, uint32_t flags, void* timeout)
+{
+    struct mmsghdr m[vlen];
+    uint32_t iovlen = 0;
+    size_t ctrlen = 0;
+    for(uint32_t i=0; i<vlen; ++i) {
+        if(msgs[i].msg_hdr.msg_iovlen>iovlen) iovlen = msgs[i].msg_hdr.msg_iovlen;
+        if(msgs[i].msg_hdr.msg_controllen>ctrlen) ctrlen = msgs[i].msg_hdr.msg_controllen;
+        m[i].msg_len = msgs[i].msg_len;
+    }
+    struct iovec iov[vlen][iovlen];
+    uint8_t buff[vlen][ctrlen+256];
+    for(uint32_t i=0; i<vlen; ++i)
+        AlignMsgHdr_32(&m[i].msg_hdr, iov[i], buff[i], &msgs[i].msg_hdr, 1);
+    int ret = recvmmsg(socket, m, vlen, flags, timeout);
+    for(uint32_t i=0; i<vlen; ++i) {
+        UnalignMsgHdr_32(&msgs[i].msg_hdr, &m[i].msg_hdr);
+        msgs[i].msg_len = m[i].msg_len;
+    }
+    return ret;
+}
+
+EXPORT int my32_sendmmsg(x64emu_t* emu, int socket, struct i386_mmsghdr* msgs, uint32_t vlen, uint32_t flags)
+{
+    struct mmsghdr m[vlen];
+    uint32_t iovlen = 0;
+    size_t ctrlen = 0;
+    for(uint32_t i=0; i<vlen; ++i) {
+        if(msgs[i].msg_hdr.msg_iovlen>iovlen) iovlen = msgs[i].msg_hdr.msg_iovlen;
+        if(msgs[i].msg_hdr.msg_controllen>ctrlen) ctrlen = msgs[i].msg_hdr.msg_controllen;
+        m[i].msg_len = msgs[i].msg_len;
+    }
+    struct iovec iov[vlen][iovlen];
+    uint8_t buff[vlen][ctrlen+256];
+    for(uint32_t i=0; i<vlen; ++i)
+        AlignMsgHdr_32(&m[i].msg_hdr, iov[i], buff[i], &msgs[i].msg_hdr, 1);
+    int ret = sendmmsg(socket, m, vlen, flags);
+    for(uint32_t i=0; i<vlen; ++i) {
+        UnalignMsgHdr_32(&msgs[i].msg_hdr, &m[i].msg_hdr);
+        msgs[i].msg_len = m[i].msg_len;
+    }
+    return ret;
+}
+
 EXPORT void* my32___cmsg_nxthdr(struct i386_msghdr* mhdr, struct i386_cmsghdr* cmsg)
 {
     // simpler to redo, also, will be used internaly
@@ -234,6 +278,32 @@ EXPORT int my32_gethostbyaddr_r(x64emu_t* emu, void* addr, uint32_t len, int typ
     return r;
 }
 
+EXPORT void* my32_getservbyname(x64emu_t* emu, void* name, void* proto)
+{
+    static struct i386_servent ret = {0};
+    static ptr_t strings[128] = {0};
+    struct servent* s = getservbyname(name, proto);
+    if(!s) return NULL;
+    // convert...
+    ret.s_name = to_cstring(s->s_name);
+    ret.s_port = s->s_port;
+    ret.s_proto = to_cstring(s->s_proto);
+    ptr_t strs = to_ptrv(&strings);
+    int idx = 0;
+    ret.s_aliases = s->s_aliases?strs:0;
+    if(s->s_aliases) {
+        char** p = s->s_aliases;
+        while(*p) {
+            strings[idx++] = to_cstring(*p);
+            ++p;
+        }
+        strings[idx++] = 0;
+    }
+    // done
+    emu->libc_herr = h_errno;
+    return &ret;
+}
+
 struct i386_ifaddrs
 {
   ptr_t     ifa_next;   // struct ifaddrs *
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt
index 0ff72fe9..520c1b21 100644
--- a/src/wrapped32/generated/functions_list.txt
+++ b/src/wrapped32/generated/functions_list.txt
@@ -1110,6 +1110,7 @@
 #() iEEiiip -> iEEiiip
 #() iEEiipV -> iEEiipV
 #() iEEipii -> iEEipii
+#() iEEipuu -> iEEipuu
 #() iEEippL -> iEEippL
 #() iEEpipp -> iEEpipp
 #() iEEpipV -> iEEpipV
@@ -1149,7 +1150,9 @@
 #() iFppiUi -> iFppiUi
 #() iFppipp -> iFppipp
 #() iFpppip -> iFpppip
+#() iEpppLi -> iEpppLi
 #() iEpppLp -> iEpppLp
+#() iFppppi -> iFppppi
 #() iFppppp -> iFppppp
 #() iFXiiii -> iFXiiii
 #() iFXiiip -> iFXiiip
@@ -1308,9 +1311,11 @@
 #() iFEXpiip -> iFEXpiip
 #() iFEXpiup -> iFEXpiup
 #() iFEXpppp -> iFEXpppp
+#() iEipipLu -> iEipipLu
 #() iFuiiuup -> iFuiiuup
 #() iFpiippp -> iFpiippp
 #() iFppiiii -> iFppiiii
+#() iFppiipi -> iFppiipi
 #() iFppuIII -> iFppuIII
 #() iFppulll -> iFppulll
 #() iFpppppp -> iFpppppp
@@ -1349,6 +1354,8 @@
 #() iFXLLLLbL_ -> iFXLLLLB
 #() iFXLbL_ipi -> iFXLBipi
 #() iFXbL_upip -> iFXBupip
+#() pEEppbL_Lp -> pEEppBLp
+#() iEEipuurLL_ -> iEEipuuB
 #() iFppbL_pbL_p -> iFppBpBp
 #() iFrpuu_Lrpuu_Lui -> iFBLBLui
 #() iFXbLip_uubLip_L -> iFXBuuBL
@@ -1857,6 +1864,7 @@ wrappedlibc:
 - pEpp:
   - __cmsg_nxthdr
   - __gmtime_r
+  - getservbyname
   - gmtime_r
   - localtime_r
 - SEpp:
@@ -1917,6 +1925,8 @@ wrappedlibc:
 - iEiiip:
 - iEiipV:
 - iEipii:
+- iEipuu:
+  - sendmmsg
 - iEippi:
   - utimensat
 - iEippL:
@@ -1952,6 +1962,9 @@ wrappedlibc:
   - getpwnam_r
 - pEpLLiN:
 - pEppLLp:
+- pEppbL_Lp:
+- iEipuurLL_:
+  - recvmmsg
 - iEpLiipp:
 - iEpLiipV:
 - iEpLiLpV:
diff --git a/src/wrapped32/generated/wrappedlibctypes32.h b/src/wrapped32/generated/wrappedlibctypes32.h
index d2bb36e1..449d737e 100644
--- a/src/wrapped32/generated/wrappedlibctypes32.h
+++ b/src/wrapped32/generated/wrappedlibctypes32.h
@@ -94,6 +94,7 @@ typedef void (*vEppiV_t)(void*, void*, int32_t, ...);
 typedef int32_t (*iEiiip_t)(int32_t, int32_t, int32_t, void*);
 typedef int32_t (*iEiipV_t)(int32_t, int32_t, void*, ...);
 typedef int32_t (*iEipii_t)(int32_t, void*, int32_t, int32_t);
+typedef int32_t (*iEipuu_t)(int32_t, void*, uint32_t, uint32_t);
 typedef int32_t (*iEippi_t)(int32_t, void*, void*, int32_t);
 typedef int32_t (*iEippL_t)(int32_t, void*, void*, uintptr_t);
 typedef int32_t (*iEpipp_t)(void*, int32_t, void*, void*);
@@ -117,6 +118,8 @@ typedef int32_t (*iEppupi_t)(void*, void*, uint32_t, void*, int32_t);
 typedef int32_t (*iEpppLp_t)(void*, void*, void*, uintptr_t, void*);
 typedef void* (*pEpLLiN_t)(void*, uintptr_t, uintptr_t, int32_t, ...);
 typedef void* (*pEppLLp_t)(void*, void*, uintptr_t, uintptr_t, void*);
+typedef void* (*pEppbL_Lp_t)(void*, void*, struct_L_t*, uintptr_t, void*);
+typedef int32_t (*iEipuurLL__t)(int32_t, void*, uint32_t, uint32_t, struct_LL_t*);
 typedef int32_t (*iEpLiipp_t)(void*, uintptr_t, int32_t, int32_t, void*, void*);
 typedef int32_t (*iEpLiipV_t)(void*, uintptr_t, int32_t, int32_t, void*, ...);
 typedef int32_t (*iEpLiLpV_t)(void*, uintptr_t, int32_t, uintptr_t, void*, ...);
@@ -185,6 +188,7 @@ typedef int32_t (*iEpLiLppp_t)(void*, uintptr_t, int32_t, uintptr_t, void*, void
 	GO(backtrace_symbols, pEpi_t) \
 	GO(__cmsg_nxthdr, pEpp_t) \
 	GO(__gmtime_r, pEpp_t) \
+	GO(getservbyname, pEpp_t) \
 	GO(gmtime_r, pEpp_t) \
 	GO(localtime_r, pEpp_t) \
 	GO(vsyslog, vEipp_t) \
@@ -208,6 +212,7 @@ typedef int32_t (*iEpLiLppp_t)(void*, uintptr_t, int32_t, uintptr_t, void*, void
 	GO(wcstoul, LEpBp_i_t) \
 	GO(__vsyslog_chk, vEiipp_t) \
 	GO(__syslog_chk, vEiipV_t) \
+	GO(sendmmsg, iEipuu_t) \
 	GO(utimensat, iEippi_t) \
 	GO(readlinkat, iEippL_t) \
 	GO(getaddrinfo, iEpppp_t) \
@@ -220,6 +225,7 @@ typedef int32_t (*iEpLiLppp_t)(void*, uintptr_t, int32_t, uintptr_t, void*, void
 	GO(regexec, iEppupi_t) \
 	GO(getgrnam_r, iEpppLp_t) \
 	GO(getpwnam_r, iEpppLp_t) \
+	GO(recvmmsg, iEipuurLL__t) \
 	GO(gethostbyname_r, iFpppupp_t) \
 	GO(posix_spawn, iEpppppp_t) \
 	GO(process_vm_readv, lEipLpLL_t) \
diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c
index ba744607..320f089a 100644
--- a/src/wrapped32/generated/wrapper32.c
+++ b/src/wrapped32/generated/wrapper32.c
@@ -1201,6 +1201,7 @@ typedef void (*vFXpiiL_t)(void*, void*, int32_t, int32_t, uintptr_t);
 typedef int32_t (*iEEiiip_t)(x64emu_t*, int32_t, int32_t, int32_t, void*);
 typedef int32_t (*iEEiipV_t)(x64emu_t*, int32_t, int32_t, void*, void*);
 typedef int32_t (*iEEipii_t)(x64emu_t*, int32_t, void*, int32_t, int32_t);
+typedef int32_t (*iEEipuu_t)(x64emu_t*, int32_t, void*, uint32_t, uint32_t);
 typedef int32_t (*iEEippL_t)(x64emu_t*, int32_t, void*, void*, uintptr_t);
 typedef int32_t (*iEEpipp_t)(x64emu_t*, void*, int32_t, void*, void*);
 typedef int32_t (*iEEpipV_t)(x64emu_t*, void*, int32_t, void*, void*);
@@ -1240,7 +1241,9 @@ typedef int32_t (*iFpuipp_t)(void*, uint32_t, int32_t, void*, void*);
 typedef int32_t (*iFppiUi_t)(void*, void*, int32_t, uint64_t, int32_t);
 typedef int32_t (*iFppipp_t)(void*, void*, int32_t, void*, void*);
 typedef int32_t (*iFpppip_t)(void*, void*, void*, int32_t, void*);
+typedef int32_t (*iEpppLi_t)(void*, void*, void*, uintptr_t, int32_t);
 typedef int32_t (*iEpppLp_t)(void*, void*, void*, uintptr_t, void*);
+typedef int32_t (*iFppppi_t)(void*, void*, void*, void*, int32_t);
 typedef int32_t (*iFppppp_t)(void*, void*, void*, void*, void*);
 typedef int32_t (*iFXiiii_t)(void*, int32_t, int32_t, int32_t, int32_t);
 typedef int32_t (*iFXiiip_t)(void*, int32_t, int32_t, int32_t, void*);
@@ -1399,9 +1402,11 @@ typedef int32_t (*iFEXLpiL_t)(x64emu_t*, void*, uintptr_t, void*, int32_t, uintp
 typedef int32_t (*iFEXpiip_t)(x64emu_t*, void*, void*, int32_t, int32_t, void*);
 typedef int32_t (*iFEXpiup_t)(x64emu_t*, void*, void*, int32_t, uint32_t, void*);
 typedef int32_t (*iFEXpppp_t)(x64emu_t*, void*, void*, void*, void*, void*);
+typedef int32_t (*iEipipLu_t)(int32_t, void*, int32_t, void*, uintptr_t, uint32_t);
 typedef int32_t (*iFuiiuup_t)(uint32_t, int32_t, int32_t, uint32_t, uint32_t, void*);
 typedef int32_t (*iFpiippp_t)(void*, int32_t, int32_t, void*, void*, void*);
 typedef int32_t (*iFppiiii_t)(void*, void*, int32_t, int32_t, int32_t, int32_t);
+typedef int32_t (*iFppiipi_t)(void*, void*, int32_t, int32_t, void*, int32_t);
 typedef int32_t (*iFppuIII_t)(void*, void*, uint32_t, int64_t, int64_t, int64_t);
 typedef int32_t (*iFppulll_t)(void*, void*, uint32_t, intptr_t, intptr_t, intptr_t);
 typedef int32_t (*iFpppppp_t)(void*, void*, void*, void*, void*, void*);
@@ -1440,6 +1445,8 @@ typedef int32_t (*iFXLiiibL__t)(void*, uintptr_t, int32_t, int32_t, int32_t, str
 typedef int32_t (*iFXLLLLbL__t)(void*, uintptr_t, uintptr_t, uintptr_t, uintptr_t, struct_L_t*);
 typedef int32_t (*iFXLbL_ipi_t)(void*, uintptr_t, struct_L_t*, int32_t, void*, int32_t);
 typedef int32_t (*iFXbL_upip_t)(void*, struct_L_t*, uint32_t, void*, int32_t, void*);
+typedef void* (*pEEppbL_Lp_t)(x64emu_t*, void*, void*, struct_L_t*, uintptr_t, void*);
+typedef int32_t (*iEEipuurLL__t)(x64emu_t*, int32_t, void*, uint32_t, uint32_t, struct_LL_t*);
 typedef int32_t (*iFppbL_pbL_p_t)(void*, void*, struct_L_t*, void*, struct_L_t*, void*);
 typedef int32_t (*iFrpuu_Lrpuu_Lui_t)(struct_puu_t*, uintptr_t, struct_puu_t*, uintptr_t, uint32_t, int32_t);
 typedef int32_t (*iFXbLip_uubLip_L_t)(void*, struct_Lip_t*, uint32_t, uint32_t, struct_Lip_t*, uintptr_t);
@@ -2857,6 +2864,7 @@ void vFXpiiL_32(x64emu_t *emu, uintptr_t fcn) { vFXpiiL_t fn = (vFXpiiL_t)fcn; f
 void iEEiiip_32(x64emu_t *emu, uintptr_t fcn) { iEEiiip_t fn = (iEEiiip_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16)); emu->libc_err = errno; }
 void iEEiipV_32(x64emu_t *emu, uintptr_t fcn) { iEEiipV_t fn = (iEEiipV_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptrv(R_ESP + 16)); emu->libc_err = errno; }
 void iEEipii_32(x64emu_t *emu, uintptr_t fcn) { iEEipii_t fn = (iEEipii_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16)); emu->libc_err = errno; }
+void iEEipuu_32(x64emu_t *emu, uintptr_t fcn) { iEEipuu_t fn = (iEEipuu_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16)); emu->libc_err = errno; }
 void iEEippL_32(x64emu_t *emu, uintptr_t fcn) { iEEippL_t fn = (iEEippL_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ulong(from_ptri(ulong_t, R_ESP + 16))); emu->libc_err = errno; }
 void iEEpipp_32(x64emu_t *emu, uintptr_t fcn) { iEEpipp_t fn = (iEEpipp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16)); emu->libc_err = errno; }
 void iEEpipV_32(x64emu_t *emu, uintptr_t fcn) { iEEpipV_t fn = (iEEpipV_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptrv(R_ESP + 16)); emu->libc_err = errno; }
@@ -2896,7 +2904,9 @@ void iFpuipp_32(x64emu_t *emu, uintptr_t fcn) { iFpuipp_t fn = (iFpuipp_t)fcn; R
 void iFppiUi_32(x64emu_t *emu, uintptr_t fcn) { iFppiUi_t fn = (iFppiUi_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(uint64_t, R_ESP + 16), from_ptri(int32_t, R_ESP + 24)); }
 void iFppipp_32(x64emu_t *emu, uintptr_t fcn) { iFppipp_t fn = (iFppipp_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20)); }
 void iFpppip_32(x64emu_t *emu, uintptr_t fcn) { iFpppip_t fn = (iFpppip_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); }
+void iEpppLi_32(x64emu_t *emu, uintptr_t fcn) { iEpppLi_t fn = (iEpppLi_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptri(int32_t, R_ESP + 20)); emu->libc_err = errno; }
 void iEpppLp_32(x64emu_t *emu, uintptr_t fcn) { iEpppLp_t fn = (iEpppLp_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptriv(R_ESP + 20)); emu->libc_err = errno; }
+void iFppppi_32(x64emu_t *emu, uintptr_t fcn) { iFppppi_t fn = (iFppppi_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(int32_t, R_ESP + 20)); }
 void iFppppp_32(x64emu_t *emu, uintptr_t fcn) { iFppppp_t fn = (iFppppp_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20)); }
 void iFXiiii_32(x64emu_t *emu, uintptr_t fcn) { iFXiiii_t fn = (iFXiiii_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptri(int32_t, R_ESP + 20)); }
 void iFXiiip_32(x64emu_t *emu, uintptr_t fcn) { iFXiiip_t fn = (iFXiiip_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); }
@@ -3055,9 +3065,11 @@ void iFEXLpiL_32(x64emu_t *emu, uintptr_t fcn) { iFEXLpiL_t fn = (iFEXLpiL_t)fcn
 void iFEXpiip_32(x64emu_t *emu, uintptr_t fcn) { iFEXpiip_t fn = (iFEXpiip_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); }
 void iFEXpiup_32(x64emu_t *emu, uintptr_t fcn) { iFEXpiup_t fn = (iFEXpiup_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); }
 void iFEXpppp_32(x64emu_t *emu, uintptr_t fcn) { iFEXpppp_t fn = (iFEXpppp_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20)); }
+void iEipipLu_32(x64emu_t *emu, uintptr_t fcn) { iEipipLu_t fn = (iEipipLu_t)fcn; errno = emu->libc_err; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ulong(from_ptri(ulong_t, R_ESP + 20)), from_ptri(uint32_t, R_ESP + 24)); emu->libc_err = errno; }
 void iFuiiuup_32(x64emu_t *emu, uintptr_t fcn) { iFuiiuup_t fn = (iFuiiuup_t)fcn; R_EAX = fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20), from_ptriv(R_ESP + 24)); }
 void iFpiippp_32(x64emu_t *emu, uintptr_t fcn) { iFpiippp_t fn = (iFpiippp_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20), from_ptriv(R_ESP + 24)); }
 void iFppiiii_32(x64emu_t *emu, uintptr_t fcn) { iFppiiii_t fn = (iFppiiii_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptri(int32_t, R_ESP + 24)); }
+void iFppiipi_32(x64emu_t *emu, uintptr_t fcn) { iFppiipi_t fn = (iFppiipi_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20), from_ptri(int32_t, R_ESP + 24)); }
 void iFppuIII_32(x64emu_t *emu, uintptr_t fcn) { iFppuIII_t fn = (iFppuIII_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptri(int64_t, R_ESP + 16), from_ptri(int64_t, R_ESP + 24), from_ptri(int64_t, R_ESP + 32)); }
 void iFppulll_32(x64emu_t *emu, uintptr_t fcn) { iFppulll_t fn = (iFppulll_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_long(from_ptri(long_t, R_ESP + 16)), from_long(from_ptri(long_t, R_ESP + 20)), from_long(from_ptri(long_t, R_ESP + 24))); }
 void iFpppppp_32(x64emu_t *emu, uintptr_t fcn) { iFpppppp_t fn = (iFpppppp_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20), from_ptriv(R_ESP + 24)); }
@@ -3096,6 +3108,8 @@ void iFXLiiibL__32(x64emu_t *emu, uintptr_t fcn) { iFXLiiibL__t fn = (iFXLiiibL_
 void iFXLLLLbL__32(x64emu_t *emu, uintptr_t fcn) { iFXLLLLbL__t fn = (iFXLLLLbL__t)fcn; struct_L_t arg_24={0}; if (*(ptr_t*)(from_ptr((R_ESP + 24)))) from_struct_L(&arg_24, *(ptr_t*)(from_ptr((R_ESP + 24)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ulong(from_ptri(ulong_t, R_ESP + 20)), *(ptr_t*)(from_ptr((R_ESP + 24))) ? &arg_24 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 24)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 24))), &arg_24); }
 void iFXLbL_ipi_32(x64emu_t *emu, uintptr_t fcn) { iFXLbL_ipi_t fn = (iFXLbL_ipi_t)fcn; struct_L_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_L(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20), from_ptri(int32_t, R_ESP + 24)); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); }
 void iFXbL_upip_32(x64emu_t *emu, uintptr_t fcn) { iFXbL_upip_t fn = (iFXbL_upip_t)fcn; struct_L_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_L(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptri(uint32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptriv(R_ESP + 24)); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); }
+void pEEppbL_Lp_32(x64emu_t *emu, uintptr_t fcn) { pEEppbL_Lp_t fn = (pEEppbL_Lp_t)fcn; errno = emu->libc_err; struct_L_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_L(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptriv(R_ESP + 20))); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); emu->libc_err = errno; }
+void iEEipuurLL__32(x64emu_t *emu, uintptr_t fcn) { iEEipuurLL__t fn = (iEEipuurLL__t)fcn; errno = emu->libc_err; struct_LL_t arg_20={0}; if (*(ptr_t*)(from_ptr((R_ESP + 20)))) from_struct_LL(&arg_20, *(ptr_t*)(from_ptr((R_ESP + 20)))); R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), *(ptr_t*)(from_ptr((R_ESP + 20))) ? &arg_20 : NULL); emu->libc_err = errno; }
 void iFppbL_pbL_p_32(x64emu_t *emu, uintptr_t fcn) { iFppbL_pbL_p_t fn = (iFppbL_pbL_p_t)fcn; struct_L_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_L(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); struct_L_t arg_20={0}; if (*(ptr_t*)(from_ptr((R_ESP + 20)))) from_struct_L(&arg_20, *(ptr_t*)(from_ptr((R_ESP + 20)))); R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ptriv(R_ESP + 16), *(ptr_t*)(from_ptr((R_ESP + 20))) ? &arg_20 : NULL, from_ptriv(R_ESP + 24)); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); if (*(ptr_t*)(from_ptr((R_ESP + 20)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 20))), &arg_20); }
 void iFrpuu_Lrpuu_Lui_32(x64emu_t *emu, uintptr_t fcn) { iFrpuu_Lrpuu_Lui_t fn = (iFrpuu_Lrpuu_Lui_t)fcn; struct_puu_t arg_4={0}; if (*(ptr_t*)(from_ptr((R_ESP + 4)))) from_struct_puu(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); struct_puu_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_puu(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptri(uint32_t, R_ESP + 20), from_ptri(int32_t, R_ESP + 24)); }
 void iFXbLip_uubLip_L_32(x64emu_t *emu, uintptr_t fcn) { iFXbLip_uubLip_L_t fn = (iFXbLip_uubLip_L_t)fcn; struct_Lip_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_Lip(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); struct_Lip_t arg_20={0}; if (*(ptr_t*)(from_ptr((R_ESP + 20)))) from_struct_Lip(&arg_20, *(ptr_t*)(from_ptr((R_ESP + 20)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), *(ptr_t*)(from_ptr((R_ESP + 20))) ? &arg_20 : NULL, from_ulong(from_ptri(ulong_t, R_ESP + 24))); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_Lip(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); if (*(ptr_t*)(from_ptr((R_ESP + 20)))) to_struct_Lip(*(ptr_t*)(from_ptr((R_ESP + 20))), &arg_20); }
diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h
index f61fb5f5..1d0f6a1f 100644
--- a/src/wrapped32/generated/wrapper32.h
+++ b/src/wrapped32/generated/wrapper32.h
@@ -1151,6 +1151,7 @@ void vFXpiiL_32(x64emu_t *emu, uintptr_t fnc);
 void iEEiiip_32(x64emu_t *emu, uintptr_t fnc);
 void iEEiipV_32(x64emu_t *emu, uintptr_t fnc);
 void iEEipii_32(x64emu_t *emu, uintptr_t fnc);
+void iEEipuu_32(x64emu_t *emu, uintptr_t fnc);
 void iEEippL_32(x64emu_t *emu, uintptr_t fnc);
 void iEEpipp_32(x64emu_t *emu, uintptr_t fnc);
 void iEEpipV_32(x64emu_t *emu, uintptr_t fnc);
@@ -1190,7 +1191,9 @@ void iFpuipp_32(x64emu_t *emu, uintptr_t fnc);
 void iFppiUi_32(x64emu_t *emu, uintptr_t fnc);
 void iFppipp_32(x64emu_t *emu, uintptr_t fnc);
 void iFpppip_32(x64emu_t *emu, uintptr_t fnc);
+void iEpppLi_32(x64emu_t *emu, uintptr_t fnc);
 void iEpppLp_32(x64emu_t *emu, uintptr_t fnc);
+void iFppppi_32(x64emu_t *emu, uintptr_t fnc);
 void iFppppp_32(x64emu_t *emu, uintptr_t fnc);
 void iFXiiii_32(x64emu_t *emu, uintptr_t fnc);
 void iFXiiip_32(x64emu_t *emu, uintptr_t fnc);
@@ -1349,9 +1352,11 @@ void iFEXLpiL_32(x64emu_t *emu, uintptr_t fnc);
 void iFEXpiip_32(x64emu_t *emu, uintptr_t fnc);
 void iFEXpiup_32(x64emu_t *emu, uintptr_t fnc);
 void iFEXpppp_32(x64emu_t *emu, uintptr_t fnc);
+void iEipipLu_32(x64emu_t *emu, uintptr_t fnc);
 void iFuiiuup_32(x64emu_t *emu, uintptr_t fnc);
 void iFpiippp_32(x64emu_t *emu, uintptr_t fnc);
 void iFppiiii_32(x64emu_t *emu, uintptr_t fnc);
+void iFppiipi_32(x64emu_t *emu, uintptr_t fnc);
 void iFppuIII_32(x64emu_t *emu, uintptr_t fnc);
 void iFppulll_32(x64emu_t *emu, uintptr_t fnc);
 void iFpppppp_32(x64emu_t *emu, uintptr_t fnc);
@@ -1390,6 +1395,8 @@ void iFXLiiibL__32(x64emu_t *emu, uintptr_t fnc);
 void iFXLLLLbL__32(x64emu_t *emu, uintptr_t fnc);
 void iFXLbL_ipi_32(x64emu_t *emu, uintptr_t fnc);
 void iFXbL_upip_32(x64emu_t *emu, uintptr_t fnc);
+void pEEppbL_Lp_32(x64emu_t *emu, uintptr_t fnc);
+void iEEipuurLL__32(x64emu_t *emu, uintptr_t fnc);
 void iFppbL_pbL_p_32(x64emu_t *emu, uintptr_t fnc);
 void iFrpuu_Lrpuu_Lui_32(x64emu_t *emu, uintptr_t fnc);
 void iFXbLip_uubLip_L_32(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h
index bf3b6f3c..d3b78680 100755
--- a/src/wrapped32/wrappedlibc_private.h
+++ b/src/wrapped32/wrappedlibc_private.h
@@ -360,7 +360,7 @@ GOW(finitef, iEf)
 // finitel  // Weak
 // __finitel
 // __flbf
-//GO(flistxattr, iEipu)
+GO(flistxattr, iEipL)
 GOW(flock, iEii)
 GOW(flockfile, vFS)
 GOW(_flushlbf, vEv)
@@ -583,7 +583,7 @@ GOW(getrusage, iEiBLLLLLLLLLLLLLLLLLL_)
 //GOW(gets, pEp)
 // __gets_chk
 // getsecretkey
-//GO(getservbyname, pEpp)
+GOM(getservbyname, pEEpp)
 //GO(getservbyname_r, iEppppup)
 //GO(getservbyport, pEip)
 //GO(getservbyport_r, iEipppup)
@@ -667,11 +667,11 @@ GO(iconv_open, pEpp)
 //GO(if_freenameindex, vEp)
 //GO(if_indextoname, pEup)
 //GO(if_nameindex, pEv)
-//GO(if_nametoindex, uEp)
+GO(if_nametoindex, uEp)
 // imaxabs  // Weak
 GOWS(imaxdiv, pEpII) //%%
 DATA(in6addr_any, 16)  // type R
-//DATA(in6addr_loopback, 16) // type R
+DATA(in6addr_loopback, 16) // type R
 // inb  // Weak
 //GOW(index, pEpi)
 // inet6_opt_append
@@ -995,8 +995,8 @@ GOW(ldexpl, DFDi)
 GOW2(ldexpl, KFKi, ldexp)
 #endif
 GOS(ldiv, pEEpii)               //%% return a struct, so address of stuct is on the stack, as a shadow 1st element
-//GOM(lfind, pEEpppLp)            //%%
-//GO(lgetxattr, iEpppu)
+GOM(lfind, pEEppbL_Lp)            //%%
+GO(lgetxattr, iEpppL)
 GOM(__libc_alloca_cutoff, iEEL) //%%
 // __libc_allocate_rtsig
 // __libc_allocate_rtsig_private
@@ -1037,10 +1037,10 @@ GO2(__libc_sigaction, iEEipp, my32_sigaction) //%%
 GOW(link, iEpp)
 //GO(linkat, iEipipi)
 GOW(listen, iEii)
-//GO(listxattr, iEppu)
+GO(listxattr, iEppL)
 // llabs
 // lldiv
-//GO(llistxattr, iEppu)
+GO(llistxattr, iEppL)
 // llseek   // Weak
 // loc1 // type B
 // loc2 // type B
@@ -1056,11 +1056,11 @@ GOM(__longjmp_chk, vEEpi)   //%%
 GO(lrand48, lEv)
 // lrand48_r
 //GO(lremovexattr, iEpp)
-//GOM(lsearch, pEEpppLp)      //%%
+GOM(lsearch, pEEppbL_Lp)      //%%
 GOW(lseek, lEili)
 // __lseek  // Weak
 GOW(lseek64, IEiIi)
-//GO(lsetxattr, iEpppui)
+GO(lsetxattr, iEpppLi)
 //GO(lutimes, iEpp)
 GOM(__lxstat, iEEipp)       //%%
 GOM(__lxstat64, iEEipp)     //%%
@@ -1380,7 +1380,7 @@ GO(recv, lEipLi)
 GO(__recv_chk, iEipLLi)
 GOW(recvfrom, lEipLipp)
 // __recvfrom_chk
-//GOM(recvmmsg, iEEipuup)    //%% actual recvmmsg is glibc 2.12+. The syscall is Linux 2.6.33+, so use syscall...
+GOM(recvmmsg, iEEipuurLL_)
 GOWM(recvmsg, lEEipi)
 // re_exec  // Weak
 GOWM(regcomp, iEEppi)
@@ -1408,8 +1408,8 @@ GOW(re_set_syntax, LEL)
 GO(__res_iclose, vEpi)
 GO(__res_init, iEv)
 //GO(__res_maybe_init, iEpi)
-//GO(__res_nclose, vEp)
-//GO(__res_ninit, iEp)
+GO(__res_nclose, vEp)
+GO(__res_ninit, iEp)
 //DATA(__resp, 4)
 // __res_randomid
 GOM(__res_state, pEEv)
@@ -1480,7 +1480,7 @@ GOW(send, lEipLi)
 GO(sendfile, lEiibl_L)
 GO(sendfile64, lEiipL)
 GOWM(sendmsg, lEEipi)
-//GOM(__sendmmsg, iEEipuu)    //%% actual __sendmmsg is glibc 2.14+. The syscall is Linux 3.0+, so use syscall...
+GOM(sendmmsg, iEEipuu)
 GOW(sendto, lEipLipu)
 // setaliasent
 GOW(setbuf, vESp)
@@ -1540,7 +1540,7 @@ GOW(setuid, iEu)
 GOW(setutent, vEv)
 // setutxent
 GOW(setvbuf, iESpiL)
-//GO(setxattr, iEpppui)
+GO(setxattr, iEpppLi)
 // sgetspent
 // sgetspent_r  // Weak
 GOWM(shmat, pEEipi)
@@ -1596,7 +1596,7 @@ GOM(__snprintf_chk, iEEpLiipV) //%%
 // sockatmark
 GOW(socket, iEiii)
 GOW(socketpair, iEiiip)
-//GO(splice, iEipipuu)
+GO(splice, iEipipLu)
 GOM(sprintf, iEEppV) //%%
 GOM(__sprintf_chk, iEEpiipV) //%%
 // sprofil  // Weak
@@ -1813,7 +1813,7 @@ GO(tcsetpgrp, iEii)
 // tee
 //GO(telldir, iEp)
 GO(tempnam, pEpp)
-//GOW(textdomain, pEp)
+GOW(textdomain, tEp)
 // tfind    // Weak
 GO(time, LEBL_)
 GO(timegm, LEriiiiiiiiilt_)
diff --git a/src/wrapped32/wrappedlibresolv_private.h b/src/wrapped32/wrappedlibresolv_private.h
index e5041815..a546082c 100644
--- a/src/wrapped32/wrappedlibresolv_private.h
+++ b/src/wrapped32/wrappedlibresolv_private.h
@@ -6,7 +6,7 @@
 //GO(__b64_pton, iFppL)
 //GO(__dn_comp, iFppipp)
 //GO(__dn_count_labels, iFp)
-//GO(__dn_expand, iFppppi)
+GO(__dn_expand, iFppppi)
 //GOW(dn_expand, iFppppi)
 //GO(__dn_skipname, iFpp)
 //GO(__fp_nquery, vFpiS)
@@ -85,7 +85,7 @@
 //GOW(res_mkquery, iFipiipippi)
 //GO(__res_nameinquery, iFpiipp)
 //GO(__res_nmkquery, 
-//GO(__res_nquery, iFppiipi)
+GO(__res_nquery, iFppiipi)
 //GO(__res_nquerydomain, 
 //GO(__res_nsearch, iFppiipi)
 //GO(__res_nsend,