about summary refs log tree commit diff
path: root/arch/x86_64/bits
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-04-08 09:24:19 -0400
committerRich Felker <dalias@aerifal.cx>2011-04-08 09:24:19 -0400
commit7168790763cdeb794df52be6e3b39fbb021c5a64 (patch)
treefa302a8cb7f16d6201db3499082cc6b70012769a /arch/x86_64/bits
parent5b8d81f706da0b7dc0abb5d0d74595d5b2f60d52 (diff)
downloadmusl-7168790763cdeb794df52be6e3b39fbb021c5a64.tar.gz
musl-7168790763cdeb794df52be6e3b39fbb021c5a64.tar.xz
musl-7168790763cdeb794df52be6e3b39fbb021c5a64.zip
workaround broken msghdr struct on 64bit linux
POSIX clearly specifies the type of msg_iovlen and msg_controllen, and
Linux ignores it and makes them both size_t instead. to work around
this we add padding (instead of just using the wrong types like glibc
does), but we also need to patch-up the struct before passing it to
the kernel in case the caller did not zero-fill it.

if i could trust the kernel to just ignore the upper 32 bits, this
would not be necessary, but i don't think it will ignore them...
Diffstat (limited to 'arch/x86_64/bits')
-rw-r--r--arch/x86_64/bits/socket.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86_64/bits/socket.h b/arch/x86_64/bits/socket.h
index b3230625..0e5ee1aa 100644
--- a/arch/x86_64/bits/socket.h
+++ b/arch/x86_64/bits/socket.h
@@ -3,9 +3,9 @@ struct msghdr
 	void *msg_name;
 	socklen_t msg_namelen;
 	struct iovec *msg_iov;
-	int msg_iovlen;
+	int msg_iovlen, __pad1;
 	void *msg_control;
-	socklen_t msg_controllen;
+	socklen_t msg_controllen, __pad2;
 	int msg_flags;
 };