This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.24-189-g4775578


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  4775578486c8ee2aa09b402eb272eb932e7e0691 (commit)
       via  c66b29f9cce9bf7c67d55879dff5e4cd03ecfac1 (commit)
       via  05b68e14b146586c46121730241142256f0ef850 (commit)
       via  f2bea4da2e65b5d91a23a01fb2062bcec33974aa (commit)
       via  11160cb76f56e0a711686e34881a4eaf1ad2fa0e (commit)
       via  cb765808fbffca30a1c67cf01ffdce30f8e6df3e (commit)
      from  3a35923e97a6e6e67f95a59ba7e45be22b45cd0b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4775578486c8ee2aa09b402eb272eb932e7e0691

commit 4775578486c8ee2aa09b402eb272eb932e7e0691
Author: Zack Weinberg <zackw@panix.com>
Date:   Tue Aug 23 21:19:17 2016 -0400

    Installed header hygiene (BZ#20366): Test of installed headers.
    
    This adds a test to ensure that the problems fixed in the last several
    patches do not recur.  Each directory checks the headers that it
    installs for two properties: first, each header must be compilable in
    isolation, as both C and C++, under a representative combination of
    language and library conformance levels; second, there is a blacklist
    of identifiers that may not appear in any installed header, currently
    consisting of the legacy BSD typedefs.  (There is an exemption for the
    headers that define those typedefs, and for the RPC headers.  It may be
    necessary to make this more sophisticated if we add more stuff to the
    blacklist in the future.)
    
    In order for this test to work correctly, every wrapper header
    that actually defines something must guard those definitions with
     #ifndef _ISOMAC.  This is the existing mechanism used by the conform/
    tests to tell wrapper headers not to define anything that the public
    header wouldn't, and not to use anything from libc-symbols.h.  conform/
    only cares for headers that we need to check for standards conformance,
    whereas this test applies to *every* header.  (Headers in include/ that
    are either installed directly, or are internal-use-only and do *not*
    correspond to any installed header, are not affected.)
    
    	* scripts/check-installed-headers.sh: New script.
    	* Rules: In each directory that defines header files to be installed,
    	run check-installed-headers.sh on them as a special test.
    	* Makefile: Likewise for the headers installed at top level.
    
    	* include/aliases.h, include/alloca.h, include/argz.h
    	* include/arpa/nameser.h, include/arpa/nameser_compat.h
    	* include/elf.h, include/envz.h, include/err.h
    	* include/execinfo.h, include/fpu_control.h, include/getopt.h
    	* include/gshadow.h, include/ifaddrs.h, include/libintl.h
    	* include/link.h, include/malloc.h, include/mcheck.h
    	* include/mntent.h, include/netinet/ether.h
    	* include/nss.h, include/obstack.h, include/printf.h
    	* include/pty.h, include/resolv.h, include/rpc/auth.h
    	* include/rpc/auth_des.h, include/rpc/auth_unix.h
    	* include/rpc/clnt.h, include/rpc/des_crypt.h
    	* include/rpc/key_prot.h, include/rpc/netdb.h
    	* include/rpc/pmap_clnt.h, include/rpc/pmap_prot.h
    	* include/rpc/pmap_rmt.h, include/rpc/rpc.h
    	* include/rpc/rpc_msg.h, include/rpc/svc.h
    	* include/rpc/svc_auth.h, include/rpc/xdr.h
    	* include/rpcsvc/nis_callback.h, include/rpcsvc/nislib.h
    	* include/rpcsvc/yp.h, include/rpcsvc/ypclnt.h
    	* include/rpcsvc/ypupd.h, include/shadow.h
    	* include/stdio_ext.h, include/sys/epoll.h
    	* include/sys/file.h, include/sys/gmon.h, include/sys/ioctl.h
    	* include/sys/prctl.h, include/sys/profil.h
    	* include/sys/statfs.h, include/sys/sysctl.h
    	* include/sys/sysinfo.h, include/ttyent.h, include/utmp.h
    	* sysdeps/arm/nacl/include/bits/setjmp.h
    	* sysdeps/mips/include/sys/asm.h
    	* sysdeps/unix/sysv/linux/include/sys/sysinfo.h
    	* sysdeps/unix/sysv/linux/include/sys/timex.h
    	* sysdeps/x86/fpu/include/bits/fenv.h:
    	Add #ifndef _ISOMAC guard around internal declarations.
    	Add multiple-inclusion guard if not already present.

diff --git a/ChangeLog b/ChangeLog
index 47ea836..fa6d945 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,44 @@
 2016-09-23  Zack Weinberg  <zackw@panix.com>
 
+	* scripts/check-installed-headers.sh: New script.
+	* Rules: In each directory that defines header files to be installed,
+	run check-installed-headers.sh on them as a special test.
+	* Makefile: Likewise for the headers installed at top level.
+
+	* include/aliases.h, include/alloca.h, include/argz.h
+	* include/arpa/nameser.h, include/arpa/nameser_compat.h
+	* include/elf.h, include/envz.h, include/err.h
+	* include/execinfo.h, include/fpu_control.h, include/getopt.h
+	* include/gshadow.h, include/ifaddrs.h, include/libintl.h
+	* include/link.h, include/malloc.h, include/mcheck.h
+	* include/mntent.h, include/netinet/ether.h
+	* include/nss.h, include/obstack.h, include/printf.h
+	* include/pty.h, include/resolv.h, include/rpc/auth.h
+	* include/rpc/auth_des.h, include/rpc/auth_unix.h
+	* include/rpc/clnt.h, include/rpc/des_crypt.h
+	* include/rpc/key_prot.h, include/rpc/netdb.h
+	* include/rpc/pmap_clnt.h, include/rpc/pmap_prot.h
+	* include/rpc/pmap_rmt.h, include/rpc/rpc.h
+	* include/rpc/rpc_msg.h, include/rpc/svc.h
+	* include/rpc/svc_auth.h, include/rpc/xdr.h
+	* include/rpcsvc/nis_callback.h, include/rpcsvc/nislib.h
+	* include/rpcsvc/yp.h, include/rpcsvc/ypclnt.h
+	* include/rpcsvc/ypupd.h, include/shadow.h
+	* include/stdio_ext.h, include/sys/epoll.h
+	* include/sys/file.h, include/sys/gmon.h, include/sys/ioctl.h
+	* include/sys/prctl.h, include/sys/profil.h
+	* include/sys/statfs.h, include/sys/sysctl.h
+	* include/sys/sysinfo.h, include/ttyent.h, include/utmp.h
+	* sysdeps/arm/nacl/include/bits/setjmp.h
+	* sysdeps/mips/include/sys/asm.h
+	* sysdeps/unix/sysv/linux/include/sys/sysinfo.h
+	* sysdeps/unix/sysv/linux/include/sys/timex.h
+	* sysdeps/x86/fpu/include/bits/fenv.h:
+	Add #ifndef _ISOMAC guard around internal declarations.
+	Add multiple-inclusion guard if not already present.
+
+2016-09-23  Zack Weinberg  <zackw@panix.com>
+
 	* sysdeps/generic/sys/ucontext.h
 	* sysdeps/arm/sys/ucontext.h
 	* sysdeps/i386/sys/ucontext.h
diff --git a/Makefile b/Makefile
index 4478c97..1ae3281 100644
--- a/Makefile
+++ b/Makefile
@@ -318,6 +318,29 @@ $(objpfx)begin-end-check.out: scripts/begin-end-check.pl
 	$(evaluate-test)
 endif
 
+ifneq "$(headers)" ""
+# Special test of all the installed headers in this directory.
+tests-special += $(objpfx)check-installed-headers-c.out
+libof-check-installed-headers-c := nonlib
+$(objpfx)check-installed-headers-c.out: \
+    scripts/check-installed-headers.sh $(headers)
+	$(SHELL) $(..)scripts/check-installed-headers.sh c \
+	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(headers) > $@; \
+	$(evaluate-test)
+
+ifneq "$(CXX)" ""
+tests-special += $(objpfx)check-installed-headers-cxx.out
+libof-check-installed-headers-cxx := nonlib
+$(objpfx)check-installed-headers-cxx.out: \
+    scripts/check-installed-headers.sh $(headers)
+	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
+	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(headers) > $@; \
+	$(evaluate-test)
+endif
+endif
+
 define summarize-tests
 @egrep -v '^(PASS|XFAIL):' $(objpfx)$1 || true
 @echo "Summary of test results$2:"
diff --git a/Rules b/Rules
index 8306d36..342d659 100644
--- a/Rules
+++ b/Rules
@@ -80,6 +80,29 @@ $(common-objpfx)dummy.c:
 	(echo 'extern void __dummy__ (void);'; \
 	 echo 'void __dummy__ (void) { }') > $@
 common-generated += dummy.o dummy.c
+
+ifneq "$(headers)" ""
+# Special test of all the installed headers in this directory.
+tests-special += $(objpfx)check-installed-headers-c.out
+libof-check-installed-headers-c := nonlib
+$(objpfx)check-installed-headers-c.out: \
+    $(..)scripts/check-installed-headers.sh $(headers)
+	$(SHELL) $(..)scripts/check-installed-headers.sh c \
+	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(headers) > $@; \
+	$(evaluate-test)
+
+ifneq "$(CXX)" ""
+tests-special += $(objpfx)check-installed-headers-cxx.out
+libof-check-installed-headers-cxx := nonlib
+$(objpfx)check-installed-headers-cxx.out: \
+    $(..)scripts/check-installed-headers.sh $(headers)
+	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
+	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(headers) > $@; \
+	$(evaluate-test)
+endif
+endif
 
 # This makes all the auxiliary and test programs.
 
diff --git a/include/aliases.h b/include/aliases.h
index f7cfafc..ece69eb 100644
--- a/include/aliases.h
+++ b/include/aliases.h
@@ -1,6 +1,8 @@
 #ifndef _ALIASES_H
 #include <inet/aliases.h>
 
+# ifndef _ISOMAC
+
 extern int __getaliasent_r (struct aliasent *__restrict __result_buf,
 			    char *__restrict __buffer, size_t __buflen,
 			    struct aliasent **__restrict __result)
@@ -34,4 +36,5 @@ DECLARE_NSS_PROTOTYPES (nis)
 DECLARE_NSS_PROTOTYPES (nisplus)
 #undef DECLARE_NSS_PROTOTYPES
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/alloca.h b/include/alloca.h
index 0150025..fd90664 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -1,6 +1,9 @@
 #ifndef _ALLOCA_H
 
 #include <stdlib/alloca.h>
+
+# ifndef _ISOMAC
+
 #include <stackinfo.h>
 
 #undef	__alloca
@@ -73,4 +76,5 @@ libc_hidden_proto (__libc_alloca_cutoff)
      extend_alloca (buf, len, s__); })
 #endif
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/argz.h b/include/argz.h
index 4eab0b6..0388c23 100644
--- a/include/argz.h
+++ b/include/argz.h
@@ -2,8 +2,11 @@
 
 #include <string/argz.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (argz_delete)
 libc_hidden_proto (__argz_count)
 libc_hidden_proto (__argz_stringify)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h
index ce6f023..cd7ab6e 100644
--- a/include/arpa/nameser.h
+++ b/include/arpa/nameser.h
@@ -2,6 +2,8 @@
 
 #include <resolv/arpa/nameser.h>
 
+# ifndef _ISOMAC
+
 /* If the machine allows unaligned access we can do better than using
    the NS_GET16, NS_GET32, NS_PUT16, and NS_PUT32 macros from the
    installed header.  */
@@ -74,4 +76,5 @@ libresolv_hidden_proto (ns_samename)
 libresolv_hidden_proto (ns_makecanon)
 libresolv_hidden_proto (ns_format_ttl)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/arpa/nameser_compat.h b/include/arpa/nameser_compat.h
index 2e735ed..6928000 100644
--- a/include/arpa/nameser_compat.h
+++ b/include/arpa/nameser_compat.h
@@ -1,8 +1,11 @@
 #ifndef _ARPA_NAMESER_COMPAT_
 #include <resolv/arpa/nameser_compat.h>
 
+# ifndef _ISOMAC
+
 /* Picksome unused number to represent lookups of IPv4 and IPv6 (i.e.,
    T_A and T_AAAA).  */
 #define T_UNSPEC 62321
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/elf.h b/include/elf.h
index 60658c6..f06a33f 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -1,5 +1,8 @@
 #ifndef _ELF_H
-# include <elf/elf.h>
+#include <elf/elf.h>
+
+# ifndef _ISOMAC
+
 /* Some information which is not meant for the public and therefore not
    in <elf.h>.  */
 # include <dl-dtprocnum.h>
@@ -9,4 +12,6 @@
 # define DT_1_SUPPORTED_MASK \
    (DF_1_NOW | DF_1_NODELETE | DF_1_INITFIRST | DF_1_NOOPEN \
     | DF_1_ORIGIN | DF_1_NODEFLIB)
-#endif
+
+# endif /* !_ISOMAC */
+#endif /* elf.h */
diff --git a/include/envz.h b/include/envz.h
index 8cfd9b5..633fcc6 100644
--- a/include/envz.h
+++ b/include/envz.h
@@ -2,7 +2,10 @@
 
 #include <string/envz.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (envz_entry)
 libc_hidden_proto (envz_remove)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/err.h b/include/err.h
index 737dfc1..3828559 100644
--- a/include/err.h
+++ b/include/err.h
@@ -1,8 +1,14 @@
+#ifndef _ERR_H
 #include <misc/err.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (warn)
 libc_hidden_proto (warnx)
 libc_hidden_proto (vwarn)
 libc_hidden_proto (vwarnx)
 libc_hidden_proto (verr)
 libc_hidden_proto (verrx)
+
+# endif /* !_ISOMAC */
+#endif /* err.h */
diff --git a/include/execinfo.h b/include/execinfo.h
index c929821..0b132b0 100644
--- a/include/execinfo.h
+++ b/include/execinfo.h
@@ -1,6 +1,8 @@
 #ifndef _EXECINFO_H
 #include <debug/execinfo.h>
 
+# ifndef _ISOMAC
+
 extern int __backtrace (void **__array, int __size);
 libc_hidden_proto (__backtrace)
 
@@ -10,4 +12,5 @@ extern void __backtrace_symbols_fd (void *const *__array, int __size,
 				    int __fd);
 libc_hidden_proto (__backtrace_symbols_fd)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/fpu_control.h b/include/fpu_control.h
index d0b5e9c..4498a83 100644
--- a/include/fpu_control.h
+++ b/include/fpu_control.h
@@ -1,4 +1,10 @@
+#ifndef _FPU_CONTROL_H
 #include_next <fpu_control.h>
 
+# ifndef _ISOMAC
+
 /* Called at startup.  It can be used to manipulate fpu control register.  */
 extern void __setfpucw (fpu_control_t);
+
+# endif /* !_ISOMAC */
+#endif /* fpu_control.h */
diff --git a/include/getopt.h b/include/getopt.h
index 6f2693d..c094972 100644
--- a/include/getopt.h
+++ b/include/getopt.h
@@ -3,11 +3,10 @@
 #include <features.h>		/* Get __GNU_LIBRARY__ defined now.  */
 #include <posix/getopt.h>
 
-# ifdef _GETOPT_H
+# if defined _GETOPT_H && !defined _ISOMAC
 
 /* Now define the internal interfaces.  */
 extern void __getopt_clean_environment (char **__env);
 
-# endif
-
+# endif /* _GETOPT_H && !_ISOMAC */
 #endif
diff --git a/include/gshadow.h b/include/gshadow.h
index 8a981f6..532801a 100644
--- a/include/gshadow.h
+++ b/include/gshadow.h
@@ -1,6 +1,8 @@
 #ifndef _GSHADOW_H
 #include <gshadow/gshadow.h>
 
