Hi!
Would it be possible to change
--- linux/include/linux/socket.h.jj Tue Sep 26 12:09:51 2000
+++ linux/include/linux/socket.h Mon Oct 2 11:10:15 2000
@@ -47,7 +47,11 @@ struct msghdr {
*/
struct cmsghdr {
+#if defined(__alpha__)
__kernel_size_t cmsg_len; /* data byte count, including hdr */
+#else
+ unsigned int cmsg_len; /* socklen_t everywhere but on Alpha */
+#endif
int cmsg_level; /* originating protocol */
int cmsg_type; /* protocol-specific type */
};
and kill a lot of cmsg32 translation stuff from sys_sparc32.c and
sys_ia32.c?
E.g. Solaris defines cmsg_len as socklen_t and even Linux man page for
recvmsg defines it that way as well.
Sparc 64bit userland can definitely survive that change, I don't know if
ia64 can change it as well (and recompile everything), but as I think
everyone will have to recompile everything for glibc 2.2 anyway...
Below is an excerpt from my mail to libc-hacker:
> The problem is slightly different - it is in the cmsghdr structure
> definition in the Linux kernel and SPARC 32<->64bit translation layer.
> cmsghdr is defined as size_t; int; int while on e.g. on Solaris it is
> socklen_t; int; int which would simplify things a lot (because unlike size_t
> socklen_t does not differ between 64bit kernel and 32bit userland).
> The 32<->64bit translation layer (sys_sparc32.c) unfortunately unless it
> wants to suck really badly has to do the uint64_t;int;int ->
> uint32_t;int;int cmsghdr translation in userland and at the moment it does
> so in situ.
> So, I think we basically have 3 options:
> - hack around it in H.J's patch so that we always give some space in the
> msg_control buffer (other places in glibc use stuff like CMSG_SPACE() to
> calculate msg_controllen for recvmsg and they always seem to give space for
> the in situ translation).
> - hack the sys32_recvmsg translation so that it does not do the 32<->64bit
> msg_control translation in situ, but instead e.g. allocates a msg_controllen
> * 1.5 area off the userland %sp (and decrements it temporarily).
> - change cmsghdr definition at least on sparc64 (maybe ia64, mips64, k8) to
> socklen_t and kill all the ugly translation.
Jakub
|