Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src struct netnet.n_net used to be an unsigned long integer.



details:   https://anonhg.NetBSD.org/src/rev/b305b14a0a09
branches:  trunk
changeset: 566413:b305b14a0a09
user:      kleink <kleink%NetBSD.org@localhost>
date:      Sat May 08 18:52:15 2004 +0000

description:
struct netnet.n_net used to be an unsigned long integer.

In XNS5, and subsequently in POSIX-2001 it was changed to socklen_t.

To accomodate for this while preserving binary compatibility with the
old interface, prepend or append 32 bits of padding, depending on
the (LP64 data model) architecture's endianness.  Fixes PR
standards/21411 from Ben Harris.

This should be deleted the next time the libc major number is
incremented.

Also, update getnetbyaddr(3)'s `net' argument accordingly.

diffstat:

 include/netdb.h             |  15 ++++++++++++---
 lib/libc/net/getnetent.3    |   8 ++++----
 lib/libc/net/getnetent.c    |  10 ++++++++--
 lib/libc/net/getnetnamadr.c |  18 +++++++++++++++---
 lib/libc/shlib_version      |   3 ++-
 5 files changed, 41 insertions(+), 13 deletions(-)

diffs (180 lines):

diff -r cf864ef2d203 -r b305b14a0a09 include/netdb.h
--- a/include/netdb.h   Sat May 08 16:50:37 2004 +0000
+++ b/include/netdb.h   Sat May 08 18:52:15 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netdb.h,v 1.36 2004/04/14 04:37:59 itojun Exp $        */
+/*     $NetBSD: netdb.h,v 1.37 2004/05/08 18:52:15 kleink Exp $        */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -85,6 +85,7 @@
 #define _NETDB_H_
 
 #include <machine/ansi.h>
+#include <machine/endian_machdep.h>
 #include <sys/ansi.h>
 #include <sys/cdefs.h>
 #include <sys/featuretest.h>
@@ -135,7 +136,15 @@
        char            *n_name;        /* official name of net */
        char            **n_aliases;    /* alias list */
        int             n_addrtype;     /* net address type */
-       unsigned long   n_net;          /* network # XXX */
+#if (defined(__sparc__) && defined(_LP64)) || \
+    (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _BIG_ENDIAN))
+       int             __n_pad0;       /* ABI compatibility */
+#endif
+       uint32_t        n_net;          /* network # */
+#if defined(__alpha__) || (defined(__i386__) && defined(_LP64)) || \
+    (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _LITTLE_ENDIAN))
+       int             __n_pad0;       /* ABI compatibility */
+#endif
 };
 
 struct servent {
@@ -286,7 +295,7 @@
 struct hostent *getipnodebyname __P((const char *, int, int, int *));
 #endif
 #endif
-struct netent  *getnetbyaddr __P((unsigned long, int));
+struct netent  *getnetbyaddr __P((uint32_t, int));
 struct netent  *getnetbyname __P((const char *));
 struct netent  *getnetent __P((void));
 struct protoent        *getprotobyname __P((const char *));
diff -r cf864ef2d203 -r b305b14a0a09 lib/libc/net/getnetent.3
--- a/lib/libc/net/getnetent.3  Sat May 08 16:50:37 2004 +0000
+++ b/lib/libc/net/getnetent.3  Sat May 08 18:52:15 2004 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: getnetent.3,v 1.12 2003/08/07 16:43:08 agc Exp $
+.\"    $NetBSD: getnetent.3,v 1.13 2004/05/08 18:52:15 kleink Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)getnetent.3        8.1 (Berkeley) 6/4/93
 .\"
-.Dd January 16, 1999
+.Dd May 8, 2004
 .Dt GETNETENT 3
 .Os
 .Sh NAME
@@ -48,7 +48,7 @@
 .Ft struct netent *
 .Fn getnetbyname "const char *name"
 .Ft struct netent *
-.Fn getnetbyaddr "long net" "int type"
+.Fn getnetbyaddr "uint32_t net" "int type"
 .Fn setnetent "int stayopen"
 .Fn endnetent
 .Sh DESCRIPTION
@@ -68,7 +68,7 @@
        char            *n_name;        /* official name of net */
        char            **n_aliases;    /* alias list */
        int             n_addrtype;     /* net number type */
-       unsigned long   n_net;          /* net number */
+       uint32_t        n_net;          /* net number */
 };
 .Ed
 .Pp
