CMSG_DATA() 32/64 bit binary incompatibility
John
jwd at bsdwins.com
Mon Oct 10 19:18:42 PDT 2005
Hi folks,
I'd like some opinions.
The CMSG_DATA() definition in sys/socket.h returns different
values when compiled for 32 bit (address + offset 12), or 64 bit
(address + offset 16).
A 32 bit application copied over to a 64 bit system which uses
ipc SCM_RIGHTS does not work. An application compiled on a 64 bit
systems with -m32 -B/usr/lib32 options to produce a 32 bit binary
does not work either. Compiled as a 64 bit application it works
of course.
The documentation element of struct cmsghdr (cmsg_data) is
documented as being type u_char. However, the alignment provided
by the _ALIGN() macro is based on 'long', which varies depending
on the compilation target (32 or 64 bit).
Within the kernel, there is currently no distinction between
a 32 bit app with 32 bit alignment, or a 64 bit app with 64 bit
alignment (uipc_usrreg.c:unp_internalize()).
And thus the opinion request. Should the macro definition
be fixed? Should the kernel be able to distinquish between a 32
bit or 64 bit application?
Thoughts?
John
More information about the freebsd-amd64
mailing list