diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2014-07-12 16:25:10 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2014-07-12 16:25:10 +0000 |
commit | 2039f6b74df84ee50091647629f3c65b57371135 (patch) | |
tree | 076e09339c1066da837771e8393ddab7ce9ff891 /sys/netinet/in.h | |
parent | 30586300cf458635b5a017a2f2e7c7345538d628 (diff) |
Tackle the endian.h mess. Make it so that:
* you can #include <sys/endian.h> instead of <machine/endian.h>,
and ditto <endian.h> (fixes code that pulls in <sys/endian.h> first)
* those will always export the symbols that POSIX specified for
<endian.h>, including the new {be,le}{16,32,64}toh() set. c.f.
http://austingroupbugs.net/view.php?id=162
if __BSD_VISIBLE then you also get the symbols that our <machine/endian.h>
currently exports (ntohs, NTOHS, dlg's bemtoh*, etc)
* when doing POSIX compiles (not __BSD_VISIBLE), then <netinet/in.h> and
<arpa/inet.h> will *stop* exporting the extra symbols like BYTE_ORDER
and betoh*
ok deraadt@
Diffstat (limited to 'sys/netinet/in.h')
-rw-r--r-- | sys/netinet/in.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/netinet/in.h b/sys/netinet/in.h index 770905adb1d..9976b6cdde9 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in.h,v 1.108 2014/04/25 09:44:38 mpi Exp $ */ +/* $OpenBSD: in.h,v 1.109 2014/07/12 16:25:08 guenther Exp $ */ /* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */ /* @@ -42,7 +42,15 @@ #ifndef _KERNEL #include <sys/types.h> -#include <machine/endian.h> + +/* <sys/_endian.h> is pulled in by <sys/types.h> */ +#ifndef htons +#define htons(x) __htobe16(x) +#define htonl(x) __htobe32(x) +#define ntohs(x) __htobe16(x) +#define ntohl(x) __htobe32(x) +#endif + #endif /* _KERNEL */ #ifndef _SA_FAMILY_T_DEFINED_ |