svn commit: trunk/uClibc/libc/sysdeps/linux: common/bits mips/bits
andersen at uclibc.org
andersen at uclibc.org
Sat Nov 4 18:33:05 UTC 2006
Author: andersen
Date: 2006-11-04 10:33:04 -0800 (Sat, 04 Nov 2006)
New Revision: 16494
Log:
based on a patch from Atsushi Nemoto:
There is a mismatch of struct msghdr between the kernel and libc.
In a 64-bit environment, the size of msg_namelen is 4 for all, but
the size of msg_iovlen and msg_controllen is 8 bytes for the kernel
and for glibc, but 4 bytes for uClibc. Fix size for the 64bit case.
Modified:
trunk/uClibc/libc/sysdeps/linux/common/bits/socket.h
trunk/uClibc/libc/sysdeps/linux/mips/bits/socket.h
Changeset:
Modified: trunk/uClibc/libc/sysdeps/linux/common/bits/socket.h
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/bits/socket.h 2006-11-03 18:55:00 UTC (rev 16493)
+++ trunk/uClibc/libc/sysdeps/linux/common/bits/socket.h 2006-11-04 18:33:04 UTC (rev 16494)
@@ -215,16 +215,26 @@
/* Note: do not change these members to match glibc; these match the
SuSv3 spec already (e.g. msg_iovlen/msg_controllen).
http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html */
+/* Note: linux kernel uses __kernel_size_t (which is 8bytes on 64bit
+ platforms, and 4bytes on 32bit platforms) for msg_iovlen/msg_controllen */
struct msghdr
{
void *msg_name; /* Address to send to/receive from. */
socklen_t msg_namelen; /* Length of address data. */
struct iovec *msg_iov; /* Vector of data to send/receive into. */
+#if __WORDSIZE == 32
int msg_iovlen; /* Number of elements in the vector. */
+#else
+ size_t msg_iovlen; /* Number of elements in the vector. */
+#endif
void *msg_control; /* Ancillary data (eg BSD filedesc passing). */
+#if __WORDSIZE == 32
socklen_t msg_controllen; /* Ancillary data buffer length. */
+#else
+ size_t msg_controllen; /* Ancillary data buffer length. */
+#endif
int msg_flags; /* Flags on received message. */
};
Modified: trunk/uClibc/libc/sysdeps/linux/mips/bits/socket.h
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/mips/bits/socket.h 2006-11-03 18:55:00 UTC (rev 16493)
+++ trunk/uClibc/libc/sysdeps/linux/mips/bits/socket.h 2006-11-04 18:33:04 UTC (rev 16494)
@@ -213,16 +213,29 @@
/* Structure describing messages sent by
`sendmsg' and received by `recvmsg'. */
+/* Note: do not change these members to match glibc; these match the
+ SuSv3 spec already (e.g. msg_iovlen/msg_controllen).
+ http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html */
+/* Note: linux kernel uses __kernel_size_t (which is 8bytes on 64bit
+ platforms, and 4bytes on 32bit platforms) for msg_iovlen/msg_controllen */
struct msghdr
{
void *msg_name; /* Address to send to/receive from. */
socklen_t msg_namelen; /* Length of address data. */
struct iovec *msg_iov; /* Vector of data to send/receive into. */
+#if __WORDSIZE == 32
int msg_iovlen; /* Number of elements in the vector. */
+#else
+ size_t msg_iovlen; /* Number of elements in the vector. */
+#endif
void *msg_control; /* Ancillary data (eg BSD filedesc passing). */
+#if __WORDSIZE == 32
socklen_t msg_controllen; /* Ancillary data buffer length. */
+#else
+ size_t msg_controllen; /* Ancillary data buffer length. */
+#endif
int msg_flags; /* Flags on received message. */
};
More information about the uClibc-cvs
mailing list