Date: Sat, 28 May 2005 03:30:02 +0900 From: Hajimu UMEMOTO <ume@FreeBSD.org> To: Warner Losh <imp@bsdimp.com>, nectar@FreeBSD.org, des@FreeBSD.org Cc: standards@FreeBSD.org, current@FreeBSD.org, freebsd-arch@FreeBSD.org Subject: Re: [CFR] correct type of addrinfo.ai_addrlen and netent.n_net Message-ID: <yge3bs8ttcl.wl%ume@mahoroba.org> In-Reply-To: <20050509.104234.71141880.imp@bsdimp.com> References: <ygemzrcgnej.wl%ume@mahoroba.org> <200505041529.36826.peter@wemm.org> <ygell6ojsef.wl%ume@mahoroba.org> <20050509.104234.71141880.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--Multipart_Sat_May_28_03:30:02_2005-1 Content-Type: text/plain; charset=US-ASCII Hi, >>>>> On Mon, 09 May 2005 10:42:34 -0600 (MDT) >>>>> Warner Losh <imp@bsdimp.com> said: > Are you suggest when to remove padding? Since the major of libc was > bumped already in 6-CURRENT, it may better to wait 7-CURRENT. imp> We've generally not worried compatibility in the 'rough and tumble' imp> world of FreeBSD current. So unless there's a problem in the upgrade imp> path, I think that we safely omit them. I'll commit the attached change to nuke padding. It will break ABI compatibility on 64 bit arch. So, I'm planning bumping major of affected shlibs. Please review it. Sincerely, --Multipart_Sat_May_28_03:30:02_2005-1 Content-Type: text/x-patch; charset=US-ASCII Content-Disposition: attachment; filename="netdb.h-padding-nuke.diff" Content-Transfer-Encoding: 7bit Index: include/netdb.h diff -u include/netdb.h.orig include/netdb.h --- include/netdb.h.orig Sat May 28 01:20:40 2005 +++ include/netdb.h Sat May 28 01:31:52 2005 @@ -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; @@ -105,28 +103,11 @@ #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 { @@ -142,29 +123,12 @@ 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 */ @@ -262,11 +226,7 @@ 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 **); Index: kerberos5/lib/Makefile.inc diff -u kerberos5/lib/Makefile.inc.orig kerberos5/lib/Makefile.inc --- kerberos5/lib/Makefile.inc.orig Sat Oct 25 18:24:54 2003 +++ kerberos5/lib/Makefile.inc Sat May 28 01:49:00 2005 @@ -1,5 +1,5 @@ # $FreeBSD: src/kerberos5/lib/Makefile.inc,v 1.6 2003/10/09 19:48:45 nectar Exp $ -SHLIB_MAJOR?= 7 +SHLIB_MAJOR?= 8 .include "../Makefile.inc" Index: lib/libbsnmp/Makefile.inc diff -u lib/libbsnmp/Makefile.inc.orig lib/libbsnmp/Makefile.inc --- lib/libbsnmp/Makefile.inc.orig Mon Oct 25 00:32:30 2004 +++ lib/libbsnmp/Makefile.inc Sat May 28 01:39:39 2005 @@ -1,6 +1,6 @@ # $FreeBSD: src/lib/libbsnmp/Makefile.inc,v 1.5 2004/10/24 15:32:30 ru Exp $ -SHLIB_MAJOR= 2 +SHLIB_MAJOR= 3 WARNS?= 6 NO_WERROR= INCSDIR= ${INCLUDEDIR}/bsnmp Index: lib/libc/net/getaddrinfo.c diff -u -p lib/libc/net/getaddrinfo.c.orig lib/libc/net/getaddrinfo.c --- lib/libc/net/getaddrinfo.c.orig Sat May 28 01:38:16 2005 +++ lib/libc/net/getaddrinfo.c Sat May 28 01:33:09 2005 @@ -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 Index: lib/libc/net/getnetbydns.c diff -u -p lib/libc/net/getnetbydns.c.orig lib/libc/net/getnetbydns.c --- lib/libc/net/getnetbydns.c.orig Sat May 28 01:24:33 2005 +++ lib/libc/net/getnetbydns.c Sat May 28 01:36:52 2005 @@ -259,9 +259,6 @@ getnetanswer(querybuf *answer, int ansle 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_d 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; Index: lib/libc/net/getnetbyht.c diff -u -p lib/libc/net/getnetbyht.c.orig lib/libc/net/getnetbyht.c --- lib/libc/net/getnetbyht.c.orig Sat May 28 01:24:33 2005 +++ lib/libc/net/getnetbyht.c Sat May 28 01:37:13 2005 @@ -122,9 +122,6 @@ again: 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) { Index: lib/libc/net/getnetbynis.c diff -u -p lib/libc/net/getnetbynis.c.orig lib/libc/net/getnetbynis.c --- lib/libc/net/getnetbynis.c.orig Sat May 28 01:24:33 2005 +++ lib/libc/net/getnetbynis.c Sat May 28 01:37:35 2005 @@ -99,9 +99,6 @@ _getnetbynis(const char *name, char *map 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; Index: lib/libc/net/getnetnamadr.c diff -u -p lib/libc/net/getnetnamadr.c.orig lib/libc/net/getnetnamadr.c --- lib/libc/net/getnetnamadr.c.orig Sat May 28 01:35:00 2005 +++ lib/libc/net/getnetnamadr.c Sat May 28 01:35:32 2005 @@ -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; } Index: lib/libfetch/Makefile diff -u lib/libfetch/Makefile.orig lib/libfetch/Makefile --- lib/libfetch/Makefile.orig Thu Jan 27 16:57:04 2005 +++ lib/libfetch/Makefile Sat May 28 01:41:14 2005 @@ -18,7 +18,7 @@ CSTD?= c99 WARNS?= 2 -SHLIB_MAJOR= 3 +SHLIB_MAJOR= 4 ftperr.h: ftp.errors @echo "static struct fetcherr _ftp_errlist[] = {" > ${.TARGET} Index: lib/libftpio/Makefile diff -u lib/libftpio/Makefile.orig lib/libftpio/Makefile --- lib/libftpio/Makefile.orig Sat Oct 25 18:25:46 2003 +++ lib/libftpio/Makefile Sat May 28 01:42:31 2005 @@ -1,7 +1,7 @@ # $FreeBSD: src/lib/libftpio/Makefile,v 1.13 2002/09/28 00:25:29 peter Exp $ LIB= ftpio -SHLIB_MAJOR= 5 +SHLIB_MAJOR= 6 SRCS= ftpio.c ftperr.c INCS= ftpio.h Index: lib/libipsec/Makefile diff -u lib/libipsec/Makefile.orig lib/libipsec/Makefile --- lib/libipsec/Makefile.orig Thu Jan 27 16:57:05 2005 +++ lib/libipsec/Makefile Sat May 28 01:42:52 2005 @@ -29,7 +29,7 @@ LIB= ipsec SHLIBDIR?= /lib -SHLIB_MAJOR= 1 +SHLIB_MAJOR= 2 CFLAGS+=-I. -I${.CURDIR} CFLAGS+=-DIPSEC_DEBUG -DIPSEC .if !defined(NO_INET6) Index: lib/libpam/Makefile.inc diff -u lib/libpam/Makefile.inc.orig lib/libpam/Makefile.inc --- lib/libpam/Makefile.inc.orig Sat May 28 01:45:39 2005 +++ lib/libpam/Makefile.inc Sat May 28 01:45:57 2005 @@ -28,4 +28,4 @@ DEBUG_FLAGS+= -DDEBUG .endif -SHLIB_MAJOR= 2 +SHLIB_MAJOR= 3 Index: lib/libpcap/Makefile diff -u lib/libpcap/Makefile.orig lib/libpcap/Makefile --- lib/libpcap/Makefile.orig Thu Jan 27 16:57:08 2005 +++ lib/libpcap/Makefile Sat May 28 01:43:25 2005 @@ -19,7 +19,7 @@ CFLAGS+=-DINET6 .endif -SHLIB_MAJOR=3 +SHLIB_MAJOR=4 # # Magic to grab sources out of src/contrib Index: lib/libutil/Makefile diff -u lib/libutil/Makefile.orig lib/libutil/Makefile --- lib/libutil/Makefile.orig Thu Jan 27 16:57:16 2005 +++ lib/libutil/Makefile Sat May 28 01:44:45 2005 @@ -2,7 +2,7 @@ # $FreeBSD: src/lib/libutil/Makefile,v 1.56 2004/05/24 22:19:27 pjd Exp $ LIB= util -SHLIB_MAJOR= 4 +SHLIB_MAJOR= 5 SHLIBDIR?= /lib CFLAGS+=-DLIBC_SCCS -I${.CURDIR} -I${.CURDIR}/../libc/gen/ CFLAGS+=-DINET6 Index: lib/libwrap/Makefile diff -u lib/libwrap/Makefile.orig lib/libwrap/Makefile --- lib/libwrap/Makefile.orig Thu Jan 27 16:57:16 2005 +++ lib/libwrap/Makefile Sat May 28 01:45:00 2005 @@ -3,7 +3,7 @@ # LIB= wrap -SHLIB_MAJOR= 3 +SHLIB_MAJOR= 4 INCS= tcpd.h MAN= hosts_access.3 MAN+= hosts_access.5 hosts_options.5 Index: secure/lib/libssh/Makefile diff -u secure/lib/libssh/Makefile.orig secure/lib/libssh/Makefile --- secure/lib/libssh/Makefile.orig Sat May 28 01:47:38 2005 +++ secure/lib/libssh/Makefile Sat May 28 01:47:52 2005 @@ -1,6 +1,8 @@ # $FreeBSD: src/secure/lib/libssh/Makefile,v 1.31 2004/12/21 09:33:45 ru Exp $ LIB= ssh +SHLIB_MAJOR= 3 + SRCS= acss.c authfd.c authfile.c bufaux.c buffer.c \ canohost.c channels.c cipher.c cipher-acss.c cipher-aes.c \ cipher-bf1.c cipher-ctr.c cipher-3des1.c cleanup.c \ --Multipart_Sat_May_28_03:30:02_2005-1 Content-Type: text/plain; charset=US-ASCII -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/ --Multipart_Sat_May_28_03:30:02_2005-1--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?yge3bs8ttcl.wl%ume>