+# ifndef _ISOMAC
+
 extern int __fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer,
 			  size_t buflen, struct sgrp **result);
 extern int __sgetsgent_r (const char *string, struct sgrp *resbuf,
@@ -12,4 +14,5 @@ extern int _nss_files_parse_sgent (char *line, struct sgrp *result,
                                    size_t datalen, int *errnop);
 libc_hidden_proto (_nss_files_parse_sgent)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/ifaddrs.h b/include/ifaddrs.h
index 2787f21..54f4b7a 100644
--- a/include/ifaddrs.h
+++ b/include/ifaddrs.h
@@ -1,5 +1,8 @@
 #ifndef _IFADDRS_H
 #include <inet/ifaddrs.h>
+
+# ifndef _ISOMAC
+
 #include <stdbool.h>
 #include <stdint.h>
 
@@ -30,4 +33,5 @@ extern void __check_native (uint32_t a1_index, int *a1_native,
 extern uint32_t __bump_nl_timestamp (void) attribute_hidden;
 #endif
 
+# endif /* !_ISOMAC */
 #endif	/* ifaddrs.h */
diff --git a/include/libintl.h b/include/libintl.h
index 0551a04..9a11367 100644
--- a/include/libintl.h
+++ b/include/libintl.h
@@ -1,5 +1,8 @@
 #ifndef _LIBINTL_H
 #include <intl/libintl.h>
+
+# ifndef _ISOMAC
+
 #include <locale.h>
 
 /* Now define the internal interfaces.  */
@@ -46,4 +49,5 @@ libc_hidden_proto (_libc_intl_domainname)
 # define _(msgid) \
   __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/link.h b/include/link.h
index 32a7392..0558442 100644
--- a/include/link.h
+++ b/include/link.h
@@ -24,12 +24,18 @@
 # error this should be impossible
 #endif
 
+# ifndef _ISOMAC
 /* Get most of the contents from the public header, but we define a
    different `struct link_map' type for private use.  The la_objopen
    prototype uses the type, so we have to declare it separately.  */
-#define link_map	link_map_public
-#define la_objopen	la_objopen_wrongproto
+#  define link_map	link_map_public
+#  define la_objopen	la_objopen_wrongproto
+# endif
+
 #include <elf/link.h>
+
+# ifndef _ISOMAC
+
 #undef	link_map
 #undef	la_objopen
 
@@ -341,4 +347,5 @@ extern int __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
    `ELF64_R_TYPE'.  */
 #define ELFW(type)	_ElfW (ELF, __ELF_NATIVE_CLASS, type)
 
+# endif /* !_ISOMAC */
 #endif /* include/link.h */
diff --git a/include/malloc.h b/include/malloc.h
index 42fc8ed..70d32c7 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -1,6 +1,7 @@
 #ifndef _MALLOC_H
 #include <malloc/malloc.h>
 
+# ifndef _ISOMAC
 
 /* In the GNU libc we rename the global variable
    `__malloc_initialized' to `__libc_malloc_initialized'.  */
@@ -11,4 +12,5 @@ extern int __malloc_initialized attribute_hidden;
 struct malloc_state;
 typedef struct malloc_state *mstate;
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/mcheck.h b/include/mcheck.h
index b0037a7..8883c3d 100644
--- a/include/mcheck.h
+++ b/include/mcheck.h
@@ -2,7 +2,10 @@
 
 #include <malloc/mcheck.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (mcheck)
 libc_hidden_proto (mcheck_check_all)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/mntent.h b/include/mntent.h
index b34674a..169210f 100644
--- a/include/mntent.h
+++ b/include/mntent.h
@@ -1,6 +1,8 @@
 #ifndef _MNTENT_H
 #include <misc/mntent.h>
 
+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern FILE *__setmntent (const char *__file, const char *__mode);
 extern struct mntent *__getmntent_r (FILE *__stream,
@@ -14,4 +16,5 @@ libc_hidden_proto (__setmntent)
 libc_hidden_proto (__getmntent_r)
 libc_hidden_proto (__endmntent)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/netinet/ether.h b/include/netinet/ether.h
index 2efe4c0..8bfe7e0 100644
--- a/include/netinet/ether.h
+++ b/include/netinet/ether.h
@@ -1,6 +1,8 @@
 #ifndef _NETINET_ETHER_H
 #include <inet/netinet/ether.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (ether_aton_r)
 libc_hidden_proto (ether_ntoa_r)
 
@@ -39,4 +41,5 @@ DECLARE_NSS_PROTOTYPES (nisplus)
 
 #undef DECLARE_NSS_PROTOTYPES
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/nss.h b/include/nss.h
index 1e8cc39..6358a10 100644
--- a/include/nss.h
+++ b/include/nss.h
@@ -1,6 +1,8 @@
 #ifndef _NSS_H
 #include <nss/nss.h>
 
+# ifndef _ISOMAC
+
 #define NSS_INVALID_FIELD_CHARACTERS ":\n"
 extern const char __nss_invalid_field_characters[] attribute_hidden;
 
@@ -11,4 +13,5 @@ _Bool __nss_valid_list_field (char **list)
 const char *__nss_rewrite_field (const char *value, char **to_be_freed)
   attribute_hidden internal_function;
 
+# endif /* !_ISOMAC */
 #endif /* _NSS_H */
diff --git a/include/obstack.h b/include/obstack.h
index 349d59b..fe2e595 100644
--- a/include/obstack.h
+++ b/include/obstack.h
@@ -1,3 +1,9 @@
+#ifndef _OBSTACK_H
 #include <malloc/obstack.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (_obstack_newchunk)
+
+# endif /* !_ISOMAC */
+#endif /* obstack.h */
diff --git a/include/printf.h b/include/printf.h
index b12b5dc..984f263 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -1,6 +1,9 @@
 #ifndef	_PRINTF_H
 
 #include <stdio-common/printf.h>
+
+# ifndef _ISOMAC
+
 #include <xlocale.h>
 
 /* Now define the internal interfaces.  */
@@ -13,4 +16,5 @@ extern int __printf_fp_l (FILE *, locale_t, const struct printf_info *,
 			  const void *const *);
 libc_hidden_proto (__printf_fp_l)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/pty.h b/include/pty.h
index a91be80..4979bb7 100644
--- a/include/pty.h
+++ b/include/pty.h
@@ -1,6 +1,9 @@
 #ifndef _PTY_H
 #include <login/pty.h>
 
+# ifndef _ISOMAC
+
 libutil_hidden_proto (openpty)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/resolv.h b/include/resolv.h
index 52ac218..699cc81 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -1,17 +1,19 @@
 #ifndef _RESOLV_H_
 
-#define RES_SET_H_ERRNO(r,x)			\
+# ifndef _ISOMAC
+#  include <stdbool.h>
+#  define RES_SET_H_ERRNO(r,x)			\
   do						\
     {						\
       (r)->res_h_errno = x;			\
       __set_h_errno(x);				\
     }						\
   while (0)
+# endif
 
-#include <stdbool.h>
 #include <resolv/resolv.h>
 
-#ifdef _RESOLV_H_
+# if defined _RESOLV_H_ && !defined _ISOMAC
 
 # if IS_IN (libc)
 #  define __resp __libc_resp
@@ -97,6 +99,5 @@ libresolv_hidden_proto (__p_secstodate)
 extern const char *_res_opcodes[];
 libresolv_hidden_proto (_res_opcodes)
 
-#endif
-
+# endif /* _RESOLV_H_ && !_ISOMAC */
 #endif
diff --git a/include/rpc/auth.h b/include/rpc/auth.h
index 0219fd9..2e55cce 100644
--- a/include/rpc/auth.h
+++ b/include/rpc/auth.h
@@ -1,6 +1,8 @@
 #ifndef _RPC_AUTH_H
 #include <sunrpc/rpc/auth.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (getnetname)
 libc_hidden_proto (netname2user)
 libc_hidden_proto (host2netname)
@@ -41,4 +43,5 @@ libc_hidden_proto (key_setnet)
 libc_hidden_proto (key_setsecret)
 libc_hidden_proto (netname2host)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/auth_des.h b/include/rpc/auth_des.h
index 0e9db1a..6afed56 100644
--- a/include/rpc/auth_des.h
+++ b/include/rpc/auth_des.h
@@ -2,6 +2,8 @@
 
 #include <sunrpc/rpc/auth_des.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (getpublickey)
 libc_hidden_proto (getsecretkey)
 libc_hidden_proto (rtime)
@@ -32,4 +34,5 @@ libc_hidden_proto (authdes_getucred)
 libc_hidden_proto (xdr_authdes_cred)
 libc_hidden_proto (xdr_authdes_verf)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/auth_unix.h b/include/rpc/auth_unix.h
index 07031c9..019efa2 100644
--- a/include/rpc/auth_unix.h
+++ b/include/rpc/auth_unix.h
@@ -1,3 +1,9 @@
+#ifndef _RPC_AUTH_UNIX_H
 #include <sunrpc/rpc/auth_unix.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (xdr_authunix_parms)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/auth_unix.h */
diff --git a/include/rpc/clnt.h b/include/rpc/clnt.h
index d79a6a7..a397023 100644
--- a/include/rpc/clnt.h
+++ b/include/rpc/clnt.h
@@ -1,6 +1,8 @@
 #ifndef _RPC_CLNT_H
 #include <sunrpc/rpc/clnt.h>
 
+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern int _openchild (const char *command, FILE **fto, FILE **ffrom);
 
@@ -27,4 +29,5 @@ libc_hidden_proto (get_myaddress)
 libc_hidden_proto (clntunix_create)
 libc_hidden_proto (__libc_clntudp_bufcreate)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/des_crypt.h b/include/rpc/des_crypt.h
index 44f7e66..7a34957 100644
--- a/include/rpc/des_crypt.h
+++ b/include/rpc/des_crypt.h
@@ -1,6 +1,8 @@
 #ifndef __DES_CRYPT_H__
 #include <sunrpc/rpc/des_crypt.h>
 
+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 
 extern int xencrypt (char *secret, char *passwd);
@@ -12,4 +14,5 @@ libc_hidden_proto (cbc_crypt)
 libc_hidden_proto (xencrypt)
 libc_hidden_proto (xdecrypt)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/key_prot.h b/include/rpc/key_prot.h
index 29d14cc..4711a94 100644
--- a/include/rpc/key_prot.h
+++ b/include/rpc/key_prot.h
@@ -1,5 +1,8 @@
+#ifndef _KEY_PROT_H_RPCGEN
 #include <sunrpc/rpc/key_prot.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (xdr_cryptkeyarg)
 libc_hidden_proto (xdr_cryptkeyarg2)
 libc_hidden_proto (xdr_cryptkeyres)
@@ -10,3 +13,6 @@ libc_hidden_proto (xdr_keystatus)
 libc_hidden_proto (xdr_getcredres)
 libc_hidden_proto (xdr_netnamestr)
 libc_hidden_proto (xdr_unixcred)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/key_prot.h */
diff --git a/include/rpc/netdb.h b/include/rpc/netdb.h
index 65af237..9b84668 100644
--- a/include/rpc/netdb.h
+++ b/include/rpc/netdb.h
@@ -1,6 +1,8 @@
 #ifndef _RPC_NETDB_H
 #include <sunrpc/rpc/netdb.h>
 
+# ifndef _ISOMAC
+
 extern int __getrpcbyname_r (const char *__name, struct rpcent *__result_buf,
 			     char *__buffer, size_t __buflen,
 			     struct rpcent **__result);
@@ -48,4 +50,5 @@ DECLARE_NSS_PROTOTYPES (nisplus)
 
 #undef DECLARE_NSS_PROTOTYPES
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/pmap_clnt.h b/include/rpc/pmap_clnt.h
index 67628e0..ec907c2 100644
--- a/include/rpc/pmap_clnt.h
+++ b/include/rpc/pmap_clnt.h
@@ -1,5 +1,7 @@
 #ifndef _RPC_PMAP_CLNT_H
-# include <sunrpc/rpc/pmap_clnt.h>
+#include <sunrpc/rpc/pmap_clnt.h>
+
+# ifndef _ISOMAC
 
 libc_hidden_proto (pmap_getport)
 libc_hidden_proto (pmap_set)
@@ -18,4 +20,5 @@ libc_hidden_proto (clnt_broadcast)
 libc_hidden_proto (pmap_getmaps)
 libc_hidden_proto (pmap_rmtcall)
 
-#endif
+# endif /* !_ISOMAC */
+#endif /* rpc/pmap_clnt.h */
diff --git a/include/rpc/pmap_prot.h b/include/rpc/pmap_prot.h
index 2e9076e..a2573d1 100644
--- a/include/rpc/pmap_prot.h
+++ b/include/rpc/pmap_prot.h
@@ -1,4 +1,10 @@
+#ifndef _RPC_PMAP_PROT_H
 #include <sunrpc/rpc/pmap_prot.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (xdr_pmap)
 libc_hidden_proto (xdr_pmaplist)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/pmap_prot.h */
diff --git a/include/rpc/pmap_rmt.h b/include/rpc/pmap_rmt.h
index e8822da..ae53a02 100644
--- a/include/rpc/pmap_rmt.h
+++ b/include/rpc/pmap_rmt.h
@@ -1,4 +1,10 @@
+#ifndef _RPC_PMAP_RMT_H
 #include <sunrpc/rpc/pmap_rmt.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (xdr_rmtcall_args)
 libc_hidden_proto (xdr_rmtcallres)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/pmap_rmt.h */
diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h
index 58bdef3..4c9ee82 100644
--- a/include/rpc/rpc.h
+++ b/include/rpc/rpc.h
@@ -1,5 +1,8 @@
 #ifndef _RPC_RPC_H
 #include <sunrpc/rpc/rpc.h>
+
+# ifndef _ISOMAC
+
 #include <libc-tsd.h>
 
 /* Now define the internal interfaces.  */
@@ -56,4 +59,5 @@ libc_hidden_proto (__rpc_thread_createerr)
 
 #endif /* _RPC_THREAD_SAFE_ */
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/rpc_msg.h b/include/rpc/rpc_msg.h
index be1f483..93c5ab8 100644
--- a/include/rpc/rpc_msg.h
+++ b/include/rpc/rpc_msg.h
@@ -1,6 +1,8 @@
 #ifndef _RPC_MSG_H
 #include <sunrpc/rpc/rpc_msg.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (_seterr_reply)
 
 /* Now define the internal interfaces.  */
@@ -14,4 +16,5 @@ libc_hidden_proto (xdr_callmsg)
 libc_hidden_proto (xdr_rejected_reply)
 libc_hidden_proto (xdr_replymsg)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/svc.h b/include/rpc/svc.h
index 61a8ab3..465bf44 100644
--- a/include/rpc/svc.h
+++ b/include/rpc/svc.h
@@ -1,6 +1,8 @@
 #ifndef _RPC_SVC_H
 #include <sunrpc/rpc/svc.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (xprt_register)
 libc_hidden_proto (xprt_unregister)
 libc_hidden_proto (svc_register)
@@ -37,4 +39,5 @@ libc_hidden_proto (svc_getreq_poll)
 
 extern void __svc_accept_failed (void) attribute_hidden;
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/svc_auth.h b/include/rpc/svc_auth.h
index 582bb31..2609d19 100644
--- a/include/rpc/svc_auth.h
+++ b/include/rpc/svc_auth.h
@@ -1,6 +1,8 @@
 #ifndef _RPC_SVC_AUTH_H
 #include <sunrpc/rpc/svc_auth.h>
 
+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern enum auth_stat _svcauth_unix (struct svc_req *rqst,
 				     struct rpc_msg *msg);
@@ -9,4 +11,5 @@ extern enum auth_stat _svcauth_short (struct svc_req *rqst,
 
 libc_hidden_proto (_authenticate)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h
index 57971d0..e1bff1c 100644
--- a/include/rpc/xdr.h
+++ b/include/rpc/xdr.h
@@ -1,5 +1,8 @@
+#ifndef _RPC_XDR_H
 #include <sunrpc/rpc/xdr.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (xdrstdio_create)
 libc_hidden_proto (xdr_array)
 libc_hidden_proto (xdr_bool)
@@ -45,3 +48,6 @@ libc_hidden_proto (xdr_int64_t)
 libc_hidden_proto (xdr_uint64_t)
 libc_hidden_proto (xdr_quad_t)
 libc_hidden_proto (xdr_u_quad_t)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/xdr.h */
diff --git a/include/rpcsvc/nis_callback.h b/include/rpcsvc/nis_callback.h
index dfa9cd3..0515d07 100644
--- a/include/rpcsvc/nis_callback.h
+++ b/include/rpcsvc/nis_callback.h
@@ -1,7 +1,10 @@
 #ifndef _RPCSVC_NIS_CALLBACK_H
 #include <nis/rpcsvc/nis_callback.h>
 
+# ifndef _ISOMAC
+
 libnsl_hidden_proto (xdr_obj_p)
 libnsl_hidden_proto (xdr_cback_data)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpcsvc/nislib.h b/include/rpcsvc/nislib.h
index 635c513..05b1987 100644
--- a/include/rpcsvc/nislib.h
+++ b/include/rpcsvc/nislib.h
@@ -1,6 +1,8 @@
 #ifndef __RPCSVC_NISLIB_H__
 #include <nis/rpcsvc/nislib.h>
 
+# ifndef _ISOMAC
+
 libnsl_hidden_proto (nis_leaf_of_r)
 libnsl_hidden_proto (nis_name_of_r)
 libnsl_hidden_proto (nis_getnames)
@@ -44,4 +46,5 @@ libnsl_hidden_proto (nis_clone_object)
 
 extern const_nis_name __nis_domain_of (const_nis_name) __THROW;
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpcsvc/yp.h b/include/rpcsvc/yp.h
index 04a973e..b6d7c15 100644
--- a/include/rpcsvc/yp.h
+++ b/include/rpcsvc/yp.h
@@ -1,6 +1,8 @@
 #ifndef __RPCSVC_YP_H__
 #include <nis/rpcsvc/yp.h>
 
+# ifndef _ISOMAC
+
 libnsl_hidden_proto (xdr_ypstat)
 libnsl_hidden_proto (xdr_ypxfrstat)
 libnsl_hidden_proto (xdr_domainname)
@@ -23,4 +25,5 @@ libnsl_hidden_proto (xdr_ypresp_order)
 libnsl_hidden_proto (xdr_ypbind_resp)
 libnsl_hidden_proto (xdr_ypresp_master)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpcsvc/ypclnt.h b/include/rpcsvc/ypclnt.h
index b38dc6b..1b4e2f2 100644
--- a/include/rpcsvc/ypclnt.h
+++ b/include/rpcsvc/ypclnt.h
@@ -1,10 +1,13 @@
 #ifndef __RPCSVC_YPCLNT_H__
 #include <nis/rpcsvc/ypclnt.h>
 
+# ifndef _ISOMAC
+
 libnsl_hidden_proto (ypbinderr_string)
 libnsl_hidden_proto (yp_bind)
 libnsl_hidden_proto (yp_get_default_domain)
 libnsl_hidden_proto (ypprot_err)
 libnsl_hidden_proto (yp_master)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpcsvc/ypupd.h b/include/rpcsvc/ypupd.h
index 7601971..6d179dd 100644
--- a/include/rpcsvc/ypupd.h
+++ b/include/rpcsvc/ypupd.h
@@ -1,8 +1,11 @@
 #ifndef __RPCSVC_YPUPD_H__
 #include <nis/rpcsvc/ypupd.h>
 
+# ifndef _ISOMAC
+
 libnsl_hidden_proto (xdr_yp_buf)
 libnsl_hidden_proto (xdr_ypdelete_args)
 libnsl_hidden_proto (xdr_ypupdate_args)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/shadow.h b/include/shadow.h
index a3f897c..124a1ab 100644
--- a/include/shadow.h
+++ b/include/shadow.h
@@ -1,6 +1,8 @@
 #ifndef _SHADOW_H
 #include <shadow/shadow.h>
 
+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern int __getspent_r (struct spwd *__result_buf, char *__buffer,
 			 size_t __buflen, struct spwd **__result)
@@ -47,4 +49,5 @@ DECLARE_NSS_PROTOTYPES (nisplus)
 #undef DECLARE_NSS_PROTOTYPES
 
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/stdio_ext.h b/include/stdio_ext.h
index 354146f..29c6e68 100644
--- a/include/stdio_ext.h
+++ b/include/stdio_ext.h
@@ -1,6 +1,7 @@
 #ifndef	_STDIO_EXT_H
+#include <stdio-common/stdio_ext.h>
 
-# include <stdio-common/stdio_ext.h>
+# ifndef _ISOMAC
 
 libc_hidden_proto (__fsetlocking)
 
@@ -18,5 +19,5 @@ libc_hidden_proto (__fsetlocking)
      __result;								\
   })
 
-
-#endif
+# endif /* !_ISOMAC */
+#endif /* stdio_ext.h */
diff --git a/include/sys/epoll.h b/include/sys/epoll.h
index ce1c2e2..86e0a54 100644
--- a/include/sys/epoll.h
+++ b/include/sys/epoll.h
@@ -1,6 +1,9 @@
 #ifndef _SYS_EPOLL_H
 #include_next <sys/epoll.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (epoll_pwait)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/sys/file.h b/include/sys/file.h
index e73a4d1..d0cd1f9 100644
--- a/include/sys/file.h
+++ b/include/sys/file.h
@@ -1,6 +1,10 @@
 #ifndef _SYS_FILE_H
 #include <misc/sys/file.h>
 
+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern int __flock (int __fd, int __operation);
+
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/sys/gmon.h b/include/sys/gmon.h
index 55739cf..30889d8 100644
--- a/include/sys/gmon.h
+++ b/include/sys/gmon.h
@@ -1,6 +1,8 @@
 #ifndef _SYS_GMON_H
 #include <gmon/sys/gmon.h>
 
+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 
 /* Write current profiling data to file.  */
@@ -12,4 +14,6 @@ extern void __bb_init_func (struct __bb *bb);
 extern void __bb_exit_func (void);
 
 extern struct gmonparam _gmonparam attribute_hidden;
+
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h
index ebadd52..bfc6909 100644
--- a/include/sys/ioctl.h
+++ b/include/sys/ioctl.h
@@ -1,6 +1,10 @@
 #ifndef _SYS_IOCTL_H
 #include <misc/sys/ioctl.h>
 
+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern int __ioctl (int __fd, unsigned long int __request, ...);
+
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/sys/prctl.h b/include/sys/prctl.h
index 316f454..0920ed6 100644
--- a/include/sys/prctl.h
+++ b/include/sys/prctl.h
@@ -1,6 +1,9 @@
 #ifndef _SYS_PRCTL_H
 #include_next <sys/prctl.h>
 
+# ifndef _ISOMAC
+
 extern int __prctl (int __option, ...);
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/sys/profil.h b/include/sys/profil.h
index 7bf1700..2b11330 100644
--- a/include/sys/profil.h
+++ b/include/sys/profil.h
@@ -1,9 +1,12 @@
 #ifndef _PROFIL_H
 #include <gmon/sys/profil.h>
 
+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 
 extern int __sprofil (struct prof *__profp, int __profcnt,
 		      struct timeval *__tvp, unsigned int __flags);
 
+# endif /* !_ISOMAC */
 #endif /* _PROFIL_H */
diff --git a/include/sys/statfs.h b/include/sys/statfs.h
index e34ad02..3fac4a3 100644
--- a/include/sys/statfs.h
+++ b/include/sys/statfs.h
@@ -1,10 +1,14 @@
 #ifndef _SYS_STATFS_H
 #include <io/sys/statfs.h>
 
+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern int __statfs (const char *__file, struct statfs *__buf);
 libc_hidden_proto (__statfs)
 extern int __fstatfs (int __fildes, struct statfs *__buf);
 extern int __statfs64 (const char *__file, struct statfs64 *__buf);
 extern int __fstatfs64 (int __fildes, struct statfs64 *__buf);
+
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/sys/sysctl.h b/include/sys/sysctl.h
index 4fffb4f..2a15e91 100644
--- a/include/sys/sysctl.h
+++ b/include/sys/sysctl.h
@@ -1,10 +1,13 @@
 #ifndef _SYS_SYSCTL_H
 #include_next <sys/sysctl.h>
 
+# ifndef _ISOMAC
+
 /* Read or write system parameters (Linux, FreeBSD specific).  */
 extern int __sysctl (int *__name, int __nlen, void *__oldval,
 		     size_t *__oldlenp, void *__newval, size_t __newlen);
 libc_hidden_proto (__sysctl)
 
 
+# endif /* !_ISOMAC */
 #endif  /* _SYS_SYSCTL_H */
diff --git a/include/sys/sysinfo.h b/include/sys/sysinfo.h
index d33055a..c33eae2 100644
--- a/include/sys/sysinfo.h
+++ b/include/sys/sysinfo.h
@@ -1,6 +1,8 @@
 #ifndef _SYS_SYSINFO_H
 #include_next <sys/sysinfo.h>
 
+# ifndef _ISOMAC
+
 /* Now we define the internal interface.  */
 
 /* Return number of configured processors.  */
@@ -18,4 +20,5 @@ extern long int __get_avphys_pages (void);
 /* Return maximum number of processes this real user ID can have.  */
 extern long int __get_child_max (void);
 
+# endif /* !_ISOMAC */
 #endif /* sys/sysinfo.h */
diff --git a/include/ttyent.h b/include/ttyent.h
index 81e5211..53a6668 100644
--- a/include/ttyent.h
+++ b/include/ttyent.h
@@ -1,5 +1,7 @@
 #ifndef	_TTYENT_H
-# include <misc/ttyent.h>
+#include <misc/ttyent.h>
+
+# ifndef _ISOMAC
 
 extern __typeof (getttyent) __getttyent __THROW;
 libc_hidden_proto (__getttyent)
@@ -8,4 +10,5 @@ libc_hidden_proto (__setttyent)
 extern __typeof (endttyent) __endttyent __THROW;
 libc_hidden_proto (__endttyent)
 
-#endif
+# endif /* !_ISOMAC */
+#endif /* ttyent.h */
diff --git a/include/utmp.h b/include/utmp.h
index 28207d1..6b2e262 100644
--- a/include/utmp.h
+++ b/include/utmp.h
@@ -1,6 +1,8 @@
 #ifndef _UTMP_H
 #include <login/utmp.h>
 
+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern void __updwtmp (const char *__wtmp_file, const struct utmp *__utmp);
 extern int __utmpname (const char *__file);
@@ -18,4 +20,5 @@ extern int __getutline_r (const struct utmp *__line,
 
 libutil_hidden_proto (login_tty)
 
+# endif /* !_ISOMAC */
 #endif
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
new file mode 100644
index 0000000..7fbc725
--- /dev/null
+++ b/scripts/check-installed-headers.sh
@@ -0,0 +1,146 @@
+#! /bin/sh
+# Copyright (C) 2016 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+#
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+# Check installed headers for cleanliness.  For each header, confirm
+# that it's possible to compile a file that includes that header and
+# does nothing else, in several different compilation modes.  Also,
+# scan the header for a set of obsolete typedefs that should no longer
+# appear.
+
+# These compilation switches assume GCC or compatible, which is probably
+# fine since we also assume that when _building_ glibc.
+c_modes="-std=c89 -std=gnu89 -std=c11 -std=gnu11"
+cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
+
+# An exhaustive test of feature selection macros would take far too long.
+# These are probably the most commonly used three.
+lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
+
+# sys/types.h+bits/types.h have to define the obsolete types.
+# rpc(svc)/* have the obsolete types too deeply embedded in their API
+# to remove.
+skip_obsolete_type_check='*/sys/types.h|*/bits/types.h|*/rpc/*|*/rpcsvc/*'
+obsolete_type_re=\
+'\<((__)?(quad_t|u(short|int|long|_(char|short|int([0-9]+_t)?|long|quad_t))))\>'
+
+if [ $# -lt 3 ]; then
+    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+    exit 2
+fi
+case "$1" in
+    (c)
+        lang_modes="$c_modes"
+        cih_test_c=$(mktemp ${TMPDIR-/tmp}/cih_test_XXXXXX.c)
+        already="$skip_obsolete_type_check"
+    ;;
+    (c++)
+        lang_modes="$cxx_modes"
+        cih_test_c=$(mktemp ${TMPDIR-/tmp}/cih_test_XXXXXX.cc)
+        # The obsolete-type check can be skipped for C++; it is
+        # sufficient to do it for C.
+        already="*"
+    ;;
+    (*)
+        echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+        exit 2;;
+esac
+shift
+cc_cmd="$1"
+shift
+trap "rm -f '$cih_test_c'" 0
+
+failed=0
+is_x86_64=unknown
+for header in "$@"; do
+    # Skip various headers for which this test gets a false failure.
+    case "$header" in
+        # bits/* are not meant to be included directly and usually #error
+        # out if you try it.
+        # regexp.h is a stub containing only an #error.
+        # Sun RPC's .x files are traditionally installed in
+        # $prefix/include/rpcsvc, but they are not C header files.
+        (bits/* | regexp.h | rpcsvc/*.x)
+            continue;;
+
+        # sys/elf.h and sys/vm86.h are "unsupported on x86-64" and
+        # #error out on that target.
+        (sys/elf.h | sys/vm86.h)
+            case "$is_x86_64" in
+                (yes) continue;;
+                (no)  ;;
+                (unknown)
+                    cat >"$cih_test_c" <<EOF
+#if defined __x86_64__ && __x86_64__
+#error "is x86-64"
+#endif
+EOF
+                    if $cc_cmd -fsyntax-only "$cih_test_c" > /dev/null 2>&1
+                    then
+                        is_x86_64=no
+                    else
+                        is_x86_64=yes
+                        continue
+                    fi
+                ;;
+            esac
+    esac
+
+    echo :: "$header"
+    for lang_mode in "" $lang_modes; do
+        for lib_mode in "" $lib_modes; do
+            echo :::: $lang_mode $lib_mode
+            if [ -z "$lib_mode" ]; then
+                expanded_lib_mode='/* default library mode */'
+            else
+                expanded_lib_mode=$(echo : $lib_mode | \
+                    sed 's/^: -D/#define /; s/=/ /')
+            fi
+            cat >"$cih_test_c" <<EOF
+/* These macros may have been defined on the command line.  They are
+   inappropriate for this test.  */
+#undef _LIBC
+#undef _GNU_SOURCE
+#undef _REENTRANT
+/* The library mode is selected here rather than on the command line to
+   ensure that this selection wins. */
+$expanded_lib_mode
+#include <$header>
+int avoid_empty_translation_unit;
+EOF
+            if $cc_cmd -fsyntax-only $lang_mode "$cih_test_c" 2>&1
+            then
+                includes=$($cc_cmd -fsyntax-only -H $lang_mode \
+                              "$cih_test_c" 2>&1 | sed -ne 's/^[.][.]* //p')
+                for h in $includes; do
+                    # Don't repeat work.
+                    eval 'case "$h" in ('"$already"') continue;; esac'
+
+                    if grep -qE "$obsolete_type_re" "$h"; then
+                        echo "*** Obsolete types detected:"
+                        grep -HE "$obsolete_type_re" "$h"
+                        failed=1
+                    fi
+                    already="$already|$h"
+                done
+            else
+                failed=1
+            fi
+        done
+    done
+done
+exit $failed
diff --git a/sysdeps/arm/nacl/include/bits/setjmp.h b/sysdeps/arm/nacl/include/bits/setjmp.h
index 6b6a235..e1fe505 100644
--- a/sysdeps/arm/nacl/include/bits/setjmp.h
+++ b/sysdeps/arm/nacl/include/bits/setjmp.h
@@ -24,6 +24,8 @@
 # include <sysdeps/arm/bits/setjmp.h>
 #endif
 
+# ifndef _ISOMAC
+
 /* Register list for a ldm/stm instruction to load/store
    the general registers from a __jmp_buf.
 
@@ -35,4 +37,5 @@
 /* Index of __jmp_buf where the sp register resides.  */
 #define __JMP_BUF_SP		0
 
+# endif /* _ISOMAC */
 #endif  /* include/bits/setjmp.h */
diff --git a/sysdeps/mips/include/sys/asm.h b/sysdeps/mips/include/sys/asm.h
index 7e288df..67acf74 100644
--- a/sysdeps/mips/include/sys/asm.h
+++ b/sysdeps/mips/include/sys/asm.h
@@ -16,8 +16,9 @@
    <http://www.gnu.org/licenses/>.  */
 
 #ifndef _SYS_ASM_H
+#include_next <sys/asm.h>
 
-# include_next <sys/asm.h>
+# ifndef _ISOMAC
 
 # undef __mips_cfi_startproc
 # define __mips_cfi_startproc cfi_startproc
@@ -50,4 +51,5 @@
 	cfi_restore (gp)
 # endif
 
-#endif
+# endif /* _ISOMAC */
+#endif /* sys/asm.h */
diff --git a/sysdeps/unix/sysv/linux/include/sys/sysinfo.h b/sysdeps/unix/sysv/linux/include/sys/sysinfo.h
index 50077fb..b76f7e0 100644
--- a/sysdeps/unix/sysv/linux/include/sys/sysinfo.h
+++ b/sysdeps/unix/sysv/linux/include/sys/sysinfo.h
@@ -21,6 +21,9 @@
 
 #include_next <sys/sysinfo.h>
 
+# ifndef _ISOMAC
+
 extern __typeof (sysinfo) __sysinfo __THROW;
 
+# endif /* _ISOMAC */
 #endif /* sys/sysinfo.h */
diff --git a/sysdeps/unix/sysv/linux/include/sys/timex.h b/sysdeps/unix/sysv/linux/include/sys/timex.h
index ace90ee..4b4ff88 100644
--- a/sysdeps/unix/sysv/linux/include/sys/timex.h
+++ b/sysdeps/unix/sysv/linux/include/sys/timex.h
@@ -21,6 +21,9 @@
 
 #include_next <sys/timex.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (__adjtimex)
 
+# endif /* _ISOMAC */
 #endif /* sys/timex.h */
diff --git a/sysdeps/x86/fpu/include/bits/fenv.h b/sysdeps/x86/fpu/include/bits/fenv.h
index 6e8b733..a410ed0 100644
--- a/sysdeps/x86/fpu/include/bits/fenv.h
+++ b/sysdeps/x86/fpu/include/bits/fenv.h
@@ -16,8 +16,11 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_FENV_H
 #include_next <bits/fenv.h>
 
+# ifndef _ISOMAC
+
 /* Ensure __feraiseexcept calls in glibc are optimized the same as
    feraiseexcept calls.  */
 
@@ -40,3 +43,6 @@ __NTH (__feraiseexcept (int __excepts))
 
 __END_DECLS
 #endif
+
+# endif /* _ISOMAC */
+#endif /* bits/fenv.h */

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c66b29f9cce9bf7c67d55879dff5e4cd03ecfac1

commit c66b29f9cce9bf7c67d55879dff5e4cd03ecfac1
Author: Zack Weinberg <zackw@panix.com>
Date:   Wed Jul 13 16:11:57 2016 -0400

    Installed-header hygiene (BZ#20366): stack_t.
    
    sys/ucontext.h unconditionally uses stack_t, and it does not make
    sense to change that.  But signal.h only declares stack_t under
    __USE_XOPEN_EXTENDED || __USE_XOPEN2K8.  The actual definition is
    already in a bits header, bits/sigstack.h, but that header insists on
    only being included by signal.h, so we have to change that as well as
    all of the sys/ucontext.h variants.  (Some but not all variants of
    bits/sigcontext.h, which sys/ucontext.h may also need, had already
    received this adjustment; for consistency, I made them all the same,
    even if that's not strictly necessary in some configurations.)
    bits/sigcontext.h and bits/sigstack.h also all need to receive
    multiple inclusion guards.
    
    	* sysdeps/generic/sys/ucontext.h
    	* sysdeps/arm/sys/ucontext.h
    	* sysdeps/i386/sys/ucontext.h
    	* sysdeps/m68k/sys/ucontext.h
    	* sysdeps/mips/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/arm/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/tile/sys/ucontext.h
    	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h:
    	Include both bits/sigcontext.h and bits/sigstack.h.
    	Fix grammar error in comment, if present.
    
    	* bits/sigstack.h
    	* sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
    	* sysdeps/unix/sysv/linux/alpha/bits/sigstack.h
    	* sysdeps/unix/sysv/linux/bits/sigstack.h
    	* sysdeps/unix/sysv/linux/ia64/bits/sigstack.h
    	* sysdeps/unix/sysv/linux/mips/bits/sigstack.h
    	* sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
    	* sysdeps/unix/sysv/linux/sparc/bits/sigstack.h
    	* bits/sigcontext.h
    	* sysdeps/mach/hurd/i386/bits/sigcontext.h
    	* sysdeps/unix/sysv/linux/bits/sigcontext.h
    	* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
    	* sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h:
    	Add multiple inclusion guard.  Permit inclusion by sys/ucontext.h
    	as well as signal.h, if this was not already allowed.  Request
    	definition of size_t if necessary.  Minimize semantically-null
    	differences across files.

diff --git a/ChangeLog b/ChangeLog
index b428ba4..47ea836 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,47 @@
 2016-09-23  Zack Weinberg  <zackw@panix.com>
 
+	* sysdeps/generic/sys/ucontext.h
+	* sysdeps/arm/sys/ucontext.h
+	* sysdeps/i386/sys/ucontext.h
+	* sysdeps/m68k/sys/ucontext.h
+	* sysdeps/mips/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/arm/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/tile/sys/ucontext.h
+	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h:
+	Include both bits/sigcontext.h and bits/sigstack.h.
+	Fix grammar error in comment, if present.
+
+	* bits/sigstack.h
+	* sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
+	* sysdeps/unix/sysv/linux/alpha/bits/sigstack.h
+	* sysdeps/unix/sysv/linux/bits/sigstack.h
+	* sysdeps/unix/sysv/linux/ia64/bits/sigstack.h
+	* sysdeps/unix/sysv/linux/mips/bits/sigstack.h
+	* sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
+	* sysdeps/unix/sysv/linux/sparc/bits/sigstack.h
+	* bits/sigcontext.h
+	* sysdeps/mach/hurd/i386/bits/sigcontext.h
+	* sysdeps/unix/sysv/linux/bits/sigcontext.h
+	* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
+	* sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h:
+	Add multiple inclusion guard.  Permit inclusion by sys/ucontext.h
+	as well as signal.h, if this was not already allowed.  Request
+	definition of size_t if necessary.  Minimize semantically-null
+	differences across files.
+
+2016-09-23  Zack Weinberg  <zackw@panix.com>
+
 	* time/time.h, bits/time.h, sysdeps/unix/sysv/linux/bits/time.h:
 	Remove all logic conditional on __need macros.	Move all the
 	conditionally defined types to their own headers...
diff --git a/bits/sigcontext.h b/bits/sigcontext.h
index 85b2a96..ddc4966 100644
--- a/bits/sigcontext.h
+++ b/bits/sigcontext.h
@@ -16,7 +16,10 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SIGNAL_H
+#ifndef _BITS_SIGCONTEXT_H
+#define _BITS_SIGCONTEXT_H 1
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
 #endif
 
@@ -30,3 +33,5 @@ struct sigcontext
   };
 
 /* Signal subcodes should be defined here.  */
+
+#endif /* bits/sigcontext.h */
diff --git a/bits/sigstack.h b/bits/sigstack.h
index b4b911e..62020b3 100644
--- a/bits/sigstack.h
+++ b/bits/sigstack.h
@@ -16,7 +16,10 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SIGNAL_H
+#ifndef _BITS_SIGSTACK_H
+#define _BITS_SIGSTACK_H 1
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
@@ -52,3 +55,5 @@ enum
 
 /* System default stack size.  */
 #define SIGSTKSZ	(MINSIGSTKSZ + 32768)
+
+#endif /* bits/sigstack.h */
diff --git a/sysdeps/arm/sys/ucontext.h b/sysdeps/arm/sys/ucontext.h
index 744cb53..28bf860 100644
--- a/sysdeps/arm/sys/ucontext.h
+++ b/sysdeps/arm/sys/ucontext.h
@@ -23,6 +23,12 @@
 #include <features.h>
 #include <signal.h>
 
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
+#include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
+
 typedef int greg_t;
 
 /* Number of general registers.  */
diff --git a/sysdeps/generic/sys/ucontext.h b/sysdeps/generic/sys/ucontext.h
index f08cec0..b5ec972 100644
--- a/sysdeps/generic/sys/ucontext.h
+++ b/sysdeps/generic/sys/ucontext.h
@@ -25,9 +25,11 @@
 #include <features.h>
 #include <signal.h>
 
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
 #include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
 
 typedef struct sigcontext mcontext_t;
 
diff --git a/sysdeps/i386/sys/ucontext.h b/sysdeps/i386/sys/ucontext.h
index d08e1a7..882173b 100644
--- a/sysdeps/i386/sys/ucontext.h
+++ b/sysdeps/i386/sys/ucontext.h
@@ -23,6 +23,12 @@
 #include <features.h>
 #include <signal.h>
 
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
+#include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
+
 /* Type for general register.  */
 typedef int greg_t;
 
diff --git a/sysdeps/m68k/sys/ucontext.h b/sysdeps/m68k/sys/ucontext.h
index ef85368..1c363a8 100644
--- a/sysdeps/m68k/sys/ucontext.h
+++ b/sysdeps/m68k/sys/ucontext.h
@@ -23,6 +23,12 @@
 #include <features.h>
 #include <signal.h>
 
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
+#include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
+
 /* Type for general register.  */
 typedef int greg_t;
 
diff --git a/sysdeps/mach/hurd/i386/bits/sigcontext.h b/sysdeps/mach/hurd/i386/bits/sigcontext.h
index 6d15b03..73585e1 100644
--- a/sysdeps/mach/hurd/i386/bits/sigcontext.h
+++ b/sysdeps/mach/hurd/i386/bits/sigcontext.h
@@ -16,12 +16,13 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_SIGCONTEXT_H
+#define _BITS_SIGCONTEXT_H 1
+
 #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
 #endif
 
-#ifndef sc_pc
-
 /* Signal handlers are actually called:
    void handler (int sig, int code, struct sigcontext *scp);  */
 
@@ -116,4 +117,4 @@ struct sigcontext
 #define DBG_SINGLE_TRAP		0x1 /* single step */
 #define DBG_BRKPNT_FAULT	0x2 /* breakpoint instruction */
 
-#endif /* sc_pc */
+#endif /* bits/sigcontext.h */
diff --git a/sysdeps/mips/sys/ucontext.h b/sysdeps/mips/sys/ucontext.h
index b3d752b..89970a8 100644
--- a/sysdeps/mips/sys/ucontext.h
+++ b/sysdeps/mips/sys/ucontext.h
@@ -21,9 +21,16 @@
 #define _SYS_UCONTEXT_H	1
 
 #include <features.h>
-#include <sgidefs.h>
 #include <signal.h>
 
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
+#include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
+#include <sgidefs.h>
+
+
 /* Type for general register.  */
 #if _MIPS_SIM == _ABIO32
 typedef __uint32_t greg_t;
diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h b/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
index 5b09b7c..cb3e97d 100644
--- a/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
+++ b/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
@@ -16,10 +16,15 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SIGNAL_H
+#ifndef _BITS_SIGSTACK_H
+#define _BITS_SIGSTACK_H 1
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
+#define __need_size_t
+#include <stddef.h>
 
 /* Structure describing a signal stack (obsolete).  */
 struct sigstack
@@ -28,8 +33,15 @@ struct sigstack
     int ss_onstack;		/* Nonzero if executing on this stack.  */
   };
 
+/* Alternate, preferred interface.  */
+typedef struct sigaltstack
+  {
+    void *ss_sp;
+    int ss_flags;
+    size_t ss_size;
+  } stack_t;
 
-/* Possible values for `ss_flags.'.  */
+/* Possible values for `ss_flags'.  */
 enum
 {
   SS_ONSTACK = 1,
@@ -44,11 +56,4 @@ enum
 /* System default stack size.  */
 #define SIGSTKSZ	16384
 
-
-/* Alternate, preferred interface.  */
-typedef struct sigaltstack
-  {
-    void *ss_sp;
-    int ss_flags;
-    size_t ss_size;
-  } stack_t;
+#endif /* bits/sigstack.h */
diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
index 01da3ca..2e3e1ee 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
@@ -23,11 +23,14 @@
 
 #include <features.h>
 #include <signal.h>
-#include <sys/procfs.h>
 
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
 #include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
+#include <sys/procfs.h>
+
 
 typedef elf_greg_t greg_t;
 
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/sigstack.h b/sysdeps/unix/sysv/linux/alpha/bits/sigstack.h
index 6ad3363..b2de7a1 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/sigstack.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/sigstack.h
@@ -16,10 +16,15 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SIGNAL_H
+#ifndef _BITS_SIGSTACK_H
+#define _BITS_SIGSTACK_H 1
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
+#define __need_size_t
+#include <stddef.h>
 
 /* Structure describing a signal stack (obsolete).  */
 struct sigstack
@@ -28,8 +33,15 @@ struct sigstack
     int ss_onstack;		/* Nonzero if executing on this stack.  */
   };
 
+/* Alternate, preferred interface.  */
+typedef struct sigaltstack
+  {
+    __ptr_t ss_sp;
+    int ss_flags;
+    size_t ss_size;
+  } stack_t;
 
-/* Possible values for `ss_flags.'.  */
+/* Possible values for `ss_flags'.  */
 enum
 {
   SS_ONSTACK = 1,
@@ -44,11 +56,4 @@ enum
 /* System default stack size.  */
 #define SIGSTKSZ	16384
 
-
-/* Alternate, preferred interface.  */
-typedef struct sigaltstack
-  {
-    __ptr_t ss_sp;
-    int ss_flags;
-    size_t ss_size;
-  } stack_t;
+#endif /* bits/sigstack.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h b/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
index a42e662..0fa4c1f 100644
--- a/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
@@ -21,7 +21,10 @@
 #include <features.h>
 #include <signal.h>
 
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
 #include <bits/sigcontext.h>
+#include <bits/sigstack.h>
 
 
 /* Type for general register.  */
diff --git a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h b/sysdeps/unix/sysv/linux/arm/sys/ucontext.h
index f32eadc..c7acead 100644
--- a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/arm/sys/ucontext.h
@@ -23,9 +23,11 @@
 #include <features.h>
 #include <signal.h>
 
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
 #include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
 
 typedef int greg_t;
 
diff --git a/sysdeps/unix/sysv/linux/bits/sigcontext.h b/sysdeps/unix/sysv/linux/bits/sigcontext.h
index 46cacb7..bdeaae8 100644
--- a/sysdeps/unix/sysv/linux/bits/sigcontext.h
+++ b/sysdeps/unix/sysv/linux/bits/sigcontext.h
@@ -15,6 +15,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_SIGCONTEXT_H
+#define _BITS_SIGCONTEXT_H 1
+
 #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
 #endif
@@ -30,3 +33,5 @@
 # define __need_NULL
 # include <stddef.h>
 #endif
+
+#endif /* bits/sigcontext.h */
diff --git a/sysdeps/unix/sysv/linux/bits/sigstack.h b/sysdeps/unix/sysv/linux/bits/sigstack.h
index 115a98e..d858f09 100644
--- a/sysdeps/unix/sysv/linux/bits/sigstack.h
+++ b/sysdeps/unix/sysv/linux/bits/sigstack.h
@@ -16,10 +16,15 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SIGNAL_H
+#ifndef _BITS_SIGSTACK_H
+#define _BITS_SIGSTACK_H 1
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
+#define __need_size_t
+#include <stddef.h>
 
 /* Structure describing a signal stack (obsolete).  */
 struct sigstack
@@ -28,8 +33,15 @@ struct sigstack
     int ss_onstack;		/* Nonzero if executing on this stack.  */
   };
 
+/* Alternate, preferred interface.  */
+typedef struct sigaltstack
+  {
+    void *ss_sp;
+    int ss_flags;
+    size_t ss_size;
+  } stack_t;
 
-/* Possible values for `ss_flags.'.  */
+/* Possible values for `ss_flags'.  */
 enum
 {
   SS_ONSTACK = 1,
@@ -44,11 +56,4 @@ enum
 /* System default stack size.  */
 #define SIGSTKSZ	8192
 
-
-/* Alternate, preferred interface.  */
-typedef struct sigaltstack
-  {
-    void *ss_sp;
-    int ss_flags;
-    size_t ss_size;
-  } stack_t;
+#endif /* bits/sigstack.h */
diff --git a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h b/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
index f6fd367..fa2bd8c 100644
--- a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
@@ -23,9 +23,10 @@
 #include <features.h>
 #include <signal.h>
 
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
 #include <bits/sigcontext.h>
+#include <bits/sigstack.h>
 
 
 /* Type for general register.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h b/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
index 591e7a2..af15ee8 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h
@@ -16,13 +16,13 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_SIGCONTEXT_H
+#define _BITS_SIGCONTEXT_H 1
+
 #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
 #endif
 
-#ifndef _BITS_SIGCONTEXT_H
-#define _BITS_SIGCONTEXT_H 1
-
 #define __need_size_t
 #include <stddef.h>
 #include <bits/sigstack.h>
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/sigstack.h b/sysdeps/unix/sysv/linux/ia64/bits/sigstack.h
index 0cd5e84..f22e503 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/sigstack.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/sigstack.h
@@ -16,12 +16,15 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SIGNAL_H
+#ifndef _BITS_SIGSTACK_H
+#define _BITS_SIGSTACK_H 1
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
-#ifndef _SIGSTACK_H
-#define _SIGSTACK_H	1
+#define __need_size_t
+#include <stddef.h>
 
 /* Structure describing a signal stack (obsolete).  */
 struct sigstack
@@ -30,8 +33,15 @@ struct sigstack
     int ss_onstack;		/* Nonzero if executing on this stack.  */
   };
 
+/* Alternate, preferred interface.  */
+typedef struct sigaltstack
+  {
+    __ptr_t ss_sp;
+    int ss_flags;
+    size_t ss_size;
+  } stack_t;
 
-/* Possible values for `ss_flags.'.  */
+/* Possible values for `ss_flags'.  */
 enum
 {
   SS_ONSTACK = 1,
@@ -50,13 +60,4 @@ enum
 /* System default stack size.  */
 #define SIGSTKSZ	262144
 
-
-/* Alternate, preferred interface.  */
-typedef struct sigaltstack
-  {
-    __ptr_t ss_sp;
-    int ss_flags;
-    size_t ss_size;
-  } stack_t;
-
-#endif	/* bits/sigstack.h */
+#endif /* bits/sigstack.h */
diff --git a/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h b/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
index c79fced..730aa78 100644
--- a/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
@@ -21,7 +21,11 @@
 #include <features.h>
 #include <signal.h>
 
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
 #include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
 
 /*
  * These are here mostly for backwards compatibility with older Unices.
diff --git a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h b/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
index d8ee542..66f4b55 100644
--- a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
@@ -23,6 +23,12 @@
 #include <features.h>
 #include <signal.h>
 
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
+#include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
+
 /* Type for general register.  */
 typedef int greg_t;
 
diff --git a/sysdeps/unix/sysv/linux/mips/bits/sigstack.h b/sysdeps/unix/sysv/linux/mips/bits/sigstack.h
index 2e96654..9e1ace9 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/sigstack.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/sigstack.h
@@ -16,10 +16,15 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SIGNAL_H
+#ifndef _BITS_SIGSTACK_H
+#define _BITS_SIGSTACK_H 1
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
+#define __need_size_t
+#include <stddef.h>
 
 /* Structure describing a signal stack (obsolete).  */
 struct sigstack
@@ -28,8 +33,15 @@ struct sigstack
     int ss_onstack;		/* Nonzero if executing on this stack.  */
   };
 
+/* Alternate, preferred interface.  */
+typedef struct sigaltstack
+  {
+    void *ss_sp;
+    size_t ss_size;
+    int ss_flags;
+  } stack_t;
 
-/* Possible values for `ss_flags.'.  */
+/* Possible values for `ss_flags'.  */
 enum
 {
   SS_ONSTACK = 1,
@@ -44,11 +56,4 @@ enum
 /* System default stack size.  */
 #define SIGSTKSZ	8192
 
-
-/* Alternate, preferred interface.  */
-typedef struct sigaltstack
-  {
-    void *ss_sp;
-    size_t ss_size;
-    int ss_flags;
-  } stack_t;
+#endif /* bits/sigstack.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h b/sysdeps/unix/sysv/linux/mips/sys/ucontext.h
index b5d2e2a..1ab0c68 100644
--- a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/mips/sys/ucontext.h
@@ -20,12 +20,15 @@
 #define _SYS_UCONTEXT_H	1
 
 #include <features.h>
-#include <sgidefs.h>
 #include <signal.h>
 
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
 #include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
+#include <sgidefs.h>
+
 
 /* Type for general register.  Even in o32 we assume 64-bit registers,
    like the kernel.  */
diff --git a/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h b/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
index a44ec61..26c55de 100644
--- a/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
@@ -24,6 +24,12 @@
 #include <features.h>
 #include <signal.h>
 
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
+#include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
+
 /* These definitions must be in sync with the kernel.  */
 
 #define MCONTEXT_VERSION 2
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h b/sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
index 5b9c0c1..b06f439 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
@@ -16,10 +16,15 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SIGNAL_H
+#ifndef _BITS_SIGSTACK_H
+#define _BITS_SIGSTACK_H 1
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
+#define __need_size_t
+#include <stddef.h>
 
 /* Structure describing a signal stack (obsolete).  */
 struct sigstack
@@ -28,8 +33,15 @@ struct sigstack
     int ss_onstack;		/* Nonzero if executing on this stack.  */
   };
 
+/* Alternate, preferred interface.  */
+typedef struct sigaltstack
+  {
+    void *ss_sp;
+    int ss_flags;
+    size_t ss_size;
+  } stack_t;
 
-/* Possible values for `ss_flags.'.  */
+/* Possible values for `ss_flags'.  */
 enum
 {
   SS_ONSTACK = 1,
@@ -44,11 +56,4 @@ enum
 /* System default stack size.  */
 #define SIGSTKSZ	16384
 
-
-/* Alternate, preferred interface.  */
-typedef struct sigaltstack
-  {
-    void *ss_sp;
-    int ss_flags;
-    size_t ss_size;
-  } stack_t;
+#endif /* bits/sigstack.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h b/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
index 2b97bc7..c4634f6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
@@ -21,9 +21,11 @@
 #include <features.h>
 #include <signal.h>
 
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
 #include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
 
 #if __WORDSIZE == 32
 
diff --git a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h b/sysdeps/unix/sysv/linux/s390/sys/ucontext.h
index 78f5fd7..0128d1f 100644
--- a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/s390/sys/ucontext.h
@@ -18,15 +18,15 @@
 
 #ifndef _SYS_UCONTEXT_H
 #define _SYS_UCONTEXT_H	1
-/* Forward definition to avoid parse errors */
-struct ucontext;
-typedef struct ucontext ucontext_t;
+
 #include <features.h>
 #include <signal.h>
 
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
+/* We need the signal context definitions even if they are not exposed
+   by in <signal.h>.  */
 #include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
 
 /* Type for a program status word.  */
 typedef struct
diff --git a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h
index ab9a7e6..2c5fa04 100644
--- a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h
@@ -23,9 +23,10 @@
 #include <features.h>
 #include <signal.h>
 
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
 #include <bits/sigcontext.h>
+#include <bits/sigstack.h>
 
 
 typedef int greg_t;
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h b/sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h
index 43253f2..8794ddd 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h
@@ -15,6 +15,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_SIGCONTEXT_H
+#define _BITS_SIGCONTEXT_H 1
+
 #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
 #endif
@@ -75,3 +78,5 @@ struct sigcontext
 };
 
 #endif /* sparc64 */
+
+#endif /* bits/sigcontext.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/sigstack.h b/sysdeps/unix/sysv/linux/sparc/bits/sigstack.h
index 5b9c0c1..b06f439 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/sigstack.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/sigstack.h
@@ -16,10 +16,15 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SIGNAL_H
+#ifndef _BITS_SIGSTACK_H
+#define _BITS_SIGSTACK_H 1
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
+#define __need_size_t
+#include <stddef.h>
 
 /* Structure describing a signal stack (obsolete).  */
 struct sigstack
@@ -28,8 +33,15 @@ struct sigstack
     int ss_onstack;		/* Nonzero if executing on this stack.  */
   };
 
+/* Alternate, preferred interface.  */
+typedef struct sigaltstack
+  {
+    void *ss_sp;
+    int ss_flags;
+    size_t ss_size;
+  } stack_t;
 
-/* Possible values for `ss_flags.'.  */
+/* Possible values for `ss_flags'.  */
 enum
 {
   SS_ONSTACK = 1,
@@ -44,11 +56,4 @@ enum
 /* System default stack size.  */
 #define SIGSTKSZ	16384
 
-
-/* Alternate, preferred interface.  */
-typedef struct sigaltstack
-  {
-    void *ss_sp;
-    int ss_flags;
-    size_t ss_size;
-  } stack_t;
+#endif /* bits/sigstack.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h b/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
index d7bf2ae..5856398 100644
--- a/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
@@ -20,8 +20,15 @@
 
 #include <features.h>
 #include <signal.h>
+
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
+#include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
 #include <bits/wordsize.h>
 
+
 #if __WORDSIZE == 64
 
 #define MC_TSTATE	0
diff --git a/sysdeps/unix/sysv/linux/tile/sys/ucontext.h b/sysdeps/unix/sysv/linux/tile/sys/ucontext.h
index d930a1f..59c9bd1 100644
--- a/sysdeps/unix/sysv/linux/tile/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/tile/sys/ucontext.h
@@ -22,13 +22,15 @@
 #include <features.h>
 #include <signal.h>
 
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
 #include <bits/sigcontext.h>
+#include <bits/sigstack.h>
 
 /* Get register type and register names. */
 #include <arch/abi.h>
 
+
 /* Type for general register.  */
 typedef uint_reg_t greg_t;
 
diff --git a/sysdeps/unix/sysv/linux/x86/sys/ucontext.h b/sysdeps/unix/sysv/linux/x86/sys/ucontext.h
index 0620635..99ee946 100644
--- a/sysdeps/unix/sysv/linux/x86/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/x86/sys/ucontext.h
@@ -21,9 +21,11 @@
 #include <features.h>
 #include <signal.h>
 
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
+/* We need the signal context definitions even if they are not exposed
+   by <signal.h>.  */
 #include <bits/sigcontext.h>
+#include <bits/sigstack.h>
+
 
 #ifdef __x86_64__
 

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=05b68e14b146586c46121730241142256f0ef850

commit 05b68e14b146586c46121730241142256f0ef850
Author: Zack Weinberg <zackw@panix.com>
Date:   Wed Aug 24 11:54:34 2016 -0400

    Installed-header hygiene (BZ#20366): time.h types.
    
    Many headers are expected to expose a subset of the type definitions
    in time.h.  time.h has a whole bunch of messy logic for conditionally
    defining some its types and structs, but, as best I can tell, this
    has never worked 100%.  In particular, __need_timespec is ineffective
    if _TIME_H has already been defined, which means that if you compile
    
      #include <time.h>
      #include <sched.h>
    
    with e.g. -fsyntax-only -std=c89 -Wall -Wsystem-headers, you will get
    
    In file included from test.c:2:0:
    /usr/include/sched.h:74:57: warning: "struct timespec" declared inside
      parameter list will not be visible outside of this definition or declaration
     extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
                                                             ^~~~~~~~
    
    And if you want to _use_ sched_rr_get_interval in a TU compiled that
    way, you're hosed.
    
    This patch replaces all of that with small bits/types/TYPE.h headers
    as introduced earlier.  time.h and bits/time.h are now *much* simpler,
    and a lot of other headers are slightly simpler.
    
    	* time/time.h, bits/time.h, sysdeps/unix/sysv/linux/bits/time.h:
    	Remove all logic conditional on __need macros.  Move all the
    	conditionally defined types to their own headers...
    	* time/bits/types/clock_t.h: Define clock_t here.
    	* time/bits/types/clockid_t.h: Define clockid_t here.
    	* time/bits/types/struct_itimerspec.h: Define struct itimerspec here.
    	* time/bits/types/struct_timespec.h: Define struct timespec here.
    	* time/bits/types/struct_timeval.h: Define struct timeval here.
    	* time/bits/types/struct_tm.h: Define struct tm here.
    	* time/bits/types/time_t.h: Define time_t here.
    	* time/bits/types/timer_t.h: Define timer_t here.
    	* time/Makefile: Install the new headers.
    
    	* bits/resource.h, io/fcntl.h, io/sys/poll.h, io/sys/stat.h
    	* io/utime.h, misc/sys/select.h, posix/sched.h, posix/sys/times.h
    	* posix/sys/types.h, resolv/netdb.h, rt/aio.h, rt/mqueue.h
    	* signal/signal.h, pthread/semaphore.h, sysdeps/nptl/pthread.h
    	* sysdeps/unix/sysv/linux/alpha/bits/resource.h
    	* sysdeps/unix/sysv/linux/alpha/sys/acct.h
    	* sysdeps/unix/sysv/linux/bits/resource.h
    	* sysdeps/unix/sysv/linux/bits/timex.h
    	* sysdeps/unix/sysv/linux/mips/bits/resource.h
    	* sysdeps/unix/sysv/linux/net/ppp_defs.h
    	* sysdeps/unix/sysv/linux/sparc/bits/resource.h
    	* sysdeps/unix/sysv/linux/sys/acct.h
    	* sysdeps/unix/sysv/linux/sys/timerfd.h
    	* sysvipc/sys/msg.h, sysvipc/sys/sem.h, sysvipc/sys/shm.h
    	* time/sys/time.h, time/sys/timeb.h
    	Use the new bits/types headers.
    
    	* include/time.h: Remove __need logic.
    	* include/bits/time.h
    	* include/bits/types/clock_t.h, include/bits/types/clockid_t.h
    	* include/bits/types/time_t.h, include/bits/types/timer_t.h
    	* include/bits/types/struct_itimerspec.h
    	* include/bits/types/struct_timespec.h
    	* include/bits/types/struct_timeval.h
    	* include/bits/types/struct_tm.h:
    	New wrapper headers.

diff --git a/ChangeLog b/ChangeLog
index 60500b4..b428ba4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,47 @@
 2016-09-23  Zack Weinberg  <zackw@panix.com>
 
+	* time/time.h, bits/time.h, sysdeps/unix/sysv/linux/bits/time.h:
+	Remove all logic conditional on __need macros.	Move all the
+	conditionally defined types to their own headers...
+	* time/bits/types/clock_t.h: Define clock_t here.
+	* time/bits/types/clockid_t.h: Define clockid_t here.
+	* time/bits/types/struct_itimerspec.h: Define struct itimerspec here.
+	* time/bits/types/struct_timespec.h: Define struct timespec here.
+	* time/bits/types/struct_timeval.h: Define struct timeval here.
+	* time/bits/types/struct_tm.h: Define struct tm here.
+	* time/bits/types/time_t.h: Define time_t here.
+	* time/bits/types/timer_t.h: Define timer_t here.
+	* time/Makefile: Install the new headers.
+
+	* bits/resource.h, io/fcntl.h, io/sys/poll.h, io/sys/stat.h
+	* io/utime.h, misc/sys/select.h, posix/sched.h, posix/sys/times.h
+	* posix/sys/types.h, resolv/netdb.h, rt/aio.h, rt/mqueue.h
+	* signal/signal.h, pthread/semaphore.h, sysdeps/nptl/pthread.h
+	* sysdeps/unix/sysv/linux/alpha/bits/resource.h
+	* sysdeps/unix/sysv/linux/alpha/sys/acct.h
+	* sysdeps/unix/sysv/linux/bits/resource.h
+	* sysdeps/unix/sysv/linux/bits/timex.h
+	* sysdeps/unix/sysv/linux/mips/bits/resource.h
+	* sysdeps/unix/sysv/linux/net/ppp_defs.h
+	* sysdeps/unix/sysv/linux/sparc/bits/resource.h
+	* sysdeps/unix/sysv/linux/sys/acct.h
+	* sysdeps/unix/sysv/linux/sys/timerfd.h
+	* sysvipc/sys/msg.h, sysvipc/sys/sem.h, sysvipc/sys/shm.h
+	* time/sys/time.h, time/sys/timeb.h
+	Use the new bits/types headers.
+
+	* include/time.h: Remove __need logic.
+	* include/bits/time.h
+	* include/bits/types/clock_t.h, include/bits/types/clockid_t.h
+	* include/bits/types/time_t.h, include/bits/types/timer_t.h
+	* include/bits/types/struct_itimerspec.h
+	* include/bits/types/struct_timespec.h
+	* include/bits/types/struct_timeval.h
+	* include/bits/types/struct_tm.h:
+	New wrapper headers.
+
+2016-09-23  Zack Weinberg  <zackw@panix.com>
+
 	* sysdeps/mach/hurd/net/if_ppp.h
 	* sysdeps/unix/sysv/linux/net/if_ppp.h:
 	Only define struct ifpppstatsreq and struct ifpppcstatsreq
diff --git a/bits/resource.h b/bits/resource.h
index 7d2d66c..5cd2fe5 100644
--- a/bits/resource.h
+++ b/bits/resource.h
@@ -129,8 +129,7 @@ enum __rusage_who
 #define RUSAGE_CHILDREN RUSAGE_CHILDREN
   };
 
-#define __need_timeval
-#include <bits/time.h>           /* For `struct timeval'.  */
+#include <bits/types/struct_timeval.h>
 
 /* Structure which says how much of each resource has been used.  */
 struct rusage
diff --git a/bits/time.h b/bits/time.h
index 19c7ab0..84e0e94 100644
--- a/bits/time.h
+++ b/bits/time.h
@@ -20,9 +20,10 @@
  * Never include this file directly; use <time.h> instead.
  */
 
-#ifndef __need_timeval
-# ifndef _BITS_TIME_H
-#  define _BITS_TIME_H	1
+#ifndef _BITS_TIME_H
+#define _BITS_TIME_H	1
+
+#include <bits/types.h>
 
 /* ISO/IEC 9899:1999 7.23.1: Components of time
    The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is
@@ -30,51 +31,34 @@
 /* CAE XSH, Issue 4, Version 2: <time.h>
    The value of CLOCKS_PER_SEC is required to be 1 million on all
    XSI-conformant systems. */
-#  define CLOCKS_PER_SEC  ((clock_t) 1000000)
+#define CLOCKS_PER_SEC  ((__clock_t) 1000000)
 
-#  if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
+#if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \
+   && !defined __USE_XOPEN2K
 /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
    presents the real value for clock ticks per second for the system.  */
-#   include <bits/types.h>
 extern long int __sysconf (int);
-#   define CLK_TCK ((__clock_t) __sysconf (2))	/* 2 is _SC_CLK_TCK */
-#  endif
+# define CLK_TCK ((__clock_t) __sysconf (2))	/* 2 is _SC_CLK_TCK */
+#endif
 
-#  ifdef __USE_POSIX199309
+#ifdef __USE_POSIX199309
 /* Identifier for system-wide realtime clock.  */
-#   define CLOCK_REALTIME		0
+# define CLOCK_REALTIME			0
 /* Monotonic system-wide clock.  */
-#   define CLOCK_MONOTONIC		1
+# define CLOCK_MONOTONIC		1
 /* High-resolution timer from the CPU.  */
-#   define CLOCK_PROCESS_CPUTIME_ID	2
+# define CLOCK_PROCESS_CPUTIME_ID	2
 /* Thread-specific CPU-time clock.  */
-#   define CLOCK_THREAD_CPUTIME_ID	3
+# define CLOCK_THREAD_CPUTIME_ID	3
 /* Monotonic system-wide clock, not adjusted for frequency scaling.  */
-#   define CLOCK_MONOTONIC_RAW		4
+# define CLOCK_MONOTONIC_RAW		4
 /* Identifier for system-wide realtime clock, updated only on ticks.  */
-#   define CLOCK_REALTIME_COARSE	5
+# define CLOCK_REALTIME_COARSE		5
 /* Monotonic system-wide clock, updated only on ticks.  */
-#   define CLOCK_MONOTONIC_COARSE	6
+# define CLOCK_MONOTONIC_COARSE		6
 
 /* Flag to indicate time is absolute.  */
-#   define TIMER_ABSTIME		1
-#  endif
-
-# endif	/* bits/time.h */
+# define TIMER_ABSTIME			1
 #endif
 
-#ifdef __need_timeval
-# undef __need_timeval
-# ifndef _STRUCT_TIMEVAL
-#  define _STRUCT_TIMEVAL	1
-#  include <bits/types.h>
-
-/* A time value that is accurate to the nearest
-   microsecond but also has a range of years.  */
-struct timeval
-  {
-    __time_t tv_sec;		/* Seconds.  */
-    __suseconds_t tv_usec;	/* Microseconds.  */
-  };
-# endif	/* struct timeval */
-#endif	/* need timeval */
+#endif	/* bits/time.h */
diff --git a/include/bits/types/clock_t.h b/include/bits/types/clock_t.h
new file mode 100644
index 0000000..a08940d
--- /dev/null
+++ b/include/bits/types/clock_t.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/clock_t.h"
diff --git a/include/bits/types/clockid_t.h b/include/bits/types/clockid_t.h
new file mode 100644
index 0000000..fb0a514
--- /dev/null
+++ b/include/bits/types/clockid_t.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/clockid_t.h"
diff --git a/include/bits/types/struct_itimerspec.h b/include/bits/types/struct_itimerspec.h
new file mode 100644
index 0000000..7d325d6
--- /dev/null
+++ b/include/bits/types/struct_itimerspec.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/struct_itimerspec.h"
diff --git a/include/bits/types/struct_timespec.h b/include/bits/types/struct_timespec.h
new file mode 100644
index 0000000..b8ec6a3
--- /dev/null
+++ b/include/bits/types/struct_timespec.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/struct_timespec.h"
diff --git a/include/bits/types/struct_timeval.h b/include/bits/types/struct_timeval.h
new file mode 100644
index 0000000..5d2cb78
--- /dev/null
+++ b/include/bits/types/struct_timeval.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/struct_timeval.h"
diff --git a/include/bits/types/struct_tm.h b/include/bits/types/struct_tm.h
new file mode 100644
index 0000000..b70ac52
--- /dev/null
+++ b/include/bits/types/struct_tm.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/struct_tm.h"
diff --git a/include/bits/types/time_t.h b/include/bits/types/time_t.h
new file mode 100644
index 0000000..16e75e1
--- /dev/null
+++ b/include/bits/types/time_t.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/time_t.h"
diff --git a/include/bits/types/timer_t.h b/include/bits/types/timer_t.h
new file mode 100644
index 0000000..e6b279b
--- /dev/null
+++ b/include/bits/types/timer_t.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/timer_t.h"
diff --git a/include/time.h b/include/time.h
index 8dd10dc..684ceb8 100644
--- a/include/time.h
+++ b/include/time.h
@@ -1,8 +1,7 @@
 #ifndef _TIME_H
-#if defined __need_time_t  || defined __need_clock_t || defined __need_timespec || defined _ISOMAC
-# include <time/time.h>
-#else
-# include <time/time.h>
+#include <time/time.h>
+
+#ifndef _ISOMAC
 # include <xlocale.h>
 
 __BEGIN_DECLS
diff --git a/io/fcntl.h b/io/fcntl.h
index cb706b4..12099a2 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -72,8 +72,7 @@ typedef __pid_t pid_t;
 
 /* For XPG all symbols from <sys/stat.h> should also be available.  */
 #ifdef __USE_XOPEN2K8
-# define __need_timespec
-# include <time.h>
+# include <bits/types/struct_timespec.h>
 #endif
 #if defined __USE_XOPEN || defined __USE_XOPEN2K8
 # include <bits/stat.h>
diff --git a/io/sys/poll.h b/io/sys/poll.h
index e751860..58498b0 100644
--- a/io/sys/poll.h
+++ b/io/sys/poll.h
@@ -27,8 +27,7 @@
 /* Get the __sigset_t definition.  */
 # include <bits/sigset.h>
 /* Get the timespec definition.  */
-# define __need_timespec
-# include <time.h>
+#include <bits/types/struct_timespec.h>
 #endif
 
 
diff --git a/io/sys/stat.h b/io/sys/stat.h
index 6925f61..71462a7 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -26,19 +26,16 @@
 
 #include <bits/types.h>		/* For __mode_t and __dev_t.  */
 
-#if defined __USE_XOPEN || defined __USE_XOPEN2K || defined __USE_ATFILE
-# if defined __USE_XOPEN || defined __USE_XOPEN2K
-#  define __need_time_t
-# endif
-# ifdef __USE_ATFILE
-#  define __need_timespec
-# endif
-# include <time.h>		/* For time_t resp. timespec.  */
+#ifdef __USE_ATFILE
+# include <bits/types/struct_timespec.h>
 #endif
 
 #if defined __USE_XOPEN || defined __USE_XOPEN2K
 /* The Single Unix specification says that some more types are
    available here.  */
+
+# include <bits/types/time_t.h>
+
 # ifndef __dev_t_defined
 typedef __dev_t dev_t;
 #  define __dev_t_defined
diff --git a/io/utime.h b/io/utime.h
index 3cc0d5e..b30e1cc 100644
--- a/io/utime.h
+++ b/io/utime.h
@@ -29,8 +29,7 @@ __BEGIN_DECLS
 #include <bits/types.h>
 
 #if defined __USE_XOPEN || defined __USE_XOPEN2K
-# define __need_time_t
-# include <time.h>
+# include <bits/types/time_t.h>
 #endif
 
 /* Structure describing file times.  */
diff --git a/misc/sys/select.h b/misc/sys/select.h
index 52dd94f..2e4de40 100644
--- a/misc/sys/select.h
+++ b/misc/sys/select.h
@@ -38,13 +38,11 @@ typedef __sigset_t sigset_t;
 #endif
 
 /* Get definition of timer specification structures.  */
-#define __need_time_t
+#include <bits/types/time_t.h>
+#include <bits/types/struct_timeval.h>
 #ifdef __USE_XOPEN2K
-# define __need_timespec
+# include <bits/types/struct_timespec.h>
 #endif
-#include <time.h>
-#define __need_timeval
-#include <bits/time.h>
 
 #ifndef __suseconds_t_defined
 typedef __suseconds_t suseconds_t;
diff --git a/posix/sched.h b/posix/sched.h
index 253c963..5b431c6 100644
--- a/posix/sched.h
+++ b/posix/sched.h
@@ -25,13 +25,14 @@
 #include <bits/types.h>
 
 #define __need_size_t
+#define __need_NULL
 #include <stddef.h>
 
-#ifdef __USE_XOPEN2K
-# define __need_time_t
-# define __need_timespec
+#include <bits/types/time_t.h>
+#include <bits/types/struct_timespec.h>
+#ifndef __USE_XOPEN2K
+# include <time.h>
 #endif
-#include <time.h>
 
 #ifndef __pid_t_defined
 typedef __pid_t pid_t;
diff --git a/posix/sys/times.h b/posix/sys/times.h
index a877d14..c7308d2 100644
--- a/posix/sys/times.h
+++ b/posix/sys/times.h
@@ -24,9 +24,7 @@
 
 #include <features.h>
 
-#define	__need_clock_t
-#include <time.h>
-
+#include <bits/types/clock_t.h>
 
 __BEGIN_DECLS
 
diff --git a/posix/sys/types.h b/posix/sys/types.h
index 83dadcd..386f3e5 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -124,12 +124,11 @@ typedef __key_t key_t;
 #endif
 
 #if defined __USE_XOPEN || defined __USE_XOPEN2K8
-# define __need_clock_t
+# include <bits/types/clock_t.h>
 #endif
-#define	__need_time_t
-#define __need_timer_t
-#define __need_clockid_t
-#include <time.h>
+#include <bits/types/clockid_t.h>
+#include <bits/types/time_t.h>
+#include <bits/types/timer_t.h>
 
 #ifdef __USE_XOPEN
 # ifndef __useconds_t_defined
diff --git a/resolv/netdb.h b/resolv/netdb.h
index 3aba530..9a409c0 100644
--- a/resolv/netdb.h
+++ b/resolv/netdb.h
@@ -35,8 +35,7 @@
 #ifdef __USE_GNU
 # define __need_sigevent_t
 # include <bits/siginfo.h>
-# define __need_timespec
-# include <time.h>
+# include <bits/types/struct_timespec.h>
 #endif
 
 #include <bits/netdb.h>
diff --git a/rt/aio.h b/rt/aio.h
index 8cb6a5e..bc70082 100644
--- a/rt/aio.h
+++ b/rt/aio.h
@@ -26,8 +26,7 @@
 #include <sys/types.h>
 #define __need_sigevent_t
 #include <bits/siginfo.h>
-#define __need_timespec
-#include <time.h>
+#include <bits/types/struct_timespec.h>
 
 __BEGIN_DECLS
 
diff --git a/rt/mqueue.h b/rt/mqueue.h
index 9700cdc..db6022f 100644
--- a/rt/mqueue.h
+++ b/rt/mqueue.h
@@ -23,8 +23,7 @@
 #include <fcntl.h>
 #define __need_sigevent_t
 #include <bits/siginfo.h>
-#define __need_timespec
-#include <time.h>
+#include <bits/types/struct_timespec.h>
 /* Get the definition of mqd_t and struct mq_attr.  */
 #include <bits/mqueue.h>
 
diff --git a/signal/signal.h b/signal/signal.h
index 47e995a..2825386 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -71,8 +71,7 @@ typedef __uid_t uid_t;
 
 #ifdef __USE_POSIX199309
 /* We need `struct timespec' later on.  */
-# define __need_timespec
-# include <time.h>
+# include <bits/types/struct_timespec.h>
 #endif
 
 #if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
index fd0894e..cc6517b 100644
--- a/sysdeps/nptl/pthread.h
+++ b/sysdeps/nptl/pthread.h
@@ -26,6 +26,7 @@
 #include <bits/pthreadtypes.h>
 #include <bits/setjmp.h>
 #include <bits/wordsize.h>
+#include <bits/types/struct_timespec.h>
 
 
 /* Detach state.  */
diff --git a/sysdeps/pthread/semaphore.h b/sysdeps/pthread/semaphore.h
index 9927db7..5508267 100644
--- a/sysdeps/pthread/semaphore.h
+++ b/sysdeps/pthread/semaphore.h
@@ -21,8 +21,7 @@
 #include <features.h>
 #include <sys/types.h>
 #ifdef __USE_XOPEN2K
-# define __need_timespec
-# include <time.h>
+# include <bits/types/struct_timespec.h>
 #endif
 
 /* Get the definition for sem_t.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/resource.h b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
index fbc8f5a..1c17605 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
@@ -175,8 +175,7 @@ enum __rusage_who
 #endif
 };
 
-#define __need_timeval
-#include <bits/time.h>		/* For `struct timeval'.  */
+#include <bits/types/struct_timeval.h>
 
 /* Structure which says how much of each resource has been used.  */
 struct rusage
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/acct.h b/sysdeps/unix/sysv/linux/alpha/sys/acct.h
index 01da7bf..9fb9bdc 100644
--- a/sysdeps/unix/sysv/linux/alpha/sys/acct.h
+++ b/sysdeps/unix/sysv/linux/alpha/sys/acct.h
@@ -20,9 +20,7 @@
 #define _SYS_ACCT_H	1
 #include <features.h>
 
-#define	__need_time_t
-#include <time.h>
-
+#include <bits/types/time_t.h>
 
 __BEGIN_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index 8af0e0e..e2a62bc 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -175,8 +175,7 @@ enum __rusage_who
 #endif
 };
 
-#define __need_timeval
-#include <bits/time.h>		/* For `struct timeval'.  */
+#include <bits/types/struct_timeval.h>
 
 /* Structure which says how much of each resource has been used.  */
 
diff --git a/sysdeps/unix/sysv/linux/bits/time.h b/sysdeps/unix/sysv/linux/bits/time.h
index 87eb51f..1fade54 100644
--- a/sysdeps/unix/sysv/linux/bits/time.h
+++ b/sysdeps/unix/sysv/linux/bits/time.h
@@ -20,24 +20,10 @@
  * Never include this file directly; use <time.h> instead.
  */
 
-#if defined __need_timeval || defined __USE_GNU
-# ifndef _STRUCT_TIMEVAL
-#  define _STRUCT_TIMEVAL	1
-#  include <bits/types.h>
+#ifndef _BITS_TIME_H
+#define _BITS_TIME_H	1
 
-/* A time value that is accurate to the nearest
-   microsecond but also has a range of years.  */
-struct timeval
-  {
-    __time_t tv_sec;		/* Seconds.  */
-    __suseconds_t tv_usec;	/* Microseconds.  */
-  };
-# endif	/* struct timeval */
-#endif
-
-#ifndef __need_timeval
-# ifndef _BITS_TIME_H
-#  define _BITS_TIME_H	1
+#include <bits/types.h>
 
 /* ISO/IEC 9899:1999 7.23.1: Components of time
    The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is
@@ -45,47 +31,46 @@ struct timeval
 /* CAE XSH, Issue 4, Version 2: <time.h>
    The value of CLOCKS_PER_SEC is required to be 1 million on all
    XSI-conformant systems. */
-#  define CLOCKS_PER_SEC  ((clock_t) 1000000)
+#define CLOCKS_PER_SEC  ((__clock_t) 1000000)
 
-#  if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \
+#if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \
    && !defined __USE_XOPEN2K
 /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
    presents the real value for clock ticks per second for the system.  */
-#   include <bits/types.h>
 extern long int __sysconf (int);
-#   define CLK_TCK ((__clock_t) __sysconf (2))	/* 2 is _SC_CLK_TCK */
-#  endif
+# define CLK_TCK ((__clock_t) __sysconf (2))	/* 2 is _SC_CLK_TCK */
+#endif
 
-#  ifdef __USE_POSIX199309
+#ifdef __USE_POSIX199309
 /* Identifier for system-wide realtime clock.  */
-#   define CLOCK_REALTIME		0
+# define CLOCK_REALTIME			0
 /* Monotonic system-wide clock.  */
-#   define CLOCK_MONOTONIC		1
+# define CLOCK_MONOTONIC		1
 /* High-resolution timer from the CPU.  */
-#   define CLOCK_PROCESS_CPUTIME_ID	2
+# define CLOCK_PROCESS_CPUTIME_ID	2
 /* Thread-specific CPU-time clock.  */
-#   define CLOCK_THREAD_CPUTIME_ID	3
+# define CLOCK_THREAD_CPUTIME_ID	3
 /* Monotonic system-wide clock, not adjusted for frequency scaling.  */
-#   define CLOCK_MONOTONIC_RAW		4
+# define CLOCK_MONOTONIC_RAW		4
 /* Identifier for system-wide realtime clock, updated only on ticks.  */
-#   define CLOCK_REALTIME_COARSE	5
+# define CLOCK_REALTIME_COARSE		5
 /* Monotonic system-wide clock, updated only on ticks.  */
-#   define CLOCK_MONOTONIC_COARSE	6
+# define CLOCK_MONOTONIC_COARSE		6
 /* Monotonic system-wide clock that includes time spent in suspension.  */
-#   define CLOCK_BOOTTIME		7
+# define CLOCK_BOOTTIME			7
 /* Like CLOCK_REALTIME but also wakes suspended system.  */
-#   define CLOCK_REALTIME_ALARM		8
+# define CLOCK_REALTIME_ALARM		8
 /* Like CLOCK_BOOTTIME but also wakes suspended system.  */
-#   define CLOCK_BOOTTIME_ALARM		9
+# define CLOCK_BOOTTIME_ALARM		9
 /* Like CLOCK_REALTIME but in International Atomic Time.  */
-#   define CLOCK_TAI			11
+# define CLOCK_TAI			11
 
 /* Flag to indicate time is absolute.  */
-#   define TIMER_ABSTIME		1
-#  endif
+# define TIMER_ABSTIME			1
+#endif
 
-#  ifdef __USE_GNU
-#   include <bits/timex.h>
+#ifdef __USE_GNU
+# include <bits/timex.h>
 
 __BEGIN_DECLS
 
@@ -93,9 +78,6 @@ __BEGIN_DECLS
 extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW;
 
 __END_DECLS
-#  endif /* use GNU */
-
-# endif	/* bits/time.h */
-#endif
+#endif /* use GNU */
 
-#undef __need_timeval
+#endif	/* bits/time.h */
diff --git a/sysdeps/unix/sysv/linux/bits/timex.h b/sysdeps/unix/sysv/linux/bits/timex.h
index 5eb7ccb..1bf6121 100644
--- a/sysdeps/unix/sysv/linux/bits/timex.h
+++ b/sysdeps/unix/sysv/linux/bits/timex.h
@@ -19,6 +19,7 @@
 #define	_BITS_TIMEX_H	1
 
 #include <bits/types.h>
+#include <bits/types/struct_timeval.h>
 
 /* These definitions from linux/timex.h as of 3.18.  */
 
diff --git a/sysdeps/unix/sysv/linux/mips/bits/resource.h b/sysdeps/unix/sysv/linux/mips/bits/resource.h
index 4ce5ff6..e3bcccf 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/resource.h
@@ -183,8 +183,7 @@ enum __rusage_who
 #endif
 };
 
-#define __need_timeval
-#include <bits/time.h>		/* For `struct timeval'.  */
+#include <bits/types/struct_timeval.h>
 
 /* Structure which says how much of each resource has been used.  */
 struct rusage
diff --git a/sysdeps/unix/sysv/linux/net/ppp_defs.h b/sysdeps/unix/sysv/linux/net/ppp_defs.h
index f8924c4..5e492e9 100644
--- a/sysdeps/unix/sysv/linux/net/ppp_defs.h
+++ b/sysdeps/unix/sysv/linux/net/ppp_defs.h
@@ -1,9 +1,7 @@
 #ifndef _NET_PPP_DEFS_H
 #define _NET_PPP_DEFS_H 1
 
-#define __need_time_t
-#include <time.h>
-
+#include <bits/types/time_t.h>
 #include <asm/types.h>
 #include <linux/ppp_defs.h>
 
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/resource.h b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
index 305ca5e..c5eac6f 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
@@ -191,8 +191,7 @@ enum __rusage_who
 #endif
 };
 
-#define __need_timeval
-#include <bits/time.h>		/* For `struct timeval'.  */
+#include <bits/types/struct_timeval.h>
 
 /* Structure which says how much of each resource has been used.  */
 struct rusage
diff --git a/sysdeps/unix/sysv/linux/sys/acct.h b/sysdeps/unix/sysv/linux/sys/acct.h
index d24c2a7..bc8a08e 100644
--- a/sysdeps/unix/sysv/linux/sys/acct.h
+++ b/sysdeps/unix/sysv/linux/sys/acct.h
@@ -21,8 +21,7 @@
 #include <sys/types.h>
 #include <stdint.h>
 #include <endian.h>
-#define	__need_time_t
-#include <time.h>
+#include <bits/types/time_t.h>
 
 __BEGIN_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h b/sysdeps/unix/sysv/linux/sys/timerfd.h
index d037213..492c488 100644
--- a/sysdeps/unix/sysv/linux/sys/timerfd.h
+++ b/sysdeps/unix/sysv/linux/sys/timerfd.h
@@ -19,6 +19,7 @@
 #define	_SYS_TIMERFD_H	1
 
 #include <time.h>
+#include <bits/types/struct_itimerspec.h>
 
 /* Get the platform-dependent flags.  */
 #include <bits/timerfd.h>
diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h
index 4dc559f..4499dc5 100644
--- a/sysvipc/sys/msg.h
+++ b/sysvipc/sys/msg.h
@@ -30,8 +30,7 @@
 #include <bits/msq.h>
 
 /* Define types required by the standard.  */
-#define	__need_time_t
-#include <time.h>
+#include <bits/types/time_t.h>
 
 #ifndef __pid_t_defined
 typedef __pid_t pid_t;
diff --git a/sysvipc/sys/sem.h b/sysvipc/sys/sem.h
index 1b32092..3a79f9d 100644
--- a/sysvipc/sys/sem.h
+++ b/sysvipc/sys/sem.h
@@ -30,8 +30,7 @@
 #include <bits/sem.h>
 
 #ifdef __USE_GNU
-# define __need_timespec
-# include <time.h>
+# include <bits/types/struct_timespec.h>
 #endif
 
 /* The following System V style IPC functions implement a semaphore
diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h
index df263dc..41dc6c6 100644
--- a/sysvipc/sys/shm.h
+++ b/sysvipc/sys/shm.h
@@ -30,8 +30,7 @@
 #include <bits/shm.h>
 
 /* Define types required by the standard.  */
-#define __need_time_t
-#include <time.h>
+#include <bits/types/time_t.h>
 
 #ifdef __USE_XOPEN
 # ifndef __pid_t_defined
diff --git a/time/Makefile b/time/Makefile
index e052c07..326a81b 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -22,7 +22,12 @@ subdir	:= time
 
 include ../Makeconfig
 
-headers	:= time.h sys/time.h sys/timeb.h bits/time.h
+headers := time.h sys/time.h sys/timeb.h bits/time.h			\
+	   bits/types/clockid_t.h bits/types/clock_t.h			\
+	   bits/types/struct_itimerspec.h				\
+	   bits/types/struct_timespec.h bits/types/struct_timeval.h	\
+	   bits/types/struct_tm.h bits/types/timer_t.h			\
+	   bits/types/time_t.h
 
 routines := offtime asctime clock ctime ctime_r difftime \
 	    gmtime localtime mktime time		 \
diff --git a/time/bits/types/clock_t.h b/time/bits/types/clock_t.h
new file mode 100644
index 0000000..b8cbaf2
--- /dev/null
+++ b/time/bits/types/clock_t.h
@@ -0,0 +1,15 @@
+#ifndef __clock_t_defined
+#define __clock_t_defined 1
+
+#include <bits/types.h>
+
+__BEGIN_NAMESPACE_STD
+/* Returned by `clock'.  */
+typedef __clock_t clock_t;
+__END_NAMESPACE_STD
+
+#if defined __USE_XOPEN || defined __USE_POSIX
+__USING_NAMESPACE_STD(clock_t)
+#endif
+
+#endif
diff --git a/time/bits/types/clockid_t.h b/time/bits/types/clockid_t.h
new file mode 100644
index 0000000..b17c7da
--- /dev/null
+++ b/time/bits/types/clockid_t.h
@@ -0,0 +1,9 @@
+#ifndef __clockid_t_defined
+#define __clockid_t_defined 1
+
+#include <bits/types.h>
+
+/* Clock ID used in clock and timer functions.  */
+typedef __clockid_t clockid_t;
+
+#endif
diff --git a/time/bits/types/struct_itimerspec.h b/time/bits/types/struct_itimerspec.h
new file mode 100644
index 0000000..17cc1ac
--- /dev/null
+++ b/time/bits/types/struct_itimerspec.h
@@ -0,0 +1,14 @@
+#ifndef __itimerspec_defined
+#define __itimerspec_defined 1
+
+#include <bits/types.h>
+#include <bits/types/struct_timespec.h>
+
+/* POSIX.1b structure for timer start values and intervals.  */
+struct itimerspec
+  {
+    struct timespec it_interval;
+    struct timespec it_value;
+  };
+
+#endif
diff --git a/time/bits/types/struct_timespec.h b/time/bits/types/struct_timespec.h
new file mode 100644
index 0000000..644db9f
--- /dev/null
+++ b/time/bits/types/struct_timespec.h
@@ -0,0 +1,14 @@
+#ifndef __timespec_defined
+#define __timespec_defined 1
+
+#include <bits/types.h>
+
+/* POSIX.1b structure for a time value.  This is like a `struct timeval' but
+   has nanoseconds instead of microseconds.  */
+struct timespec
+{
+  __time_t tv_sec;		/* Seconds.  */
+  __syscall_slong_t tv_nsec;	/* Nanoseconds.  */
+};
+
+#endif
diff --git a/time/bits/types/struct_timeval.h b/time/bits/types/struct_timeval.h
new file mode 100644
index 0000000..70394ce
--- /dev/null
+++ b/time/bits/types/struct_timeval.h
@@ -0,0 +1,13 @@
+#ifndef __timeval_defined
+#define __timeval_defined 1
+
+#include <bits/types.h>
+
+/* A time value that is accurate to the nearest
+   microsecond but also has a range of years.  */
+struct timeval
+{
+  __time_t tv_sec;		/* Seconds.  */
+  __suseconds_t tv_usec;	/* Microseconds.  */
+};
+#endif
diff --git a/time/bits/types/struct_tm.h b/time/bits/types/struct_tm.h
new file mode 100644
index 0000000..8f5af16
--- /dev/null
+++ b/time/bits/types/struct_tm.h
@@ -0,0 +1,33 @@
+#ifndef __struct_tm_defined
+#define __struct_tm_defined 1
+
+#include <bits/types.h>
+
+/* ISO C `broken-down time' structure.  */
+__BEGIN_NAMESPACE_STD
+struct tm
+{
+  int tm_sec;			/* Seconds.	[0-60] (1 leap second) */
+  int tm_min;			/* Minutes.	[0-59] */
+  int tm_hour;			/* Hours.	[0-23] */
+  int tm_mday;			/* Day.		[1-31] */
+  int tm_mon;			/* Month.	[0-11] */
+  int tm_year;			/* Year	- 1900.  */
+  int tm_wday;			/* Day of week.	[0-6] */
+  int tm_yday;			/* Days in year.[0-365]	*/
+  int tm_isdst;			/* DST.		[-1/0/1]*/
+
+# ifdef	__USE_MISC
+  long int tm_gmtoff;		/* Seconds east of UTC.  */
+  const char *tm_zone;		/* Timezone abbreviation.  */
+# else
+  long int __tm_gmtoff;		/* Seconds east of UTC.  */
+  const char *__tm_zone;	/* Timezone abbreviation.  */
+# endif
+};
+__END_NAMESPACE_STD
+#if defined __USE_XOPEN || defined __USE_POSIX
+__USING_NAMESPACE_STD(tm)
+#endif
+
+#endif
diff --git a/time/bits/types/time_t.h b/time/bits/types/time_t.h
new file mode 100644
index 0000000..16e5269
--- /dev/null
+++ b/time/bits/types/time_t.h
@@ -0,0 +1,14 @@
+#ifndef __time_t_defined
+#define __time_t_defined 1
+
+#include <bits/types.h>
+
+__BEGIN_NAMESPACE_STD
+/* Returned by `time'.  */
+typedef __time_t time_t;
+__END_NAMESPACE_STD
+#ifdef __USE_POSIX
+__USING_NAMESPACE_STD(time_t)
+#endif
+
+#endif
diff --git a/time/bits/types/timer_t.h b/time/bits/types/timer_t.h
new file mode 100644
index 0000000..d71a413
--- /dev/null
+++ b/time/bits/types/timer_t.h
@@ -0,0 +1,9 @@
+#ifndef __timer_t_defined
+#define __timer_t_defined 1
+
+#include <bits/types.h>
+
+/* Timer ID returned by `timer_create'.  */
+typedef __timer_t timer_t;
+
+#endif
diff --git a/time/sys/time.h b/time/sys/time.h
index 545de6f..89d574f 100644
--- a/time/sys/time.h
+++ b/time/sys/time.h
@@ -21,18 +21,15 @@
 #include <features.h>
 
 #include <bits/types.h>
-#define __need_time_t
-#include <time.h>
-#define __need_timeval
-#include <bits/time.h>
-
-#include <sys/select.h>
+#include <bits/types/time_t.h>
+#include <bits/types/struct_timeval.h>
 
 #ifndef __suseconds_t_defined
 typedef __suseconds_t suseconds_t;
 # define __suseconds_t_defined
 #endif
 
+#include <sys/select.h>
 
 __BEGIN_DECLS
 
diff --git a/time/sys/timeb.h b/time/sys/timeb.h
index 41d71bf..1e7d0a9 100644
--- a/time/sys/timeb.h
+++ b/time/sys/timeb.h
@@ -20,9 +20,7 @@
 
 #include <features.h>
 
-#define __need_time_t
-#include <time.h>
-
+#include <bits/types/time_t.h>
 
 __BEGIN_DECLS
 
diff --git a/time/time.h b/time/time.h
index cc93917..c38fac7 100644
--- a/time/time.h
+++ b/time/time.h
@@ -20,168 +20,52 @@
  */
 
 #ifndef	_TIME_H
+#define _TIME_H	1
 
-#if (! defined __need_time_t && !defined __need_clock_t && \
-     ! defined __need_timespec)
-# define _TIME_H	1
-# include <features.h>
+#include <features.h>
 
-__BEGIN_DECLS
-
-#endif
-
-#ifdef	_TIME_H
-/* Get size_t and NULL from <stddef.h>.  */
-# define __need_size_t
-# define __need_NULL
-# include <stddef.h>
+#define __need_size_t
+#define __need_NULL
+#include <stddef.h>
 
 /* This defines CLOCKS_PER_SEC, which is the number of processor clock
-   ticks per second.  */
-# include <bits/time.h>
-
-/* This is the obsolete POSIX.1-1988 name for the same constant.  */
-# if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
-#  ifndef CLK_TCK
-#   define CLK_TCK	CLOCKS_PER_SEC
-#  endif
-# endif
-
-#endif /* <time.h> included.  */
-
-#if !defined __clock_t_defined && (defined _TIME_H || defined __need_clock_t)
-# define __clock_t_defined	1
-
-# include <bits/types.h>
-
-__BEGIN_NAMESPACE_STD
-/* Returned by `clock'.  */
-typedef __clock_t clock_t;
-__END_NAMESPACE_STD
-#if defined __USE_XOPEN || defined __USE_POSIX
-__USING_NAMESPACE_STD(clock_t)
-#endif
-
-#endif /* clock_t not defined and <time.h> or need clock_t.  */
-#undef	__need_clock_t
-
-#if !defined __time_t_defined && (defined _TIME_H || defined __need_time_t)
-# define __time_t_defined	1
-
-# include <bits/types.h>
-
-__BEGIN_NAMESPACE_STD
-/* Returned by `time'.  */
-typedef __time_t time_t;
-__END_NAMESPACE_STD
-#ifdef __USE_POSIX
-__USING_NAMESPACE_STD(time_t)
-#endif
-
-#endif /* time_t not defined and <time.h> or need time_t.  */
-#undef	__need_time_t
-
-#if !defined __clockid_t_defined && \
-   ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_clockid_t)
-# define __clockid_t_defined	1
-
-# include <bits/types.h>
-
-/* Clock ID used in clock and timer functions.  */
-typedef __clockid_t clockid_t;
-
-#endif /* clockid_t not defined and <time.h> or need clockid_t.  */
-#undef	__clockid_time_t
-
-#if !defined __timer_t_defined && \
-    ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_timer_t)
-# define __timer_t_defined	1
-
-# include <bits/types.h>
-
-/* Timer ID returned by `timer_create'.  */
-typedef __timer_t timer_t;
-
-#endif /* timer_t not defined and <time.h> or need timer_t.  */
-#undef	__need_timer_t
+   ticks per second, and possibly a number of other constants.   */
+#include <bits/time.h>
 
