cleanup types stuff in headers, fix missing u_int*_t in sys/types.h
[musl] / src / network / sendmsg.c
index ea2fe48..047c0ef 100644 (file)
@@ -1,14 +1,21 @@
 #include <sys/socket.h>
+#include <limits.h>
 #include "syscall.h"
-#include "socketcall.h"
 #include "libc.h"
 
 ssize_t sendmsg(int fd, const struct msghdr *msg, int flags)
 {
-       unsigned long args[] = { fd, (unsigned long)msg, flags };
        ssize_t r;
+#if LONG_MAX > INT_MAX
+       struct msghdr h;
+       if (msg) {
+               h = *msg;
+               h.__pad1 = h.__pad2 = 0;
+               msg = &h;
+       }
+#endif
        CANCELPT_BEGIN;
-       r = syscall2(__NR_socketcall, SYS_SENDMSG, (long)args);
+       r = socketcall(sendmsg, fd, msg, flags, 0, 0, 0);
        CANCELPT_END;
        return r;
 }