NetBSD Problem Report #47794

From www@NetBSD.org  Thu May  2 22:35:42 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 62A7663EDA5
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  2 May 2013 22:35:42 +0000 (UTC)
Message-Id: <20130502223541.2D46463EDA5@www.NetBSD.org>
Date: Thu,  2 May 2013 22:35:41 +0000 (UTC)
From: rhansen@bbn.com
Reply-To: rhansen@bbn.com
To: gnats-bugs@NetBSD.org
Subject: circular header dependencies force header inclusion order with <machine/byte_swap.h>
X-Send-Pr-Version: www-1.0

>Number:         47794
>Category:       kern
>Synopsis:       circular header dependencies force header inclusion order with <machine/byte_swap.h>
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    dholland
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 02 22:40:01 +0000 2013
>Last-Modified:  Tue May 28 03:35:01 +0000 2013
>Originator:     Richard Hansen
>Release:        6.0.1
>Organization:
BBN
>Environment:
NetBSD netbsd.bbn.com 6.0.1 NetBSD 6.0.1 (GENERIC) amd64
>Description:
Due to circular header dependencies, '#include <machine/byte_swap.h>' without '#include <sys/bswap.h>' before it (either directly or indirectly, e.g., via <sys/endian.h>) causes macro redefined error messages.

 1. machine/byte_swap.h includes sys/types.h
    -> sys/types.h includes machine/endian.h
       -> machine/endian.h includes sys/endian.h
          -> sys/endian.h includes machine/bswap.h
             -> machine/bswap.h includes machine/byte_swap.h
                -> machine/byte_swap.h already included, do nothing
             -> machine/bswap.h includes sys/bswap.h
                -> sys/bswap.h defines __BYTE_SWAP_U??_VARIABLE
 2. machine/byte_swap.h defines __BYTE_SWAP_U??_VARIABLE

I understand that machine/*.h are arch-specific headers which may make this look like an amd64-specific bug, but there is at least this circular header dependency in all architectures:

  * sys/types.h includes machine/endian.h
  * machine/endian.h includes sys/endian.h (on all architectures)
  * sys/endian.h includes sys/types.h
>How-To-Repeat:
$ gcc -O2 -Werror -o /dev/null -x c /usr/include/machine/byte_swap.h
cc1: warnings being treated as errors
/usr/include/machine/byte_swap.h:45:0: error: "__BYTE_SWAP_U64_VARIABLE" redefined
/usr/include/sys/bswap.h:30:0: note: this is the location of the previous definition
/usr/include/machine/byte_swap.h:54:0: error: "__BYTE_SWAP_U32_VARIABLE" redefined
/usr/include/sys/bswap.h:34:0: note: this is the location of the previous definition
/usr/include/machine/byte_swap.h:63:0: error: "__BYTE_SWAP_U16_VARIABLE" redefined
/usr/include/sys/bswap.h:38:0: note: this is the location of the previous definition

>Fix:
Remove the line '#include <machine/endian.h>' from sys/types.h -- it doesn't need it.  It's unclear to me why it was ever included in the first place.

Unfortunately, sys/types.h has been including machine/endian.h for two decades now, so removing the inclusion breaks lots of (bad) code.  Much -- but not all -- of the problematic code can be addressed by including sys/endian.h from sys/param.h (which, based on the description in its man page, seems to be the header equivalent of a junk drawer).  In particular, the AC_C_BIGENDIAN autoconf test checks sys/param.h for the endianness macros provided by sys/endian.h.

Unfortunately, finding all of the bad code is not trivial -- some of the bad code simply does stuff like this:

    #if BYTE_ORDER == BIG_ENDIAN
      /* foo */
    #else
      /* bar */
    #endif

Code like this will still compile if machine/endian.h hasn't been included but may fail at runtime.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->dholland
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Wed, 08 May 2013 16:19:20 +0000
Responsible-Changed-Why:
this looks like the kind of thing I'd better take care of


From: Richard Hansen <rhansen@bbn.com>
To: gnats-bugs@NetBSD.org
Cc: dholland@NetBSD.org
Subject: Re: kern/47794 (circular header dependencies force header inclusion
 order with <machine/byte_swap.h>)
