From bcee06d42c20a8ea0e6c6ffb8924e16e7e793c0f Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 18 Feb 2002 20:35:27 +0000 Subject: o Move NTOHL() and associated macros into . These are deprecated in favor of the POSIX-defined lowercase variants. o Change all occurrences of NTOHL() and associated marcros in the source tree to use the lowercase function variants. o Add missing license bits to sparc64's . Approved by: jake o Clean up files. o Remove unused __uint16_swap_uint32() from i386's . o Remove prototypes for non-existent bswapXX() functions. o Include in to define the POSIX-required ntohl() family of functions. o Do similar things to expose the ntohl() family in libstand, , and . o Prepend underscores to the ntohl() family to help deal with complexities associated with having MD (asm and inline) versions, and having to prevent exposure of these functions in other headers that happen to make use of endian-specific defines. o Create weak aliases to the canonical function name to help deal with third-party software forgetting to include an appropriate header. o Remove some now unneeded pollution from . o Add missing includes in userland. Tested on: alpha, i386 Reviewed by: bde, jake, tmm --- lib/libc/alpha/net/byte_swap_2.S | 7 +++++-- lib/libc/alpha/net/byte_swap_4.S | 7 +++++-- lib/libc/alpha/net/htonl.S | 5 ++++- lib/libc/alpha/net/htons.S | 5 ++++- lib/libc/alpha/net/ntohl.S | 5 ++++- lib/libc/alpha/net/ntohs.S | 5 ++++- lib/libc/amd64/net/htonl.S | 4 +++- lib/libc/amd64/net/htons.S | 4 +++- lib/libc/amd64/net/ntohl.S | 4 +++- lib/libc/amd64/net/ntohs.S | 4 +++- lib/libc/i386/net/htonl.S | 4 +++- lib/libc/i386/net/htons.S | 4 +++- lib/libc/i386/net/ntohl.S | 4 +++- lib/libc/i386/net/ntohs.S | 4 +++- lib/libc/ia64/net/byte_swap_2.S | 5 +++-- lib/libc/ia64/net/byte_swap_4.S | 5 +++-- lib/libc/ia64/net/htonl.S | 3 ++- lib/libc/ia64/net/htons.S | 3 ++- lib/libc/ia64/net/ntohl.S | 3 ++- lib/libc/ia64/net/ntohs.S | 3 ++- lib/libc/locale/rune.c | 1 + lib/libc/net/getservent.c | 6 ++++++ lib/libc/net/ns_addr.c | 1 + lib/libc/net/ns_ntoa.c | 6 ++++++ lib/libc/rpc/auth_des.c | 1 - lib/libc/rpc/clnt_dg.c | 1 + lib/libc/rpc/clnt_vc.c | 1 + lib/libc/rpc/pmap_getmaps.c | 1 + lib/libc/rpc/pmap_getport.c | 1 + lib/libc/sparc64/net/htonl.S | 6 ++++-- lib/libc/sparc64/net/htons.S | 6 ++++-- lib/libc/sparc64/net/ntohl.S | 6 ++++-- lib/libc/sparc64/net/ntohs.S | 6 ++++-- lib/libc/xdr/xdr_stdio.c | 1 + lib/libc/yp/yplib.c | 1 + 35 files changed, 100 insertions(+), 33 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/alpha/net/byte_swap_2.S b/lib/libc/alpha/net/byte_swap_2.S index fab3c58..ebcbeda 100644 --- a/lib/libc/alpha/net/byte_swap_2.S +++ b/lib/libc/alpha/net/byte_swap_2.S @@ -25,12 +25,14 @@ * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. + * + * $FreeBSD$ */ #include -#ifndef NAME -#define NAME byte_swap_2 +#if !defined(ALIAS) || !defined(NAME) +#error ALIAS or NAME not defined #endif /* @@ -38,6 +40,7 @@ * * Argument is an unsigned 2-byte integer (u_int16_t). */ +XLEAF(ALIAS, 1) LEAF(NAME, 1) /* a0 contains 0x0123 */ extbl a0, 0, t0 /* t0 = 0x 23 */ extbl a0, 1, t1 /* t1 = 0x 01 */ diff --git a/lib/libc/alpha/net/byte_swap_4.S b/lib/libc/alpha/net/byte_swap_4.S index 8dbb83c..ddfd1e9 100644 --- a/lib/libc/alpha/net/byte_swap_4.S +++ b/lib/libc/alpha/net/byte_swap_4.S @@ -25,12 +25,14 @@ * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. + * + * $FreeBSD$ */ #include -#ifndef NAME -#define NAME byte_swap_4 +#if !defined(ALIAS) || !defined(NAME) +#error ALIAS or NAME not defined #endif /* @@ -38,6 +40,7 @@ * * Argument is an unsigned 4-byte integer (u_int32_t). */ +XLEAF(ALIAS, 1) LEAF(NAME, 1) /* a0 contains 0x01234567 */ extbl a0, 0, t0 /* t0 = 0x 67 */ extbl a0, 1, t1 /* t1 = 0x 45 */ diff --git a/lib/libc/alpha/net/htonl.S b/lib/libc/alpha/net/htonl.S index bacab1e..90d9441 100644 --- a/lib/libc/alpha/net/htonl.S +++ b/lib/libc/alpha/net/htonl.S @@ -25,8 +25,11 @@ * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. + * + * $FreeBSD$ */ -#define NAME htonl +#define ALIAS htonl +#define NAME __htonl #include "byte_swap_4.S" diff --git a/lib/libc/alpha/net/htons.S b/lib/libc/alpha/net/htons.S index fb08222..405d537 100644 --- a/lib/libc/alpha/net/htons.S +++ b/lib/libc/alpha/net/htons.S @@ -25,8 +25,11 @@ * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. + * + * $FreeBSD$ */ -#define NAME htons +#define ALIAS htons +#define NAME __htons #include "byte_swap_2.S" diff --git a/lib/libc/alpha/net/ntohl.S b/lib/libc/alpha/net/ntohl.S index b571647..54ea68d 100644 --- a/lib/libc/alpha/net/ntohl.S +++ b/lib/libc/alpha/net/ntohl.S @@ -25,8 +25,11 @@ * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. + * + * $FreeBSD$ */ -#define NAME ntohl +#define ALIAS ntohl +#define NAME __ntohl #include "byte_swap_4.S" diff --git a/lib/libc/alpha/net/ntohs.S b/lib/libc/alpha/net/ntohs.S index 6db9961..f841a7a8 100644 --- a/lib/libc/alpha/net/ntohs.S +++ b/lib/libc/alpha/net/ntohs.S @@ -25,8 +25,11 @@ * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. + * + * $FreeBSD$ */ -#define NAME ntohs +#define ALIAS ntohs +#define NAME __ntohs #include "byte_swap_2.S" diff --git a/lib/libc/amd64/net/htonl.S b/lib/libc/amd64/net/htonl.S index af3354f..6658b69 100644 --- a/lib/libc/amd64/net/htonl.S +++ b/lib/libc/amd64/net/htonl.S @@ -43,7 +43,9 @@ #include -ENTRY(htonl) + .weak CNAME(htonl) + .set CNAME(htonl),CNAME(__htonl) +ENTRY(__htonl) movl 4(%esp),%eax xchgb %al,%ah roll $16,%eax diff --git a/lib/libc/amd64/net/htons.S b/lib/libc/amd64/net/htons.S index c78b108..c354eaa 100644 --- a/lib/libc/amd64/net/htons.S +++ b/lib/libc/amd64/net/htons.S @@ -43,7 +43,9 @@ #include -ENTRY(htons) + .weak CNAME(htons) + .set CNAME(htons),CNAME(__htons) +ENTRY(__htons) movzwl 4(%esp),%eax xchgb %al,%ah ret diff --git a/lib/libc/amd64/net/ntohl.S b/lib/libc/amd64/net/ntohl.S index 3a2c202..46ff54e 100644 --- a/lib/libc/amd64/net/ntohl.S +++ b/lib/libc/amd64/net/ntohl.S @@ -43,7 +43,9 @@ #include -ENTRY(ntohl) + .weak CNAME(ntohl) + .set CNAME(ntohl),CNAME(__ntohl) +ENTRY(__ntohl) movl 4(%esp),%eax xchgb %al,%ah roll $16,%eax diff --git a/lib/libc/amd64/net/ntohs.S b/lib/libc/amd64/net/ntohs.S index 110faf7..3f0a36a 100644 --- a/lib/libc/amd64/net/ntohs.S +++ b/lib/libc/amd64/net/ntohs.S @@ -43,7 +43,9 @@ #include -ENTRY(ntohs) + .weak CNAME(ntohs) + .set CNAME(ntohs),CNAME(__ntohs) +ENTRY(__ntohs) movzwl 4(%esp),%eax xchgb %al,%ah ret diff --git a/lib/libc/i386/net/htonl.S b/lib/libc/i386/net/htonl.S index af3354f..6658b69 100644 --- a/lib/libc/i386/net/htonl.S +++ b/lib/libc/i386/net/htonl.S @@ -43,7 +43,9 @@ #include -ENTRY(htonl) + .weak CNAME(htonl) + .set CNAME(htonl),CNAME(__htonl) +ENTRY(__htonl) movl 4(%esp),%eax xchgb %al,%ah roll $16,%eax diff --git a/lib/libc/i386/net/htons.S b/lib/libc/i386/net/htons.S index c78b108..c354eaa 100644 --- a/lib/libc/i386/net/htons.S +++ b/lib/libc/i386/net/htons.S @@ -43,7 +43,9 @@ #include -ENTRY(htons) + .weak CNAME(htons) + .set CNAME(htons),CNAME(__htons) +ENTRY(__htons) movzwl 4(%esp),%eax xchgb %al,%ah ret diff --git a/lib/libc/i386/net/ntohl.S b/lib/libc/i386/net/ntohl.S index 3a2c202..46ff54e 100644 --- a/lib/libc/i386/net/ntohl.S +++ b/lib/libc/i386/net/ntohl.S @@ -43,7 +43,9 @@ #include -ENTRY(ntohl) + .weak CNAME(ntohl) + .set CNAME(ntohl),CNAME(__ntohl) +ENTRY(__ntohl) movl 4(%esp),%eax xchgb %al,%ah roll $16,%eax diff --git a/lib/libc/i386/net/ntohs.S b/lib/libc/i386/net/ntohs.S index 110faf7..3f0a36a 100644 --- a/lib/libc/i386/net/ntohs.S +++ b/lib/libc/i386/net/ntohs.S @@ -43,7 +43,9 @@ #include -ENTRY(ntohs) + .weak CNAME(ntohs) + .set CNAME(ntohs),CNAME(__ntohs) +ENTRY(__ntohs) movzwl 4(%esp),%eax xchgb %al,%ah ret diff --git a/lib/libc/ia64/net/byte_swap_2.S b/lib/libc/ia64/net/byte_swap_2.S index fbee3c8..19d0eef 100644 --- a/lib/libc/ia64/net/byte_swap_2.S +++ b/lib/libc/ia64/net/byte_swap_2.S @@ -30,8 +30,8 @@ #include -#ifndef NAME -#define NAME byte_swap_2 +#if !defined(ALIAS) || !defined(NAME) +#error ALIAS or NAME not defined #endif /* @@ -39,6 +39,7 @@ * * Argument is an unsigned 2-byte integer (u_int16_t). */ +WEAK_ALIAS(ALIAS, NAME) ENTRY(NAME, 1) mux1 r16=in0,@rev ;; diff --git a/lib/libc/ia64/net/byte_swap_4.S b/lib/libc/ia64/net/byte_swap_4.S index d183644..71019ba 100644 --- a/lib/libc/ia64/net/byte_swap_4.S +++ b/lib/libc/ia64/net/byte_swap_4.S @@ -30,8 +30,8 @@ #include -#ifndef NAME -#define NAME byte_swap_4 +#if !defined(ALIAS) || !defined(NAME) +#error ALIAS or NAME not defined #endif /* @@ -39,6 +39,7 @@ * * Argument is an unsigned 4-byte integer (u_int32_t). */ +WEAK_ALIAS(ALIAS, NAME) ENTRY(NAME, 1) mux1 r16=in0,@rev ;; diff --git a/lib/libc/ia64/net/htonl.S b/lib/libc/ia64/net/htonl.S index 20d86af..7a71a29 100644 --- a/lib/libc/ia64/net/htonl.S +++ b/lib/libc/ia64/net/htonl.S @@ -28,6 +28,7 @@ * rights to redistribute these changes. */ -#define NAME htonl +#define ALIAS htonl +#define NAME __htonl #include "byte_swap_4.S" diff --git a/lib/libc/ia64/net/htons.S b/lib/libc/ia64/net/htons.S index 5082d88..689b367 100644 --- a/lib/libc/ia64/net/htons.S +++ b/lib/libc/ia64/net/htons.S @@ -28,6 +28,7 @@ * rights to redistribute these changes. */ -#define NAME htons +#define ALIAS htons +#define NAME __htons #include "byte_swap_2.S" diff --git a/lib/libc/ia64/net/ntohl.S b/lib/libc/ia64/net/ntohl.S index 54299c4..9e2c612 100644 --- a/lib/libc/ia64/net/ntohl.S +++ b/lib/libc/ia64/net/ntohl.S @@ -28,6 +28,7 @@ * rights to redistribute these changes. */ -#define NAME ntohl +#define ALIAS ntohl +#define NAME __ntohl #include "byte_swap_4.S" diff --git a/lib/libc/ia64/net/ntohs.S b/lib/libc/ia64/net/ntohs.S index 1eec14b..16a884b 100644 --- a/lib/libc/ia64/net/ntohs.S +++ b/lib/libc/ia64/net/ntohs.S @@ -28,6 +28,7 @@ * rights to redistribute these changes. */ -#define NAME ntohs +#define ALIAS ntohs +#define NAME __ntohs #include "byte_swap_2.S" diff --git a/lib/libc/locale/rune.c b/lib/libc/locale/rune.c index f0a5490..a6b890d 100644 --- a/lib/libc/locale/rune.c +++ b/lib/libc/locale/rune.c @@ -41,6 +41,7 @@ static char sccsid[] = "@(#)rune.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include "namespace.h" +#include #include #include #include diff --git a/lib/libc/net/getservent.c b/lib/libc/net/getservent.c index cd4449f..5ffb6d2 100644 --- a/lib/libc/net/getservent.c +++ b/lib/libc/net/getservent.c @@ -31,12 +31,18 @@ * SUCH DAMAGE. */ +#if 0 #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)getservent.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ +#endif 0 + +#include +__FBSDID("$FreeBSD$"); #include #include +#include #include #include #include diff --git a/lib/libc/net/ns_addr.c b/lib/libc/net/ns_addr.c index 75449ed..e00f20d 100644 --- a/lib/libc/net/ns_addr.c +++ b/lib/libc/net/ns_addr.c @@ -41,6 +41,7 @@ static char sccsid[] = "@(#)ns_addr.c 8.1 (Berkeley) 6/7/93"; #endif /* LIBC_SCCS and not lint */ #include +#include #include #include #include diff --git a/lib/libc/net/ns_ntoa.c b/lib/libc/net/ns_ntoa.c index de5f305..6ba2caf 100644 --- a/lib/libc/net/ns_ntoa.c +++ b/lib/libc/net/ns_ntoa.c @@ -31,11 +31,17 @@ * SUCH DAMAGE. */ +#if 0 #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)ns_ntoa.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ +#endif + +#include +__FBSDID("$FreeBSD$"); #include +#include #include #include diff --git a/lib/libc/rpc/auth_des.c b/lib/libc/rpc/auth_des.c index e7aef64..6a7da3a 100644 --- a/lib/libc/rpc/auth_des.c +++ b/lib/libc/rpc/auth_des.c @@ -48,7 +48,6 @@ #include #include #include -#include /* XXX: just to get htonl() and ntohl() */ #include #undef NIS #include diff --git a/lib/libc/rpc/clnt_dg.c b/lib/libc/rpc/clnt_dg.c index 59869bf..5ca88d3 100644 --- a/lib/libc/rpc/clnt_dg.c +++ b/lib/libc/rpc/clnt_dg.c @@ -52,6 +52,7 @@ static char sccsid[] = "@(#)clnt_dg.c 1.19 89/03/16 Copyr 1988 Sun Micro"; #include #include #include +#include #include #include #include diff --git a/lib/libc/rpc/clnt_vc.c b/lib/libc/rpc/clnt_vc.c index d2d0178..b96822e 100644 --- a/lib/libc/rpc/clnt_vc.c +++ b/lib/libc/rpc/clnt_vc.c @@ -65,6 +65,7 @@ static char sccsid[] = "@(#)clnt_vc.c 1.19 89/03/16 Copyr 1988 Sun Micro"; #include #include +#include #include #include #include diff --git a/lib/libc/rpc/pmap_getmaps.c b/lib/libc/rpc/pmap_getmaps.c index 4c8397f..3fdc44f 100644 --- a/lib/libc/rpc/pmap_getmaps.c +++ b/lib/libc/rpc/pmap_getmaps.c @@ -49,6 +49,7 @@ static char *rcsid = "$FreeBSD$"; #include #include +#include #include #include diff --git a/lib/libc/rpc/pmap_getport.c b/lib/libc/rpc/pmap_getport.c index ff75c9f..02946d3 100644 --- a/lib/libc/rpc/pmap_getport.c +++ b/lib/libc/rpc/pmap_getport.c @@ -47,6 +47,7 @@ static char *rcsid = "$FreeBSD$"; #include #include +#include #include #include diff --git a/lib/libc/sparc64/net/htonl.S b/lib/libc/sparc64/net/htonl.S index c479615..c3d10e5 100644 --- a/lib/libc/sparc64/net/htonl.S +++ b/lib/libc/sparc64/net/htonl.S @@ -53,7 +53,9 @@ #endif /* SYSLIBC_RCS and not lint */ /* netorder = htonl(hostorder) */ -ENTRY(htonl) + .weak CNAME(htonl) + .set CNAME(htonl),CNAME(__htonl) +ENTRY(__htonl) retl srl %o0, 0, %o0 /* zero extend -- or do we sign extend? */ -END(htonl) +END(__htonl) diff --git a/lib/libc/sparc64/net/htons.S b/lib/libc/sparc64/net/htons.S index 70cd0cc..6f1fa70 100644 --- a/lib/libc/sparc64/net/htons.S +++ b/lib/libc/sparc64/net/htons.S @@ -53,9 +53,11 @@ #endif /* SYSLIBC_RCS and not lint */ /* netorder = htons(hostorder) */ -ENTRY(htons) + .weak CNAME(htons) + .set CNAME(htons),CNAME(__htons) +ENTRY(__htons) sethi %hi(0xffff0000), %o1 signx %o1, %o1 retl andn %o0, %o1, %o0 -END(htons) +END(__htons) diff --git a/lib/libc/sparc64/net/ntohl.S b/lib/libc/sparc64/net/ntohl.S index 3ed47ee..4a54691 100644 --- a/lib/libc/sparc64/net/ntohl.S +++ b/lib/libc/sparc64/net/ntohl.S @@ -53,7 +53,9 @@ #endif /* SYSLIBC_RCS and not lint */ /* hostorder = ntohl(netorder) */ -ENTRY(ntohl) + .weak CNAME(ntohl) + .set CNAME(ntohl),CNAME(__ntohl) +ENTRY(__ntohl) retl signx %o0, %o0 -END(ntohl) +END(__ntohl) diff --git a/lib/libc/sparc64/net/ntohs.S b/lib/libc/sparc64/net/ntohs.S index f3a5e19..1b144a9 100644 --- a/lib/libc/sparc64/net/ntohs.S +++ b/lib/libc/sparc64/net/ntohs.S @@ -53,9 +53,11 @@ #endif /* SYSLIBC_RCS and not lint */ /* hostorder = ntohs(netorder) */ -ENTRY(ntohs) + .weak CNAME(ntohs) + .set CNAME(ntohs),CNAME(__ntohs) +ENTRY(__ntohs) sethi %hi(0xffff0000), %o1 signx %o1, %o1 retl andn %o0, %o1, %o0 -END(ntohs) +END(__ntohs) diff --git a/lib/libc/xdr/xdr_stdio.c b/lib/libc/xdr/xdr_stdio.c index c4328ec..e49cb44 100644 --- a/lib/libc/xdr/xdr_stdio.c +++ b/lib/libc/xdr/xdr_stdio.c @@ -49,6 +49,7 @@ static char *rcsid = "$FreeBSD$"; #include "namespace.h" #include +#include #include #include #include "un-namespace.h" diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c index 0a4bc7e..9f9ffba 100644 --- a/lib/libc/yp/yplib.c +++ b/lib/libc/yp/yplib.c @@ -38,6 +38,7 @@ static char *rcsid = "$FreeBSD$"; #include #include #include +#include #include #include #include -- cgit v1.1