In message: <201008101956.o7aju5ms044...@haluter.fromme.com>
            Oliver Fromme <o...@fromme.com> writes:
: 
: M. Warner Losh wrote:
:  > /*
:  >  * Macros to cast a struct sockaddr, or parts thereof.  struct
:  >  * sockaddr's alginment is loose to later be cast to a sockaddr_in or
:  >  * sockaddr_in6.  On architectures with strict alignment requirements,
:  >  * this leads to compiler warnings because the compiler doesn't know
:  >  * the ABI guarantees proper alignment.
:  >  */
:  > 
:  > But this leads me to think that the right fix might be:
:  > 
:  > /*
:  >  * Structure used by kernel to store most
:  >  * addresses.
:  >  */
:  > struct sockaddr {
:  >    unsigned char   sa_len;         /* total length */
:  >    sa_family_t     sa_family;      /* address family */
:  >    char            sa_data[14];    /* actually longer; address value */
:  > } __aligned(4);
:  > 
:  > since that's what the ABI defines....
: 
: Yes, that would solve most of the problems, at least the ones
: related to struct sockaddr.
: 
: Can we make that change to struct sockaddr, or does it cause
: unwanted side-effects?
: 
: I could do a full "make universe" to test it, but it would
: probably take two days on my 9-current machine.

Just do it on MIPS.

You'll find that a number of structures are potentially already
allocated with less than required alignment.  There's about a dozen
places in the tree that would start to fail if we did this, or the
stronger form of __aligned(8).  We could add that to the other
structures, but then we're breaking ABI rules, I think.

Warner
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to