From ad0fab44e2a20be7dd0f2fdc6e1aba86a530443a Mon Sep 17 00:00:00 2001 From: Hajimu UMEMOTO Date: Fri, 3 Jun 2005 03:32:06 +0000 Subject: [PATCH] - Remove padding for ABI compatibility of n_net member from struct netent. - Change 1st argument of getnetbyaddr() to an uint32_t on 64 bit arch as well to confirm to POSIX-2001. These changes break ABI compatibility on 64 bit arch. There is similar padding issue for ai_addrlen of struct addrinfo. However, it is leaved as is for now. Discussed on: arch@, standards@ and current@ X-MFC after: never --- include/netdb.h | 21 --------------------- lib/libc/net/getnetbydns.c | 6 ------ lib/libc/net/getnetbyht.c | 3 --- lib/libc/net/getnetbynis.c | 3 --- lib/libc/net/getnetnamadr.c | 6 +----- 5 files changed, 1 insertion(+), 38 deletions(-) diff --git a/include/netdb.h b/include/netdb.h index 8c57ebfb8a3b..f003c2590462 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -105,28 +105,11 @@ struct hostent { #define h_addr h_addr_list[0] /* address, for backward compatibility */ }; -/* - * Note: n_net used to be an unsigned long integer. - * In XNS5, and subsequently in POSIX-2001 it was changed to an - * uint32_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 netent { char *n_name; /* official name of net */ char **n_aliases; /* alias list */ int n_addrtype; /* net address type */ -#if __LONG_BIT == 64 && _BYTE_ORDER == _BIG_ENDIAN - uint32_t __n_pad0; /* ABI compatibility */ -#endif uint32_t n_net; /* network # */ -#if __LONG_BIT == 64 && _BYTE_ORDER == _LITTLE_ENDIAN - uint32_t __n_pad0; /* ABI compatibility */ -#endif }; struct servent { @@ -262,11 +245,7 @@ struct hostent *gethostbyname2(const char *, int); struct hostent *gethostent(void); struct hostent *getipnodebyaddr(const void *, size_t, int, int *); struct hostent *getipnodebyname(const char *, int, int, int *); -#if __LONG_BIT == 64 -struct netent *getnetbyaddr(unsigned long, int); /* ABI compatibility */ -#else struct netent *getnetbyaddr(uint32_t, int); -#endif struct netent *getnetbyname(const char *); struct netent *getnetent(void); int getnetgrent(char **, char **, char **); diff --git a/lib/libc/net/getnetbydns.c b/lib/libc/net/getnetbydns.c index 5eca2685cefa..7dbb725c1617 100644 --- a/lib/libc/net/getnetbydns.c +++ b/lib/libc/net/getnetbydns.c @@ -259,9 +259,6 @@ getnetanswer(querybuf *answer, int anslen, int net_i, struct netent *ne, break; } ne->n_aliases++; -#if __LONG_BIT == 64 - ne->__n_pad0 = 0; /* ABI compatibility */ -#endif return 0; } h_errno = TRY_AGAIN; @@ -334,9 +331,6 @@ _dns_getnetbyaddr(void *rval, void *cb_data, va_list ap) while ((net & 0xff) == 0 && net != 0) net >>= 8; ne->n_net = net; -#if __LONG_BIT == 64 - ne->__n_pad0 = 0; /* ABI compatibility */ -#endif return NS_SUCCESS; } return NS_NOTFOUND; diff --git a/lib/libc/net/getnetbyht.c b/lib/libc/net/getnetbyht.c index f4dcd98a424a..4696b1a0ee6f 100644 --- a/lib/libc/net/getnetbyht.c +++ b/lib/libc/net/getnetbyht.c @@ -122,9 +122,6 @@ getnetent_r(struct netent *ne, struct netent_data *ned) if (p != NULL) *p++ = '\0'; ne->n_net = inet_network(cp); -#if __LONG_BIT == 64 - ne->__n_pad0 = 0; /* ABI compatibility */ -#endif ne->n_addrtype = AF_INET; q = ne->n_aliases = ned->net_aliases; if (p != NULL) { diff --git a/lib/libc/net/getnetbynis.c b/lib/libc/net/getnetbynis.c index 70785ac5bd5e..200e7a4e269b 100644 --- a/lib/libc/net/getnetbynis.c +++ b/lib/libc/net/getnetbynis.c @@ -99,9 +99,6 @@ _getnetbynis(const char *name, char *map, int af, struct netent *ne, cp++; ne->n_net = inet_network(cp); -#if __LONG_BIT == 64 - ne->__n_pad0 = 0; /* ABI compatibility */ -#endif ne->n_addrtype = AF_INET; q = ne->n_aliases = ned->net_aliases; diff --git a/lib/libc/net/getnetnamadr.c b/lib/libc/net/getnetnamadr.c index eb8c9ae69538..ef982bc4d03d 100644 --- a/lib/libc/net/getnetnamadr.c +++ b/lib/libc/net/getnetnamadr.c @@ -165,17 +165,13 @@ getnetbyname(const char *name) } struct netent * -#if __LONG_BIT == 64 -getnetbyaddr(u_long addr, int af) /* ABI compatibility */ -#else getnetbyaddr(uint32_t addr, int af) -#endif { struct netdata *nd; if ((nd = __netdata_init()) == NULL) return NULL; - if (getnetbyaddr_r((uint32_t)addr, af, &nd->net, &nd->data) != 0) + if (getnetbyaddr_r(addr, af, &nd->net, &nd->data) != 0) return NULL; return &nd->net; }