+/* Many of the typedefs and structs whose official home is this header
+   may also need to be defined by other headers.  */
+#include <bits/types/clock_t.h>
+#include <bits/types/time_t.h>
+#include <bits/types/struct_tm.h>
 
-#if (!defined __timespec_defined					\
-     && ((defined _TIME_H						\
-	  && (defined __USE_POSIX199309					\
-	      || defined __USE_ISOC11))					\
-	 || defined __need_timespec))
-# define __timespec_defined	1
-
-# include <bits/types.h>	/* This defines __time_t for us.  */
-
-/* POSIX.1b structure for a time value.  This is like a `struct timeval' but
-   has nanoseconds instead of microseconds.  */
-struct timespec
-  {
-    __time_t tv_sec;		/* Seconds.  */
-    __syscall_slong_t tv_nsec;	/* Nanoseconds.  */
-  };
-
-#endif /* timespec not defined and <time.h> or need timespec.  */
-#undef	__need_timespec
-
-
-#ifdef	_TIME_H
-__BEGIN_NAMESPACE_STD
-/* Used by other time functions.  */
-struct tm
-{
-  int tm_sec;			/* Seconds.	[0-60] (1 leap second) */
-  int tm_min;			/* Minutes.	[0-59] */
-  int tm_hour;			/* Hours.	[0-23] */
-  int tm_mday;			/* Day.		[1-31] */
-  int tm_mon;			/* Month.	[0-11] */
-  int tm_year;			/* Year	- 1900.  */
-  int tm_wday;			/* Day of week.	[0-6] */
-  int tm_yday;			/* Days in year.[0-365]	*/
-  int tm_isdst;			/* DST.		[-1/0/1]*/
-
-# ifdef	__USE_MISC
-  long int tm_gmtoff;		/* Seconds east of UTC.  */
-  const char *tm_zone;		/* Timezone abbreviation.  */
-# else
-  long int __tm_gmtoff;		/* Seconds east of UTC.  */
-  const char *__tm_zone;	/* Timezone abbreviation.  */
-# endif
-};
-__END_NAMESPACE_STD
-#if defined __USE_XOPEN || defined __USE_POSIX
-__USING_NAMESPACE_STD(tm)
+#if defined __USE_POSIX199309 || defined __USE_ISOC11
+# include <bits/types/struct_timespec.h>
 #endif
 
