summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-03-05 21:06:12 +0000
committerUlrich Drepper <drepper@redhat.com>1997-03-05 21:06:12 +0000
commit4db14580ca346d7a59c7fbc3143d8c9130fe146b (patch)
tree612a1423723fffde900a51c75969c003760f3104
parent379091f89dbef52841b270d8b3042c264f54e603 (diff)
(htonl, htons, ntohl, ntohs): Change prototypes to use types with
explicit width. `unsigned long' is different on 64 bit systems.
-rw-r--r--sysdeps/generic/netinet/in.h15
-rw-r--r--sysdeps/unix/sysv/linux/netinet/in.h15
2 files changed, 20 insertions, 10 deletions
diff --git a/sysdeps/generic/netinet/in.h b/sysdeps/generic/netinet/in.h
index ad77c8be7d..5531fc2ece 100644
--- a/sysdeps/generic/netinet/in.h
+++ b/sysdeps/generic/netinet/in.h
@@ -190,12 +190,17 @@ struct ip_mreq
struct in_addr imr_interface; /* local IP address of interface */
};
-/* Functions to convert between host and network byte order. */
+/* Functions to convert between host and network byte order.
-extern unsigned long int ntohl __P ((unsigned long int));
-extern unsigned short int ntohs __P ((unsigned short int));
-extern unsigned long int htonl __P ((unsigned long int));
-extern unsigned short int htons __P ((unsigned short int));
+ Please note that these functions normally take `unsigned long int' or
+ `unsigned short int' values as arguments and also return them. But
+ this was a short-sighted decision since on different systems the types
+ may have different representations but the values are always the same. */
+
+extern u_int32_t ntohl __P ((u_int32_t __netlong));
+extern u_int16_t ntohs __P ((u_int16_t __netshort));
+extern u_int32_t htonl __P ((u_int32_t __hostlong));
+extern u_int16_t htons __P ((u_int16_t __hostshort));
#include <endian.h>
diff --git a/sysdeps/unix/sysv/linux/netinet/in.h b/sysdeps/unix/sysv/linux/netinet/in.h
index a45bb664ad..34a867a961 100644
--- a/sysdeps/unix/sysv/linux/netinet/in.h
+++ b/sysdeps/unix/sysv/linux/netinet/in.h
@@ -186,12 +186,17 @@ struct ip_mreq
struct in_addr imr_interface; /* local IP address of interface */
};
-/* Functions to convert between host and network byte order. */
+/* Functions to convert between host and network byte order.
-extern unsigned long int ntohl __P ((unsigned long int));
-extern unsigned short int ntohs __P ((unsigned short int));
-extern unsigned long int htonl __P ((unsigned long int));
-extern unsigned short int htons __P ((unsigned short int));
+ Please note that these functions normally take `unsigned long int' or
+ `unsigned short int' values as arguments and also return them. But
+ this was a short-sighted decision since on different systems the types
+ may have different representations but the values are always the same. */
+
+extern u_int32_t ntohl __P ((u_int32_t __netlong));
+extern u_int16_t ntohs __P ((u_int16_t __netshort));
+extern u_int32_t htonl __P ((u_int32_t __hostlong));
+extern u_int16_t htons __P ((u_int16_t __hostshort));
#include <endian.h>