summaryrefslogtreecommitdiffstats
path: root/sys/libkern
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 /sys/libkern
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 'sys/libkern')
-rw-r--r--sys/libkern/alpha/byte_swap_2.S5
-rw-r--r--sys/libkern/alpha/byte_swap_4.S5
-rw-r--r--sys/libkern/alpha/htonl.S3
-rw-r--r--sys/libkern/alpha/htons.S3
-rw-r--r--sys/libkern/alpha/ntohl.S3
-rw-r--r--sys/libkern/alpha/ntohs.S3
-rw-r--r--sys/libkern/ia64/byte_swap_2.S5
-rw-r--r--sys/libkern/ia64/byte_swap_4.S5
-rw-r--r--sys/libkern/ia64/htonl.S3
-rw-r--r--sys/libkern/ia64/htons.S3
-rw-r--r--sys/libkern/ia64/ntohl.S3
-rw-r--r--sys/libkern/ia64/ntohs.S3
12 files changed, 28 insertions, 16 deletions
diff --git a/sys/libkern/alpha/byte_swap_2.S b/sys/libkern/alpha/byte_swap_2.S
index a9d70a9..8111918 100644
--- a/sys/libkern/alpha/byte_swap_2.S
+++ b/sys/libkern/alpha/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).
*/
+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/sys/libkern/alpha/byte_swap_4.S b/sys/libkern/alpha/byte_swap_4.S
index 9f6df34..d31bbe8 100644
--- a/sys/libkern/alpha/byte_swap_4.S
+++ b/sys/libkern/alpha/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).
*/
+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/sys/libkern/alpha/htonl.S b/sys/libkern/alpha/htonl.S
index b5ebaa5..2604034 100644
--- a/sys/libkern/alpha/htonl.S
+++ b/sys/libkern/alpha/htonl.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME htonl
+#define ALIAS htonl
+#define NAME __htonl
#include <libkern/alpha/byte_swap_4.S>
diff --git a/sys/libkern/alpha/htons.S b/sys/libkern/alpha/htons.S
index 9ffabf4..6b8ea16 100644
--- a/sys/libkern/alpha/htons.S
+++ b/sys/libkern/alpha/htons.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME htons
+#define ALIAS htons
+#define NAME __htons
#include <libkern/alpha/byte_swap_2.S>
diff --git a/sys/libkern/alpha/ntohl.S b/sys/libkern/alpha/ntohl.S
index f86a404..590203a 100644
--- a/sys/libkern/alpha/ntohl.S
+++ b/sys/libkern/alpha/ntohl.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME ntohl
+#define ALIAS ntohl
+#define NAME __ntohl
#include <libkern/alpha/byte_swap_4.S>
diff --git a/sys/libkern/alpha/ntohs.S b/sys/libkern/alpha/ntohs.S
index 496f75c..9306881 100644
--- a/sys/libkern/alpha/ntohs.S
+++ b/sys/libkern/alpha/ntohs.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME ntohs
+#define ALIAS ntohs
+#define NAME __ntohs
#include <libkern/alpha/byte_swap_2.S>
diff --git a/sys/libkern/ia64/byte_swap_2.S b/sys/libkern/ia64/byte_swap_2.S
index fbee3c8..19d0eef 100644
--- a/sys/libkern/ia64/byte_swap_2.S
+++ b/sys/libkern/ia64/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/sys/libkern/ia64/byte_swap_4.S b/sys/libkern/ia64/byte_swap_4.S
index d183644..71019ba 100644
--- a/sys/libkern/ia64/byte_swap_4.S
+++ b/sys/libkern/ia64/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/sys/libkern/ia64/htonl.S b/sys/libkern/ia64/htonl.S
index 666f702..f0c89f4 100644
--- a/sys/libkern/ia64/htonl.S
+++ b/sys/libkern/ia64/htonl.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME htonl
+#define ALIAS htonl
+#define NAME __htonl
#include <libkern/ia64/byte_swap_4.S>
diff --git a/sys/libkern/ia64/htons.S b/sys/libkern/ia64/htons.S
index aaea4da..16a83d6 100644
--- a/sys/libkern/ia64/htons.S
+++ b/sys/libkern/ia64/htons.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME htons
+#define ALIAS htons
+#define NAME __htons
#include <libkern/ia64/byte_swap_2.S>
diff --git a/sys/libkern/ia64/ntohl.S b/sys/libkern/ia64/ntohl.S
index b306222..2f2e7ba 100644
--- a/sys/libkern/ia64/ntohl.S
+++ b/sys/libkern/ia64/ntohl.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME ntohl
+#define ALIAS ntohl
+#define NAME __ntohl
#include <libkern/ia64/byte_swap_4.S>
diff --git a/sys/libkern/ia64/ntohs.S b/sys/libkern/ia64/ntohs.S
index ddd7344..051f103 100644
--- a/sys/libkern/ia64/ntohs.S
+++ b/sys/libkern/ia64/ntohs.S
@@ -28,6 +28,7 @@
* rights to redistribute these changes.
*/
-#define NAME ntohs
+#define ALIAS ntohs
+#define NAME __ntohs
#include <libkern/ia64/byte_swap_2.S>
OpenPOWER on IntegriCloud