From 0086861d082c6c56525401724a9f1afd389d5f78 Mon Sep 17 00:00:00 2001 From: guenther <> Date: Sat, 12 Jul 2014 16:25:08 +0000 Subject: [PATCH] Tackle the endian.h mess. Make it so that: * you can #include instead of , and ditto (fixes code that pulls in first) * those will always export the symbols that POSIX specified for , 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 currently exports (ntohs, NTOHS, dlg's bemtoh*, etc) * when doing POSIX compiles (not __BSD_VISIBLE), then and will *stop* exporting the extra symbols like BYTE_ORDER and betoh* ok deraadt@ --- src/include/Makefile | 4 ++-- src/include/arpa/inet.h | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/include/Makefile b/src/include/Makefile index dcf89162..7b5219f8 100644 --- a/src/include/Makefile +++ b/src/include/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.191 2014/07/11 21:50:28 tedu Exp $ +# $OpenBSD: Makefile,v 1.192 2014/07/12 16:25:08 guenther Exp $ # $NetBSD: Makefile,v 1.59 1996/05/15 21:36:43 jtc Exp $ # @(#)Makefile 5.45.1.1 (Berkeley) 5/6/91 @@ -28,7 +28,7 @@ FILES+= ieeefp.h .endif MFILES= frame.h -LFILES= fcntl.h syslog.h termios.h stdarg.h stdint.h varargs.h +LFILES= endian.h fcntl.h syslog.h termios.h stdarg.h stdint.h varargs.h DIRS= arpa protocols rpc rpcsvc LDIRS= crypto ddb dev isofs miscfs msdosfs net netinet netinet6 \ diff --git a/src/include/arpa/inet.h b/src/include/arpa/inet.h index d653736d..34828d05 100644 --- a/src/include/arpa/inet.h +++ b/src/include/arpa/inet.h @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.h,v 1.15 2012/12/05 23:19:57 deraadt Exp $ */ +/* $OpenBSD: inet.h,v 1.16 2014/07/12 16:25:08 guenther Exp $ */ /* * ++Copyright++ 1983, 1993 @@ -62,7 +62,14 @@ /* External definitions for functions in inet(3) */ #include -#include + +/* is pulled in by */ +#ifndef htons +#define htons(x) __htobe16(x) +#define htonl(x) __htobe32(x) +#define ntohs(x) __htobe16(x) +#define ntohl(x) __htobe32(x) +#endif #ifndef _SOCKLEN_T_DEFINED_ #define _SOCKLEN_T_DEFINED_