-
-# ifdef __USE_POSIX199309
-/* POSIX.1b structure for timer start values and intervals.  */
-struct itimerspec
-  {
-    struct timespec it_interval;
-    struct timespec it_value;
-  };
-
-/* We can use a simple forward declaration.  */
+#ifdef __USE_POSIX199309
+# include <bits/types/clockid_t.h>
+# include <bits/types/timer_t.h>
+# include <bits/types/struct_itimerspec.h>
 struct sigevent;
+#endif
 
-# endif	/* POSIX.1b */
-
-# ifdef __USE_XOPEN2K
-#  ifndef __pid_t_defined
+#ifdef __USE_XOPEN2K
+# ifndef __pid_t_defined
 typedef __pid_t pid_t;
-#   define __pid_t_defined
-#  endif
+#  define __pid_t_defined
 # endif
+#endif
 
+#ifdef __USE_XOPEN2K8
+# include <xlocale.h>
+#endif
 
-# ifdef __USE_ISOC11
+#ifdef __USE_ISOC11
 /* Time base values for timespec_get.  */
 # define TIME_UTC 1
-# endif
+#endif
 
+__BEGIN_DECLS
 
 __BEGIN_NAMESPACE_STD
 /* Time used by the program so far (user time + system time).
@@ -207,30 +91,29 @@ extern size_t strftime (char *__restrict __s, size_t __maxsize,
 			const struct tm *__restrict __tp) __THROW;
 __END_NAMESPACE_STD
 
-# ifdef __USE_XOPEN
+#ifdef __USE_XOPEN
 /* Parse S according to FORMAT and store binary time information in TP.
    The return value is a pointer to the first unparsed character in S.  */
 extern char *strptime (const char *__restrict __s,
 		       const char *__restrict __fmt, struct tm *__tp)
      __THROW;
-# endif
+#endif
 
-# ifdef __USE_XOPEN2K8
+#ifdef __USE_XOPEN2K8
 /* Similar to the two functions above but take the information from
    the provided locale and not the global locale.  */
-# include <xlocale.h>
 
 extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
 			  const char *__restrict __format,
 			  const struct tm *__restrict __tp,
 			  __locale_t __loc) __THROW;
-# endif
+#endif
 
-# ifdef __USE_GNU
+#ifdef __USE_GNU
 extern char *strptime_l (const char *__restrict __s,
 			 const char *__restrict __fmt, struct tm *__tp,
 			 __locale_t __loc) __THROW;
-# endif
+#endif
 
 
 __BEGIN_NAMESPACE_STD
@@ -243,7 +126,7 @@ extern struct tm *gmtime (const time_t *__timer) __THROW;
 extern struct tm *localtime (const time_t *__timer) __THROW;
 __END_NAMESPACE_STD
 