diff -r cf864ef2d203 -r b305b14a0a09 lib/libc/net/getnetent.c
--- a/lib/libc/net/getnetent.c  Sat May 08 16:50:37 2004 +0000
+++ b/lib/libc/net/getnetent.c  Sat May 08 18:52:15 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getnetent.c,v 1.15 2003/08/07 16:43:08 agc Exp $       */
+/*     $NetBSD: getnetent.c,v 1.16 2004/05/08 18:52:15 kleink Exp $    */
 
 /*
  * Copyright (c) 1983, 1993
@@ -44,7 +44,7 @@
 static char sccsid[] = "@(#)getnetent.c        8.1 (Berkeley) 6/4/93";
 static char rcsid[] = "Id: getnetent.c,v 8.4 1997/06/01 20:34:37 vixie Exp ";
 #else
-__RCSID("$NetBSD: getnetent.c,v 1.15 2003/08/07 16:43:08 agc Exp $");
+__RCSID("$NetBSD: getnetent.c,v 1.16 2004/05/08 18:52:15 kleink Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -122,6 +122,12 @@
 
        if (netf == NULL && (netf = fopen(_PATH_NETWORKS, "r" )) == NULL)
                return (NULL);
+#if (defined(__sparc__) && defined(_LP64)) ||          \
+    defined(__alpha__) ||                              \
+    (defined(__i386__) && defined(_LP64)) ||           \
+    (defined(__sh__) && defined(_LP64))
+       net.__n_pad0 = 0;
+#endif
 again:
        p = fgets(line, sizeof line, netf);
        if (p == NULL)
diff -r cf864ef2d203 -r b305b14a0a09 lib/libc/net/getnetnamadr.c
--- a/lib/libc/net/getnetnamadr.c       Sat May 08 16:50:37 2004 +0000
+++ b/lib/libc/net/getnetnamadr.c       Sat May 08 18:52:15 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getnetnamadr.c,v 1.28 2004/01/29 01:39:15 lukem Exp $  */
+/*     $NetBSD: getnetnamadr.c,v 1.29 2004/05/08 18:52:15 kleink Exp $ */
 
 /* Copyright (c) 1993 Carlos Leandro and Rui Salgueiro
  *     Dep. Matematica Universidade de Coimbra, Portugal, Europe
@@ -43,7 +43,7 @@
 static char sccsid_[] = "from getnetnamadr.c   1.4 (Coimbra) 93/06/03";
 static char rcsid[] = "Id: getnetnamadr.c,v 8.8 1997/06/01 20:34:37 vixie Exp ";
 #else
-__RCSID("$NetBSD: getnetnamadr.c,v 1.28 2004/01/29 01:39:15 lukem Exp $");
+__RCSID("$NetBSD: getnetnamadr.c,v 1.29 2004/05/08 18:52:15 kleink Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -237,6 +237,12 @@
                if (strcasecmp(in, "IN-ADDR.ARPA") != 0)
                        goto next_alias;
                net_entry.n_aliases++;
+#if (defined(__sparc__) && defined(_LP64)) ||          \
+    defined(__alpha__) ||                              \
+    (defined(__i386__) && defined(_LP64)) ||           \
+    (defined(__sh__) && defined(_LP64))
+               net_entry.__n_pad0 = 0;
+#endif
                return (&net_entry);
        }
        h_errno = TRY_AGAIN;
@@ -354,7 +360,7 @@
 
 struct netent *
 getnetbyaddr(net, net_type)
-       u_long net;
+       uint32_t net;
        int net_type;
 {
        struct netent *np;
@@ -600,6 +606,12 @@
        if (p != NULL)
                *p++ = '\0';
        net_entry.n_net = inet_network(cp);
+#if (defined(__sparc__) && defined(_LP64)) ||          \
+    defined(__alpha__) ||                              \
+    (defined(__i386__) && defined(_LP64)) ||           \
+    (defined(__sh__) && defined(_LP64))
+       net_entry.__n_pad0 = 0;
+#endif
        net_entry.n_addrtype = AF_INET;
        q = net_entry.n_aliases = net_aliases;
        if (p != NULL)  {
diff -r cf864ef2d203 -r b305b14a0a09 lib/libc/shlib_version
--- a/lib/libc/shlib_version    Sat May 08 16:50:37 2004 +0000
+++ b/lib/libc/shlib_version    Sat May 08 18:52:15 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: shlib_version,v 1.151 2004/04/28 00:11:44 kleink Exp $
+#      $NetBSD: shlib_version,v 1.152 2004/05/08 18:52:15 kleink Exp $
 #      Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
@@ -14,6 +14,7 @@
 # - libc/gen/is{inf,nan}d_ieee754.c: remove is{inf,nan} aliases
 # - libc/arch/vax/gen/is{inf,nan}.c: remove
 # - libc/db/hash/ndbm.c: remove; __ndbm13 -> ndbm
+# - libc/net/getnet{ent,namadr}.c, netdb.h: remove __n_pad0
 #
 major=12
 minor=117



Home | Main Index | Thread Index | Old Index