aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Barcroft <mike@FreeBSD.org>2002-02-18 20:35:27 +0000
committerMike Barcroft <mike@FreeBSD.org>2002-02-18 20:35:27 +0000
commitfd8e4ebc8c18caec3eefac6527831f9ee6a92959 (patch)
tree970c36894ee638248ec810bd7570ac8aabb5eaf5 /lib
parent3e1ce344baebe1f56863d29d656549c93a464ded (diff)
downloadsrc-fd8e4ebc8c18caec3eefac6527831f9ee6a92959.tar.gz
src-fd8e4ebc8c18caec3eefac6527831f9ee6a92959.zip
Notes
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 fab3c58d8471..ebcbeda22f81 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 8dbb83ca2484..ddfd1e9970c2 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 bacab1ede388..90d94415d58e 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 fb082223a9d1..405d5378a23e 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 b571647342f7..54ea68dba613 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 6db996176806..f841a7a8b4a3 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 af3354f54795..6658b69025a6 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 c78b1088b42a..c354eaa0c94e 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 3a2c2025c84d..46ff54e32202 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 110faf7b6d77..3f0a36ab6ea2 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 af3354f54795..6658b69025a6 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 c78b1088b42a..c354eaa0c94e 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 3a2c2025c84d..46ff54e32202 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 110faf7b6d77..3f0a36ab6ea2 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 fbee3c862515..19d0eefbec8f 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 d1836442c287..71019ba4c4c8 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 20d86afe399a..7a71a29d90ee 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 5082d882eaf8..689b367938ee 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 54299c4aae7f..9e2c612d618c 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 1eec14b543aa..16a884b924bf 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 f0a54907c917..a6b890d3df97 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 cd4449fbb86f..5ffb6d26e17c 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 75449ed98b94..e00f20d2086b 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 de5f30588710..6ba2caf41197 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 e7aef6419504..6a7da3a05036 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 59869bf7271c..5ca88d3f88f7 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 d2d01785cb46..b96822efe9c5 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 4c8397f412d4..3fdc44ff01b0 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 ff75c9ff1d62..02946d32a50e 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 c47961529397..c3d10e5997c2 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 70cd0cce87f5..6f1fa7070b32 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 3ed47ee66222..4a546913536d 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 f3a5e19e3f46..1b144a90affb 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 c4328ec181a8..e49cb44a37f5 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 0a4bc7e09a70..9f9ffbac096a 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 051d28b4dc95..7a4c6b8afe7d 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 b73d72cbc3b0..437a2b30c27e 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 b55b58b41f81..9f0a21e16212 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 e7bbb1cd8c49..ab591eb44fc9 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 4f611c5c9010..2ffcc466a6ec 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 c145fda71437..16a54c5db15b 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 1299ac9ad356..f2240e3b1301 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 b9f95a9606bf..a0c7d0cf205b 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 6ac0de818984..06d9dbf56baa 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 b9e31ad1626c..e3570f9a9ee4 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 *