Date: Mon, 27 May 2013 22:31:19 -0400

 This is a multi-part message in MIME format.
 --------------050300020203060204000000
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 7bit

 On 2013-05-08 12:19, dholland@NetBSD.org wrote:
 > this looks like the kind of thing I'd better take care of

 Attached are some patches (against netbsd-6-1-RELEASE) to help with this:

 1-ferret.patch:  DO NOT COMMIT

     Induce build errors when `#include <sys/endian.h>` is missing

     These changes are intended to help identify code that depends
     on the contents of <sys/endian.h> but doesn't explicitly
     include that header (instead relying on <sys/types.h>
     including <sys/endian.h>).

     These changes are only for amd64; other architectures will
     require tweaks.

 2-include-arpa-inet.h-from-netinet-in.h.patch:

     Include <arpa/inet.h> from <netinet/in.h>

     POSIX Issue 7 (IEEE 1003.1-2008) says that <netinet/in.h> "may
     also make visible all symbols from <arpa/inet.h>" and that
     <arpa/inet.h> "may also make visible all symbols from
     <netinet/in.h>".  Many applications seem to rely on these
     non-requirements.

 3-include-sys-endian.h-from-sys-param.h.patch:

     Include <sys/endian.h> from <sys/param.h>

     Lots of kernel code relies on the assumption that
     <sys/param.h> includes <sys/endian.h>, so explicitly add the
     inclusion rather than rely on <sys/types.h> including
     <sys/endian.h>.

 4-add-missing-includes.patch:

     Fix assumptions that <sys/types.h> includes <machine/endian.h>

     Rather than depend upon <sys/types.h> including
     <machine/endian.h>, explicitly include <sys/endian.h>,
     <arpa/inet.h>, or <machine/bswap.h> where needed.

 Hope this helps,
 Richard

 --------------050300020203060204000000
 Content-Type: text/x-patch;
  name="1-ferret.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="1-ferret.patch"

 From 59bd26df56901f9e4d28e0425740b952e9810974 Mon Sep 17 00:00:00 2001
 From: Richard Hansen <rhansen@bbn.com>
 Date: Mon, 27 May 2013 21:42:47 -0400
 Subject: [PATCH 1/4] Induce build errors when `#include <sys/endian.h>` is
  missing

 DO NOT COMMIT

 These changes are intended to help identify code that depends
 on the contents of <sys/endian.h> but doesn't explicitly
 include that header (instead relying on <sys/types.h>
 including <sys/endian.h>).

 These changes are only for amd64; other architectures will
 require tweaks.
 ---
  src/external/cddl/osnet/sys/machine/endian.h |    7 +-
  src/sys/arch/amd64/include/endian_machdep.h  |    5 ++
  src/sys/sys/endian.h                         |  104 ++++++++++++++++++++++++++
  src/sys/sys/types.h                          |    2 +
  4 files changed, 113 insertions(+), 5 deletions(-)

 diff --git a/src/external/cddl/osnet/sys/machine/endian.h b/src/external/cddl/osnet/sys/machine/endian.h
 index c7b6579..200414e 100644
 --- a/src/external/cddl/osnet/sys/machine/endian.h
 +++ b/src/external/cddl/osnet/sys/machine/endian.h
 @@ -26,19 +26,16 @@
   * $FreeBSD: src/sys/compat/opensolaris/machine/endian.h,v 1.1 2007/04/06 01:09:06 pjd Exp $
   */

 -#ifndef	_OPENSOLARIS_MACHINE_ENDIAN_H_
 -#define	_OPENSOLARIS_MACHINE_ENDIAN_H_
 -
  #include_next <machine/endian.h>

  /*
   * Solaris defines _LITTLE_ENDIAN or _BIG_ENDIAN, but never both and decides
   * which architecture it is based on which thing is defined.
   */
 +#ifdef _AMD64_ENDIAN_MACHDEP_H
  #if _BYTE_ORDER == _LITTLE_ENDIAN
  #undef	_BIG_ENDIAN
  #else
  #undef	_LITTLE_ENDIAN
  #endif
 -
 -#endif	/* !_OPENSOLARIS_MACHINE_ENDIAN_H_ */
 +#endif
 diff --git a/src/sys/arch/amd64/include/endian_machdep.h b/src/sys/arch/amd64/include/endian_machdep.h
 index 7cb88d2..c57e6cd 100644
 --- a/src/sys/arch/amd64/include/endian_machdep.h
 +++ b/src/sys/arch/amd64/include/endian_machdep.h
 @@ -1,3 +1,8 @@
  /*	$NetBSD: endian_machdep.h,v 1.4 2006/01/30 21:52:38 dsl Exp $	*/

 +#ifndef _AMD64_ENDIAN_MACHDEP_H
 +#define _AMD64_ENDIAN_MACHDEP_H
 +
  #define _BYTE_ORDER _LITTLE_ENDIAN
 +
 +#endif
 diff --git a/src/sys/sys/endian.h b/src/sys/sys/endian.h
 index ac5418c..0a85f33 100644
 --- a/src/sys/sys/endian.h
 +++ b/src/sys/sys/endian.h
 @@ -31,9 +31,111 @@
   *	@(#)endian.h	8.1 (Berkeley) 6/11/93
   */

 +#ifdef _MACHINE_ENDIAN_INCLUDED_FROM_TYPES_H
 +#  ifndef _SYS_ENDIAN_H_FROM_TYPES_H
 +#    define _SYS_ENDIAN_H_FROM_TYPES_H
 +#    ifndef _SYS_ENDIAN_H_
 +       /* dummy defines in an attempt to provoke compiler errors */
 +#      define _LITTLE_ENDIAN _LITTLE_ENDIAN _LITTLE_ENDIAN_dummy_define
 +#      define _BIG_ENDIAN _BIG_ENDIAN _BIG_ENDIAN_dummy_define
 +#      define _PDP_ENDIAN _PDP_ENDIAN _PDP_ENDIAN_dummy_define
 +#      define _QUAD_HIGHWORD _QUAD_HIGHWORD _QUAD_HIGHWORD_dummy_define
 +#      define _QUAD_LOWWORD _QUAD_LOWWORD _QUAD_LOWWORD_dummy_define
 +#      if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
 +#        define LITTLE_ENDIAN LITTLE_ENDIAN LITTLE_ENDIAN_dummy_define
 +#        define BIG_ENDIAN BIG_ENDIAN BIG_ENDIAN_dummy_define
 +#        define PDP_ENDIAN PDP_ENDIAN PDP_ENDIAN_dummy_define
 +#        define BYTE_ORDER BYTE_ORDER BYTE_ORDER_dummy_define
 +#        ifndef _LOCORE
 +#          define ntohl(x) ntohl ntohl_dummy_define
 +#          define ntohs(x) ntohs ntohs_dummy_define
 +#          define htonl(x) htonl htonl_dummy_define
 +#          define htons(x) htons htons_dummy_define
 +#          define NTOHL(x) NTOHL NTOHL_dummy_define
 +#          define NTOHS(x) NTOHS NTOHS_dummy_define
 +#          define HTONL(x) HTONL HTONL_dummy_define
 +#          define HTONS(x) HTONS HTONS_dummy_define
 +#          define htobe16(x) htobe16 htobe16_dummy_define
 +#          define htobe32(x) htobe32 htobe32_dummy_define
 +#          define htobe64(x) htobe64 htobe64_dummy_define
 +#          define htole16(x) htole16 htole16_dummy_define
 +#          define htole32(x) htole32 htole32_dummy_define
 +#          define htole64(x) htole64 htole64_dummy_define
 +#          define HTOBE16(x) HTOBE16 HTOBE16_dummy_define
 +#          define HTOBE32(x) HTOBE32 HTOBE32_dummy_define
 +#          define HTOBE64(x) HTOBE64 HTOBE64_dummy_define
 +#          define HTOLE16(x) HTOLE16 HTOLE16_dummy_define
 +#          define HTOLE32(x) HTOLE32 HTOLE32_dummy_define
 +#          define HTOLE64(x) HTOLE64 HTOLE64_dummy_define
 +#          define be16toh(x) be16toh be16toh_dummy_define
 +#          define be32toh(x) be32toh be32toh_dummy_define
 +#          define be64toh(x) be64toh be64toh_dummy_define
 +#          define le16toh(x) le16toh le16toh_dummy_define
 +#          define le32toh(x) le32toh le32toh_dummy_define
 +#          define le64toh(x) le64toh le64toh_dummy_define
 +#          define BE16TOH(x) BE16TOH BE16TOH_dummy_define
 +#          define BE32TOH(x) BE32TOH BE32TOH_dummy_define
 +#          define BE64TOH(x) BE64TOH BE64TOH_dummy_define
 +#          define LE16TOH(x) LE16TOH LE16TOH_dummy_define
 +#          define LE32TOH(x) LE32TOH LE32TOH_dummy_define
 +#          define LE64TOH(x) LE64TOH LE64TOH_dummy_define
 +#        endif /* !_LOCORE */
 +#      endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
 +#    endif /* !_SYS_ENDIAN_H_ */
 +#  endif /* _SYS_ENDIAN_H_FROM_TYPES_H */
 +#else /* _MACHINE_ENDIAN_INCLUDED_FROM_TYPES_H */
 +
  #ifndef _SYS_ENDIAN_H_
  #define _SYS_ENDIAN_H_

 +#    ifdef _SYS_ENDIAN_H_FROM_TYPES_H
 +#      undef _LITTLE_ENDIAN
 +#      undef _BIG_ENDIAN
 +#      undef _PDP_ENDIAN
 +#      undef _QUAD_HIGHWORD
 +#      undef _QUAD_LOWWORD
 +#      if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
 +#        undef LITTLE_ENDIAN
 +#        undef BIG_ENDIAN
 +#        undef PDP_ENDIAN
 +#        undef BYTE_ORDER
 +#        ifndef _LOCORE
 +#          undef ntohl
 +#          undef ntohs
 +#          undef htonl
 +#          undef htons
 +#          undef NTOHL
 +#          undef NTOHS
 +#          undef HTONL
 +#          undef HTONS
 +#          undef htobe16
 +#          undef htobe32
 +#          undef htobe64
 +#          undef htole16
 +#          undef htole32
 +#          undef htole64
 +#          undef HTOBE16
 +#          undef HTOBE32
 +#          undef HTOBE64
 +#          undef HTOLE16
 +#          undef HTOLE32
 +#          undef HTOLE64
 +#          undef be16toh
 +#          undef be32toh
 +#          undef be64toh
 +#          undef le16toh
 +#          undef le32toh
 +#          undef le64toh
 +#          undef BE16TOH
 +#          undef BE32TOH
 +#          undef BE64TOH
 +#          undef LE16TOH
 +#          undef LE32TOH
 +#          undef LE64TOH
 +#        endif /* !_LOCORE */
 +#      endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
 +#    endif /* _SYS_ENDIAN_H_FROM_TYPES_H */
 +
  #include <sys/featuretest.h>

  /*
 @@ -338,3 +440,5 @@ le64dec(const void *buf)
  #endif /* !_LOCORE */
  #endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
  #endif /* !_SYS_ENDIAN_H_ */
 +
 +#endif /* _MACHINE_ENDIAN_INCLUDED_FROM_TYPES_H */
 diff --git a/src/sys/sys/types.h b/src/sys/sys/types.h
 index 48eaa40..cbc764e 100644
 --- a/src/sys/sys/types.h
 +++ b/src/sys/sys/types.h
 @@ -95,7 +95,9 @@ typedef	uint16_t	u_int16_t;
  typedef	uint32_t	u_int32_t;
  typedef	uint64_t	u_int64_t;

 +#define _MACHINE_ENDIAN_INCLUDED_FROM_TYPES_H
  #include <machine/endian.h>
 +#undef _MACHINE_ENDIAN_INCLUDED_FROM_TYPES_H

  #if defined(_NETBSD_SOURCE)
  typedef	unsigned char	u_char;
 -- 
 1.7.9.3


 --------------050300020203060204000000
 Content-Type: text/x-patch;
  name="2-include-arpa-inet.h-from-netinet-in.h.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="2-include-arpa-inet.h-from-netinet-in.h.patch"

 From 254ef2991d16c7adad5ec3de58bcf9bf41c22135 Mon Sep 17 00:00:00 2001
 From: Richard Hansen <rhansen@bbn.com>
 Date: Mon, 27 May 2013 21:42:49 -0400
 Subject: [PATCH 2/4] Include <arpa/inet.h> from <netinet/in.h>

 POSIX Issue 7 (IEEE 1003.1-2008) says that <netinet/in.h> "may
 also make visible all symbols from <arpa/inet.h>" and that
 <arpa/inet.h> "may also make visible all symbols from
 <netinet/in.h>".  Many applications seem to rely on these
 non-requirements.
 ---
  src/sys/netinet/in.h |   24 ++++++++++++++++++++++++
  1 file changed, 24 insertions(+)

 diff --git a/src/sys/netinet/in.h b/src/sys/netinet/in.h
 index 7b2fb49..3c0d968 100644
 --- a/src/sys/netinet/in.h
 +++ b/src/sys/netinet/in.h
 @@ -596,6 +596,30 @@ sockaddr_in_alloc(const struct in_addr *addr, in_port_t port, int flags)

  	return sa;
  }
 +#else /* _KERNEL */
 +
 +/*
 + * POSIX Issue 7 (IEEE 1003.1-2008) says that <netinet/in.h> "may also
 + * make visible all symbols from <arpa/inet.h>" and that <arpa/inet.h>
 + * "may also make visible all symbols from <netinet/in.h>".  Many
 + * applications seem to rely on these non-requirements, so include
 + * <arpa/inet.h> here.
 + *
 + * Note that <arpa/inet.h> depends on some of the stuff in this
 + * header, so #include <arpa/inet.h> is the last thing done in this
 + * header.  A better solution would be to move the contents of both
 + * <netinet/in.h> and <arpa/inet.h> to a third header that is included
 + * from both.
 + *
 + * Also, for some reason <arpa/inet.h> (and many other standard C and
 + * POSIX headers) is not in the include path when building the kernel
 + * or `src/sys/arch/${arch}/stand`, so it is only included when both
 + * _KERNEL and _STANDALONE are not defined.
 + */
 +#ifndef _STANDALONE
 +#include <arpa/inet.h>
 +#endif /* !_STANDALONE */
 +
  #endif /* _KERNEL */

  #endif /* !_NETINET_IN_H_ */
 -- 
 1.7.9.3


 --------------050300020203060204000000
 Content-Type: text/x-patch;
  name="3-include-sys-endian.h-from-sys-param.h.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="3-include-sys-endian.h-from-sys-param.h.patch"

 From aae3d2d68a096dde98ba18a4594a80e865c56dac Mon Sep 17 00:00:00 2001
 From: Richard Hansen <rhansen@bbn.com>
 Date: Mon, 27 May 2013 21:42:51 -0400
 Subject: [PATCH 3/4] Include <sys/endian.h> from <sys/param.h>

 Lots of kernel code relies on the assumption that
 <sys/param.h> includes <sys/endian.h>, so explicitly add the
 inclusion rather than rely on <sys/types.h> including
 <sys/endian.h>.
 ---
  src/sys/sys/param.h |    1 +
  1 file changed, 1 insertion(+)

 diff --git a/src/sys/sys/param.h b/src/sys/sys/param.h
 index 08d737c..baa9aac 100644
 --- a/src/sys/sys/param.h
 +++ b/src/sys/sys/param.h
 @@ -99,6 +99,7 @@
  #ifndef __ASSEMBLER__
  #include <sys/inttypes.h>
  #include <sys/types.h>
 +#include <sys/endian.h>

  /*
   * Machine-independent constants (some used in following include files).
 -- 
 1.7.9.3


 --------------050300020203060204000000
 Content-Type: text/x-patch;
  name="4-add-missing-includes.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="4-add-missing-includes.patch"

 From 73354c6918de2acf8f2b4a520b81a0cad636731e Mon Sep 17 00:00:00 2001
 From: Richard Hansen <rhansen@bbn.com>
 Date: Mon, 27 May 2013 21:42:54 -0400
 Subject: [PATCH 4/4] Fix assumptions that <sys/types.h> includes
  <machine/endian.h>

 Rather than depend upon <sys/types.h> including
 <machine/endian.h>, explicitly include <sys/endian.h>,
 <arpa/inet.h>, or <machine/bswap.h> where needed.
 ---
  src/common/lib/libc/hash/sha1/sha1.c               |    1 +
  src/common/lib/libc/hash/sha2/sha2.c               |    1 +
  src/common/lib/libc/inet/inet_addr.c               |    2 ++
  src/common/lib/libc/quad/quad.h                    |    1 +
  .../external/bsd/libsaslc/dist/src/mech_gssapi.c   |    1 +
  .../dist/mDNSShared/dnssd_clientstub.c             |    1 +
  .../mDNSResponder/dist/mDNSShared/dnssd_ipc.c      |    2 ++
  src/external/cddl/osnet/sys/sys/byteorder.h        |    2 ++
  src/games/adventure/save.c                         |    1 +
  src/games/robots/score.c                           |    1 +
  src/games/tetris/scores.c                          |    2 ++
  src/include/arpa/inet.h                            |    1 +
  src/include/netdb.h                                |    2 +-
  src/include/rpc/xdr.h                              |    2 ++
  src/lib/libc/citrus/citrus_csmapper.c              |    1 +
  src/lib/libc/citrus/citrus_db.c                    |    1 +
  src/lib/libc/db/btree/bt_open.c                    |    1 +
  src/lib/libc/db/hash/hash_page.c                   |    1 +
  src/lib/libc/gen/devname.c                         |    1 +
  src/lib/libc/nls/catgets.c                         |    1 +
  src/lib/libc/rpc/clnt_dg.c                         |    1 +
  src/lib/libc/rpc/pmap_getport.c                    |    1 +
  src/lib/libm/src/math_private.h                    |    1 +
  src/lib/libossaudio/soundcard.h                    |    2 +-
  src/lib/libterminfo/term.c                         |    1 +
  src/lib/libukfs/ukfs_disklabel.c                   |    1 +
  src/libexec/talkd/print.c                          |    1 +
  src/regress/sys/crypto/blowfish/bftest.c           |    1 +
  src/sbin/fsck_v7fs/fsck_v7fs.c                     |    1 +
  src/sbin/iscsictl/iscsic_globals.h                 |    1 +
  src/sys/dev/pci/if_bnxreg.h                        |    2 ++
  src/sys/dist/ipf/netinet/ip_compat.h               |    1 +
  src/sys/fs/cd9660/iso.h                            |    2 ++
  src/sys/fs/v7fs/v7fs_endian.c                      |    2 ++
  src/sys/lib/libkern/intoa.c                        |    1 +
  src/sys/lib/libsa/arp.c                            |    1 +
  src/sys/lib/libsa/tftp.c                           |    1 +
  src/sys/netinet/icmp6.h                            |    2 ++
  src/sys/netinet/ip.h                               |    2 ++
  src/sys/netinet/tcp.h                              |    1 +
  src/sys/netinet6/in6.h                             |    1 +
  src/sys/sys/cdio.h                                 |    2 ++
  src/sys/sys/exec_aout.h                            |    2 ++
  src/sys/sys/midiio.h                               |    2 +-
  src/sys/sys/wait.h                                 |    1 +
  src/sys/ufs/ext2fs/ext2fs.h                        |    1 +
  src/sys/ufs/ufs/dir.h                              |    2 ++
  src/usr.bin/vndcompress/vndcompress.h              |    1 +
  src/usr.bin/window/ww.h                            |    1 +
  src/usr.sbin/dev_mkdb/dev_mkdb.c                   |    1 +
  src/usr.sbin/makefs/v7fs.c                         |    1 +
  src/usr.sbin/mopd/common/get.c                     |    1 +
  src/usr.sbin/paxctl/paxctl.c                       |    1 +
  .../mit/MesaLib/dist/src/mesa/main/compiler.h      |    1 +
  54 files changed, 67 insertions(+), 3 deletions(-)

 diff --git a/src/common/lib/libc/hash/sha1/sha1.c b/src/common/lib/libc/hash/sha1/sha1.c
 index cbd60fc..862e838 100644
 --- a/src/common/lib/libc/hash/sha1/sha1.c
 +++ b/src/common/lib/libc/hash/sha1/sha1.c
 @@ -37,6 +37,7 @@ __RCSID("$NetBSD: sha1.c,v 1.6 2009/11/06 20:31:18 joerg Exp $");
  #endif

  #include <sys/types.h>
 +#include <sys/endian.h>
  #include <sys/sha1.h>


 diff --git a/src/common/lib/libc/hash/sha2/sha2.c b/src/common/lib/libc/hash/sha2/sha2.c
 index 55fd47d..e6eda21 100644
 --- a/src/common/lib/libc/hash/sha2/sha2.c
 +++ b/src/common/lib/libc/hash/sha2/sha2.c
 @@ -60,6 +60,7 @@ __RCSID("$NetBSD: sha2.c,v 1.21 2010/01/24 21:11:18 joerg Exp $");
  #endif

  #include <sys/types.h>
 +#include <sys/endian.h>
  #include <sys/sha2.h>

  #if HAVE_NBTOOL_CONFIG_H
 diff --git a/src/common/lib/libc/inet/inet_addr.c b/src/common/lib/libc/inet/inet_addr.c
 index 551ba17..282c36c 100644
 --- a/src/common/lib/libc/inet/inet_addr.c
 +++ b/src/common/lib/libc/inet/inet_addr.c
 @@ -102,6 +102,8 @@ __weak_alias(inet_aton,_inet_aton)
  #include <netinet/in.h>
  #endif

 +#include <sys/endian.h>
 +
  /*
   * Ascii internet address interpretation routine.
   * The value returned is in network order.
 diff --git a/src/common/lib/libc/quad/quad.h b/src/common/lib/libc/quad/quad.h
 index d9e0e19..f80fc62 100644
 --- a/src/common/lib/libc/quad/quad.h
 +++ b/src/common/lib/libc/quad/quad.h
 @@ -52,6 +52,7 @@
   */

  #include <sys/types.h>
 +#include <sys/endian.h>
  #if !defined(_KERNEL) && !defined(_STANDALONE)
  #include <limits.h>
  #else
 diff --git a/src/crypto/external/bsd/libsaslc/dist/src/mech_gssapi.c b/src/crypto/external/bsd/libsaslc/dist/src/mech_gssapi.c
 index 27e8d22..55c7d70 100644
 --- a/src/crypto/external/bsd/libsaslc/dist/src/mech_gssapi.c
 +++ b/src/crypto/external/bsd/libsaslc/dist/src/mech_gssapi.c
 @@ -44,6 +44,7 @@ __RCSID("$NetBSD: mech_gssapi.c,v 1.6 2011/02/20 01:59:46 christos Exp $");
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
 +#include <sys/endian.h>

  #include <gssapi/gssapi.h>

 diff --git a/src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_clientstub.c b/src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_clientstub.c
 index 4797123..2479744 100644
 --- a/src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_clientstub.c
 +++ b/src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_clientstub.c
 @@ -357,6 +357,7 @@ Minor textual tidying
  	#include <sys/time.h>
  	#include <sys/socket.h>
  	#include <syslog.h>
 +	#include <arpa/inet.h>

  	#define sockaddr_mdns sockaddr_un
  	#define AF_MDNS AF_LOCAL
 diff --git a/src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.c b/src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.c
 index 5c1ec4d..1657784 100644
 --- a/src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.c
 +++ b/src/external/apache2/mDNSResponder/dist/mDNSShared/dnssd_ipc.c
 @@ -108,6 +108,8 @@ char *win32_strerror(int inErrorCode)
  	return buffer;
  	}

 +#else
 +	#include <arpa/inet.h>
  #endif

  void put_uint32(const uint32_t l, char **ptr)
 diff --git a/src/external/cddl/osnet/sys/sys/byteorder.h b/src/external/cddl/osnet/sys/sys/byteorder.h
 index 7c4f0e5..499e0c9 100644
 --- a/src/external/cddl/osnet/sys/sys/byteorder.h
 +++ b/src/external/cddl/osnet/sys/sys/byteorder.h
 @@ -42,6 +42,8 @@
  #ifndef _OPENSOLARIS_SYS_BYTEORDER_H_
  #define	_OPENSOLARIS_SYS_BYTEORDER_H_

 +#include <machine/endian.h>
 +
  /*
   * Macros to reverse byte order
   */
 diff --git a/src/games/adventure/save.c b/src/games/adventure/save.c
 index 7392c69..5c3462a 100644
 --- a/src/games/adventure/save.c
 +++ b/src/games/adventure/save.c
 @@ -45,6 +45,7 @@ __RCSID("$NetBSD: save.c,v 1.13 2012/01/08 18:16:00 dholland Exp $");

  #include <sys/types.h>
  #include <sys/time.h>
 +#include <arpa/inet.h>
  #include <stdbool.h>
  #include <stdio.h>
  #include <stdlib.h>
 diff --git a/src/games/robots/score.c b/src/games/robots/score.c
 index 5ae9083..0080aa3 100644
 --- a/src/games/robots/score.c
 +++ b/src/games/robots/score.c
 @@ -46,6 +46,7 @@ __RCSID("$NetBSD: score.c,v 1.23 2009/08/12 08:30:55 dholland Exp $");
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
 +#include <arpa/inet.h>
  #include "robots.h"
  #include "pathnames.h"

 diff --git a/src/games/tetris/scores.c b/src/games/tetris/scores.c
 index 7d5fca8..1f7ed09 100644
 --- a/src/games/tetris/scores.c
 +++ b/src/games/tetris/scores.c
 @@ -49,6 +49,8 @@
  #include <stdlib.h>
  #include <string.h>
  #include <sys/stat.h>
 +#include <sys/types.h>
 +#include <machine/bswap.h>
  #include <time.h>
  #include <term.h>
  #include <unistd.h>
 diff --git a/src/include/arpa/inet.h b/src/include/arpa/inet.h
 index 0f2e9f2..6d7da9b 100644
 --- a/src/include/arpa/inet.h
 +++ b/src/include/arpa/inet.h
 @@ -65,6 +65,7 @@
  #include <sys/cdefs.h>
  #include <sys/featuretest.h>
  #include <sys/types.h>
 +#include <sys/endian.h>

  #include <netinet/in.h>

 diff --git a/src/include/netdb.h b/src/include/netdb.h
 index 59d624f..2df88a5 100644
 --- a/src/include/netdb.h
 +++ b/src/include/netdb.h
 @@ -91,7 +91,7 @@
  #define	_NETDB_H_

  #include <machine/ansi.h>
 -#include <machine/endian_machdep.h>
 +#include <sys/endian.h>
  #include <sys/ansi.h>
  #include <sys/cdefs.h>
  #include <sys/featuretest.h>
 diff --git a/src/include/rpc/xdr.h b/src/include/rpc/xdr.h
 index f15ccb2..a9bb4f1 100644
 --- a/src/include/rpc/xdr.h
 +++ b/src/include/rpc/xdr.h
 @@ -42,6 +42,8 @@
  #define _RPC_XDR_H_
  #include <sys/cdefs.h>

 +#include <arpa/inet.h>
 +
  /*
   * XDR provides a conventional way for converting between C data
   * types and an external bit-string representation.  Library supplied
 diff --git a/src/lib/libc/citrus/citrus_csmapper.c b/src/lib/libc/citrus/citrus_csmapper.c
 index 4e8f445..543cb57 100644
 --- a/src/lib/libc/citrus/citrus_csmapper.c
 +++ b/src/lib/libc/citrus/citrus_csmapper.c
 @@ -41,6 +41,7 @@ __RCSID("$NetBSD: citrus_csmapper.c,v 1.11 2011/11/20 07:43:52 tnozaki Exp $");
  #include <limits.h>
  #include <paths.h>
  #include <sys/types.h>
 +#include <sys/endian.h>
  #include <sys/queue.h>

  #include "citrus_namespace.h"
 diff --git a/src/lib/libc/citrus/citrus_db.c b/src/lib/libc/citrus/citrus_db.c
 index fc7e014..c0a67aa 100644
 --- a/src/lib/libc/citrus/citrus_db.c
 +++ b/src/lib/libc/citrus/citrus_db.c
 @@ -39,6 +39,7 @@ __RCSID("$NetBSD: citrus_db.c,v 1.5 2008/02/09 14:56:20 junyoung Exp $");
  #include <errno.h>
  #include <limits.h>
  #include <sys/types.h>
 +#include <sys/endian.h>

  #include "citrus_namespace.h"
  #include "citrus_bcs.h"
 diff --git a/src/lib/libc/db/btree/bt_open.c b/src/lib/libc/db/btree/bt_open.c
 index 633f1c2..b38b9fc 100644
 --- a/src/lib/libc/db/btree/bt_open.c
 +++ b/src/lib/libc/db/btree/bt_open.c
 @@ -49,6 +49,7 @@ __RCSID("$NetBSD: bt_open.c,v 1.25 2011/04/17 23:12:38 christos Exp $");

  #include "namespace.h"
  #include <sys/stat.h>
 +#include <sys/endian.h>

  #include <assert.h>
  #include <errno.h>
 diff --git a/src/lib/libc/db/hash/hash_page.c b/src/lib/libc/db/hash/hash_page.c
 index 625ea2d..83479e0 100644
 --- a/src/lib/libc/db/hash/hash_page.c
 +++ b/src/lib/libc/db/hash/hash_page.c
 @@ -58,6 +58,7 @@ __RCSID("$NetBSD: hash_page.c,v 1.24 2011/04/17 23:12:38 christos Exp $");
  #include "namespace.h"

  #include <sys/types.h>
 +#include <sys/endian.h>

  #include <errno.h>
  #include <fcntl.h>
 diff --git a/src/lib/libc/gen/devname.c b/src/lib/libc/gen/devname.c
 index c1b9f52..079d31c 100644
 --- a/src/lib/libc/gen/devname.c
 +++ b/src/lib/libc/gen/devname.c
 @@ -35,6 +35,7 @@ __RCSID("$NetBSD: devname.c,v 1.21.8.1 2012/06/23 22:54:54 riz Exp $");
  #include "namespace.h"
  #include "reentrant.h"
  #include <sys/stat.h>
 +#include <sys/endian.h>

  #include <cdbr.h>
  #include <errno.h>
 diff --git a/src/lib/libc/nls/catgets.c b/src/lib/libc/nls/catgets.c
 index acee17b..a6c705e 100644
 --- a/src/lib/libc/nls/catgets.c
 +++ b/src/lib/libc/nls/catgets.c
 @@ -41,6 +41,7 @@ __RCSID("$NetBSD: catgets.c,v 1.18 2008/04/28 20:23:00 martin Exp $");
  #include <stdlib.h>
  #include <string.h>
  #include <nl_types.h>
 +#include <arpa/inet.h>

  #ifdef __weak_alias
  __weak_alias(catgets, _catgets)
 diff --git a/src/lib/libc/rpc/clnt_dg.c b/src/lib/libc/rpc/clnt_dg.c
 index e76f520..c7ec368 100644
 --- a/src/lib/libc/rpc/clnt_dg.c
 +++ b/src/lib/libc/rpc/clnt_dg.c
 @@ -58,6 +58,7 @@ __RCSID("$NetBSD: clnt_dg.c,v 1.25.4.1 2013/03/14 22:03:08 riz Exp $");
  #include <sys/ioctl.h>
  #include <rpc/rpc.h>
  #include <assert.h>
 +#include <arpa/inet.h>
  #include <errno.h>
  #include <stdlib.h>
  #include <string.h>
 diff --git a/src/lib/libc/rpc/pmap_getport.c b/src/lib/libc/rpc/pmap_getport.c
 index d70fac0..c9a94ee 100644
 --- a/src/lib/libc/rpc/pmap_getport.c
 +++ b/src/lib/libc/rpc/pmap_getport.c
 @@ -55,6 +55,7 @@ __RCSID("$NetBSD: pmap_getport.c,v 1.18.30.1 2013/03/14 22:03:08 riz Exp $");

  #include <net/if.h>

 +#include <arpa/inet.h>
  #include <assert.h>
  #include <unistd.h>

 diff --git a/src/lib/libm/src/math_private.h b/src/lib/libm/src/math_private.h
 index 17fe877..6cfa815 100644
 --- a/src/lib/libm/src/math_private.h
 +++ b/src/lib/libm/src/math_private.h
 @@ -18,6 +18,7 @@
  #define _MATH_PRIVATE_H_

  #include <sys/types.h>
 +#include <sys/endian.h>

  /* The original fdlibm code used statements like:
  	n0 = ((*(int*)&one)>>29)^1;		* index of high word *
 diff --git a/src/lib/libossaudio/soundcard.h b/src/lib/libossaudio/soundcard.h
 index eb1d44b..24b115c 100644
 --- a/src/lib/libossaudio/soundcard.h
 +++ b/src/lib/libossaudio/soundcard.h
 @@ -99,7 +99,7 @@
  #define   APF_CPUINTENS			2

  /* Need native 16 bit format which depends on byte order */
 -#include <machine/endian_machdep.h>
 +#include <sys/endian.h>
  #if _BYTE_ORDER == _LITTLE_ENDIAN
  #define  AFMT_S16_NE AFMT_S16_LE
  #else
 diff --git a/src/lib/libterminfo/term.c b/src/lib/libterminfo/term.c
 index 7721f18..06b1d0d 100644
 --- a/src/lib/libterminfo/term.c
 +++ b/src/lib/libterminfo/term.c
 @@ -31,6 +31,7 @@
  __RCSID("$NetBSD: term.c,v 1.13.4.1 2012/06/23 22:54:57 riz Exp $");

  #include <sys/stat.h>
 +#include <sys/endian.h>

  #include <assert.h>
  #include <cdbr.h>
 diff --git a/src/lib/libukfs/ukfs_disklabel.c b/src/lib/libukfs/ukfs_disklabel.c
 index ff7e0d7..5de1cc1 100644
 --- a/src/lib/libukfs/ukfs_disklabel.c
 +++ b/src/lib/libukfs/ukfs_disklabel.c
 @@ -41,6 +41,7 @@
   */

  #include <sys/types.h>
 +#include <machine/bswap.h>

  #include <string.h>
  #include <unistd.h>
 diff --git a/src/libexec/talkd/print.c b/src/libexec/talkd/print.c
 index cd2c808..6d778bf 100644
 --- a/src/libexec/talkd/print.c
 +++ b/src/libexec/talkd/print.c
 @@ -42,6 +42,7 @@ __RCSID("$NetBSD: print.c,v 1.10 2009/03/16 01:13:38 lukem Exp $");

  #include <sys/types.h>
  #include <sys/socket.h>
 +#include <arpa/inet.h>
  #include <protocols/talkd.h>
  #include <inttypes.h>
  #include <syslog.h>
 diff --git a/src/regress/sys/crypto/blowfish/bftest.c b/src/regress/sys/crypto/blowfish/bftest.c
 index 9adefb4..31a0f52 100644
 --- a/src/regress/sys/crypto/blowfish/bftest.c
 +++ b/src/regress/sys/crypto/blowfish/bftest.c
 @@ -89,6 +89,7 @@

  #include <sys/cdefs.h>
  #include <sys/types.h>
 +#include <arpa/inet.h>

  #include <stdio.h>
  #include <string.h>
 diff --git a/src/sbin/fsck_v7fs/fsck_v7fs.c b/src/sbin/fsck_v7fs/fsck_v7fs.c
 index e3faaa9..bca5cca 100644
 --- a/src/sbin/fsck_v7fs/fsck_v7fs.c
 +++ b/src/sbin/fsck_v7fs/fsck_v7fs.c
 @@ -42,6 +42,7 @@ __RCSID("$NetBSD: fsck_v7fs.c,v 1.1 2011/06/27 11:52:58 uch Exp $");
  #include <err.h>
  #include <sys/ioctl.h>
  #include <sys/disklabel.h>
 +#include <sys/endian.h>

  #include <fs/v7fs/v7fs.h>
  #include "v7fs_impl.h"
 diff --git a/src/sbin/iscsictl/iscsic_globals.h b/src/sbin/iscsictl/iscsic_globals.h
 index f0693d2..3a8d3b4 100644
 --- a/src/sbin/iscsictl/iscsic_globals.h
 +++ b/src/sbin/iscsictl/iscsic_globals.h
 @@ -34,6 +34,7 @@
  #define _ISCSIC_GLOBALS_H

  #include <sys/types.h>
 +#include <sys/endian.h>

  #include <stdio.h>
  #include <stdlib.h>
 diff --git a/src/sys/dev/pci/if_bnxreg.h b/src/sys/dev/pci/if_bnxreg.h
 index 5a87cce..26bd727 100644
 --- a/src/sys/dev/pci/if_bnxreg.h
 +++ b/src/sys/dev/pci/if_bnxreg.h
 @@ -32,6 +32,8 @@
   * $FreeBSD: src/sys/dev/bce/if_bcereg.h,v 1.4 2006/05/04 00:34:07 mjacob Exp $
   */

 +#include <sys/endian.h>
 +
  #define ETHER_ALIGN	2

  /* General controller flags -- bnx_flags element in bnx_softc */
 diff --git a/src/sys/dist/ipf/netinet/ip_compat.h b/src/sys/dist/ipf/netinet/ip_compat.h
 index 253abf6..d4d13aa 100644
 --- a/src/sys/dist/ipf/netinet/ip_compat.h
 +++ b/src/sys/dist/ipf/netinet/ip_compat.h
 @@ -771,6 +771,7 @@ typedef unsigned int    u_32_t;
  /*                                  N E T B S D                            */
  /* ----------------------------------------------------------------------- */
  #ifdef __NetBSD__
 +# include <sys/endian.h>
  # if (NetBSD >= 199905) && !defined(IPFILTER_LKM) && defined(_KERNEL)
  #  if (__NetBSD_Version__ < 399001400)
  #   include "opt_ipfilter_log.h"
 diff --git a/src/sys/fs/cd9660/iso.h b/src/sys/fs/cd9660/iso.h
 index 14dd986..b4f216b 100644
 --- a/src/sys/fs/cd9660/iso.h
 +++ b/src/sys/fs/cd9660/iso.h
 @@ -45,6 +45,8 @@
  #ifndef _ISOFS_CD9660_ISO_H_
  #define _ISOFS_CD9660_ISO_H_

 +#include <sys/endian.h>
 +
  #define ISODCL(from, to) (to - from + 1)

  struct iso_volume_descriptor {
 diff --git a/src/sys/fs/v7fs/v7fs_endian.c b/src/sys/fs/v7fs/v7fs_endian.c
 index d3cd230..7ee997f 100644
 --- a/src/sys/fs/v7fs/v7fs_endian.c
 +++ b/src/sys/fs/v7fs/v7fs_endian.c
 @@ -43,6 +43,8 @@ __KERNEL_RCSID(0, "$NetBSD: v7fs_endian.c,v 1.2 2011/07/18 21:51:49 apb Exp $");
  #include "v7fs_endian.h"
  #include "v7fs_impl.h"

 +#include <sys/endian.h>
 +
  #ifndef BYTE_ORDER
  #error
  #endif
 diff --git a/src/sys/lib/libkern/intoa.c b/src/sys/lib/libkern/intoa.c
 index 2f781b1..e2e75d7 100644
 --- a/src/sys/lib/libkern/intoa.c
 +++ b/src/sys/lib/libkern/intoa.c
 @@ -40,6 +40,7 @@
   */

  #include <sys/types.h>
 +#include <sys/endian.h>

  #if defined(_KERNEL) || defined(_STANDALONE)
  #include <lib/libkern/libkern.h>
 diff --git a/src/sys/lib/libsa/arp.c b/src/sys/lib/libsa/arp.c
 index 8716fd6..e3249fc 100644
 --- a/src/sys/lib/libsa/arp.c
 +++ b/src/sys/lib/libsa/arp.c
 @@ -40,6 +40,7 @@
   */

  #include <sys/types.h>
 +#include <sys/endian.h>
  #include <sys/socket.h>
  #include <net/if.h>
  #include <net/if_ether.h>
 diff --git a/src/sys/lib/libsa/tftp.c b/src/sys/lib/libsa/tftp.c
 index f6a025d..8c1e9a6 100644
 --- a/src/sys/lib/libsa/tftp.c
 +++ b/src/sys/lib/libsa/tftp.c
 @@ -48,6 +48,7 @@
   */

  #include <sys/types.h>
 +#include <sys/endian.h>
  #include <sys/stat.h>
  #include <netinet/in.h>
  #include <netinet/udp.h>
 diff --git a/src/sys/netinet/icmp6.h b/src/sys/netinet/icmp6.h
 index f836a2d..e30fc93 100644
 --- a/src/sys/netinet/icmp6.h
 +++ b/src/sys/netinet/icmp6.h
 @@ -65,6 +65,8 @@
  #ifndef _NETINET_ICMP6_H_
  #define _NETINET_ICMP6_H_

 +#include <sys/endian.h>
 +
  #define ICMPV6_PLD_MAXLEN	1232	/* IPV6_MMTU - sizeof(struct ip6_hdr)
  					   - sizeof(struct icmp6_hdr) */

 diff --git a/src/sys/netinet/ip.h b/src/sys/netinet/ip.h
 index 3c9b5c4..a0f3fb8 100644
 --- a/src/sys/netinet/ip.h
 +++ b/src/sys/netinet/ip.h
 @@ -34,7 +34,9 @@
  #ifndef _NETINET_IP_H_
  #define _NETINET_IP_H_

 +#include <sys/endian.h>
  #include <netinet/in_systm.h>	/* for n_time */
 +
  /*
   * Definitions for internet protocol version 4.
   * Per RFC 791, September 1981.
 diff --git a/src/sys/netinet/tcp.h b/src/sys/netinet/tcp.h
 index d987f2e..79881b9 100644
 --- a/src/sys/netinet/tcp.h
 +++ b/src/sys/netinet/tcp.h
 @@ -38,6 +38,7 @@

  #if defined(_NETBSD_SOURCE)
  #include <sys/types.h>
 +#include <sys/endian.h>

  typedef uint32_t tcp_seq;
  /*
 diff --git a/src/sys/netinet6/in6.h b/src/sys/netinet6/in6.h
 index 4b72d31..19f3009 100644
 --- a/src/sys/netinet6/in6.h
 +++ b/src/sys/netinet6/in6.h
 @@ -178,6 +178,7 @@ extern const struct in6_addr in6mask128;
   * Macros started with IPV6_ADDR is KAME local
   */
  #ifdef _KERNEL	/* XXX nonstandard */
 +#include <sys/endian.h>
  #if BYTE_ORDER == BIG_ENDIAN
  #define IPV6_ADDR_INT32_ONE	1
  #define IPV6_ADDR_INT32_TWO	2
 diff --git a/src/sys/sys/cdio.h b/src/sys/sys/cdio.h
 index 2684cb5..f0a24d3 100644
 --- a/src/sys/sys/cdio.h
 +++ b/src/sys/sys/cdio.h
 @@ -3,6 +3,8 @@
  #ifndef _SYS_CDIO_H_
  #define _SYS_CDIO_H_

 +#include <sys/endian.h>
 +
  /* Shared between kernel & process */

  union msf_lba {
 diff --git a/src/sys/sys/exec_aout.h b/src/sys/sys/exec_aout.h
 index bfbfda4..15b840e 100644
 --- a/src/sys/sys/exec_aout.h
 +++ b/src/sys/sys/exec_aout.h
 @@ -33,6 +33,8 @@
  #ifndef _SYS_EXEC_AOUT_H_
  #define _SYS_EXEC_AOUT_H_

 +#include <sys/endian.h>
 +
  #ifndef N_PAGSIZ
  #define	N_PAGSIZ(ex)	(AOUT_LDPGSZ)
  #endif
 diff --git a/src/sys/sys/midiio.h b/src/sys/sys/midiio.h
 index 8d1cbef..3c30829 100644
 --- a/src/sys/sys/midiio.h
 +++ b/src/sys/sys/midiio.h
 @@ -38,7 +38,7 @@
   * the binary level.
   */

 -#include <machine/endian_machdep.h>
 +#include <sys/endian.h>

  /*
   * ioctl() commands for /dev/midi##
 diff --git a/src/sys/sys/wait.h b/src/sys/sys/wait.h
 index 0a37176..4299fb3 100644
 --- a/src/sys/sys/wait.h
 +++ b/src/sys/sys/wait.h
 @@ -113,6 +113,7 @@
  #define	WAIT_MYPGRP	0	/* any process in my process group */

  #include <sys/types.h>
 +#include <sys/endian.h>

  /*
   * Deprecated:
 diff --git a/src/sys/ufs/ext2fs/ext2fs.h b/src/sys/ufs/ext2fs/ext2fs.h
 index 6b994a2..97e2fa6 100644
 --- a/src/sys/ufs/ext2fs/ext2fs.h
 +++ b/src/sys/ufs/ext2fs/ext2fs.h
 @@ -63,6 +63,7 @@
  #define _UFS_EXT2FS_EXT2FS_H_

  #include <sys/bswap.h>
 +#include <sys/endian.h>

  /*
   * Each disk drive contains some number of file systems.
 diff --git a/src/sys/ufs/ufs/dir.h b/src/sys/ufs/ufs/dir.h
 index 74cf7e7..3d4e7c9 100644
 --- a/src/sys/ufs/ufs/dir.h
 +++ b/src/sys/ufs/ufs/dir.h
 @@ -39,6 +39,8 @@
  #ifndef _UFS_UFS_DIR_H_
  #define	_UFS_UFS_DIR_H_

 +#include <sys/endian.h>
 +
  /*
   * Theoretically, directories can be more than 2Gb in length; however, in
   * practice this seems unlikely. So, we define the type doff_t as a 32-bit
 diff --git a/src/usr.bin/vndcompress/vndcompress.h b/src/usr.bin/vndcompress/vndcompress.h
 index dec9a5f..c0f1032 100644
 --- a/src/usr.bin/vndcompress/vndcompress.h
 +++ b/src/usr.bin/vndcompress/vndcompress.h
 @@ -47,6 +47,7 @@
  #ifndef __CLCONFIG_H__
  #define __CLCONFIG_H__

 +#include <sys/endian.h>
  #include <machine/bswap.h>

  struct cloop_header;
 diff --git a/src/usr.bin/window/ww.h b/src/usr.bin/window/ww.h
 index 1c0fcf7..df9588d 100644
 --- a/src/usr.bin/window/ww.h
 +++ b/src/usr.bin/window/ww.h
 @@ -38,6 +38,7 @@
  #define __WW_H__

  #include <sys/types.h>
 +#include <sys/endian.h>
  #ifdef OLD_TTY
  #include <sgtty.h>
  #else
 diff --git a/src/usr.sbin/dev_mkdb/dev_mkdb.c b/src/usr.sbin/dev_mkdb/dev_mkdb.c
 index a103a3a..0b7e5ea 100644
 --- a/src/usr.sbin/dev_mkdb/dev_mkdb.c
 +++ b/src/usr.sbin/dev_mkdb/dev_mkdb.c
 @@ -34,6 +34,7 @@ __RCSID("$NetBSD: dev_mkdb.c,v 1.28.4.1 2012/06/23 22:54:58 riz Exp $");

  #include <sys/queue.h>
  #include <sys/stat.h>
 +#include <sys/endian.h>

  #include <cdbw.h>
  #include <db.h>
 diff --git a/src/usr.sbin/makefs/v7fs.c b/src/usr.sbin/makefs/v7fs.c
 index c55c097..3cde165 100644
 --- a/src/usr.sbin/makefs/v7fs.c
 +++ b/src/usr.sbin/makefs/v7fs.c
 @@ -38,6 +38,7 @@
  __RCSID("$NetBSD: v7fs.c,v 1.3 2011/08/10 11:31:49 uch Exp $");
  #endif	/* !__lint */

 +#include <sys/endian.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <unistd.h>
 diff --git a/src/usr.sbin/mopd/common/get.c b/src/usr.sbin/mopd/common/get.c
 index ae471a2..268cd87 100644
 --- a/src/usr.sbin/mopd/common/get.c
 +++ b/src/usr.sbin/mopd/common/get.c
 @@ -32,6 +32,7 @@ __RCSID("$NetBSD: get.c,v 1.6 2009/11/17 18:58:07 drochner Exp $");
  #include "os.h"
  #include "get.h"
  #include "mopdef.h"
 +#include <arpa/inet.h>

  u_char
  mopGetChar(const u_char *pkt, int *idx)
 diff --git a/src/usr.sbin/paxctl/paxctl.c b/src/usr.sbin/paxctl/paxctl.c
 index 12dacc4..8e4de6a 100644
 --- a/src/usr.sbin/paxctl/paxctl.c
 +++ b/src/usr.sbin/paxctl/paxctl.c
 @@ -39,6 +39,7 @@ __RCSID("$NetBSD: paxctl.c,v 1.12 2009/10/27 16:27:47 christos Exp $");
  #endif /* not lint */

  #include <sys/types.h>
 +#include <machine/bswap.h>
  #ifdef HAVE_NBTOOL_CONFIG_H
  #include "../../sys/sys/exec_elf.h"
  #else
 diff --git a/xsrc/external/mit/MesaLib/dist/src/mesa/main/compiler.h b/xsrc/external/mit/MesaLib/dist/src/mesa/main/compiler.h
 index 81704ae..5a3229e 100644
 --- a/xsrc/external/mit/MesaLib/dist/src/mesa/main/compiler.h
 +++ b/xsrc/external/mit/MesaLib/dist/src/mesa/main/compiler.h
 @@ -33,6 +33,7 @@
  #ifndef COMPILER_H
  #define COMPILER_H

 +#include <sys/endian.h>

  #include <assert.h>
  #include <ctype.h>
 -- 
 1.7.9.3


 --------------050300020203060204000000--

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.