-# ifdef __USE_POSIX
+#ifdef __USE_POSIX
 /* Return the `struct tm' representation of *TIMER in UTC,
    using *TP to store the result.  */
 extern struct tm *gmtime_r (const time_t *__restrict __timer,
@@ -253,7 +136,7 @@ extern struct tm *gmtime_r (const time_t *__restrict __timer,
    using *TP to store the result.  */
 extern struct tm *localtime_r (const time_t *__restrict __timer,
 			       struct tm *__restrict __tp) __THROW;
-# endif	/* POSIX */
+#endif	/* POSIX */
 
 __BEGIN_NAMESPACE_STD
 /* Return a string of the form "Day Mon dd hh:mm:ss yyyy\n"
@@ -264,7 +147,7 @@ extern char *asctime (const struct tm *__tp) __THROW;
 extern char *ctime (const time_t *__timer) __THROW;
 __END_NAMESPACE_STD
 
-# ifdef __USE_POSIX
+#ifdef __USE_POSIX
 /* Reentrant versions of the above functions.  */
 
 /* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n"
@@ -275,7 +158,7 @@ extern char *asctime_r (const struct tm *__restrict __tp,
 /* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'.  */
 extern char *ctime_r (const time_t *__restrict __timer,
 		      char *__restrict __buf) __THROW;
-# endif	/* POSIX */
+#endif	/* POSIX */
 
 
 /* Defined in localtime.c.  */
@@ -284,34 +167,34 @@ extern int __daylight;		/* If daylight-saving time is ever in use.  */
 extern long int __timezone;	/* Seconds west of UTC.  */
 
 
-# ifdef	__USE_POSIX
+#ifdef	__USE_POSIX
 /* Same as above.  */
 extern char *tzname[2];
 
 /* Set time conversion information from the TZ environment variable.
    If TZ is not defined, a locale-dependent default is used.  */
 extern void tzset (void) __THROW;
-# endif
+#endif
 
-# if defined __USE_MISC || defined __USE_XOPEN
+#if defined __USE_MISC || defined __USE_XOPEN
 extern int daylight;
 extern long int timezone;
-# endif
+#endif
 
-# ifdef __USE_MISC
+#ifdef __USE_MISC
 /* Set the system time to *WHEN.
    This call is restricted to the superuser.  */
 extern int stime (const time_t *__when) __THROW;
-# endif
+#endif
 
 
 /* Nonzero if YEAR is a leap year (every 4 years,
    except every 100th isn't, and every 400th is).  */
-# define __isleap(year)	\
+#define __isleap(year)	\
   ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
 
 
-# ifdef __USE_MISC
+#ifdef __USE_MISC
 /* Miscellaneous functions many Unices inherited from the public domain
    localtime package.  These are included only for compatibility.  */
 
@@ -323,10 +206,10 @@ extern time_t timelocal (struct tm *__tp) __THROW;
 
 /* Return the number of days in YEAR.  */
 extern int dysize (int __year) __THROW  __attribute__ ((__const__));
-# endif
+#endif
 
 
-# ifdef __USE_POSIX199309
+#ifdef __USE_POSIX199309
 /* Pause execution for a number of nanoseconds.
 
    This function is a cancellation point and therefore not marked with
@@ -345,7 +228,7 @@ extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW;
 extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp)
      __THROW;
 
-#  ifdef __USE_XOPEN2K
+# ifdef __USE_XOPEN2K
 /* High-resolution sleep with the specified clock.
 
    This function is a cancellation point and therefore not marked with
@@ -356,7 +239,7 @@ extern int clock_nanosleep (clockid_t __clock_id, int __flags,
 
 /* Return clock ID for CPU-time clock.  */
 extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW;
-#  endif
+# endif
 
 
 /* Create new per-process timer using CLOCK_ID.  */
@@ -378,17 +261,17 @@ extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
 
 /* Get expiration overrun for timer TIMERID.  */
 extern int timer_getoverrun (timer_t __timerid) __THROW;
-# endif
+#endif
 
 
-# ifdef __USE_ISOC11
+#ifdef __USE_ISOC11
 /* Set TS to calendar time based in time base BASE.  */
 extern int timespec_get (struct timespec *__ts, int __base)
      __THROW __nonnull ((1));
-# endif
+#endif
 
 
-# ifdef __USE_XOPEN_EXTENDED
+#ifdef __USE_XOPEN_EXTENDED
 /* Set to one of the following values to indicate an error.
      1  the DATEMSK environment variable is null or undefined,
      2  the template file cannot be opened for reading,
@@ -410,9 +293,9 @@ extern int getdate_err;
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern struct tm *getdate (const char *__string);
-# endif
+#endif
 
-# ifdef __USE_GNU
+#ifdef __USE_GNU
 /* Since `getdate' is not reentrant because of the use of `getdate_err'
    and the static buffer to return the result in, we provide a thread-safe
    variant.  The functionality is the same.  The result is returned in
@@ -425,10 +308,8 @@ extern struct tm *getdate (const char *__string);
    therefore not marked with __THROW.  */
 extern int getdate_r (const char *__restrict __string,
 		      struct tm *__restrict __resbufp);
-# endif
+#endif
 
 __END_DECLS
 
-#endif /* <time.h> included.  */
-
-#endif /* <time.h> not already included.  */
+#endif /* time.h.  */

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=f2bea4da2e65b5d91a23a01fb2062bcec33974aa

commit f2bea4da2e65b5d91a23a01fb2062bcec33974aa
Author: Zack Weinberg <zackw@panix.com>
Date:   Wed Jul 13 15:20:29 2016 -0400

    Installed-header hygiene (BZ#20366): conditionally defined structures.
    
    Several network-related structures are defined conditionally under
    __USE_MISC, but unconditionally used by other headers.  The path of
    least resistance is usually to condition the uses on __USE_MISC as
    well.
    
    	* sysdeps/mach/hurd/net/if_ppp.h
    	* sysdeps/unix/sysv/linux/net/if_ppp.h:
            Only define struct ifpppstatsreq and struct ifpppcstatsreq
            if __USE_MISC is defined, to ensure struct ifreq is declared.
    
    	* inet/netinet/ether.h: Condition all function prototypes
            on __USE_MISC, to ensure struct ether_addr is declared.
    
    sys/socket.h defines struct osockaddr only under __USE_MISC, whereas
    protocols/talkd.h requires it unconditionally.  Here it doesn't make
    sense to condition the entire body of protocols/talkd.h on __USE_MISC.
    Rather than complicate sys/socket.h with a __need macro or duplicate
    the definition, I am introducing a new concept: tiny headers named
    bits/types/TYPE.h that define TYPE and nothing else.  This can, I hope,
    ultimately replace *all* the __need macros.  The guard macro for such
    headers will be __TYPE_defined, just in case application or third-party
    library code is looking at them.
    
    	* socket/bits/types/struct_osockaddr.h: New header.
    	* include/bits/types/struct_osockaddr.h: New wrapper.
    	* socket/Makefile: Install the new header.
    	* socket/sys/socket.h,  inet/protocols/talkd.h:
    	Refer to bits/types/struct_osockaddr.h for the definition of
    	struct osockaddr.

diff --git a/ChangeLog b/ChangeLog
index 81456f8..60500b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2016-09-23  Zack Weinberg  <zackw@panix.com>
 
+	* sysdeps/mach/hurd/net/if_ppp.h
+	* sysdeps/unix/sysv/linux/net/if_ppp.h:
+	Only define struct ifpppstatsreq and struct ifpppcstatsreq
+	if __USE_MISC is defined, to ensure struct ifreq is declared.
+
+	* inet/netinet/ether.h: Condition all function prototypes
+	on __USE_MISC, to ensure struct ether_addr is declared.
+
+	* socket/bits/types/struct_osockaddr.h: New header.
+	* include/bits/types/struct_osockaddr.h: New wrapper.
+	* socket/Makefile: Install the new header.
+	* socket/sys/socket.h, inet/protocols/talkd.h:
+	Refer to bits/types/struct_osockaddr.h for the definition of
+	struct osockaddr.
+
+2016-09-23  Zack Weinberg  <zackw@panix.com>
+
 	* bits/in.h, gmon/sys/gmon.h, inet/netinet/igmp.h
 	* inet/protocols/routed.h, inet/protocols/talkd.h
 	* inet/protocols/timed.h, io/fts.h, nptl_db/thread_db.h
diff --git a/include/bits/types/struct_osockaddr.h b/include/bits/types/struct_osockaddr.h
new file mode 100644
index 0000000..78f3188
--- /dev/null
+++ b/include/bits/types/struct_osockaddr.h
@@ -0,0 +1 @@
+#include "../../socket/bits/types/struct_osockaddr.h"
diff --git a/inet/netinet/ether.h b/inet/netinet/ether.h
index 3dff523..0952b23 100644
--- a/inet/netinet/ether.h
+++ b/inet/netinet/ether.h
@@ -24,6 +24,7 @@
 /* Get definition of `struct ether_addr'.  */
 #include <netinet/if_ether.h>
 
+#ifdef __USE_MISC
 __BEGIN_DECLS
 
 /* Convert 48 bit Ethernet ADDRess to ASCII.  */
@@ -49,5 +50,6 @@ extern int ether_line (const char *__line, struct ether_addr *__addr,
 		       char *__hostname) __THROW;
 
 __END_DECLS
+#endif /* Use misc.  */
 
 #endif /* netinet/ether.h */
diff --git a/inet/protocols/talkd.h b/inet/protocols/talkd.h
index 34e2654..09bd8a9 100644
--- a/inet/protocols/talkd.h
+++ b/inet/protocols/talkd.h
@@ -53,6 +53,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <stdint.h>
+#include <bits/types/struct_osockaddr.h>
 
 /*
  * Client->server request message format.
diff --git a/socket/Makefile b/socket/Makefile
index 92450e8..6be5ec7 100644
--- a/socket/Makefile
+++ b/socket/Makefile
@@ -23,7 +23,8 @@ subdir	:= socket
 include ../Makeconfig
 
 headers	:= sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \
-	   bits/socket2.h sys/socketvar.h net/if.h
+	   bits/socket2.h bits/types/struct_osockaddr.h \
+	   sys/socketvar.h net/if.h
 
 routines := accept bind connect getpeername getsockname getsockopt	\
 	    listen recv recvfrom recvmsg send sendmsg sendto		\
diff --git a/socket/bits/types/struct_osockaddr.h b/socket/bits/types/struct_osockaddr.h
new file mode 100644
index 0000000..e0bf59d
--- /dev/null
+++ b/socket/bits/types/struct_osockaddr.h
@@ -0,0 +1,12 @@
+#ifndef __osockaddr_defined
+#define __osockaddr_defined 1
+
+/* This is the 4.3 BSD `struct sockaddr' format, which is used as wire
+   format in the grotty old 4.3 `talk' protocol.  */
+struct osockaddr
+{
+  unsigned short int sa_family;
+  unsigned char sa_data[14];
+};
+
+#endif
diff --git a/socket/sys/socket.h b/socket/sys/socket.h
index c9f0f50..5be1b91 100644
--- a/socket/sys/socket.h
+++ b/socket/sys/socket.h
@@ -38,13 +38,7 @@ __BEGIN_DECLS
 #include <bits/socket.h>
 
 #ifdef __USE_MISC
-/* This is the 4.3 BSD `struct sockaddr' format, which is used as wire
-   format in the grotty old 4.3 `talk' protocol.  */
-struct osockaddr
-  {
-    unsigned short int sa_family;
-    unsigned char sa_data[14];
-  };
+# include <bits/types/struct_osockaddr.h>
 #endif
 
 /* The following constants should be used for the second parameter of
diff --git a/sysdeps/mach/hurd/net/if_ppp.h b/sysdeps/mach/hurd/net/if_ppp.h
index b210d7f..8ee620b 100644
--- a/sysdeps/mach/hurd/net/if_ppp.h
+++ b/sysdeps/mach/hurd/net/if_ppp.h
@@ -119,6 +119,8 @@ struct ppp_option_data {
 	int	  transmit;
 };
 
+/* 'struct ifreq' is only available from net/if.h under __USE_MISC.  */
+#ifdef __USE_MISC
 struct ifpppstatsreq {
   struct ifreq	   b;
   struct ppp_stats stats;			/* statistic information */
@@ -131,6 +133,7 @@ struct ifpppcstatsreq {
 
 #define ifr__name       b.ifr_ifrn.ifrn_name
 #define stats_ptr       b.ifr_ifru.ifru_data
+#endif
 
 /*
  * Ioctl definitions.
diff --git a/sysdeps/unix/sysv/linux/net/if_ppp.h b/sysdeps/unix/sysv/linux/net/if_ppp.h
index 9994982..31a2076 100644
--- a/sysdeps/unix/sysv/linux/net/if_ppp.h
+++ b/sysdeps/unix/sysv/linux/net/if_ppp.h
@@ -118,6 +118,8 @@ struct ppp_option_data {
 	int	 transmit;
 };
 
+/* 'struct ifreq' is only available from net/if.h under __USE_MISC.  */
+#ifdef __USE_MISC
 struct ifpppstatsreq {
   struct ifreq	   b;
   struct ppp_stats stats;			/* statistic information */
@@ -130,6 +132,7 @@ struct ifpppcstatsreq {
 
 #define ifr__name       b.ifr_ifrn.ifrn_name
 #define stats_ptr       b.ifr_ifru.ifru_data
+#endif
 
 /*
  * Ioctl definitions.

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=11160cb76f56e0a711686e34881a4eaf1ad2fa0e

commit 11160cb76f56e0a711686e34881a4eaf1ad2fa0e
Author: Zack Weinberg <zackw@panix.com>
Date:   Sun Aug 21 15:38:41 2016 -0400

    Installed-header hygiene (BZ#20366): obsolete BSD u_* types.
    
    The types u_char, u_short, u_int, u_long, ushort, uint, ulong, u_int8_t,
    u_int16_t, u_int32_t, u_int64_t, quad_t, and u_quad_t are BSDisms that
    have never been standardized.  While glibc should continue to *provide*
    these types for compatibility's sake, its public headers should not
    use them.
    
    The meat of this change was mechanically generated by the following
    shell command:
    
        perl -pi~ -e '
            s/\b(__)?u_char\b/unsigned char/g;
            s/\b(__)?u_?short\b/unsigned short/g;
            s/\b(__)?u_?int\b/unsigned int/g;
            s/\b(__)?u_?long\b/unsigned long/g;
            s/\b(__)?u_int8_t\b/uint8_t/g;
            s/\b(__)?u_int16_t\b/uint16_t/g;
            s/\b(__)?u_int32_t\b/uint32_t/g;
            s/\b(__)?u_int64_t\b/uint64_t/g;
            s/\b(__)?u_quad_t\b/uint64_t/g;
            s/\b(__)?quad_t\b/uint64_t/g;
        ' $(grep -lE -e '\<((__)?(quad_t|u(short|int|long|_(char|short|int([0-9]+_t)?|long|quad_t))))\>' \
            $(grep -LE '\<(_(SYS|BITS)_TYPES_H|rpc/(rpc|rpc_msg|types|xdr)\.h)\>' \
              $(find . \( -false $(sed 's/^/-o -name /' all-installed-headers) \
                       \) -printf '%P\n' | sort -u)))
    
    where 'all-installed-headers' was a list of the basenames of all installed
    header files, manually extracted from the Makefiles.  Non-installed
    wrapper headers in include/ are also adjusted, for consistency.
    I then manually fixed up indentation and line-wrapping.
    
    sys/types.h and bits/types.h are excluded because they must continue
    to define the u_* types (under __USE_MISC) for compatibility with
    applications.  They do not use these types themselves.
    
    All headers that (transitively) include rpc/types.h are also excluded,
    for three reasons.  First, the u_* types are defined by rpc/types.h,
    unconditionally (not just under __USE_MISC) so they are logically part
    of the SunRPC API.  Second, many of those headers appear to be
    machine-generated.  Third, it's my understanding that we are getting
    rid of as much of SunRPC as possible in the near future.
    
    (The one file under sunrpc/ that's touched, sunrpc/rpc/rpc_des.h, does
    *not* include rpc/types.h.  This may itself be a bug.)
    
    After changing from u_intNN_t to uintNN_t, a number of headers now
    need to include stdint.h to pick up those types.  It might be more
    hygenic, namespace-wise, to use __uintNN_t instead, but none of these
    headers are bound by ISO or POSIX to do so, and it's unlikely that
    anyone using them will be bothered.  (The two files that were using
    __-prefixed versions of the u_types, sysdeps/mach/hurd/net/route.h and
    sysdeps/unix/sysv/linux/net/route.h, both already also contained uses of
    the unprefixed versions.)
    
    Some of these files directly included features.h and/or sys/cdefs.h,
    which I removed, as the style generally seems to be to let sys/types.h
    do that for us.  (This does not change the set of definitions exposed
    by any header; sys/types.h unconditionally includes both features.h
    and sys/cdefs.h.)
    
    One file included asm/types.h unnecessarily.
    
    	* bits/in.h, gmon/sys/gmon.h, inet/netinet/igmp.h
    	* inet/protocols/routed.h, inet/protocols/talkd.h
    	* inet/protocols/timed.h, io/fts.h, nptl_db/thread_db.h
    	* resolv/arpa/nameser.h, resolv/resolv.h, sunrpc/rpc/rpc_des.h
    	* sysdeps/generic/netinet/if_ether.h
    	* sysdeps/generic/netinet/in_systm.h
    	* sysdeps/generic/netinet/ip.h, sysdeps/generic/netinet/tcp.h
    	* sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h
    	* sysdeps/gnu/netinet/udp.h, sysdeps/mach/hurd/net/ethernet.h
    	* sysdeps/mach/hurd/net/if_arp.h
    	* sysdeps/mach/hurd/net/if_ppp.h
    	* sysdeps/mach/hurd/net/route.h, sysdeps/mach/sys/reboot.h
    	* sysdeps/unix/sysv/linux/bits/in.h
    	* sysdeps/unix/sysv/linux/net/ethernet.h
    	* sysdeps/unix/sysv/linux/net/if_arp.h
    	* sysdeps/unix/sysv/linux/net/if_ppp.h
    	* sysdeps/unix/sysv/linux/net/if_shaper.h
    	* sysdeps/unix/sysv/linux/net/route.h
    	* sysdeps/unix/sysv/linux/netinet/if_ether.h
    	* sysdeps/unix/sysv/linux/netinet/if_fddi.h
    	* sysdeps/unix/sysv/linux/netinet/if_tr.h
    	* sysdeps/unix/sysv/linux/netipx/ipx.h
    	* sysdeps/unix/sysv/linux/sys/acct.h
    	* include/arpa/nameser.h, include/resolv.h:
    	Change all uses of u_char to unsigned char,
    	u_short and ushort to unsigned short, u_int and uint to unsigned int,
    	u_long and ulong to unsigned long, u_int8_t to uint8_t,
            u_int16_t to uint16_t, u_int32_t to uint32_t, quad_t to int64_t,
    	and u_int64_t and u_quad_t to uint64_t.
    
    	* mach/sys/reboot.h: Remove two casts of integer literals
    	to the types they already have.
    
    	* bits/in.h: Correct error in description of IP_MULTICAST_LOOP.
    	* sysdeps/unix/sysv/linux/bits/in.h: Likewise.
    	* sysdeps/unix/sysv/linux/netinet/if_ether.h: Change a comment
    	from referring to 'unsigned char' to 'uint8_t' for consistency with
    	the macro definition below.
    
    	* gmon/sys/gmon.h, inet/netinet/igmp.h, inet/protocols/talkd.h
    	* io/fts.h, resolv/arpa/nameser.h, resolv/resolv.h
    	* sunrpc/rpc/rpc_des.h, sysdeps/generic/netinet/ip.h
    	* sysdeps/gnu/netinet/tcp.h, sysdeps/gnu/netinet/udp.h
    	* sysdeps/mach/hurd/net/if_ppp.h, sysdeps/unix/sysv/linux/net/if_ppp.h
    	* sysdeps/unix/sysv/linux/sys/acct.h
    	* include/arpa/nameser.h, include/resolv.h:
    	Fix indentation disrupted by mechanical edits.
    
    	* inet/protocols/talkd.h, resolv/arpa/nameser.h
    	* sysdeps/generic/netinet/in_systm.h
    	* sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h
    	* sysdeps/gnu/netinet/udp.h
    	* sysdeps/unix/sysv/linux/net/ethernet.h
    	* sysdeps/unix/sysv/linux/net/if_arp.h
    	* sysdeps/unix/sysv/linux/net/if_ppp.h
    	* sysdeps/unix/sysv/linux/net/if_shaper.h
    	* sysdeps/unix/sysv/linux/netinet/if_fddi.h
    	* sysdeps/unix/sysv/linux/netinet/if_tr.h
    	* sysdeps/unix/sysv/linux/netipx/ipx.h
    	* sysdeps/unix/sysv/linux/sys/acct.h
    	Include stdint.h for uintNN_t definitions.
    	Don't include sys/cdefs.h, features.h, or asm/types.h directly.

diff --git a/ChangeLog b/ChangeLog
index f4ea6f1..81456f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,70 @@
 2016-09-23  Zack Weinberg  <zackw@panix.com>
 
+	* bits/in.h, gmon/sys/gmon.h, inet/netinet/igmp.h
+	* inet/protocols/routed.h, inet/protocols/talkd.h
+	* inet/protocols/timed.h, io/fts.h, nptl_db/thread_db.h
+	* resolv/arpa/nameser.h, resolv/resolv.h, sunrpc/rpc/rpc_des.h
+	* sysdeps/generic/netinet/if_ether.h
+	* sysdeps/generic/netinet/in_systm.h
+	* sysdeps/generic/netinet/ip.h, sysdeps/generic/netinet/tcp.h
+	* sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h
+	* sysdeps/gnu/netinet/udp.h, sysdeps/mach/hurd/net/ethernet.h
+	* sysdeps/mach/hurd/net/if_arp.h
+	* sysdeps/mach/hurd/net/if_ppp.h
+	* sysdeps/mach/hurd/net/route.h, sysdeps/mach/sys/reboot.h
+	* sysdeps/unix/sysv/linux/bits/in.h
+	* sysdeps/unix/sysv/linux/net/ethernet.h
+	* sysdeps/unix/sysv/linux/net/if_arp.h
+	* sysdeps/unix/sysv/linux/net/if_ppp.h
+	* sysdeps/unix/sysv/linux/net/if_shaper.h
+	* sysdeps/unix/sysv/linux/net/route.h
+	* sysdeps/unix/sysv/linux/netinet/if_ether.h
+	* sysdeps/unix/sysv/linux/netinet/if_fddi.h
+	* sysdeps/unix/sysv/linux/netinet/if_tr.h
+	* sysdeps/unix/sysv/linux/netipx/ipx.h
+	* sysdeps/unix/sysv/linux/sys/acct.h
+	* include/arpa/nameser.h, include/resolv.h:
+	Change all uses of u_char to unsigned char,
+	u_short and ushort to unsigned short, u_int and uint to unsigned int,
+	u_long and ulong to unsigned long, u_int8_t to uint8_t,
+	u_int16_t to uint16_t, u_int32_t to uint32_t, quad_t to int64_t,
+	and u_int64_t and u_quad_t to uint64_t.
+
+	* mach/sys/reboot.h: Remove two casts of integer literals
+	to the types they already have.
+
+	* bits/in.h: Correct error in description of IP_MULTICAST_LOOP.
+	* sysdeps/unix/sysv/linux/bits/in.h: Likewise.
+	* sysdeps/unix/sysv/linux/netinet/if_ether.h: Change a comment
+	from referring to 'unsigned char' to 'uint8_t' for consistency with
+	the macro definition below.
+
+	* gmon/sys/gmon.h, inet/netinet/igmp.h, inet/protocols/talkd.h
+	* io/fts.h, resolv/arpa/nameser.h, resolv/resolv.h
+	* sunrpc/rpc/rpc_des.h, sysdeps/generic/netinet/ip.h
+	* sysdeps/gnu/netinet/tcp.h, sysdeps/gnu/netinet/udp.h
+	* sysdeps/mach/hurd/net/if_ppp.h, sysdeps/unix/sysv/linux/net/if_ppp.h
+	* sysdeps/unix/sysv/linux/sys/acct.h
+	* include/arpa/nameser.h, include/resolv.h:
+	Fix indentation disrupted by mechanical edits.
+
+	* inet/protocols/talkd.h, resolv/arpa/nameser.h
+	* sysdeps/generic/netinet/in_systm.h
+	* sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h
+	* sysdeps/gnu/netinet/udp.h
+	* sysdeps/unix/sysv/linux/net/ethernet.h
+	* sysdeps/unix/sysv/linux/net/if_arp.h
+	* sysdeps/unix/sysv/linux/net/if_ppp.h
+	* sysdeps/unix/sysv/linux/net/if_shaper.h
+	* sysdeps/unix/sysv/linux/netinet/if_fddi.h
+	* sysdeps/unix/sysv/linux/netinet/if_tr.h
+	* sysdeps/unix/sysv/linux/netipx/ipx.h
+	* sysdeps/unix/sysv/linux/sys/acct.h
+	Include stdint.h for uintNN_t definitions.
+	Don't include sys/cdefs.h, features.h, or asm/types.h directly.
+
+2016-09-23  Zack Weinberg  <zackw@panix.com>
+
 	* rpcsvc/nislib.h: Include rpcsvc/nis.h.
 	* sysdeps/unix/sysv/linux/netrose/rose.h:
 	Include sys/socket.h and netax25/ax25.h.
diff --git a/bits/in.h b/bits/in.h
index 7dc93c1..8063a75 100644
--- a/bits/in.h
+++ b/bits/in.h
@@ -39,8 +39,8 @@
 #define	IP_RECVDSTADDR	7	/* bool; Receive IP dst addr w/datagram.  */
 #define	IP_RETOPTS	8	/* ip_opts; Set/get IP per-packet options.  */
 #define IP_MULTICAST_IF 9	/* in_addr; set/get IP multicast i/f */
-#define IP_MULTICAST_TTL 10	/* u_char; set/get IP multicast ttl */
-#define IP_MULTICAST_LOOP 11	/* i_char; set/get IP multicast loopback */
+#define IP_MULTICAST_TTL 10	/* unsigned char; set/get IP multicast ttl */
+#define IP_MULTICAST_LOOP 11	/* bool; set/get IP multicast loopback */
 #define IP_ADD_MEMBERSHIP 12	/* ip_mreq; add an IP group membership */
 #define IP_DROP_MEMBERSHIP 13	/* ip_mreq; drop an IP group membership */
 
diff --git a/gmon/sys/gmon.h b/gmon/sys/gmon.h
index 5b430ab..b4cc3b0 100644
--- a/gmon/sys/gmon.h
+++ b/gmon/sys/gmon.h
@@ -117,7 +117,7 @@ extern struct __bb *__bb_head;
 /*
  * The type used to represent indices into gmonparam.tos[].
  */
-#define	ARCINDEX	u_long
+#define	ARCINDEX	unsigned long
 
 /*
  * Maximum number of arcs we want to allow.
@@ -130,7 +130,7 @@ extern struct __bb *__bb_head;
 #define MAXARCS		(1 << 20)
 
 struct tostruct {
-	u_long		selfpc;
+	unsigned long	selfpc;
 	long		count;
 	ARCINDEX	link;
 };
@@ -140,9 +140,9 @@ struct tostruct {
  * the called site and a count.
  */
 struct rawarc {
-	u_long	raw_frompc;
-	u_long	raw_selfpc;
-	long	raw_count;
+	unsigned long	raw_frompc;
+	unsigned long	raw_selfpc;
+	long		raw_count;
 };
 
 /*
@@ -156,17 +156,17 @@ struct rawarc {
  */
 struct gmonparam {
 	long int	state;
-	u_short		*kcount;
-	u_long		kcountsize;
+	unsigned short	*kcount;
+	unsigned long	kcountsize;
 	ARCINDEX	*froms;
-	u_long		fromssize;
+	unsigned long	fromssize;
 	struct tostruct	*tos;
-	u_long		tossize;
+	unsigned long	tossize;
 	long		tolimit;
-	u_long		lowpc;
-	u_long		highpc;
-	u_long		textsize;
-	u_long		hashfraction;
+	unsigned long	lowpc;
+	unsigned long	highpc;
+	unsigned long	textsize;
+	unsigned long	hashfraction;
 	long		log_hashfraction;
 };
 
@@ -190,8 +190,8 @@ struct gmonparam {
 __BEGIN_DECLS
 
 /* Set up data structures and start profiling.  */
-extern void __monstartup (u_long __lowpc, u_long __highpc) __THROW;
-extern void monstartup (u_long __lowpc, u_long __highpc) __THROW;
+extern void __monstartup (unsigned long __lowpc, unsigned long __highpc) __THROW;
+extern void monstartup (unsigned long __lowpc, unsigned long __highpc) __THROW;
 
 /* Clean up profiling and write out gmon.out.  */
 extern void _mcleanup (void) __THROW;
diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h
index 57f7457..ce6f023 100644
--- a/include/arpa/nameser.h
+++ b/include/arpa/nameser.h
@@ -47,8 +47,8 @@ extern const struct _ns_flagdata _ns_flagdata[] attribute_hidden;
 
 #endif
 
-extern u_int		__ns_get16 (const u_char *) __THROW;
-extern u_long		__ns_get32 (const u_char *) __THROW;
+extern unsigned int	__ns_get16 (const unsigned char *) __THROW;
+extern unsigned long	__ns_get32 (const unsigned char *) __THROW;
 
 #define ns_msg_getflag(handle, flag) \
   (((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift)
diff --git a/include/resolv.h b/include/resolv.h
index d7c98dc..52ac218 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -29,14 +29,14 @@ extern struct hostent *_gethtent (void);
 extern struct hostent *_gethtbyname (const char *__name);
 extern struct hostent *_gethtbyname2 (const char *__name, int __af);
 struct hostent *_gethtbyaddr (const char *addr, size_t __len, int __af);
-extern u_int32_t _getlong (const u_char *__src);
-extern u_int16_t _getshort (const u_char *__src);
-extern void res_pquery (const res_state __statp, const u_char *__msg,
+extern uint32_t _getlong (const unsigned char *__src);
+extern uint16_t _getshort (const unsigned char *__src);
+extern void res_pquery (const res_state __statp, const unsigned char *__msg,
 			int __len, FILE *__file);
 extern int res_ourserver_p (const res_state __statp,
 			    const struct sockaddr_in6 *__inp);
 extern void __res_iclose (res_state statp, bool free_addr);
-extern int __res_nopt(res_state statp, int n0, u_char *buf, int buflen,
+extern int __res_nopt(res_state statp, int n0, unsigned char *buf, int buflen,
 		      int anslen);
 libc_hidden_proto (__res_ninit)
 libc_hidden_proto (__res_maybe_init)
@@ -45,12 +45,16 @@ libc_hidden_proto (__res_iclose)
 libc_hidden_proto (__res_randomid)
 libc_hidden_proto (__res_state)
 
-int __libc_res_nquery (res_state, const char *, int, int, u_char *, int,
-		       u_char **, u_char **, int *, int *, int *);
-int __libc_res_nsearch (res_state, const char *, int, int, u_char *, int,
-			u_char **, u_char **, int *, int *, int *);
-int __libc_res_nsend (res_state, const u_char *, int, const u_char *, int,
-		      u_char *, int, u_char **, u_char **, int *, int *, int *)
+int __libc_res_nquery (res_state, const char *, int, int,
+		       unsigned char *, int, unsigned char **,
+		       unsigned char **, int *, int *, int *);
+int __libc_res_nsearch (res_state, const char *, int, int,
+			unsigned char *, int, unsigned char **,
+			unsigned char **, int *, int *, int *);
+int __libc_res_nsend (res_state, const unsigned char *, int,
+		      const unsigned char *, int, unsigned char *,
+		      int, unsigned char **, unsigned char **,
+		      int *, int *, int *)
   attribute_hidden;
 
 libresolv_hidden_proto (_sethtent)
diff --git a/inet/netinet/igmp.h b/inet/netinet/igmp.h
index fc7599e..ffbebc7 100644
--- a/inet/netinet/igmp.h
+++ b/inet/netinet/igmp.h
@@ -64,10 +64,10 @@ __BEGIN_DECLS
  */
 
 struct igmp {
-  u_int8_t igmp_type;             /* IGMP type */
-  u_int8_t igmp_code;             /* routing code */
-  u_int16_t igmp_cksum;           /* checksum */
-  struct in_addr igmp_group;      /* group address */
+  uint8_t igmp_type;             /* IGMP type */
+  uint8_t igmp_code;             /* routing code */
+  uint16_t igmp_cksum;           /* checksum */
+  struct in_addr igmp_group;     /* group address */
 };
 
 #define IGMP_MINLEN			8
diff --git a/inet/protocols/routed.h b/inet/protocols/routed.h
index befd865..adb1767 100644
--- a/inet/protocols/routed.h
+++ b/inet/protocols/routed.h
@@ -48,9 +48,9 @@ struct netinfo {
 };
 
 struct rip {
-	u_char	rip_cmd;		/* request/response */
-	u_char	rip_vers;		/* protocol version # */
-	u_char	rip_res1[2];		/* pad to 32-bit boundary */
+	unsigned char	rip_cmd;		/* request/response */
+	unsigned char	rip_vers;		/* protocol version # */
+	unsigned char	rip_res1[2];		/* pad to 32-bit boundary */
 	union {
 		struct	netinfo ru_nets[1];	/* variable length... */
 		char	ru_tracefile[1];	/* ditto ... */
diff --git a/inet/protocols/talkd.h b/inet/protocols/talkd.h
index a8f33b1..34e2654 100644
--- a/inet/protocols/talkd.h
+++ b/inet/protocols/talkd.h
@@ -52,16 +52,17 @@
 
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <stdint.h>
 
 /*
  * Client->server request message format.
  */
 typedef struct {
-	u_char	vers;		/* protocol version */
-	u_char	type;		/* request type, see below */
-	u_char	answer;		/* not used */
-	u_char	pad;
-	u_int32_t id_num;	/* message id */
+	unsigned char	vers;	/* protocol version */
+	unsigned char	type;	/* request type, see below */
+	unsigned char	answer;	/* not used */
+	unsigned char	pad;
+	uint32_t id_num;	/* message id */
 	struct	osockaddr addr;		/* old (4.3) style */
 	struct	osockaddr ctl_addr;	/* old (4.3) style */
 	int32_t	pid;		/* caller's process id */
@@ -76,11 +77,11 @@ typedef struct {
  * Server->client response message format.
  */
 typedef struct {
-	u_char	vers;		/* protocol version */
-	u_char	type;		/* type of request message, see below */
-	u_char	answer;		/* response to request message, see below */
-	u_char	pad;
-	u_int32_t id_num;	/* message id */
+	unsigned char	vers;	/* protocol version */
+	unsigned char	type;	/* type of request message, see below */
+	unsigned char	answer;	/* response to request message, see below */
+	unsigned char	pad;
+	uint32_t	id_num;	/* message id */
 	struct	osockaddr addr;	/* address for establishing conversation */
 } CTL_RESPONSE;
 
diff --git a/inet/protocols/timed.h b/inet/protocols/timed.h
index b5d4702..cabdce4 100644
--- a/inet/protocols/timed.h
+++ b/inet/protocols/timed.h
@@ -44,9 +44,9 @@
 #define MAXHOSTNAMELEN	64
 
 struct tsp {
-	u_char	tsp_type;
-	u_char	tsp_vers;
-	u_short	tsp_seq;
+	unsigned char	tsp_type;
+	unsigned char	tsp_vers;
+	unsigned short	tsp_seq;
 	union {
 		struct timeval tspu_time;
 		char tspu_hopcnt;
diff --git a/io/fts.h b/io/fts.h
index 127a0d2..607e8b1 100644
--- a/io/fts.h
+++ b/io/fts.h
@@ -105,8 +105,8 @@ typedef struct _ftsent {
 	char *fts_path;			/* root path */
 	int fts_errno;			/* errno for this node */
 	int fts_symfd;			/* fd for symlink */
-	u_short fts_pathlen;		/* strlen(fts_path) */
-	u_short fts_namelen;		/* strlen(fts_name) */
+	unsigned short fts_pathlen;	/* strlen(fts_path) */
+	unsigned short fts_namelen;	/* strlen(fts_name) */
 
 	ino_t fts_ino;			/* inode */
 	dev_t fts_dev;			/* device */
@@ -130,17 +130,17 @@ typedef struct _ftsent {
 #define	FTS_SL		12		/* symbolic link */
 #define	FTS_SLNONE	13		/* symbolic link without target */
 #define FTS_W		14		/* whiteout object */
-	u_short fts_info;		/* user flags for FTSENT structure */
+	unsigned short fts_info;	/* user flags for FTSENT structure */
 
 #define	FTS_DONTCHDIR	 0x01		/* don't chdir .. to the parent */
 #define	FTS_SYMFOLLOW	 0x02		/* followed a symlink to get here */
-	u_short fts_flags;		/* private flags for FTSENT structure */
+	unsigned short fts_flags;	/* private flags for FTSENT structure */
 
 #define	FTS_AGAIN	 1		/* read node again */
 #define	FTS_FOLLOW	 2		/* follow symbolic link */
 #define	FTS_NOINSTR	 3		/* no instructions */
 #define	FTS_SKIP	 4		/* discard node */
-	u_short fts_instr;		/* fts_set() instructions */
+	unsigned short fts_instr;	/* fts_set() instructions */
 
 	struct stat *fts_statp;		/* stat(2) information */
 	char fts_name[1];		/* file name */
@@ -157,8 +157,8 @@ typedef struct _ftsent64 {
 	char *fts_path;			/* root path */
 	int fts_errno;			/* errno for this node */
 	int fts_symfd;			/* fd for symlink */
-	u_short fts_pathlen;		/* strlen(fts_path) */
-	u_short fts_namelen;		/* strlen(fts_name) */
+	unsigned short fts_pathlen;		/* strlen(fts_path) */
+	unsigned short fts_namelen;		/* strlen(fts_name) */
 
 	ino64_t fts_ino;		/* inode */
 	dev_t fts_dev;			/* device */
@@ -166,11 +166,11 @@ typedef struct _ftsent64 {
 
 	short fts_level;		/* depth (-1 to N) */
 
-	u_short fts_info;		/* user flags for FTSENT structure */
+	unsigned short fts_info;	/* user flags for FTSENT structure */
 
-	u_short fts_flags;		/* private flags for FTSENT structure */
+	unsigned short fts_flags;	/* private flags for FTSENT structure */
 
-	u_short fts_instr;		/* fts_set() instructions */
+	unsigned short fts_instr;	/* fts_set() instructions */
 
 	struct stat64 *fts_statp;	/* stat(2) information */
 	char fts_name[1];		/* file name */
diff --git a/nptl_db/thread_db.h b/nptl_db/thread_db.h
index abb95df..540c318 100644
--- a/nptl_db/thread_db.h
+++ b/nptl_db/thread_db.h
@@ -108,7 +108,7 @@ struct link_map;
 
 #define TD_EVENTSIZE	2
 #define BT_UISHIFT	5 /* log base 2 of BT_NBIPUI, to extract word index */
-#define BT_NBIPUI	(1 << BT_UISHIFT)       /* n bits per uint */
+#define BT_NBIPUI	(1 << BT_UISHIFT)       /* n bits per unsigned int */
 #define BT_UIMASK	(BT_NBIPUI - 1)         /* to extract bit index */
 
 /* Bitmask of enabled events. */
diff --git a/resolv/arpa/nameser.h b/resolv/arpa/nameser.h
index a866ce8..80d5cdf 100644
--- a/resolv/arpa/nameser.h
+++ b/resolv/arpa/nameser.h
@@ -50,7 +50,7 @@
 
 #include <sys/param.h>
 #include <sys/types.h>
-#include <sys/cdefs.h>
+#include <stdint.h>
 
 /*
  * Define constants based on RFC 883, RFC 1034, RFC 1035
@@ -63,9 +63,9 @@
 #define NS_HFIXEDSZ	12	/*%< #/bytes of fixed data in header */
 #define NS_QFIXEDSZ	4	/*%< #/bytes of fixed data in query */
 #define NS_RRFIXEDSZ	10	/*%< #/bytes of fixed data in r record */
-#define NS_INT32SZ	4	/*%< #/bytes of data in a u_int32_t */
-#define NS_INT16SZ	2	/*%< #/bytes of data in a u_int16_t */
-#define NS_INT8SZ	1	/*%< #/bytes of data in a u_int8_t */
+#define NS_INT32SZ	4	/*%< #/bytes of data in a uint32_t */
+#define NS_INT16SZ	2	/*%< #/bytes of data in a uint16_t */
+#define NS_INT8SZ	1	/*%< #/bytes of data in a uint8_t */
 #define NS_INADDRSZ	4	/*%< IPv4 T_A */
 #define NS_IN6ADDRSZ	16	/*%< IPv6 T_AAAA */
 #define NS_CMPRSFLGS	0xc0	/*%< Flag bits indicating name compression. */
@@ -91,12 +91,12 @@ typedef enum __ns_sect {
  * leading _'s on the member names.  Use the accessor functions, not the _'s.
  */
 typedef struct __ns_msg {
-	const u_char	*_msg, *_eom;
-	u_int16_t	_id, _flags, _counts[ns_s_max];
-	const u_char	*_sections[ns_s_max];
-	ns_sect		_sect;
-	int		_rrnum;
-	const u_char	*_msg_ptr;
+	const unsigned char	*_msg, *_eom;
+	uint16_t		_id, _flags, _counts[ns_s_max];
+	const unsigned char	*_sections[ns_s_max];
+	ns_sect			_sect;
+	int			_rrnum;
+	const unsigned char	*_msg_ptr;
 } ns_msg;
 
 /* Private data structure - do not use from outside library. */
@@ -115,12 +115,12 @@ extern const struct _ns_flagdata _ns_flagdata[];
  * This is a parsed record.  It is caller allocated and has no dynamic data.
  */
 typedef	struct __ns_rr {
-	char		name[NS_MAXDNAME];
-	u_int16_t	type;
-	u_int16_t	rr_class;
-	u_int32_t	ttl;
-	u_int16_t	rdlength;
-	const u_char *	rdata;
+	char			name[NS_MAXDNAME];
+	uint16_t		type;
+	uint16_t		rr_class;
+	uint32_t		ttl;
+	uint16_t		rdlength;
+	const unsigned char *	rdata;
 } ns_rr;
 
 /* Accessor macros - this is part of the public interface. */
@@ -317,34 +317,34 @@ typedef enum __ns_cert_types {
  * Inline versions of get/put short/long.  Pointer is advanced.
  */
 #define NS_GET16(s, cp) do { \
-	const u_char *t_cp = (const u_char *)(cp); \
-	(s) = ((u_int16_t)t_cp[0] << 8) \
-	    | ((u_int16_t)t_cp[1]) \
+	const unsigned char *t_cp = (const unsigned char *)(cp); \
+	(s) = ((uint16_t)t_cp[0] << 8) \
+	    | ((uint16_t)t_cp[1]) \
 	    ; \
 	(cp) += NS_INT16SZ; \
 } while (0)
 
 #define NS_GET32(l, cp) do { \
-	const u_char *t_cp = (const u_char *)(cp); \
-	(l) = ((u_int32_t)t_cp[0] << 24) \
-	    | ((u_int32_t)t_cp[1] << 16) \
-	    | ((u_int32_t)t_cp[2] << 8) \
-	    | ((u_int32_t)t_cp[3]) \
+	const unsigned char *t_cp = (const unsigned char *)(cp); \
+	(l) = ((uint32_t)t_cp[0] << 24) \
+	    | ((uint32_t)t_cp[1] << 16) \
+	    | ((uint32_t)t_cp[2] << 8) \
+	    | ((uint32_t)t_cp[3]) \
 	    ; \
 	(cp) += NS_INT32SZ; \
 } while (0)
 
 #define NS_PUT16(s, cp) do { \
-	u_int16_t t_s = (u_int16_t)(s); \
-	u_char *t_cp = (u_char *)(cp); \
+	uint16_t t_s = (uint16_t)(s); \
+	unsigned char *t_cp = (unsigned char *)(cp); \
 	*t_cp++ = t_s >> 8; \
 	*t_cp   = t_s; \
 	(cp) += NS_INT16SZ; \
 } while (0)
 
 #define NS_PUT32(l, cp) do { \
-	u_int32_t t_l = (u_int32_t)(l); \
-	u_char *t_cp = (u_char *)(cp); \
+	uint32_t t_l = (uint32_t)(l); \
+	unsigned char *t_cp = (unsigned char *)(cp); \
 	*t_cp++ = t_l >> 24; \
 	*t_cp++ = t_l >> 16; \
 	*t_cp++ = t_l >> 8; \
@@ -354,38 +354,46 @@ typedef enum __ns_cert_types {
 
 __BEGIN_DECLS
 int		ns_msg_getflag (ns_msg, int) __THROW;
-u_int		ns_get16 (const u_char *) __THROW;
-u_long		ns_get32 (const u_char *) __THROW;
-void		ns_put16 (u_int, u_char *) __THROW;
-void		ns_put32 (u_long, u_char *) __THROW;
-int		ns_initparse (const u_char *, int, ns_msg *) __THROW;
-int		ns_skiprr (const u_char *, const u_char *, ns_sect, int)
-     __THROW;
+unsigned int	ns_get16 (const unsigned char *) __THROW;
+unsigned long	ns_get32 (const unsigned char *) __THROW;
+void		ns_put16 (unsigned int, unsigned char *) __THROW;
+void		ns_put32 (unsigned long, unsigned char *) __THROW;
+int		ns_initparse (const unsigned char *, int, ns_msg *) __THROW;
+int		ns_skiprr (const unsigned char *, const unsigned char *,
+			   ns_sect, int) __THROW;
 int		ns_parserr (ns_msg *, ns_sect, int, ns_rr *) __THROW;
 int		ns_sprintrr (const ns_msg *, const ns_rr *,
 			     const char *, const char *, char *, size_t)
      __THROW;
-int		ns_sprintrrf (const u_char *, size_t, const char *,
-			      ns_class, ns_type, u_long, const u_char *,
-			      size_t, const char *, const char *,
-			      char *, size_t) __THROW;
-int		ns_format_ttl (u_long, char *, size_t) __THROW;
-int		ns_parse_ttl (const char *, u_long *) __THROW;
-u_int32_t	ns_datetosecs (const char *, int *) __THROW;
-int		ns_name_ntol (const u_char *, u_char *, size_t) __THROW;
-int		ns_name_ntop (const u_char *, char *, size_t) __THROW;
-int		ns_name_pton (const char *, u_char *, size_t) __THROW;
-int		ns_name_unpack (const u_char *, const u_char *,
-				const u_char *, u_char *, size_t) __THROW;
-int		ns_name_pack (const u_char *, u_char *, int,
-			      const u_char **, const u_char **) __THROW;
-int		ns_name_uncompress (const u_char *, const u_char *,
-				    const u_char *, char *, size_t) __THROW;
-int		ns_name_compress (const char *, u_char *, size_t,
-				  const u_char **, const u_char **) __THROW;
-int		ns_name_skip (const u_char **, const u_char *) __THROW;
-void		ns_name_rollback (const u_char *, const u_char **,
-				  const u_char **) __THROW;
+int		ns_sprintrrf (const unsigned char *, size_t, const char *,
+			      ns_class, ns_type, unsigned long,
+			      const unsigned char *, size_t, const char *,
+			      const char *, char *, size_t) __THROW;
+int		ns_format_ttl (unsigned long, char *, size_t) __THROW;
+int		ns_parse_ttl (const char *, unsigned long *) __THROW;
+uint32_t	ns_datetosecs (const char *, int *) __THROW;
+int		ns_name_ntol (const unsigned char *, unsigned char *, size_t)
+     __THROW;
+int		ns_name_ntop (const unsigned char *, char *, size_t) __THROW;
+int		ns_name_pton (const char *, unsigned char *, size_t) __THROW;
+int		ns_name_unpack (const unsigned char *, const unsigned char *,
+				const unsigned char *, unsigned char *, size_t)
+     __THROW;
+int		ns_name_pack (const unsigned char *, unsigned char *, int,
+			      const unsigned char **, const unsigned char **)
+     __THROW;
+int		ns_name_uncompress (const unsigned char *,
+				    const unsigned char *,
+				    const unsigned char *,
+				    char *, size_t) __THROW;
+int		ns_name_compress (const char *, unsigned char *, size_t,
+				  const unsigned char **,
+				  const unsigned char **) __THROW;
+int		ns_name_skip (const unsigned char **, const unsigned char *)
+     __THROW;
+void		ns_name_rollback (const unsigned char *,
+				  const unsigned char **,
+				  const unsigned char **) __THROW;
 int		ns_samedomain (const char *, const char *) __THROW;
 int		ns_subdomain (const char *, const char *) __THROW;
 int		ns_makecanon (const char *, char *, size_t) __THROW;
diff --git a/resolv/resolv.h b/resolv/resolv.h
index a6f4dad..58c3c38 100644
--- a/resolv/resolv.h
+++ b/resolv/resolv.h
@@ -87,39 +87,39 @@
 struct __res_state {
 	int	retrans;		/* retransmition time interval */
 	int	retry;			/* number of times to retransmit */
-	u_long	options;		/* option flags - see below. */
+	unsigned long options;		/* option flags - see below. */
 	int	nscount;		/* number of name servers */
 	struct sockaddr_in
 		nsaddr_list[MAXNS];	/* address of name server */
 # define nsaddr	nsaddr_list[0]		/* for backward compatibility */
-	u_short	id;			/* current message id */
+	unsigned short id;		/* current message id */
 	/* 2 byte hole here.  */
 	char	*dnsrch[MAXDNSRCH+1];	/* components of domain to search */
 	char	defdname[256];		/* default domain (deprecated) */
-	u_long	pfcode;			/* RES_PRF_ flags - see below. */
+	unsigned long pfcode;		/* RES_PRF_ flags - see below. */
 	unsigned ndots:4;		/* threshold for initial abs. query */
 	unsigned nsort:4;		/* number of elements in sort_list[] */
 	unsigned ipv6_unavail:1;	/* connecting to IPv6 server failed */
 	unsigned unused:23;
 	struct {
 		struct in_addr	addr;
-		u_int32_t	mask;
+		uint32_t	mask;
 	} sort_list[MAXRESOLVSORT];
 	/* 4 byte hole here on 64-bit architectures.  */
 	void * __glibc_unused_qhook;
 	void * __glibc_unused_rhook;
 	int	res_h_errno;		/* last one set for this context */
 	int	_vcsock;		/* PRIVATE: for res_send VC i/o */
-	u_int	_flags;			/* PRIVATE: see below */
+	unsigned int _flags;		/* PRIVATE: see below */
 	/* 4 byte hole here on 64-bit architectures.  */
 	union {
 		char	pad[52];	/* On an i386 this means 512b total. */
 		struct {
-			u_int16_t		nscount;
-			u_int16_t		nsmap[MAXNS];
+			uint16_t		nscount;
+			uint16_t		nsmap[MAXNS];
 			int			nssocks[MAXNS];
-			u_int16_t		nscount6;
-			u_int16_t		nsinit;
+			uint16_t		nscount6;
+			uint16_t		nsinit;
 			struct sockaddr_in6	*nsaddrs[MAXNS];
 #ifdef _LIBC
 			unsigned long long int	initstamp
@@ -247,20 +247,24 @@ __END_DECLS
 #define res_send		__res_send
 
 __BEGIN_DECLS
-void		fp_nquery (const u_char *, int, FILE *) __THROW;
-void		fp_query (const u_char *, FILE *) __THROW;
+void		fp_nquery (const unsigned char *, int, FILE *) __THROW;
+void		fp_query (const unsigned char *, FILE *) __THROW;
 const char *	hostalias (const char *) __THROW;
-void		p_query (const u_char *) __THROW;
+void		p_query (const unsigned char *) __THROW;
 void		res_close (void) __THROW;
 int		res_init (void) __THROW;
 int		res_isourserver (const struct sockaddr_in *) __THROW;
-int		res_mkquery (int, const char *, int, int, const u_char *,
-			     int, const u_char *, u_char *, int) __THROW;
-int		res_query (const char *, int, int, u_char *, int) __THROW;
+int		res_mkquery (int, const char *, int, int,
+			     const unsigned char *, int, const unsigned char *,
+			     unsigned char *, int) __THROW;
+int		res_query (const char *, int, int, unsigned char *, int)
+     __THROW;
 int		res_querydomain (const char *, const char *, int, int,
-				 u_char *, int) __THROW;
-int		res_search (const char *, int, int, u_char *, int) __THROW;
-int		res_send (const u_char *, int, u_char *, int) __THROW;
+				 unsigned char *, int) __THROW;
+int		res_search (const char *, int, int, unsigned char *, int)
+     __THROW;
+int		res_send (const unsigned char *, int, unsigned char *, int)
+     __THROW;
 __END_DECLS
 
 #define b64_ntop		__b64_ntop
@@ -313,56 +317,65 @@ int		res_dnok (const char *) __THROW;
 int		sym_ston (const struct res_sym *, const char *, int *) __THROW;
 const char *	sym_ntos (const struct res_sym *, int, int *) __THROW;
 const char *	sym_ntop (const struct res_sym *, int, int *) __THROW;
-int		b64_ntop (u_char const *, size_t, char *, size_t) __THROW;
-int		b64_pton (char const *, u_char *, size_t) __THROW;
-int		loc_aton (const char *__ascii, u_char *__binary) __THROW;
-const char *	loc_ntoa (const u_char *__binary, char *__ascii) __THROW;
-int		dn_skipname (const u_char *, const u_char *) __THROW;
-void		putlong (u_int32_t, u_char *) __THROW;
-void		putshort (u_int16_t, u_char *) __THROW;
+int		b64_ntop (const unsigned char *, size_t, char *, size_t)
+     __THROW;
+int		b64_pton (char const *, unsigned char *, size_t) __THROW;
+int		loc_aton (const char *__ascii, unsigned char *__binary) __THROW;
+const char *	loc_ntoa (const unsigned char *__binary, char *__ascii) __THROW;
+int		dn_skipname (const unsigned char *, const unsigned char *)
+     __THROW;
+void		putlong (uint32_t, unsigned char *) __THROW;
+void		putshort (uint16_t, unsigned char *) __THROW;
 const char *	p_class (int) __THROW;
-const char *	p_time (u_int32_t) __THROW;
+const char *	p_time (uint32_t) __THROW;
 const char *	p_type (int) __THROW;
 const char *	p_rcode (int) __THROW;
-const u_char *	p_cdnname (const u_char *, const u_char *, int, FILE *)
-     __THROW;
-const u_char *	p_cdname (const u_char *, const u_char *, FILE *) __THROW;
-const u_char *	p_fqnname (const u_char *__cp, const u_char *__msg,
-			   int, char *, int) __THROW;
-const u_char *	p_fqname (const u_char *, const u_char *, FILE *) __THROW;
-const char *	p_option (u_long __option) __THROW;
-char *		p_secstodate (u_long) __THROW;
+const unsigned char * p_cdnname (const unsigned char *,
+				 const unsigned char *, int, FILE *) __THROW;
+const unsigned char * p_cdname (const unsigned char *, const unsigned char *,
+				FILE *) __THROW;
+const unsigned char * p_fqnname (const unsigned char *__cp,
+				 const unsigned char *__msg,
+				 int, char *, int) __THROW;
+const unsigned char * p_fqname (const unsigned char *,
+				const unsigned char *, FILE *) __THROW;
+const char *	p_option (unsigned long __option) __THROW;
+char *		p_secstodate (unsigned long) __THROW;
 int		dn_count_labels (const char *) __THROW;
-int		dn_comp (const char *, u_char *, int, u_char **, u_char **)
-     __THROW;
-int		dn_expand (const u_char *, const u_char *, const u_char *,
-			   char *, int) __THROW;
-u_int		res_randomid (void) __THROW;
+int		dn_comp (const char *, unsigned char *, int, unsigned char **,
+			 unsigned char **) __THROW;
+int		dn_expand (const unsigned char *, const unsigned char *,
+			   const unsigned char *, char *, int) __THROW;
+unsigned int	res_randomid (void) __THROW;
 int		res_nameinquery (const char *, int, int,
-				 const u_char *, const u_char *) __THROW;
-int		res_queriesmatch (const u_char *, const u_char *,
-				  const u_char *, const u_char *) __THROW;
+				 const unsigned char *,
+				 const unsigned char *) __THROW;
+int		res_queriesmatch (const unsigned char *,
+				  const unsigned char *,
+				  const unsigned char *,
+				  const unsigned char *) __THROW;
 const char *	p_section (int __section, int __opcode) __THROW;
 /* Things involving a resolver context. */
 int		res_ninit (res_state) __THROW;
 int		res_nisourserver (const res_state,
 				  const struct sockaddr_in *) __THROW;
 void		fp_resstat (const res_state, FILE *) __THROW;
-void		res_npquery (const res_state, const u_char *, int, FILE *)
-     __THROW;
+void		res_npquery (const res_state, const unsigned char *, int,
+			     FILE *) __THROW;
 const char *	res_hostalias (const res_state, const char *, char *, size_t)
      __THROW;
-int		res_nquery (res_state, const char *, int, int, u_char *, int)
-     __THROW;
-int		res_nsearch (res_state, const char *, int, int, u_char *, int)
-     __THROW;
+int		res_nquery (res_state, const char *, int, int,
+			    unsigned char *, int) __THROW;
+int		res_nsearch (res_state, const char *, int, int,
+			     unsigned char *, int) __THROW;
 int		res_nquerydomain (res_state, const char *, const char *, int,
-				  int, u_char *, int) __THROW;
+				  int, unsigned char *, int) __THROW;
 int		res_nmkquery (res_state, int, const char *, int, int,
-			      const u_char *, int, const u_char *, u_char *,
-			      int) __THROW;
-int		res_nsend (res_state, const u_char *, int, u_char *, int)
+			      const unsigned char *, int,
+			      const unsigned char *, unsigned char *, int)
      __THROW;
+int		res_nsend (res_state, const unsigned char *, int,
+			   unsigned char *, int) __THROW;
 void		res_nclose (res_state) __THROW;
 __END_DECLS
 #endif
diff --git a/sunrpc/rpc/rpc_des.h b/sunrpc/rpc/rpc_des.h
index 4b3c426..2091f52 100644
--- a/sunrpc/rpc/rpc_des.h
+++ b/sunrpc/rpc/rpc_des.h
@@ -53,15 +53,15 @@ enum desmode
  */
 struct desparams
   {
-    u_char des_key[8];		/* key (with low bit parity) */
+    unsigned char des_key[8];	/* key (with low bit parity) */
     enum desdir des_dir;	/* direction */
     enum desmode des_mode;	/* mode */
-    u_char des_ivec[8];		/* input vector */
+    unsigned char des_ivec[8];	/* input vector */
     unsigned des_len;		/* number of bytes to crypt */
     union
       {
-	u_char UDES_data[DES_QUICKLEN];
-	u_char *UDES_buf;
+	unsigned char UDES_data[DES_QUICKLEN];
+	unsigned char *UDES_buf;
       }
     UDES;
 #define des_data UDES.UDES_data	/* direct data here if quick */
diff --git a/sysdeps/generic/netinet/if_ether.h b/sysdeps/generic/netinet/if_ether.h
index c106a41..6d02536 100644
--- a/sysdeps/generic/netinet/if_ether.h
+++ b/sysdeps/generic/netinet/if_ether.h
@@ -26,7 +26,7 @@
    systems.  */
 struct ether_addr
 {
-  u_int8_t ether_addr_octet[ETH_ALEN];
+  uint8_t ether_addr_octet[ETH_ALEN];
 } __attribute__ ((__packed__));
 
 #endif /* netinet/if_ether.h */
diff --git a/sysdeps/generic/netinet/in_systm.h b/sysdeps/generic/netinet/in_systm.h
index 41704ee..7b9a92b 100644
--- a/sysdeps/generic/netinet/in_systm.h
+++ b/sysdeps/generic/netinet/in_systm.h
@@ -19,8 +19,8 @@
 #ifndef _NETINET_IN_SYSTM_H
 #define _NETINET_IN_SYSTM_H 1
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
+#include <stdint.h>
 
 __BEGIN_DECLS
 
@@ -31,9 +31,9 @@ __BEGIN_DECLS
  * may not reflect the actual size of the native data types.
  */
 
-typedef u_int16_t n_short;      /* short as received from the net */
-typedef u_int32_t n_long;       /* long as received from the net  */
-typedef u_int32_t n_time;       /* ms since 00:00 GMT, byte rev   */
+typedef uint16_t n_short;      /* short as received from the net */
+typedef uint32_t n_long;       /* long as received from the net  */
+typedef uint32_t n_time;       /* ms since 00:00 GMT, byte rev   */
 
 __END_DECLS
 
diff --git a/sysdeps/generic/netinet/ip.h b/sysdeps/generic/netinet/ip.h
index 557a460..5f16c9a 100644
--- a/sysdeps/generic/netinet/ip.h
+++ b/sysdeps/generic/netinet/ip.h
@@ -27,8 +27,8 @@ __BEGIN_DECLS
 
 struct timestamp
   {
-    u_int8_t len;
-    u_int8_t ptr;
+    uint8_t len;
+    uint8_t ptr;
 #if __BYTE_ORDER == __LITTLE_ENDIAN
     unsigned int flags:4;
     unsigned int overflow:4;
@@ -38,7 +38,7 @@ struct timestamp
 #else
 # error	"Please fix <bits/endian.h>"
 #endif
-    u_int32_t data[9];
+    uint32_t data[9];
   };
 
 struct iphdr
@@ -52,15 +52,15 @@ struct iphdr
 #else
 # error	"Please fix <bits/endian.h>"
 #endif
-    u_int8_t tos;
-    u_int16_t tot_len;
-    u_int16_t id;
-    u_int16_t frag_off;
-    u_int8_t ttl;
-    u_int8_t protocol;
-    u_int16_t check;
-    u_int32_t saddr;
-    u_int32_t daddr;
+    uint8_t tos;
+    uint16_t tot_len;
+    uint16_t id;
+    uint16_t frag_off;
+    uint8_t ttl;
+    uint8_t protocol;
+    uint16_t check;
+    uint32_t saddr;
+    uint32_t daddr;
     /*The options start here. */
   };
 
@@ -114,17 +114,17 @@ struct ip
     unsigned int ip_v:4;		/* version */
     unsigned int ip_hl:4;		/* header length */
 #endif
-    u_int8_t ip_tos;			/* type of service */
-    u_short ip_len;			/* total length */
-    u_short ip_id;			/* identification */
-    u_short ip_off;			/* fragment offset field */
+    uint8_t ip_tos;			/* type of service */
+    unsigned short ip_len;		/* total length */
+    unsigned short ip_id;		/* identification */
+    unsigned short ip_off;		/* fragment offset field */
 #define	IP_RF 0x8000			/* reserved fragment flag */
 #define	IP_DF 0x4000			/* dont fragment flag */
 #define	IP_MF 0x2000			/* more fragments flag */
 #define	IP_OFFMASK 0x1fff		/* mask for fragmenting bits */
-    u_int8_t ip_ttl;			/* time to live */
-    u_int8_t ip_p;			/* protocol */
-    u_short ip_sum;			/* checksum */
+    uint8_t ip_ttl;			/* time to live */
+    uint8_t ip_p;			/* protocol */
+    unsigned short ip_sum;		/* checksum */
     struct in_addr ip_src, ip_dst;	/* source and dest address */
   };
 
@@ -133,9 +133,9 @@ struct ip
  */
 struct ip_timestamp
   {
-    u_int8_t ipt_code;			/* IPOPT_TS */
-    u_int8_t ipt_len;			/* size of structure (variable) */
-    u_int8_t ipt_ptr;			/* index of current entry */
+    uint8_t ipt_code;			/* IPOPT_TS */
+    uint8_t ipt_len;			/* size of structure (variable) */
+    uint8_t ipt_ptr;			/* index of current entry */
 #if __BYTE_ORDER == __LITTLE_ENDIAN
     unsigned int ipt_flg:4;		/* flags, see below */
     unsigned int ipt_oflw:4;		/* overflow counter */
@@ -144,7 +144,7 @@ struct ip_timestamp
     unsigned int ipt_oflw:4;		/* overflow counter */
     unsigned int ipt_flg:4;		/* flags, see below */
 #endif
-    u_int32_t data[9];
+    uint32_t data[9];
   };
 #endif /* __USE_MISC */
 
diff --git a/sysdeps/generic/netinet/tcp.h b/sysdeps/generic/netinet/tcp.h
index 0d71903..49f1bfb 100644
--- a/sysdeps/generic/netinet/tcp.h
+++ b/sysdeps/generic/netinet/tcp.h
@@ -43,42 +43,42 @@ typedef	unsigned int	tcp_seq;
  * Per RFC 793, September, 1981.
  */
 struct tcphdr {
-	u_short	th_sport;		/* source port */
-	u_short	th_dport;		/* destination port */
-	tcp_seq	th_seq;			/* sequence number */
-	tcp_seq	th_ack;			/* acknowledgement number */
+	unsigned short	th_sport;	/* source port */
+	unsigned short	th_dport;	/* destination port */
+	tcp_seq		th_seq;		/* sequence number */
+	tcp_seq		th_ack;		/* acknowledgement number */
 #if __BYTE_ORDER == __LITTLE_ENDIAN
-	u_char	th_x2:4,		/* (unused) */
-		th_off:4;		/* data offset */
+	unsigned char	th_x2:4,	/* (unused) */
+			th_off:4;	/* data offset */
 #endif
 #if __BYTE_ORDER == __BIG_ENDIAN
-	u_char	th_off:4,		/* data offset */
-		th_x2:4;		/* (unused) */
+	unsigned char	th_off:4,	/* data offset */
+			th_x2:4;	/* (unused) */
 #endif
-	u_char	th_flags;
+	unsigned char	th_flags;
 #define	TH_FIN	0x01
 #define	TH_SYN	0x02
 #define	TH_RST	0x04
 #define	TH_PUSH	0x08
 #define	TH_ACK	0x10
 #define	TH_URG	0x20
-	u_short	th_win;			/* window */
-	u_short	th_sum;			/* checksum */
-	u_short	th_urp;			/* urgent pointer */
+	unsigned short	th_win;		/* window */
+	unsigned short	th_sum;		/* checksum */
+	unsigned short	th_urp;		/* urgent pointer */
 };
 
 #define	TCPOPT_EOL		0
 #define	TCPOPT_NOP		1
 #define	TCPOPT_MAXSEG		2
-#define    TCPOLEN_MAXSEG		4
+#define TCPOLEN_MAXSEG		4
 #define TCPOPT_WINDOW		3
-#define    TCPOLEN_WINDOW		3
+#define TCPOLEN_WINDOW		3
 #define TCPOPT_SACK_PERMITTED	4		/* Experimental */
-#define    TCPOLEN_SACK_PERMITTED	2
+#define TCPOLEN_SACK_PERMITTED	2
 #define TCPOPT_SACK		5		/* Experimental */
 #define TCPOPT_TIMESTAMP	8
-#define    TCPOLEN_TIMESTAMP		10
-#define    TCPOLEN_TSTAMP_APPA		(TCPOLEN_TIMESTAMP+2) /* appendix A */
+#define TCPOLEN_TIMESTAMP	10
+#define TCPOLEN_TSTAMP_APPA	(TCPOLEN_TIMESTAMP+2) /* appendix A */
 
 #define TCPOPT_TSTAMP_HDR	\
     (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
diff --git a/sysdeps/gnu/netinet/ip_icmp.h b/sysdeps/gnu/netinet/ip_icmp.h
index 4f7c1b1..542e789 100644
--- a/sysdeps/gnu/netinet/ip_icmp.h
+++ b/sysdeps/gnu/netinet/ip_icmp.h
@@ -18,28 +18,28 @@
 #ifndef __NETINET_IP_ICMP_H
 #define __NETINET_IP_ICMP_H    1
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
+#include <stdint.h>
 
 __BEGIN_DECLS
 
 struct icmphdr
 {
-  u_int8_t type;		/* message type */
-  u_int8_t code;		/* type sub-code */
-  u_int16_t checksum;
+  uint8_t type;		/* message type */
+  uint8_t code;		/* type sub-code */
+  uint16_t checksum;
   union
   {
     struct
     {
-      u_int16_t	id;
-      u_int16_t	sequence;
+      uint16_t	id;
+      uint16_t	sequence;
     } echo;			/* echo datagram */
-    u_int32_t	gateway;	/* gateway address */
+    uint32_t	gateway;	/* gateway address */
     struct
     {
-      u_int16_t	__glibc_reserved;
-      u_int16_t	mtu;
+      uint16_t	__glibc_reserved;
+      uint16_t	mtu;
     } frag;			/* path mtu discovery */
   } un;
 };
@@ -130,38 +130,38 @@ struct icmphdr
  */
 struct icmp_ra_addr
 {
-  u_int32_t ira_addr;
-  u_int32_t ira_preference;
+  uint32_t ira_addr;
+  uint32_t ira_preference;
 };
 
 struct icmp
 {
-  u_int8_t  icmp_type;	/* type of message, see below */
-  u_int8_t  icmp_code;	/* type sub code */
-  u_int16_t icmp_cksum;	/* ones complement checksum of struct */
+  uint8_t  icmp_type;	/* type of message, see below */
+  uint8_t  icmp_code;	/* type sub code */
+  uint16_t icmp_cksum;	/* ones complement checksum of struct */
   union
   {
-    u_char ih_pptr;		/* ICMP_PARAMPROB */
+    unsigned char ih_pptr;	/* ICMP_PARAMPROB */
     struct in_addr ih_gwaddr;	/* gateway address */
     struct ih_idseq		/* echo datagram */
     {
-      u_int16_t icd_id;
-      u_int16_t icd_seq;
+      uint16_t icd_id;
+      uint16_t icd_seq;
     } ih_idseq;
-    u_int32_t ih_void;
+    uint32_t ih_void;
 
     /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
     struct ih_pmtu
     {
-      u_int16_t ipm_void;
-      u_int16_t ipm_nextmtu;
+      uint16_t ipm_void;
+      uint16_t ipm_nextmtu;
     } ih_pmtu;
 
     struct ih_rtradv
     {
-      u_int8_t irt_num_addrs;
-      u_int8_t irt_wpa;
-      u_int16_t irt_lifetime;
+      uint8_t irt_num_addrs;
+      uint8_t irt_wpa;
+      uint16_t irt_lifetime;
     } ih_rtradv;
   } icmp_hun;
 #define	icmp_pptr	icmp_hun.ih_pptr
@@ -178,9 +178,9 @@ struct icmp
   {
     struct
     {
-      u_int32_t its_otime;
-      u_int32_t its_rtime;
-      u_int32_t its_ttime;
+      uint32_t its_otime;
+      uint32_t its_rtime;
+      uint32_t its_ttime;
     } id_ts;
     struct
     {
@@ -188,8 +188,8 @@ struct icmp
       /* options and then 64 bits of data */
     } id_ip;
     struct icmp_ra_addr id_radv;
-    u_int32_t   id_mask;
-    u_int8_t    id_data[1];
+    uint32_t   id_mask;
+    uint8_t    id_data[1];
   } icmp_dun;
 #define	icmp_otime	icmp_dun.id_ts.its_otime
 #define	icmp_rtime	icmp_dun.id_ts.its_rtime
diff --git a/sysdeps/gnu/netinet/tcp.h b/sysdeps/gnu/netinet/tcp.h
index 3918bca..3fbea54 100644
--- a/sysdeps/gnu/netinet/tcp.h
+++ b/sysdeps/gnu/netinet/tcp.h
@@ -73,8 +73,9 @@
 #ifdef __USE_MISC
 # include <sys/types.h>
 # include <sys/socket.h>
+# include <stdint.h>
 
-typedef	u_int32_t tcp_seq;
+typedef	uint32_t tcp_seq;
 /*
  * TCP header.
  * Per RFC 793, September, 1981.
@@ -85,61 +86,61 @@ struct tcphdr
     {
       struct
       {
-	u_int16_t th_sport;		/* source port */
-	u_int16_t th_dport;		/* destination port */
+	uint16_t th_sport;	/* source port */
+	uint16_t th_dport;	/* destination port */
 	tcp_seq th_seq;		/* sequence number */
 	tcp_seq th_ack;		/* acknowledgement number */
 # if __BYTE_ORDER == __LITTLE_ENDIAN
-	u_int8_t th_x2:4;		/* (unused) */
-	u_int8_t th_off:4;		/* data offset */
+	uint8_t th_x2:4;	/* (unused) */
+	uint8_t th_off:4;	/* data offset */
 # endif
 # if __BYTE_ORDER == __BIG_ENDIAN
-	u_int8_t th_off:4;		/* data offset */
-	u_int8_t th_x2:4;		/* (unused) */
+	uint8_t th_off:4;	/* data offset */
+	uint8_t th_x2:4;	/* (unused) */
 # endif
-	u_int8_t th_flags;
+	uint8_t th_flags;
 # define TH_FIN	0x01
 # define TH_SYN	0x02
 # define TH_RST	0x04
 # define TH_PUSH	0x08
 # define TH_ACK	0x10
 # define TH_URG	0x20
-	u_int16_t th_win;		/* window */
-	u_int16_t th_sum;		/* checksum */
-	u_int16_t th_urp;		/* urgent pointer */
+	uint16_t th_win;	/* window */
+	uint16_t th_sum;	/* checksum */
+	uint16_t th_urp;	/* urgent pointer */
       };
       struct
       {
-	u_int16_t source;
-	u_int16_t dest;
-	u_int32_t seq;
-	u_int32_t ack_seq;
+	uint16_t source;
+	uint16_t dest;
+	uint32_t seq;
+	uint32_t ack_seq;
 # if __BYTE_ORDER == __LITTLE_ENDIAN
-	u_int16_t res1:4;
-	u_int16_t doff:4;
-	u_int16_t fin:1;
-	u_int16_t syn:1;
-	u_int16_t rst:1;
-	u_int16_t psh:1;
-	u_int16_t ack:1;
-	u_int16_t urg:1;
-	u_int16_t res2:2;
+	uint16_t res1:4;
+	uint16_t doff:4;
+	uint16_t fin:1;
+	uint16_t syn:1;
+	uint16_t rst:1;
+	uint16_t psh:1;
+	uint16_t ack:1;
+	uint16_t urg:1;
+	uint16_t res2:2;
 # elif __BYTE_ORDER == __BIG_ENDIAN
-	u_int16_t doff:4;
-	u_int16_t res1:4;
-	u_int16_t res2:2;
-	u_int16_t urg:1;
-	u_int16_t ack:1;
-	u_int16_t psh:1;
-	u_int16_t rst:1;
-	u_int16_t syn:1;
-	u_int16_t fin:1;
+	uint16_t doff:4;
+	uint16_t res1:4;
+	uint16_t res2:2;
+	uint16_t urg:1;
+	uint16_t ack:1;
+	uint16_t psh:1;
+	uint16_t rst:1;
+	uint16_t syn:1;
+	uint16_t fin:1;
 # else
 #  error "Adjust your <bits/endian.h> defines"
 # endif
-	u_int16_t window;
-	u_int16_t check;
-	u_int16_t urg_ptr;
+	uint16_t window;
+	uint16_t check;
+	uint16_t urg_ptr;
       };
     };
 };
@@ -209,45 +210,45 @@ enum tcp_ca_state
 
 struct tcp_info
 {
-  u_int8_t	tcpi_state;
-  u_int8_t	tcpi_ca_state;
-  u_int8_t	tcpi_retransmits;
-  u_int8_t	tcpi_probes;
-  u_int8_t	tcpi_backoff;
-  u_int8_t	tcpi_options;
-  u_int8_t	tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
-
-  u_int32_t	tcpi_rto;
-  u_int32_t	tcpi_ato;
-  u_int32_t	tcpi_snd_mss;
-  u_int32_t	tcpi_rcv_mss;
-
-  u_int32_t	tcpi_unacked;
-  u_int32_t	tcpi_sacked;
-  u_int32_t	tcpi_lost;
-  u_int32_t	tcpi_retrans;
-  u_int32_t	tcpi_fackets;
+  uint8_t	tcpi_state;
+  uint8_t	tcpi_ca_state;
+  uint8_t	tcpi_retransmits;
+  uint8_t	tcpi_probes;
+  uint8_t	tcpi_backoff;
+  uint8_t	tcpi_options;
+  uint8_t	tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
+
+  uint32_t	tcpi_rto;
+  uint32_t	tcpi_ato;
+  uint32_t	tcpi_snd_mss;
+  uint32_t	tcpi_rcv_mss;
+
+  uint32_t	tcpi_unacked;
+  uint32_t	tcpi_sacked;
+  uint32_t	tcpi_lost;
+  uint32_t	tcpi_retrans;
+  uint32_t	tcpi_fackets;
 
   /* Times. */
-  u_int32_t	tcpi_last_data_sent;
-  u_int32_t	tcpi_last_ack_sent;	/* Not remembered, sorry.  */
-  u_int32_t	tcpi_last_data_recv;
-  u_int32_t	tcpi_last_ack_recv;
+  uint32_t	tcpi_last_data_sent;
+  uint32_t	tcpi_last_ack_sent;	/* Not remembered, sorry.  */
+  uint32_t	tcpi_last_data_recv;
+  uint32_t	tcpi_last_ack_recv;
 
   /* Metrics. */
-  u_int32_t	tcpi_pmtu;
-  u_int32_t	tcpi_rcv_ssthresh;
-  u_int32_t	tcpi_rtt;
-  u_int32_t	tcpi_rttvar;
-  u_int32_t	tcpi_snd_ssthresh;
-  u_int32_t	tcpi_snd_cwnd;
-  u_int32_t	tcpi_advmss;
-  u_int32_t	tcpi_reordering;
-
-  u_int32_t	tcpi_rcv_rtt;
-  u_int32_t	tcpi_rcv_space;
-
-  u_int32_t	tcpi_total_retrans;
+  uint32_t	tcpi_pmtu;
+  uint32_t	tcpi_rcv_ssthresh;
+  uint32_t	tcpi_rtt;
+  uint32_t	tcpi_rttvar;
+  uint32_t	tcpi_snd_ssthresh;
+  uint32_t	tcpi_snd_cwnd;
+  uint32_t	tcpi_advmss;
+  uint32_t	tcpi_reordering;
+
+  uint32_t	tcpi_rcv_rtt;
+  uint32_t	tcpi_rcv_space;
+
+  uint32_t	tcpi_total_retrans;
 };
 
 
@@ -257,17 +258,17 @@ struct tcp_info
 struct tcp_md5sig
 {
   struct sockaddr_storage tcpm_addr;		/* Address associated.  */
-  u_int16_t	__tcpm_pad1;			/* Zero.  */
-  u_int16_t	tcpm_keylen;			/* Key length.  */
-  u_int32_t	__tcpm_pad2;			/* Zero.  */
-  u_int8_t	tcpm_key[TCP_MD5SIG_MAXKEYLEN];	/* Key (binary).  */
+  uint16_t	__tcpm_pad1;			/* Zero.  */
+  uint16_t	tcpm_keylen;			/* Key length.  */
+  uint32_t	__tcpm_pad2;			/* Zero.  */
+  uint8_t	tcpm_key[TCP_MD5SIG_MAXKEYLEN];	/* Key (binary).  */
 };
 
 /* For socket repair options.  */
 struct tcp_repair_opt
 {
-  u_int32_t	opt_code;
-  u_int32_t	opt_val;
+  uint32_t	opt_code;
+  uint32_t	opt_val;
 };
 
 /* Queue to repair, for TCP_REPAIR_QUEUE.  */
@@ -298,12 +299,12 @@ enum
 
 struct tcp_cookie_transactions
 {
-  u_int16_t	tcpct_flags;
-  u_int8_t	__tcpct_pad1;
-  u_int8_t	tcpct_cookie_desired;
-  u_int16_t	tcpct_s_data_desired;
-  u_int16_t	tcpct_used;
-  u_int8_t	tcpct_value[TCP_MSS_DEFAULT];
+  uint16_t	tcpct_flags;
+  uint8_t	__tcpct_pad1;
+  uint8_t	tcpct_cookie_desired;
+  uint16_t	tcpct_s_data_desired;
+  uint16_t	tcpct_used;
+  uint8_t	tcpct_value[TCP_MSS_DEFAULT];
 };
 
 #endif /* Misc.  */
diff --git a/sysdeps/gnu/netinet/udp.h b/sysdeps/gnu/netinet/udp.h
index e3d4492..d5f60e4 100644
--- a/sysdeps/gnu/netinet/udp.h
+++ b/sysdeps/gnu/netinet/udp.h
@@ -47,9 +47,8 @@
 #ifndef __NETINET_UDP_H
 #define __NETINET_UDP_H    1
 
-#include <features.h>
 #include <sys/types.h>
-
+#include <stdint.h>
 
 /* UDP header as specified by RFC 768, August 1980. */
 
@@ -59,17 +58,17 @@ struct udphdr
   {
     struct
     {
-      u_int16_t uh_sport;		/* source port */
-      u_int16_t uh_dport;		/* destination port */
-      u_int16_t uh_ulen;		/* udp length */
-      u_int16_t uh_sum;		/* udp checksum */
+      uint16_t uh_sport;	/* source port */
+      uint16_t uh_dport;	/* destination port */
+      uint16_t uh_ulen;		/* udp length */
+      uint16_t uh_sum;		/* udp checksum */
     };
     struct
     {
-      u_int16_t source;
-      u_int16_t dest;
-      u_int16_t len;
-      u_int16_t check;
+      uint16_t source;
+      uint16_t dest;
+      uint16_t len;
+      uint16_t check;
     };
   };
 };
diff --git a/sysdeps/mach/hurd/net/ethernet.h b/sysdeps/mach/hurd/net/ethernet.h
index 404311e..ddac678 100644
--- a/sysdeps/mach/hurd/net/ethernet.h
+++ b/sysdeps/mach/hurd/net/ethernet.h
@@ -31,15 +31,15 @@ __BEGIN_DECLS
    systems.  */
 struct ether_addr
 {
-  u_int8_t ether_addr_octet[ETH_ALEN];
+  uint8_t ether_addr_octet[ETH_ALEN];
 };
 
 /* 10Mb/s ethernet header */
 struct ether_header
 {
-  u_int8_t  ether_dhost[ETH_ALEN];	/* destination eth addr	*/
-  u_int8_t  ether_shost[ETH_ALEN];	/* source ether addr	*/
-  u_int16_t ether_type;		        /* packet type ID field	*/
+  uint8_t  ether_dhost[ETH_ALEN];	/* destination eth addr	*/
+  uint8_t  ether_shost[ETH_ALEN];	/* source ether addr	*/
+  uint16_t ether_type;		        /* packet type ID field	*/
 };
 
 /* Ethernet protocol ID's */
diff --git a/sysdeps/mach/hurd/net/if_arp.h b/sysdeps/mach/hurd/net/if_arp.h
index 7ed5550..90d389d 100644
--- a/sysdeps/mach/hurd/net/if_arp.h
+++ b/sysdeps/mach/hurd/net/if_arp.h
@@ -132,7 +132,7 @@ struct arpreq
 struct arpd_request
   {
     unsigned short int req;		/* Request type.  */
-    u_int32_t ip;			/* IP address of entry.  */
+    uint32_t ip;			/* IP address of entry.  */
     unsigned long int dev;		/* Device entry is tied to.  */
     unsigned long int stamp;
     unsigned long int updated;
diff --git a/sysdeps/mach/hurd/net/if_ppp.h b/sysdeps/mach/hurd/net/if_ppp.h
index 1b1c3ea..b210d7f 100644
--- a/sysdeps/mach/hurd/net/if_ppp.h
+++ b/sysdeps/mach/hurd/net/if_ppp.h
@@ -114,8 +114,8 @@ struct npioctl {
 
 /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
 struct ppp_option_data {
-	u_int8_t  *ptr;
-	u_int32_t length;
+	uint8_t  *ptr;
+	uint32_t  length;
 	int	  transmit;
 };
 
diff --git a/sysdeps/mach/hurd/net/route.h b/sysdeps/mach/hurd/net/route.h
index a596ce1..d974950 100644
--- a/sysdeps/mach/hurd/net/route.h
+++ b/sysdeps/mach/hurd/net/route.h
@@ -55,12 +55,12 @@ struct in6_rtmsg
     struct in6_addr rtmsg_dst;
     struct in6_addr rtmsg_src;
     struct in6_addr rtmsg_gateway;
-    u_int32_t rtmsg_type;
-    u_int16_t rtmsg_dst_len;
-    u_int16_t rtmsg_src_len;
-    u_int32_t rtmsg_metric;
+    uint32_t rtmsg_type;
+    uint16_t rtmsg_dst_len;
+    uint16_t rtmsg_src_len;
+    uint32_t rtmsg_metric;
     unsigned long int rtmsg_info;
-    u_int32_t rtmsg_flags;
+    uint32_t rtmsg_flags;
     int rtmsg_ifindex;
   };
 
@@ -109,7 +109,7 @@ struct in6_rtmsg
 #define RTF_NAT		0x08000000
 
 #define RTF_ADDRCLASSMASK	0xF8000000
-#define RT_ADDRCLASS(flags)	((__u_int32_t) flags >> 23)
+#define RT_ADDRCLASS(flags)	((uint32_t) flags >> 23)
 
 #define RT_TOS(tos)		((tos) & IPTOS_TOS_MASK)
 
diff --git a/sysdeps/mach/sys/reboot.h b/sysdeps/mach/sys/reboot.h
index fc73089..9beb8ae 100644
--- a/sysdeps/mach/sys/reboot.h
+++ b/sysdeps/mach/sys/reboot.h
@@ -27,7 +27,7 @@
  * (pre-GNU) HISTORY
  *
  * Revision 2.8  93/03/11  13:46:40  danner
- * 	u_long -> u_int.
+ * 	unsigned long -> unsigned int.
  * 	[93/03/09            danner]
  *
  * Revision 2.7  92/05/21  17:25:11  jfriedl
@@ -145,8 +145,8 @@
 #define	B_TYPEMASK		0xff
 #define	B_TYPE(val)		(((val) >> B_TYPESHIFT) & B_TYPEMASK)
 
-#define	B_MAGICMASK	((u_int)0xf0000000U)
-#define	B_DEVMAGIC	((u_int)0xa0000000U)
+#define	B_MAGICMASK	0xf0000000U
+#define	B_DEVMAGIC	0xa0000000U
 
 #define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \
 	(((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \
diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h
index 4d70a6b..f2824bb 100644
--- a/sysdeps/unix/sysv/linux/bits/in.h
+++ b/sysdeps/unix/sysv/linux/bits/in.h
@@ -53,8 +53,8 @@
 #define        IP_RECVRETOPTS  IP_RETOPTS       /* bool; Receive IP options for response.  */
 #define        IP_RETOPTS      7       /* ip_opts; Set/get IP per-packet options.  */
 #define IP_MULTICAST_IF 32	/* in_addr; set/get IP multicast i/f */
-#define IP_MULTICAST_TTL 33	/* u_char; set/get IP multicast ttl */
-#define IP_MULTICAST_LOOP 34	/* i_char; set/get IP multicast loopback */
+#define IP_MULTICAST_TTL 33	/* unsigned char; set/get IP multicast ttl */
+#define IP_MULTICAST_LOOP 34	/* bool; set/get IP multicast loopback */
 #define IP_ADD_MEMBERSHIP 35	/* ip_mreq; add an IP group membership */
 #define IP_DROP_MEMBERSHIP 36	/* ip_mreq; drop an IP group membership */
 #define IP_UNBLOCK_SOURCE 37	/* ip_mreq_source: unblock data from source */
diff --git a/sysdeps/unix/sysv/linux/net/ethernet.h b/sysdeps/unix/sysv/linux/net/ethernet.h
index 3160e93..833473e 100644
--- a/sysdeps/unix/sysv/linux/net/ethernet.h
+++ b/sysdeps/unix/sysv/linux/net/ethernet.h
@@ -21,8 +21,9 @@
 #ifndef __NET_ETHERNET_H
 #define __NET_ETHERNET_H 1
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
+#include <stdint.h>
+
 #include <linux/if_ether.h>     /* IEEE 802.3 Ethernet constants */
 
 __BEGIN_DECLS
@@ -31,15 +32,15 @@ __BEGIN_DECLS
    systems.  */
 struct ether_addr
 {
-  u_int8_t ether_addr_octet[ETH_ALEN];
+  uint8_t ether_addr_octet[ETH_ALEN];
 } __attribute__ ((__packed__));
 
 /* 10Mb/s ethernet header */
 struct ether_header
 {
-  u_int8_t  ether_dhost[ETH_ALEN];	/* destination eth addr	*/
-  u_int8_t  ether_shost[ETH_ALEN];	/* source ether addr	*/
-  u_int16_t ether_type;		        /* packet type ID field	*/
+  uint8_t  ether_dhost[ETH_ALEN];	/* destination eth addr	*/
+  uint8_t  ether_shost[ETH_ALEN];	/* source ether addr	*/
+  uint16_t ether_type;		        /* packet type ID field	*/
 } __attribute__ ((__packed__));
 
 /* Ethernet protocol ID's */
diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h
index 1b3f1d3..9a20c83 100644
--- a/sysdeps/unix/sysv/linux/net/if_arp.h
+++ b/sysdeps/unix/sysv/linux/net/if_arp.h
@@ -20,12 +20,11 @@
 /* Based on the 4.4BSD and Linux version of this file.  */
 
 #ifndef _NET_IF_ARP_H
-
 #define _NET_IF_ARP_H 1
-#include <sys/cdefs.h>
 
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <stdint.h>
 
 __BEGIN_DECLS
 
@@ -171,7 +170,7 @@ struct arpreq_old
 struct arpd_request
   {
     unsigned short int req;		/* Request type.  */
-    u_int32_t ip;			/* IP address of entry.  */
+    uint32_t ip;			/* IP address of entry.  */
     unsigned long int dev;		/* Device entry is tied to.  */
     unsigned long int stamp;
     unsigned long int updated;
diff --git a/sysdeps/unix/sysv/linux/net/if_ppp.h b/sysdeps/unix/sysv/linux/net/if_ppp.h
index 1b1c3ea..9994982 100644
--- a/sysdeps/unix/sysv/linux/net/if_ppp.h
+++ b/sysdeps/unix/sysv/linux/net/if_ppp.h
@@ -49,8 +49,7 @@
 #define __NET_IF_PPP_H 1
 
 #include <sys/types.h>
-#include <sys/cdefs.h>
-
+#include <stdint.h>
 #include <net/if.h>
 #include <sys/ioctl.h>
 #include <net/ppp_defs.h>
@@ -114,9 +113,9 @@ struct npioctl {
 
 /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
 struct ppp_option_data {
-	u_int8_t  *ptr;
-	u_int32_t length;
-	int	  transmit;
+	uint8_t  *ptr;
+	uint32_t length;
+	int	 transmit;
 };
 
 struct ifpppstatsreq {
diff --git a/sysdeps/unix/sysv/linux/net/if_shaper.h b/sysdeps/unix/sysv/linux/net/if_shaper.h
index 956ad62..e318794 100644
--- a/sysdeps/unix/sysv/linux/net/if_shaper.h
+++ b/sysdeps/unix/sysv/linux/net/if_shaper.h
@@ -18,8 +18,8 @@
 #ifndef _NET_IF_SHAPER_H
 #define _NET_IF_SHAPER_H 1
 
-#include <features.h>
 #include <sys/types.h>
+#include <stdint.h>
 #include <net/if.h>
 #include <sys/ioctl.h>
 
@@ -43,11 +43,11 @@ __BEGIN_DECLS
 
 struct shaperconf
 {
-  u_int16_t ss_cmd;
+  uint16_t ss_cmd;
   union
   {
     char ssu_name[14];
-    u_int32_t ssu_speed;
+    uint32_t ssu_speed;
   } ss_u;
 #define ss_speed ss_u.ssu_speed
 #define ss_name ss_u.ssu_name
diff --git a/sysdeps/unix/sysv/linux/net/route.h b/sysdeps/unix/sysv/linux/net/route.h
index 11d21c6..ea785ab 100644
--- a/sysdeps/unix/sysv/linux/net/route.h
+++ b/sysdeps/unix/sysv/linux/net/route.h
@@ -59,12 +59,12 @@ struct in6_rtmsg
     struct in6_addr rtmsg_dst;
     struct in6_addr rtmsg_src;
     struct in6_addr rtmsg_gateway;
-    u_int32_t rtmsg_type;
-    u_int16_t rtmsg_dst_len;
-    u_int16_t rtmsg_src_len;
-    u_int32_t rtmsg_metric;
+    uint32_t rtmsg_type;
+    uint16_t rtmsg_dst_len;
+    uint16_t rtmsg_src_len;
+    uint32_t rtmsg_metric;
     unsigned long int rtmsg_info;
-    u_int32_t rtmsg_flags;
+    uint32_t rtmsg_flags;
     int rtmsg_ifindex;
   };
 
@@ -113,7 +113,7 @@ struct in6_rtmsg
 #define RTF_NAT		0x08000000
 
 #define RTF_ADDRCLASSMASK	0xF8000000
-#define RT_ADDRCLASS(flags)	((__u_int32_t) flags >> 23)
+#define RT_ADDRCLASS(flags)	((uint32_t) flags >> 23)
 
 #define RT_TOS(tos)		((tos) & IPTOS_TOS_MASK)
 
diff --git a/sysdeps/unix/sysv/linux/netinet/if_ether.h b/sysdeps/unix/sysv/linux/netinet/if_ether.h
index e9ed137..ccd8ceb 100644
--- a/sysdeps/unix/sysv/linux/netinet/if_ether.h
+++ b/sysdeps/unix/sysv/linux/netinet/if_ether.h
@@ -70,10 +70,10 @@ __BEGIN_DECLS
  */
 struct	ether_arp {
 	struct	arphdr ea_hdr;		/* fixed-size header */
-	u_int8_t arp_sha[ETH_ALEN];	/* sender hardware address */
-	u_int8_t arp_spa[4];		/* sender protocol address */
-	u_int8_t arp_tha[ETH_ALEN];	/* target hardware address */
-	u_int8_t arp_tpa[4];		/* target protocol address */
+	uint8_t arp_sha[ETH_ALEN];	/* sender hardware address */
+	uint8_t arp_spa[4];		/* sender protocol address */
+	uint8_t arp_tha[ETH_ALEN];	/* target hardware address */
+	uint8_t arp_tpa[4];		/* target protocol address */
 };
 #define	arp_hrd	ea_hdr.ar_hrd
 #define	arp_pro	ea_hdr.ar_pro
@@ -88,14 +88,14 @@ struct	ether_arp {
  */
 #define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
 	/* struct in_addr *ipaddr; */ \
-	/* u_char enaddr[ETH_ALEN];	   */ \
+	/* uint8_t enaddr[ETH_ALEN]; */ \
 { \
 	(enaddr)[0] = 0x01; \
 	(enaddr)[1] = 0x00; \
 	(enaddr)[2] = 0x5e; \
-	(enaddr)[3] = ((u_int8_t *)ipaddr)[1] & 0x7f; \
-	(enaddr)[4] = ((u_int8_t *)ipaddr)[2]; \
-	(enaddr)[5] = ((u_int8_t *)ipaddr)[3]; \
+	(enaddr)[3] = ((uint8_t *)ipaddr)[1] & 0x7f; \
+	(enaddr)[4] = ((uint8_t *)ipaddr)[2]; \
+	(enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
 }
 
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/netinet/if_fddi.h b/sysdeps/unix/sysv/linux/netinet/if_fddi.h
index 6e0ab37..6758014 100644
--- a/sysdeps/unix/sysv/linux/netinet/if_fddi.h
+++ b/sysdeps/unix/sysv/linux/netinet/if_fddi.h
@@ -18,18 +18,16 @@
 #ifndef _NETINET_IF_FDDI_H
 #define	_NETINET_IF_FDDI_H 1
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
-#include <asm/types.h>
-
+#include <stdint.h>
 #include <linux/if_fddi.h>
 
 #ifdef __USE_MISC
 
 struct fddi_header {
-  u_int8_t fddi_fc;                    /* Frame Control (FC) value */
-  u_int8_t fddi_dhost[FDDI_K_ALEN];    /* Destination host */
-  u_int8_t fddi_shost[FDDI_K_ALEN];    /* Source host */
+  uint8_t fddi_fc;                    /* Frame Control (FC) value */
+  uint8_t fddi_dhost[FDDI_K_ALEN];    /* Destination host */
+  uint8_t fddi_shost[FDDI_K_ALEN];    /* Source host */
 };
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/netinet/if_tr.h b/sysdeps/unix/sysv/linux/netinet/if_tr.h
index c203d11..814a35d 100644
--- a/sysdeps/unix/sysv/linux/netinet/if_tr.h
+++ b/sysdeps/unix/sysv/linux/netinet/if_tr.h
@@ -18,8 +18,8 @@
 #ifndef _NETINET_IF_TR_H
 #define	_NETINET_IF_TR_H 1
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
+#include <stdint.h>
 
 /* IEEE 802.5 Token-Ring magic constants.  The frame sizes omit the preamble
    and FCS/CRC (frame check sequence). */
@@ -35,22 +35,22 @@
 /* This is an Token-Ring frame header. */
 struct trh_hdr
 {
-  u_int8_t  ac;			/* access control field */
-  u_int8_t  fc;			/* frame control field */
-  u_int8_t  daddr[TR_ALEN];	/* destination address */
-  u_int8_t  saddr[TR_ALEN];	/* source address */
-  u_int16_t rcf;		/* route control field */
-  u_int16_t rseg[8];		/* routing registers */
+  uint8_t  ac;			/* access control field */
+  uint8_t  fc;			/* frame control field */
+  uint8_t  daddr[TR_ALEN];	/* destination address */
+  uint8_t  saddr[TR_ALEN];	/* source address */
+  uint16_t rcf;			/* route control field */
+  uint16_t rseg[8];		/* routing registers */
 };
 
 /* This is an Token-Ring LLC structure */
 struct trllc
 {
-  u_int8_t  dsap;		/* destination SAP */
-  u_int8_t  ssap;		/* source SAP */
-  u_int8_t  llc;		/* LLC control field */
-  u_int8_t  protid[3];		/* protocol id */
-  u_int16_t ethertype;		/* ether type field */
+  uint8_t  dsap;		/* destination SAP */
+  uint8_t  ssap;		/* source SAP */
+  uint8_t  llc;			/* LLC control field */
+  uint8_t  protid[3];		/* protocol id */
+  uint16_t ethertype;		/* ether type field */
 };
 
 /* Token-Ring statistics collection data. */
@@ -97,12 +97,12 @@ struct tr_statistics
 
 struct trn_hdr
 {
-  u_int8_t trn_ac;                /* access control field */
-  u_int8_t trn_fc;                /* field control field */
-  u_int8_t trn_dhost[TR_ALEN];    /* destination host */
-  u_int8_t trn_shost[TR_ALEN];    /* source host */
-  u_int16_t trn_rcf;              /* route control field */
-  u_int16_t trn_rseg[8];          /* routing registers */
+  uint8_t trn_ac;                /* access control field */
+  uint8_t trn_fc;                /* field control field */
+  uint8_t trn_dhost[TR_ALEN];    /* destination host */
+  uint8_t trn_shost[TR_ALEN];    /* source host */
+  uint16_t trn_rcf;              /* route control field */
+  uint16_t trn_rseg[8];          /* routing registers */
 };
 
 #endif
diff --git a/sysdeps/unix/sysv/linux/netipx/ipx.h b/sysdeps/unix/sysv/linux/netipx/ipx.h
index 855ab99..338aab5 100644
--- a/sysdeps/unix/sysv/linux/netipx/ipx.h
+++ b/sysdeps/unix/sysv/linux/netipx/ipx.h
@@ -18,9 +18,8 @@
 #ifndef __NETIPX_IPX_H
 #define __NETIPX_IPX_H 1
 
-#include <features.h>
-
 #include <sys/types.h>
+#include <stdint.h>
 #include <bits/sockaddr.h>
 
 __BEGIN_DECLS
@@ -34,10 +33,10 @@ __BEGIN_DECLS
 struct sockaddr_ipx
   {
     sa_family_t sipx_family;
-    u_int16_t sipx_port;
-    u_int32_t sipx_network;
+    uint16_t sipx_port;
+    uint32_t sipx_network;
     unsigned char sipx_node[IPX_NODE_LEN];
-    u_int8_t sipx_type;
+    uint8_t sipx_type;
     unsigned char sipx_zero;	/* 16 byte fill */
   };
 
diff --git a/sysdeps/unix/sysv/linux/sys/acct.h b/sysdeps/unix/sysv/linux/sys/acct.h
index ea0e7fd..d24c2a7 100644
--- a/sysdeps/unix/sysv/linux/sys/acct.h
+++ b/sysdeps/unix/sysv/linux/sys/acct.h
@@ -18,12 +18,11 @@
 #ifndef _SYS_ACCT_H
 #define _SYS_ACCT_H	1
 
-#include <features.h>
-
+#include <sys/types.h>
+#include <stdint.h>
 #include <endian.h>
 #define	__need_time_t
 #include <time.h>
-#include <sys/types.h>
 
 __BEGIN_DECLS
 
@@ -35,15 +34,15 @@ __BEGIN_DECLS
   specific encoding system used.
 */
 
-typedef u_int16_t comp_t;
+typedef uint16_t comp_t;
 
 struct acct
 {
   char ac_flag;			/* Flags.  */
-  u_int16_t ac_uid;		/* Real user ID.  */
-  u_int16_t ac_gid;		/* Real group ID.  */
-  u_int16_t ac_tty;		/* Controlling terminal.  */
-  u_int32_t ac_btime;		/* Beginning time.  */
+  uint16_t ac_uid;		/* Real user ID.  */
+  uint16_t ac_gid;		/* Real group ID.  */
+  uint16_t ac_tty;		/* Controlling terminal.  */
+  uint32_t ac_btime;		/* Beginning time.  */
   comp_t ac_utime;		/* User time.  */
   comp_t ac_stime;		/* System time.  */
   comp_t ac_etime;		/* Elapsed time.  */
@@ -53,7 +52,7 @@ struct acct
   comp_t ac_minflt;		/* Minor pagefaults.  */
   comp_t ac_majflt;		/* Major pagefaults.  */
   comp_t ac_swaps;		/* Number of swaps.  */
-  u_int32_t ac_exitcode;	/* Process exitcode.  */
+  uint32_t ac_exitcode;		/* Process exitcode.  */
   char ac_comm[ACCT_COMM+1];	/* Command name.  */
   char ac_pad[10];		/* Padding bytes.  */
 };
@@ -63,13 +62,13 @@ struct acct_v3
 {
   char ac_flag;			/* Flags */
   char ac_version;		/* Always set to ACCT_VERSION */
-  u_int16_t ac_tty;		/* Control Terminal */
-  u_int32_t ac_exitcode;	/* Exitcode */
-  u_int32_t ac_uid;		/* Real User ID */
-  u_int32_t ac_gid;		/* Real Group ID */
-  u_int32_t ac_pid;		/* Process ID */
-  u_int32_t ac_ppid;		/* Parent Process ID */
-  u_int32_t ac_btime;		/* Process Creation Time */
+  uint16_t ac_tty;		/* Control Terminal */
+  uint32_t ac_exitcode;		/* Exitcode */
+  uint32_t ac_uid;		/* Real User ID */
+  uint32_t ac_gid;		/* Real Group ID */
+  uint32_t ac_pid;		/* Process ID */
+  uint32_t ac_ppid;		/* Parent Process ID */
+  uint32_t ac_btime;		/* Process Creation Time */
   float ac_etime;		/* Elapsed Time */
   comp_t ac_utime;		/* User Time */
   comp_t ac_stime;		/* System Time */

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=cb765808fbffca30a1c67cf01ffdce30f8e6df3e

commit cb765808fbffca30a1c67cf01ffdce30f8e6df3e
Author: Zack Weinberg <zackw@panix.com>
Date:   Mon Aug 22 08:06:30 2016 -0400

    Installed-header hygiene (BZ#20366): Simple self-contained fixes.
    
    Some headers did not include all of their prerequisite headers.
    
    	* rpcsvc/nislib.h: Include rpcsvc/nis.h.
    	* sysdeps/unix/sysv/linux/netrose/rose.h:
    	Include sys/socket.h and netax25/ax25.h.
    
    <endian.h> only defines BYTE_ORDER, BIG_ENDIAN, LITTLE_ENDIAN,
    etc. under __USE_MISC; glibc's headers should use __BYTE_ORDER,
    __BIG_ENDIAN, __LITTLE_ENDIAN, etc. instead.
    
    	* inet/netinet/icmp6.h, inet/netinet/ip6.h
    	* resolv/arpa/nameser_compat.h:
    	Use __BYTE_ORDER etc. instead of BYTE_ORDER etc.
    
    sys/types.h only conditionally defines caddr_t and clockid_t.
    
    	* sysdeps/unix/sysv/linux/sys/quota.h:
    	Use __caddr_t instead of caddr_t.
    	* sysdeps/unix/sysv/linux/sys/timerfd.h:
    	Use __clockid_t instead of clockid_t.
    
    Remove a #warning that was the sole actual problem with using sys/ipc.h
    without _GNU_SOURCE/_XOPEN_SOURCE.
    
    	* sysvipc/sys/ipc.h: Remove unnecessary #warning.
    
    _LIBC, __USE_XOPEN2K8, and __STDC_VERSION__ are not always defined.
    
    It seems to me that _LIBC should not appear in installed headers, but
    avoiding that for argp specifically would require more surgery than
    feels appropriate for this patch set.  It's possible that
    "#ifdef _LIBC" would be sufficient, but I wanted to be conservative.
    
    All three versions of bits/socket.h want to know whether __flexarr
    will produce a real flexible array member -- specifically, one that
    doesn't alter sizeof(the structure containing it).  They were testing
    for this with a complicated #if condition that did not agree with
    sys/cdefs.h and that tripped -Wundef warnings under -std=c90.
    I added a new macro to sys/cdefs.h, __glibc_c99_flexarr_available,
    which reveals exactly what these headers want to know.  I also took
    the opportunity to flatten the rather messy conditional nest defining
    __flexarr.
    
    	* argp/argp.h: Check whether _LIBC is defined before expanding it.
    	* posix/glob.h: Check whether __USE_XOPEN2K8 is defined instead
    	of expanding it.
    
    	* misc/sys/cdefs.h: Tidy up conditional nest defining __flexarr.
    	Define __glibc_c99_flexarr_available to 1 when the compiler
    	supports C99-compatible flexible array members, 0 otherwise.
    	* sysdeps/unix/sysv/linux/bits/socket.h
    	* sysdeps/mach/hurd/bits/socket.h
    	* bits/socket.h: Use __glibc_c99_flexarr_available in
    	definitions of struct cmsghdr and CMSG_DATA.

diff --git a/ChangeLog b/ChangeLog
index 379b6d4..f4ea6f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2016-09-23  Zack Weinberg  <zackw@panix.com>
+
+	* rpcsvc/nislib.h: Include rpcsvc/nis.h.
+	* sysdeps/unix/sysv/linux/netrose/rose.h:
+	Include sys/socket.h and netax25/ax25.h.
+
+	* inet/netinet/icmp6.h, inet/netinet/ip6.h
+	* resolv/arpa/nameser_compat.h:
+	Use __BYTE_ORDER etc. instead of BYTE_ORDER etc.
+
+	* sysdeps/unix/sysv/linux/sys/quota.h:
+	Use __caddr_t instead of caddr_t.
+	* sysdeps/unix/sysv/linux/sys/timerfd.h:
+	Use __clockid_t instead of clockid_t.
+
+	* sysvipc/sys/ipc.h: Remove unnecessary #warning.
+
+	* argp/argp.h: Check whether _LIBC is defined before expanding it.
+	* posix/glob.h: Check whether __USE_XOPEN2K8 is defined instead of
+	expanding it.
+
+	* misc/sys/cdefs.h: Tidy up conditional nest defining __flexarr.
+	Define __glibc_c99_flexarr_available to 1 when the compiler
+	supports C99-compatible flexible array members, 0 otherwise.
+	* sysdeps/unix/sysv/linux/bits/socket.h
+	* sysdeps/mach/hurd/bits/socket.h
+	* bits/socket.h: Use __glibc_c99_flexarr_available in
+	definitions of struct cmsghdr and CMSG_DATA.
+
 2016-09-23  Florian Weimer  <fweimer@redhat.com>
 
 	* manual/nss.texi (NSS Modules Interface): Adjust function return
diff --git a/argp/argp.h b/argp/argp.h
index 7cb5a69..5066776 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -511,7 +511,7 @@ extern void *__argp_input (const struct argp *__restrict __argp,
 
 #ifdef __USE_EXTERN_INLINES
 
-# if !_LIBC
+# if !(defined _LIBC && _LIBC)
 #  define __argp_usage argp_usage
 #  define __argp_state_help argp_state_help
 #  define __option_is_short _option_is_short
@@ -546,7 +546,7 @@ __NTH (__option_is_end (const struct argp_option *__opt))
   return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
 }
 
-# if !_LIBC
+# if !(defined _LIBC && _LIBC)
 #  undef __argp_usage
 #  undef __argp_state_help
 #  undef __option_is_short
diff --git a/bits/socket.h b/bits/socket.h
index a22fd56..18adca4 100644
--- a/bits/socket.h
+++ b/bits/socket.h
@@ -216,13 +216,13 @@ struct cmsghdr
 				   of cmsghdr structure.  */
     int cmsg_level;		/* Originating protocol.  */
     int cmsg_type;		/* Protocol specific type.  */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+#if __glibc_c99_flexarr_available
     __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.  */
 #endif
   };
 
 /* Ancillary data object manipulation macros.  */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+#if __glibc_c99_flexarr_available
 # define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
 #else
 # define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
diff --git a/inet/netinet/icmp6.h b/inet/netinet/icmp6.h
index b7a9637..89e3f8d 100644
--- a/inet/netinet/icmp6.h
+++ b/inet/netinet/icmp6.h
@@ -160,11 +160,11 @@ struct nd_neighbor_advert     /* neighbor advertisement */
 #define nd_na_code               nd_na_hdr.icmp6_code
 #define nd_na_cksum              nd_na_hdr.icmp6_cksum
 #define nd_na_flags_reserved     nd_na_hdr.icmp6_data32[0]
-#if     BYTE_ORDER == BIG_ENDIAN
+#if     __BYTE_ORDER == __BIG_ENDIAN
 #define ND_NA_FLAG_ROUTER        0x80000000
 #define ND_NA_FLAG_SOLICITED     0x40000000
 #define ND_NA_FLAG_OVERRIDE      0x20000000
-#else   /* BYTE_ORDER == LITTLE_ENDIAN */
+#else   /* __BYTE_ORDER == __LITTLE_ENDIAN */
 #define ND_NA_FLAG_ROUTER        0x00000080
 #define ND_NA_FLAG_SOLICITED     0x00000040
 #define ND_NA_FLAG_OVERRIDE      0x00000020
@@ -298,10 +298,10 @@ struct rr_pco_use      /* use prefix part */
 #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK  0x20
 #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO    0x10
 
-#if BYTE_ORDER == BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
 # define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
 # define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
-#elif BYTE_ORDER == LITTLE_ENDIAN
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
 # define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
 # define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
 #endif
@@ -315,10 +315,10 @@ struct rr_result       /* router renumbering result message */
     struct in6_addr     rrr_prefix;
   };
 
-#if BYTE_ORDER == BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
 # define ICMP6_RR_RESULT_FLAGS_OOB       0x0002
 # define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
-#elif BYTE_ORDER == LITTLE_ENDIAN
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
 # define ICMP6_RR_RESULT_FLAGS_OOB       0x0200
 # define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100
 #endif
diff --git a/inet/netinet/ip6.h b/inet/netinet/ip6.h
index 929d4b5..bd02c94 100644
--- a/inet/netinet/ip6.h
+++ b/inet/netinet/ip6.h
@@ -101,11 +101,11 @@ struct ip6_frag
     uint32_t  ip6f_ident;	/* identification */
   };
 
-#if BYTE_ORDER == BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
 # define IP6F_OFF_MASK       0xfff8  /* mask out offset from _offlg */
 # define IP6F_RESERVED_MASK  0x0006  /* reserved bits in ip6f_offlg */
 # define IP6F_MORE_FRAG      0x0001  /* more-fragments flag */
-#else   /* BYTE_ORDER == LITTLE_ENDIAN */
+#else   /* __BYTE_ORDER == __LITTLE_ENDIAN */
 # define IP6F_OFF_MASK       0xf8ff  /* mask out offset from _offlg */
 # define IP6F_RESERVED_MASK  0x0600  /* reserved bits in ip6f_offlg */
 # define IP6F_MORE_FRAG      0x0100  /* more-fragments flag */
@@ -175,11 +175,11 @@ struct ip6_opt_router
   };
 
 /* Router alert values (in network byte order) */
-#if BYTE_ORDER == BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
 # define IP6_ALERT_MLD	0x0000
 # define IP6_ALERT_RSVP	0x0001
 # define IP6_ALERT_AN	0x0002
-#else /* BYTE_ORDER == LITTLE_ENDING */
+#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
 # define IP6_ALERT_MLD	0x0000
 # define IP6_ALERT_RSVP	0x0100
 # define IP6_ALERT_AN	0x0200
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 6e9b840..935a94b 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -153,21 +153,27 @@
 # define __errordecl(name, msg) extern void name (void)
 #endif
 
-/* Support for flexible arrays.  */
-#if __GNUC_PREREQ (2,97)
-/* GCC 2.97 supports C99 flexible array members.  */
+/* Support for flexible arrays.
+   Headers that should use flexible arrays only if they're "real"
+   (e.g. only if they won't affect sizeof()) should test
+   #if __glibc_c99_flexarr_available.  */
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+# define __flexarr	[]
+# define __glibc_c99_flexarr_available 1
+#elif __GNUC_PREREQ (2,97)
+/* GCC 2.97 supports C99 flexible array members as an extension,
+   even when in C89 mode or compiling C++ (any version).  */
 # define __flexarr	[]
+# define __glibc_c99_flexarr_available 1
+#elif defined __GNUC__
+/* Pre-2.97 GCC did not support C99 flexible arrays but did have
+   an equivalent extension with slightly different notation.  */
+# define __flexarr	[0]
+# define __glibc_c99_flexarr_available 1
 #else
-# ifdef __GNUC__
-#  define __flexarr	[0]
-# else
-#  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
-#   define __flexarr	[]
-#  else
 /* Some other non-C99 compiler.  Approximate with [1].  */
-#   define __flexarr	[1]
-#  endif
-# endif
+# define __flexarr	[1]
+# define __glibc_c99_flexarr_available 0
 #endif
 
 
diff --git a/nis/rpcsvc/nislib.h b/nis/rpcsvc/nislib.h
index 21a8e48..1a7c3c5 100644
--- a/nis/rpcsvc/nislib.h
+++ b/nis/rpcsvc/nislib.h
@@ -19,7 +19,7 @@
 #ifndef	__RPCSVC_NISLIB_H__
 #define	__RPCSVC_NISLIB_H__
 
-#include <features.h>
+#include <rpcsvc/nis.h>
 
 __BEGIN_DECLS
 
diff --git a/posix/glob.h b/posix/glob.h
index e4548f6..ae70fa7 100644
--- a/posix/glob.h
+++ b/posix/glob.h
@@ -25,7 +25,7 @@ __BEGIN_DECLS
 /* We need `size_t' for the following definitions.  */
 #ifndef __size_t
 typedef __SIZE_TYPE__ __size_t;
-# if defined __USE_XOPEN || __USE_XOPEN2K8
+# if defined __USE_XOPEN || defined __USE_XOPEN2K8
 typedef __SIZE_TYPE__ size_t;
 # endif
 #else
diff --git a/resolv/arpa/nameser_compat.h b/resolv/arpa/nameser_compat.h
index ccc2d52..6a2f029 100644
--- a/resolv/arpa/nameser_compat.h
+++ b/resolv/arpa/nameser_compat.h
@@ -40,7 +40,7 @@
 
 typedef struct {
 	unsigned	id :16;		/*%< query identification number */
-#if BYTE_ORDER == BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
 			/* fields in third byte */
 	unsigned	qr: 1;		/*%< response flag */
 	unsigned	opcode: 4;	/*%< purpose of message */
@@ -54,7 +54,7 @@ typedef struct {
 	unsigned	cd: 1;		/*%< checking disabled by resolver */
 	unsigned	rcode :4;	/*%< response code */
 #endif
-#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
+#if __BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __PDP_ENDIAN
 			/* fields in third byte */
 	unsigned	rd :1;		/*%< recursion desired */
 	unsigned	tc :1;		/*%< truncated message */
diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h
index 257e438..5a8cd89 100644
--- a/sysdeps/mach/hurd/bits/socket.h
+++ b/sysdeps/mach/hurd/bits/socket.h
@@ -220,13 +220,13 @@ struct cmsghdr
 				   of cmsghdr structure.  */
     int cmsg_level;		/* Originating protocol.  */
     int cmsg_type;		/* Protocol specific type.  */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+#if __glibc_c99_flexarr_available
     __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.  */
 #endif
   };
 
 /* Ancillary data object manipulation macros.  */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+#if __glibc_c99_flexarr_available
 # define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
 #else
 # define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 2266047..514c373 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -273,13 +273,13 @@ struct cmsghdr
 				   with this.  */
     int cmsg_level;		/* Originating protocol.  */
     int cmsg_type;		/* Protocol specific type.  */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+#if __glibc_c99_flexarr_available
     __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.  */
 #endif
   };
 
 /* Ancillary data object manipulation macros.  */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+#if __glibc_c99_flexarr_available
 # define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
 #else
 # define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
diff --git a/sysdeps/unix/sysv/linux/netrose/rose.h b/sysdeps/unix/sysv/linux/netrose/rose.h
index 3cb7f84..762d3f5 100644
--- a/sysdeps/unix/sysv/linux/netrose/rose.h
+++ b/sysdeps/unix/sysv/linux/netrose/rose.h
@@ -21,6 +21,9 @@
 #ifndef _NETROSE_ROSE_H
 #define _NETROSE_ROSE_H 1
 
+#include <sys/socket.h>
+#include <netax25/ax25.h>
+
 /* Socket level values.  */
 #define SOL_ROSE        260
 
diff --git a/sysdeps/unix/sysv/linux/sys/quota.h b/sysdeps/unix/sysv/linux/sys/quota.h
index 1deafda..f34e741 100644
--- a/sysdeps/unix/sysv/linux/sys/quota.h
+++ b/sysdeps/unix/sysv/linux/sys/quota.h
@@ -128,7 +128,7 @@ struct dqinfo
 __BEGIN_DECLS
 
 extern int quotactl (int __cmd, const char *__special, int __id,
-		     caddr_t __addr) __THROW;
+		     __caddr_t __addr) __THROW;
 
 __END_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h b/sysdeps/unix/sysv/linux/sys/timerfd.h
index 3286997..d037213 100644
--- a/sysdeps/unix/sysv/linux/sys/timerfd.h
+++ b/sysdeps/unix/sysv/linux/sys/timerfd.h
@@ -35,7 +35,7 @@ enum
 __BEGIN_DECLS
 
 /* Return file descriptor for new interval timer source.  */
-extern int timerfd_create (clockid_t __clock_id, int __flags) __THROW;
+extern int timerfd_create (__clockid_t __clock_id, int __flags) __THROW;
 
 /* Set next expiration time of interval timer source UFD to UTMR.  If
    FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is
diff --git a/sysvipc/sys/ipc.h b/sysvipc/sys/ipc.h
index 70bd7a6..0392662 100644
--- a/sysvipc/sys/ipc.h
+++ b/sysvipc/sys/ipc.h
@@ -20,10 +20,6 @@
 
 #include <features.h>
 
-#if !defined __USE_MISC && !defined __USE_XOPEN && __GNUC__ >= 2
-# warning "Files using this header must be compiled with _GNU_SOURCE or _XOPEN_SOURCE"
-#endif
-
 /* Get system dependent definition of `struct ipc_perm' and more.  */
 #include <bits/ipctypes.h>
 #include <bits/ipc.h>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                       |  234 ++++++++++++++++++++++
 Makefile                                        |   23 +++
 Rules                                           |   23 +++
 argp/argp.h                                     |    4 +-
 bits/in.h                                       |    4 +-
 bits/resource.h                                 |    3 +-
 bits/sigcontext.h                               |    7 +-
 bits/sigstack.h                                 |    7 +-
 bits/socket.h                                   |    4 +-
 bits/time.h                                     |   54 ++----
 gmon/sys/gmon.h                                 |   30 ++--
 include/aliases.h                               |    3 +
 include/alloca.h                                |    4 +
 include/argz.h                                  |    3 +
 include/arpa/nameser.h                          |    7 +-
 include/arpa/nameser_compat.h                   |    3 +
 include/bits/types/clock_t.h                    |    1 +
 include/bits/types/clockid_t.h                  |    1 +
 include/bits/types/struct_itimerspec.h          |    1 +
 include/bits/types/struct_osockaddr.h           |    1 +
 include/bits/types/struct_timespec.h            |    1 +
 include/bits/types/struct_timeval.h             |    1 +
 include/bits/types/struct_tm.h                  |    1 +
 include/bits/types/time_t.h                     |    1 +
 include/bits/types/timer_t.h                    |    1 +
 include/elf.h                                   |    9 +-
 include/envz.h                                  |    3 +
 include/err.h                                   |    6 +
 include/execinfo.h                              |    3 +
 include/fpu_control.h                           |    6 +
 include/getopt.h                                |    5 +-
 include/gshadow.h                               |    3 +
 include/ifaddrs.h                               |    4 +
 include/libintl.h                               |    4 +
 include/link.h                                  |   11 +-
 include/malloc.h                                |    2 +
 include/mcheck.h                                |    3 +
 include/mntent.h                                |    3 +
 include/netinet/ether.h                         |    3 +
 include/nss.h                                   |    3 +
 include/obstack.h                               |    6 +
 include/printf.h                                |    4 +
 include/pty.h                                   |    3 +
 include/resolv.h                                |   35 ++--
 include/rpc/auth.h                              |    3 +
 include/rpc/auth_des.h                          |    3 +
 include/rpc/auth_unix.h                         |    6 +
 include/rpc/clnt.h                              |    3 +
 include/rpc/des_crypt.h                         |    3 +
 include/rpc/key_prot.h                          |    6 +
 include/rpc/netdb.h                             |    3 +
 include/rpc/pmap_clnt.h                         |    7 +-
 include/rpc/pmap_prot.h                         |    6 +
 include/rpc/pmap_rmt.h                          |    6 +
 include/rpc/rpc.h                               |    4 +
 include/rpc/rpc_msg.h                           |    3 +
 include/rpc/svc.h                               |    3 +
 include/rpc/svc_auth.h                          |    3 +
 include/rpc/xdr.h                               |    6 +
 include/rpcsvc/nis_callback.h                   |    3 +
 include/rpcsvc/nislib.h                         |    3 +
 include/rpcsvc/yp.h                             |    3 +
 include/rpcsvc/ypclnt.h                         |    3 +
 include/rpcsvc/ypupd.h                          |    3 +
 include/shadow.h                                |    3 +
 include/stdio_ext.h                             |    7 +-
 include/sys/epoll.h                             |    3 +
 include/sys/file.h                              |    4 +
 include/sys/gmon.h                              |    4 +
 include/sys/ioctl.h                             |    4 +
 include/sys/prctl.h                             |    3 +
 include/sys/profil.h                            |    3 +
 include/sys/statfs.h                            |    4 +
 include/sys/sysctl.h                            |    3 +
 include/sys/sysinfo.h                           |    3 +
 include/time.h                                  |    7 +-
 include/ttyent.h                                |    7 +-
 include/utmp.h                                  |    3 +
 inet/netinet/ether.h                            |    2 +
 inet/netinet/icmp6.h                            |   12 +-
 inet/netinet/igmp.h                             |    8 +-
 inet/netinet/ip6.h                              |    8 +-
 inet/protocols/routed.h                         |    6 +-
 inet/protocols/talkd.h                          |   22 ++-
 inet/protocols/timed.h                          |    6 +-
 io/fcntl.h                                      |    3 +-
 io/fts.h                                        |   20 +-
 io/sys/poll.h                                   |    3 +-
 io/sys/stat.h                                   |   13 +-
 io/utime.h                                      |    3 +-
 misc/sys/cdefs.h                                |   30 ++--
 misc/sys/select.h                               |    8 +-
 nis/rpcsvc/nislib.h                             |    2 +-
 nptl_db/thread_db.h                             |    2 +-
 posix/glob.h                                    |    2 +-
 posix/sched.h                                   |    9 +-
 posix/sys/times.h                               |    4 +-
 posix/sys/types.h                               |    9 +-
 resolv/arpa/nameser.h                           |  120 ++++++------
 resolv/arpa/nameser_compat.h                    |    4 +-
 resolv/netdb.h                                  |    3 +-
 resolv/resolv.h                                 |  117 ++++++-----
 rt/aio.h                                        |    3 +-
 rt/mqueue.h                                     |    3 +-
 scripts/check-installed-headers.sh              |  146 ++++++++++++++
 signal/signal.h                                 |    3 +-
 socket/Makefile                                 |    3 +-
 socket/bits/types/struct_osockaddr.h            |   12 ++
 socket/sys/socket.h                             |    8 +-
 sunrpc/rpc/rpc_des.h                            |    8 +-
 sysdeps/arm/nacl/include/bits/setjmp.h          |    3 +
 sysdeps/arm/sys/ucontext.h                      |    6 +
 sysdeps/generic/netinet/if_ether.h              |    2 +-
 sysdeps/generic/netinet/in_systm.h              |    8 +-
 sysdeps/generic/netinet/ip.h                    |   46 +++---
 sysdeps/generic/netinet/tcp.h                   |   34 ++--
 sysdeps/generic/sys/ucontext.h                  |    6 +-
 sysdeps/gnu/netinet/ip_icmp.h                   |   56 +++---
 sysdeps/gnu/netinet/tcp.h                       |  167 ++++++++--------
 sysdeps/gnu/netinet/udp.h                       |   19 +-
 sysdeps/i386/sys/ucontext.h                     |    6 +
 sysdeps/m68k/sys/ucontext.h                     |    6 +
 sysdeps/mach/hurd/bits/socket.h                 |    4 +-
 sysdeps/mach/hurd/i386/bits/sigcontext.h        |    7 +-
 sysdeps/mach/hurd/net/ethernet.h                |    8 +-
 sysdeps/mach/hurd/net/if_arp.h                  |    2 +-
 sysdeps/mach/hurd/net/if_ppp.h                  |    7 +-
 sysdeps/mach/hurd/net/route.h                   |   12 +-
 sysdeps/mach/sys/reboot.h                       |    6 +-
 sysdeps/mips/include/sys/asm.h                  |    6 +-
 sysdeps/mips/sys/ucontext.h                     |    9 +-
 sysdeps/nptl/pthread.h                          |    1 +
 sysdeps/pthread/semaphore.h                     |    3 +-
 sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h |   25 ++-
 sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h  |    9 +-
 sysdeps/unix/sysv/linux/alpha/bits/resource.h   |    3 +-
 sysdeps/unix/sysv/linux/alpha/bits/sigstack.h   |   25 ++-
 sysdeps/unix/sysv/linux/alpha/sys/acct.h        |    4 +-
 sysdeps/unix/sysv/linux/alpha/sys/ucontext.h    |    3 +
 sysdeps/unix/sysv/linux/arm/sys/ucontext.h      |    6 +-
 sysdeps/unix/sysv/linux/bits/in.h               |    4 +-
 sysdeps/unix/sysv/linux/bits/resource.h         |    3 +-
 sysdeps/unix/sysv/linux/bits/sigcontext.h       |    5 +
 sysdeps/unix/sysv/linux/bits/sigstack.h         |   25 ++-
 sysdeps/unix/sysv/linux/bits/socket.h           |    4 +-
 sysdeps/unix/sysv/linux/bits/time.h             |   68 +++----
 sysdeps/unix/sysv/linux/bits/timex.h            |    1 +
 sysdeps/unix/sysv/linux/hppa/sys/ucontext.h     |    5 +-
 sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h  |    6 +-
 sysdeps/unix/sysv/linux/ia64/bits/sigstack.h    |   29 ++--
 sysdeps/unix/sysv/linux/ia64/sys/ucontext.h     |    4 +
 sysdeps/unix/sysv/linux/include/sys/sysinfo.h   |    3 +
 sysdeps/unix/sysv/linux/include/sys/timex.h     |    3 +
 sysdeps/unix/sysv/linux/m68k/sys/ucontext.h     |    6 +
 sysdeps/unix/sysv/linux/mips/bits/resource.h    |    3 +-
 sysdeps/unix/sysv/linux/mips/bits/sigstack.h    |   25 ++-
 sysdeps/unix/sysv/linux/mips/sys/ucontext.h     |    9 +-
 sysdeps/unix/sysv/linux/net/ethernet.h          |   11 +-
 sysdeps/unix/sysv/linux/net/if_arp.h            |    5 +-
 sysdeps/unix/sysv/linux/net/if_ppp.h            |   12 +-
 sysdeps/unix/sysv/linux/net/if_shaper.h         |    6 +-
 sysdeps/unix/sysv/linux/net/ppp_defs.h          |    4 +-
 sysdeps/unix/sysv/linux/net/route.h             |   12 +-
 sysdeps/unix/sysv/linux/netinet/if_ether.h      |   16 +-
 sysdeps/unix/sysv/linux/netinet/if_fddi.h       |   10 +-
 sysdeps/unix/sysv/linux/netinet/if_tr.h         |   36 ++--
 sysdeps/unix/sysv/linux/netipx/ipx.h            |    9 +-
 sysdeps/unix/sysv/linux/netrose/rose.h          |    3 +
 sysdeps/unix/sysv/linux/nios2/sys/ucontext.h    |    6 +
 sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h |   25 ++-
 sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h  |    6 +-
 sysdeps/unix/sysv/linux/s390/sys/ucontext.h     |   10 +-
 sysdeps/unix/sysv/linux/sh/sys/ucontext.h       |    5 +-
 sysdeps/unix/sysv/linux/sparc/bits/resource.h   |    3 +-
 sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h |    5 +
 sysdeps/unix/sysv/linux/sparc/bits/sigstack.h   |   25 ++-
 sysdeps/unix/sysv/linux/sparc/sys/ucontext.h    |    7 +
 sysdeps/unix/sysv/linux/sys/acct.h              |   34 ++--
 sysdeps/unix/sysv/linux/sys/quota.h             |    2 +-
 sysdeps/unix/sysv/linux/sys/timerfd.h           |    3 +-
 sysdeps/unix/sysv/linux/tile/sys/ucontext.h     |    6 +-
 sysdeps/unix/sysv/linux/x86/sys/ucontext.h      |    6 +-
 sysdeps/x86/fpu/include/bits/fenv.h             |    6 +
 sysvipc/sys/ipc.h                               |    4 -
 sysvipc/sys/msg.h                               |    3 +-
 sysvipc/sys/sem.h                               |    3 +-
 sysvipc/sys/shm.h                               |    3 +-
 time/Makefile                                   |    7 +-
 time/bits/types/clock_t.h                       |   15 ++
 time/bits/types/clockid_t.h                     |    9 +
 time/bits/types/struct_itimerspec.h             |   14 ++
 time/bits/types/struct_timespec.h               |   14 ++
 time/bits/types/struct_timeval.h                |   13 ++
 time/bits/types/struct_tm.h                     |   33 +++
 time/bits/types/time_t.h                        |   14 ++
 time/bits/types/timer_t.h                       |    9 +
 time/sys/time.h                                 |    9 +-
 time/sys/timeb.h                                |    4 +-
 time/time.h                                     |  237 ++++++-----------------
 199 files changed, 1701 insertions(+), 943 deletions(-)
 create mode 100644 include/bits/types/clock_t.h
 create mode 100644 include/bits/types/clockid_t.h
 create mode 100644 include/bits/types/struct_itimerspec.h
 create mode 100644 include/bits/types/struct_osockaddr.h
 create mode 100644 include/bits/types/struct_timespec.h
 create mode 100644 include/bits/types/struct_timeval.h
 create mode 100644 include/bits/types/struct_tm.h
 create mode 100644 include/bits/types/time_t.h
 create mode 100644 include/bits/types/timer_t.h
 create mode 100644 scripts/check-installed-headers.sh
 create mode 100644 socket/bits/types/struct_osockaddr.h
 create mode 100644 time/bits/types/clock_t.h
 create mode 100644 time/bits/types/clockid_t.h
 create mode 100644 time/bits/types/struct_itimerspec.h
 create mode 100644 time/bits/types/struct_timespec.h
 create mode 100644 time/bits/types/struct_timeval.h
 create mode 100644 time/bits/types/struct_tm.h
 create mode 100644 time/bits/types/time_t.h
 create mode 100644 time/bits/types/timer_t.h


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]