Browse Source

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@
OPENBSD_5_6
guenther 10 years ago
parent
commit
0086861d08
2 changed files with 11 additions and 4 deletions
  1. +2
    -2
      src/include/Makefile
  2. +9
    -2
      src/include/arpa/inet.h

+ 2
- 2
src/include/Makefile View File

@ -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 \


+ 9
- 2
src/include/arpa/inet.h View File

@ -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 <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
#ifndef _SOCKLEN_T_DEFINED_
#define _SOCKLEN_T_DEFINED_


Loading…
Cancel
Save