summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormike <mike@FreeBSD.org>2002-02-18 20:35:27 +0000
committermike <mike@FreeBSD.org>2002-02-18 20:35:27 +0000
commitbcee06d42c20a8ea0e6c6ffb8924e16e7e793c0f (patch)
tree970c36894ee638248ec810bd7570ac8aabb5eaf5 /lib
parentf2e166dc7a7880a8564c2a7cb8ca2b94566d8d6b (diff)
downloadFreeBSD-src-bcee06d42c20a8ea0e6c6ffb8924e16e7e793c0f.zip
FreeBSD-src-bcee06d42c20a8ea0e6c6ffb8924e16e7e793c0f.tar.gz
o Move NTOHL() and associated macros into <sys/param.h>. 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 <machine/endian.h>. Approved by: jake o Clean up <machine/endian.h> files. o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>. o Remove prototypes for non-existent bswapXX() functions. o Include <machine/endian.h> in <arpa/inet.h> to define the POSIX-required ntohl() family of functions. o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>, and <sys/param.h>. 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 <sys/types.h>. o Add missing <arpa/inet.h> includes in userland. Tested on: alpha, i386 Reviewed by: bde, jake, tmm
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/alpha/net/byte_swap_2.S7
-rw-r--r--lib/libc/alpha/net/byte_swap_4.S7
-rw-r--r--lib/libc/alpha/net/htonl.S5
-rw-r--r--lib/libc/alpha/net/htons.S5
-rw-r--r--lib/libc/alpha/net/ntohl.S5
-rw-r--r--lib/libc/alpha/net/ntohs.S5
-rw-r--r--lib/libc/amd64/net/htonl.S4
-rw-r--r--lib/libc/amd64/net/htons.S4
-rw-r--r--lib/libc/amd64/net/ntohl.S4
-rw-r--r--lib/libc/amd64/net/ntohs.S4
-rw-r--r--lib/libc/i386/net/htonl.S4
-rw-r--r--lib/libc/i386/net/htons.S4
-rw-r--r--lib/libc/i386/net/ntohl.S4
-rw-r--r--lib/libc/i386/net/ntohs.S4
-rw-r--r--lib/libc/ia64/net/byte_swap_2.S5
-rw-r--r--lib/libc/ia64/net/byte_swap_4.S5
-rw-r--r--lib/libc/ia64/net/htonl.S3
-rw-r--r--lib/libc/ia64/net/htons.S3
-rw-r--r--lib/libc/ia64/net/ntohl.S3
-rw-r--r--lib/libc/ia64/net/ntohs.S3
-rw-r--r--lib/libc/locale/rune.c1
-rw-r--r--lib/libc/net/getservent.c6
-rw-r--r--lib/libc/net/ns_addr.c1
-rw-r--r--lib/libc/net/ns_ntoa.c6
-rw-r--r--lib/libc/rpc/auth_des.c1
-rw-r--r--lib/libc/rpc/clnt_dg.c1
-rw-r--r--lib/libc/rpc/clnt_vc.c1
-rw-r--r--lib/libc/rpc/pmap_getmaps.c1
-rw-r--r--lib/libc/rpc/pmap_getport.c1
-rw-r--r--lib/libc/sparc64/net/htonl.S6
-rw-r--r--lib/libc/sparc64/net/htons.S6
-rw-r--r--lib/libc/sparc64/net/ntohl.S6
-rw-r--r--lib/libc/sparc64/net/ntohs.S6
-rw-r--r--lib/libc/xdr/xdr_stdio.c1
-rw-r--r--lib/libc/yp/yplib.c1
-rw-r--r--lib/libipx/ipx_addr.c1
-rw-r--r--lib/libipx/ipx_ntoa.c1
-rw-r--r--lib/libncp/ipx.c1
-rw-r--r--lib/libncp/ncpl_bind.c1
-rw-r--r--lib/libncp/ncpl_file.c1
-rw-r--r--lib/libncp/ncpl_misc.c1
-rw-r--r--lib/libncp/ncpl_rpc.c1
-rw-r--r--lib/libncp/sap.c1
-rw-r--r--lib/libstand/net.c2
-rw-r--r--lib/libstand/stand.h13
45 files changed, 122 insertions, 34 deletions
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 <machine/asm.h>
-#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 <machine/asm.h>
-#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 <machine/asm.h>
-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 <machine/asm.h>
-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 <machine/asm.h>
-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 <machine/asm.h>
-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 <machine/asm.h>
-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 <machine/asm.h>
-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 <machine/asm.h>
-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 <machine/asm.h>
-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 <machine/asm.h>
-#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 <machine/asm.h>
-#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 <arpa/inet.h>
#include <rune.h>
#include <stdio.h>
#include <string.h>
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 <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/socket.h>
+#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
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 <sys/param.h>
+#include <arpa/inet.h>
#include <netns/ns.h>
#include <stdio.h>
#include <string.h>
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 <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <arpa/inet.h>
#include <netns/ns.h>
#include <stdio.h>
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 <rpc/auth_des.h>
#include <rpc/clnt.h>
#include <rpc/xdr.h>
-#include <netinet/in.h> /* XXX: just to get htonl() and ntohl() */
#include <sys/socket.h>
#undef NIS
#include <rpcsvc/nis.h>
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 <sys/time.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <arpa/inet.h>
#include <rpc/rpc.h>
#include <errno.h>
#include <stdlib.h>
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 <sys/un.h>
#include <sys/uio.h>
+#include <arpa/inet.h>
#include <assert.h>
#include <err.h>
#include <errno.h>
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 <sys/socket.h>
#include <sys/ioctl.h>
+#include <arpa/inet.h>
#include <net/if.h>
#include <assert.h>
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 <sys/types.h>
#include <sys/socket.h>
+#include <arpa/inet.h>
#include <net/if.h>
#include <assert.h>
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 <stdio.h>
+#include <arpa/inet.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#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 <sys/socket.h>
#include <sys/file.h>
#include <sys/uio.h>
+#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libipx/ipx_addr.c b/lib/libipx/ipx_addr.c
index 051d28b..7a4c6b8 100644
--- a/lib/libipx/ipx_addr.c
+++ b/lib/libipx/ipx_addr.c
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)ipx_addr.c";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
+#include <arpa/inet.h>
#include <netipx/ipx.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libipx/ipx_ntoa.c b/lib/libipx/ipx_ntoa.c
index b73d72c..437a2b3 100644
--- a/lib/libipx/ipx_ntoa.c
+++ b/lib/libipx/ipx_ntoa.c
@@ -39,6 +39,7 @@ static char sccsid[] = "@(#)ipx_ntoa.c";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
+#include <arpa/inet.h>
#include <netipx/ipx.h>
#include <stdio.h>
diff --git a/lib/libncp/ipx.c b/lib/libncp/ipx.c
index b55b58b..9f0a21e 100644
--- a/lib/libncp/ipx.c
+++ b/lib/libncp/ipx.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/time.h>
+#include <arpa/inet.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_dl.h>
diff --git a/lib/libncp/ncpl_bind.c b/lib/libncp/ncpl_bind.c
index e7bbb1c..ab591eb 100644
--- a/lib/libncp/ncpl_bind.c
+++ b/lib/libncp/ncpl_bind.c
@@ -34,6 +34,7 @@
__FBSDID("$FreeBSD$");
#include <sys/types.h>
+#include <arpa/inet.h>
#include <errno.h>
#include <string.h>
#include <netncp/ncp_lib.h>
diff --git a/lib/libncp/ncpl_file.c b/lib/libncp/ncpl_file.c
index 4f611c5..2ffcc46 100644
--- a/lib/libncp/ncpl_file.c
+++ b/lib/libncp/ncpl_file.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/ioctl.h>
+#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
diff --git a/lib/libncp/ncpl_misc.c b/lib/libncp/ncpl_misc.c
index c145fda..16a54c5 100644
--- a/lib/libncp/ncpl_misc.c
+++ b/lib/libncp/ncpl_misc.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/time.h>
+#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <strings.h>
diff --git a/lib/libncp/ncpl_rpc.c b/lib/libncp/ncpl_rpc.c
index 1299ac9..f2240e3 100644
--- a/lib/libncp/ncpl_rpc.c
+++ b/lib/libncp/ncpl_rpc.c
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/time.h>
+#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <strings.h>
diff --git a/lib/libncp/sap.c b/lib/libncp/sap.c
index b9f95a9..a0c7d0c 100644
--- a/lib/libncp/sap.c
+++ b/lib/libncp/sap.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
+#include <arpa/inet.h>
#include <netipx/ipx.h>
#include <errno.h>
#include <unistd.h>
diff --git a/lib/libstand/net.c b/lib/libstand/net.c
index 6ac0de8..06d9dbf 100644
--- a/lib/libstand/net.c
+++ b/lib/libstand/net.c
@@ -231,7 +231,7 @@ intoa(addr)
register int n;
static char buf[17]; /* strlen(".255.255.255.255") + 1 */
- NTOHL(addr);
+ addr = ntohl(addr);
cp = &buf[sizeof buf];
*--cp = '\0';
diff --git a/lib/libstand/stand.h b/lib/libstand/stand.h
index b9e31ad..e3570f9 100644
--- a/lib/libstand/stand.h
+++ b/lib/libstand/stand.h
@@ -371,6 +371,19 @@ extern void panic(const char *, ...) __dead2;
extern struct fs_ops *file_system[];
extern struct devsw *devsw[];
+/*
+ * Expose byteorder(3) functions.
+ */
+#define htonl(x) __htonl(x)
+#define htons(x) __htons(x)
+#define ntohl(x) __ntohl(x)
+#define ntohs(x) __ntohs(x)
+
+extern uint32_t htonl(uint32_t);
+extern uint16_t htons(uint16_t);
+extern uint32_t ntohl(uint32_t);
+extern uint16_t ntohs(uint16_t);
+
#if 0
static inline void *
OpenPOWER on IntegriCloud