Remove padding for ABI compatibility of ai_addrlen member
from struct addrinfo. This change break ABI compatibility on 64 bit arch.
This commit is contained in:
parent
0bcf56e9b9
commit
72038f290e
@ -63,8 +63,6 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/_types.h>
|
||||
#include <machine/_limits.h>
|
||||
#include <machine/endian.h>
|
||||
|
||||
#ifndef _SIZE_T_DECLARED
|
||||
typedef __size_t size_t;
|
||||
@ -125,29 +123,12 @@ struct protoent {
|
||||
int p_proto; /* protocol # */
|
||||
};
|
||||
|
||||
/*
|
||||
* Note: ai_addrlen used to be a size_t, per RFC 2553.
|
||||
* In XNS5.2, and subsequently in POSIX-2001 and RFC 3493 it was
|
||||
* changed to a socklen_t.
|
||||
* To accomodate for this while preserving binary compatibility with the
|
||||
* old interface, we prepend or append 32 bits of padding, depending on
|
||||
* the (LP64) architecture's endianness.
|
||||
*
|
||||
* This should be deleted the next time the libc major number is
|
||||
* incremented.
|
||||
*/
|
||||
struct addrinfo {
|
||||
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
|
||||
int ai_family; /* PF_xxx */
|
||||
int ai_socktype; /* SOCK_xxx */
|
||||
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
|
||||
#if __LONG_BIT == 64 && _BYTE_ORDER == _BIG_ENDIAN
|
||||
uint32_t __ai_pad0; /* ABI compatibility */
|
||||
#endif
|
||||
socklen_t ai_addrlen; /* length of ai_addr */
|
||||
#if __LONG_BIT == 64 && _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
uint32_t __ai_pad0; /* ABI compatibility */
|
||||
#endif
|
||||
char *ai_canonname; /* canonical name for hostname */
|
||||
struct sockaddr *ai_addr; /* binary address */
|
||||
struct addrinfo *ai_next; /* next structure in linked list */
|
||||
|
@ -1352,9 +1352,6 @@ get_ai(pai, afd, addr)
|
||||
memset(ai->ai_addr, 0, (size_t)afd->a_socklen);
|
||||
ai->ai_addr->sa_len = afd->a_socklen;
|
||||
ai->ai_addrlen = afd->a_socklen;
|
||||
#if __LONG_BIT == 64
|
||||
ai->__ai_pad0 = 0; /* ABI compatibility */
|
||||
#endif
|
||||
ai->ai_addr->sa_family = ai->ai_family = afd->a_af;
|
||||
p = (char *)(void *)(ai->ai_addr);
|
||||
#ifdef FAITH
|
||||
|
Loading…
x
Reference in New Issue
Block a user