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 zack/more-obsolete-typedefs-2 created. glibc-2.29.9000-129-gdd868cc


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, zack/more-obsolete-typedefs-2 has been created
        at  dd868cc7b88789af76504a3dff9770c5b953e373 (commit)

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

commit dd868cc7b88789af76504a3dff9770c5b953e373
Author: Zack Weinberg <zackw@panix.com>
Date:   Sat Mar 9 23:05:37 2019 -0500

    Donâ??t include all of sys/select.h from sys/types.h.

diff --git a/NEWS b/NEWS
index a4d3421..40d324a 100644
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,12 @@ Deprecated and removed features, and other changes affecting compatibility:
   named uint8_t, uint16_t, etc. from <stdint.h>.  There is no standardized
   replacement for register_t.
 
+* In the default conformance mode, <sys/types.h> no longer includes all of
+  <sys/select.h>; only the types fd_set and fd_mask, and the macros FD_SET,
+  FD_CLR, FD_ISSET, FD_ZERO, FD_SETSIZE, and NFDBITS, are made available.
+  (In strict conformance modes, <sys/types.h> has never included any of
+  <sys/select.h> and this is unchanged.).
+
 Changes to build and runtime requirements:
 
 * GCC 6.2 or later is required to build the GNU C Library.
diff --git a/bits/select.h b/bits/select.h
index 71b771f..346d1d8 100644
--- a/bits/select.h
+++ b/bits/select.h
@@ -15,7 +15,10 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_SELECT_H
+#ifndef _BITS_SELECT_H
+#define _BITS_SELECT_H 1
+
+#ifndef _BITS_FD_SET_H
 # error "Never use <bits/select.h> directly; include <sys/select.h> instead."
 #endif
 
@@ -35,3 +38,5 @@
   ((void) (__FDS_BITS (s)[__FD_ELT(d)] &= ~__FD_MASK(d)))
 #define __FD_ISSET(d, s) \
   ((__FDS_BITS (s)[__FD_ELT (d)] & __FD_MASK (d)) != 0)
+
+#endif /* bits/select.h */
diff --git a/include/bits/fd_set.h b/include/bits/fd_set.h
new file mode 100644
index 0000000..053fbd1
--- /dev/null
+++ b/include/bits/fd_set.h
@@ -0,0 +1 @@
+#include <misc/bits/fd_set.h>
diff --git a/misc/Makefile b/misc/Makefile
index e6c7389..ac27732 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -28,12 +28,13 @@ headers :=								\
 	libgen.h limits.h mntent.h paths.h regexp.h search.h sgtty.h	\
 	stab.h stdc-predef.h syscall.h sysexits.h syslog.h ttyent.h	\
 	values.h							\
-	bits/err-ldbl.h bits/error-ldbl.h bits/error.h bits/hwcap.h	\
-	bits/ioctl-types.h bits/ioctls.h bits/libc-header-start.h	\
-	bits/mman.h bits/param.h bits/select.h bits/select2.h		\
-	bits/stab.def bits/syslog-ldbl.h bits/syslog-path.h		\
-	bits/syslog.h bits/sysmacros.h bits/types/struct_iovec.h	\
-	bits/uio-ext.h bits/uio_lim.h bits/xopen_lim.h			\
+	bits/err-ldbl.h bits/error-ldbl.h bits/error.h bits/fd_set.h	\
+	bits/hwcap.h bits/ioctl-types.h bits/ioctls.h			\
+	bits/libc-header-start.h bits/mman.h bits/param.h		\
+	bits/select.h bits/select2.h bits/stab.def bits/syslog-ldbl.h	\
+	bits/syslog-path.h bits/syslog.h bits/sysmacros.h		\
+	bits/types/struct_iovec.h bits/uio-ext.h bits/uio_lim.h		\
+	bits/xopen_lim.h						\
 	gnu/libc-version.h						\
 	sys/auxv.h sys/cdefs.h sys/dir.h sys/file.h sys/ioctl.h		\
 	sys/mman.h sys/param.h sys/ptrace.h sys/queue.h sys/reboot.h	\
diff --git a/misc/bits/fd_set.h b/misc/bits/fd_set.h
new file mode 100644
index 0000000..766ca10
--- /dev/null
+++ b/misc/bits/fd_set.h
@@ -0,0 +1,78 @@
+/* `fd_set' type and related macros.
+   Copyright (C) 2019 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/>.  */
+
+#ifndef _BITS_FD_SET_H
+#define _BITS_FD_SET_H 1
+
+#if !defined _SYS_SELECT_H && !defined _SYS_TYPES_H
+#error "Never include <bits/fd_set.h> directly; use <sys/select.h> instead."
+#endif
+
+/* Get definition of needed basic types.  */
+#include <bits/types.h>
+
+/* Get __FD_* definitions.  */
+#include <bits/select.h>
+
+/* The fd_set member is required to be an array of longs.  */
+typedef long int __fd_mask;
+
+/* Some versions of <linux/posix_types.h> define this macros.  */
+#undef	__NFDBITS
+/* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
+#define __NFDBITS	(8 * (int) sizeof (__fd_mask))
+#define	__FD_ELT(d)	((d) / __NFDBITS)
+#define	__FD_MASK(d)	((__fd_mask) (1UL << ((d) % __NFDBITS)))
+
+/* When fortification is active, add bounds checking to __FD_ELT.  */
+#if __USE_FORTIFY_LEVEL > 0 && defined __GNUC__
+# include <bits/select2.h>
+#endif
+
+/* fd_set for select and pselect.  */
+typedef struct
+  {
+    /* XPG4.2 requires this member name.  Otherwise avoid the name
+       from the global namespace.  */
+#ifdef __USE_XOPEN
+    __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
+# define __FDS_BITS(set) ((set)->fds_bits)
+#else
+    __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
+# define __FDS_BITS(set) ((set)->__fds_bits)
+#endif
+  } fd_set;
+
+/* Maximum number of file descriptors in `fd_set'.  */
+#define	FD_SETSIZE		__FD_SETSIZE
+
+#ifdef __USE_MISC
+/* Sometimes the fd_set member is assumed to have this type.  */
+typedef __fd_mask fd_mask;
+
+/* Number of bits per word of `fd_set' (some code assumes this is 32).  */
+# define NFDBITS		__NFDBITS
+#endif
+
+/* Access macros for `fd_set'.  */
+#define	FD_SET(fd, fdsetp)	__FD_SET (fd, fdsetp)
+#define	FD_CLR(fd, fdsetp)	__FD_CLR (fd, fdsetp)
+#define	FD_ISSET(fd, fdsetp)	__FD_ISSET (fd, fdsetp)
+#define	FD_ZERO(fdsetp)		__FD_ZERO (fdsetp)
+
+#endif /* bits/fd_set.h */
diff --git a/misc/bits/select2.h b/misc/bits/select2.h
index dffdd05..1179133 100644
--- a/misc/bits/select2.h
+++ b/misc/bits/select2.h
@@ -16,7 +16,10 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_SELECT_H
+#ifndef _BITS_SELECT2_H
+#define _BITS_SELECT2_H 1
+
+#ifndef _BITS_FD_SET_H
 # error "Never include <bits/select2.h> directly; use <sys/select.h> instead."
 #endif
 
@@ -33,3 +36,5 @@ extern long int __fdelt_warn (long int __d)
 	 ? (__d / __NFDBITS)						    \
 	 : __fdelt_warn (__d))						    \
       : __fdelt_chk (__d)); })
+
+#endif
diff --git a/misc/sys/select.h b/misc/sys/select.h
index 84e2ae3..0e4ccd1 100644
--- a/misc/sys/select.h
+++ b/misc/sys/select.h
@@ -26,9 +26,6 @@
 /* Get definition of needed basic types.  */
 #include <bits/types.h>
 
-/* Get __FD_* definitions.  */
-#include <bits/select.h>
-
 /* Get sigset_t.  */
 #include <bits/types/sigset_t.h>
 
@@ -40,48 +37,8 @@
 #endif
 #include <bits/types/suseconds_t.h>
 
-/* The fd_set member is required to be an array of longs.  */
-typedef long int __fd_mask;
-
-/* Some versions of <linux/posix_types.h> define this macros.  */
-#undef	__NFDBITS
-/* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
-#define __NFDBITS	(8 * (int) sizeof (__fd_mask))
-#define	__FD_ELT(d)	((d) / __NFDBITS)
-#define	__FD_MASK(d)	((__fd_mask) (1UL << ((d) % __NFDBITS)))
-
-/* fd_set for select and pselect.  */
-typedef struct
-  {
-    /* XPG4.2 requires this member name.  Otherwise avoid the name
-       from the global namespace.  */
-#ifdef __USE_XOPEN
-    __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
-# define __FDS_BITS(set) ((set)->fds_bits)
-#else
-    __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
-# define __FDS_BITS(set) ((set)->__fds_bits)
-#endif
-  } fd_set;
-
-/* Maximum number of file descriptors in `fd_set'.  */
-#define	FD_SETSIZE		__FD_SETSIZE
-
-#ifdef __USE_MISC
-/* Sometimes the fd_set member is assumed to have this type.  */
-typedef __fd_mask fd_mask;
-
-/* Number of bits per word of `fd_set' (some code assumes this is 32).  */
-# define NFDBITS		__NFDBITS
-#endif
-
-
-/* Access macros for `fd_set'.  */
-#define	FD_SET(fd, fdsetp)	__FD_SET (fd, fdsetp)
-#define	FD_CLR(fd, fdsetp)	__FD_CLR (fd, fdsetp)
-#define	FD_ISSET(fd, fdsetp)	__FD_ISSET (fd, fdsetp)
-#define	FD_ZERO(fdsetp)		__FD_ZERO (fdsetp)
-
+/* Get fd_set and its access macros.  */
+#include <bits/fd_set.h>
 
 __BEGIN_DECLS
 
@@ -112,12 +69,6 @@ extern int pselect (int __nfds, fd_set *__restrict __readfds,
 		    const __sigset_t *__restrict __sigmask);
 #endif
 
-
-/* Define some inlines helping to catch common problems.  */
-#if __USE_FORTIFY_LEVEL > 0 && defined __GNUC__
-# include <bits/select2.h>
-#endif
-
 __END_DECLS
 
 #endif /* sys/select.h */
diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c
index 60a965d..dce93dc 100644
--- a/nptl/tst-cancel4.c
+++ b/nptl/tst-cancel4.c
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#include <sys/select.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/ipc.h>
diff --git a/posix/sys/types.h b/posix/sys/types.h
index 8f6d328..72ac7ca 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -97,7 +97,7 @@ __BEGIN_DECLS
 # include <endian.h>
 
 /* It also defines `fd_set' and the FD_* macros for `select'.  */
-# include <sys/select.h>
+# include <bits/fd_set.h>
 #endif /* Use misc.  */
 
 __END_DECLS
diff --git a/scripts/check-c++-types.sh b/scripts/check-c++-types.sh
index a8f3cff..d0617e1 100755
--- a/scripts/check-c++-types.sh
+++ b/scripts/check-c++-types.sh
@@ -46,6 +46,7 @@ while read t; do
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/resource.h>
+#include <signal.h>
 #include <unistd.h>
 void foo ($t) { }
 EOF
diff --git a/socket/sys/socket.h b/socket/sys/socket.h
index 6f242d0..e9a0b03 100644
--- a/socket/sys/socket.h
+++ b/socket/sys/socket.h
@@ -36,6 +36,10 @@ __BEGIN_DECLS
 # include <bits/types/struct_osockaddr.h>
 #endif
 
+#ifdef __USE_GNU
+# include <bits/types/struct_timespec.h>
+#endif
+
 /* The following constants should be used for the second parameter of
    `shutdown'.  */
 enum
diff --git a/sysdeps/x86/bits/select.h b/sysdeps/x86/bits/select.h
index 1da802a..f9ba48b 100644
--- a/sysdeps/x86/bits/select.h
+++ b/sysdeps/x86/bits/select.h
@@ -15,7 +15,10 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _SYS_SELECT_H
+#ifndef _BITS_SELECT_H
+#define _BITS_SELECT_H 1
+
+#ifndef _BITS_FD_SET_H
 # error "Never use <bits/select.h> directly; include <sys/select.h> instead."
 #endif
 
@@ -61,3 +64,5 @@
   ((void) (__FDS_BITS (set)[__FD_ELT (d)] &= ~__FD_MASK (d)))
 #define __FD_ISSET(d, set) \
   ((__FDS_BITS (set)[__FD_ELT (d)] & __FD_MASK (d)) != 0)
+
+#endif /* bits/select.h */

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

commit 5bef1aa7abc2340c0edcb9d1553ae46c57ca2420
Author: Zack Weinberg <zackw@panix.com>
Date:   Sat Mar 9 21:18:56 2019 -0500

    Donâ??t conditionalize declarations of ldiv_t, lldiv_t, __gwchar_t.
    
    The declarations of ldiv_t, lldiv_t, and __gwchar_t are all wrapped in
    __foo_t_defined conditionals, despite there being only one header in
    glibc that declares them.  I checked codesearch.debian.net and only
    found one other program that refers to the __foo_t_defined
    conditionals: u-boot provides its own definition of ldiv_t if
    __ldiv_t_defined is not defined by stdlib.h.  I conclude that the
    conditionals are not necessary, but the definitions of
    __ldiv_t_defined and __lldiv_t_defined should be preserved.
    
    	* stdlib/inttypes.h: Unconditionally define __gwchar_t.
            Donâ??t define ____gwchar_t_defined.
            * stdlib/stdlib.h: Unconditionally define ldiv_t.
            Condition lldiv_t only on __USE_ISOC99.

diff --git a/stdlib/inttypes.h b/stdlib/inttypes.h
index ddcb171..c5fb120 100644
--- a/stdlib/inttypes.h
+++ b/stdlib/inttypes.h
@@ -27,17 +27,14 @@
 #include <stdint.h>
 
 /* Get a definition for wchar_t.  But we must not define wchar_t itself.  */
-#ifndef ____gwchar_t_defined
-# ifdef __cplusplus
-#  define __gwchar_t wchar_t
-# elif defined __WCHAR_TYPE__
+#ifdef __cplusplus
+# define __gwchar_t wchar_t
+#elif defined __WCHAR_TYPE__
 typedef __WCHAR_TYPE__ __gwchar_t;
-# else
-#  define __need_wchar_t
-#  include <stddef.h>
+#else
+# define __need_wchar_t
+# include <stddef.h>
 typedef wchar_t __gwchar_t;
-# endif
-# define ____gwchar_t_defined	1
 #endif
 
 # if __WORDSIZE == 64
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 15debe1..5e5d966 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -62,16 +62,14 @@ typedef struct
   } div_t;
 
 /* Returned by `ldiv'.  */
-#ifndef __ldiv_t_defined
 typedef struct
   {
     long int quot;		/* Quotient.  */
     long int rem;		/* Remainder.  */
   } ldiv_t;
-# define __ldiv_t_defined	1
-#endif
+#define __ldiv_t_defined	1
 
-#if defined __USE_ISOC99 && !defined __lldiv_t_defined
+#if defined __USE_ISOC99
 /* Returned by `lldiv'.  */
 __extension__ typedef struct
   {

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

commit 697ed96c8e1d774f0f962c959c9988b1097a69f5
Author: Zack Weinberg <zackw@panix.com>
Date:   Sat Mar 9 20:54:02 2019 -0500

    Create bits/types headers for most remaining __T_defined macros.
    
    This doesn't exactly fit the theme but as long as I'm tinkering with
    sys/types.h it makes sense to go through and create single-declaration
    bits/types/ headers for all of the remaining cases where we have
    two or more headers declaring a public type.
    
    The remaining uses of the original __T_defined idiom are:
    __error_t_defined in files shared with gnulib, which probably has to
    remain as is; ____gwchar_t_defined in inttypes.h, which may not be
    necessary anymore and should be addressed separately, and
    __ldiv_t_defined and __lldiv_t_defined in stdlib.h, ditto.
    
    Our handling of LFS types is a little inconsistent: some headers
    declare both off_t and off64_t (for instance) when
    _LARGEFILE64_SOURCE, others will only declare off_t regardless of
    _LARGEFILE64_SOURCE.  I don't know if this was intentional or not.
    I am tempted to centralize responsibility for _LARGEFILE64_SOURCE as
    well as _FILE_OFFSET_BITS=64 in bits/types/off_t.h (etc) so that any
    header that declares off_t will automatically also declare off64_t
    when _LARGEFILE64_SOURCE.
    
    sunrpc/rpc/types.h is special, because it is included in files
    compiled by the *build* compiler (cross-rpcgen-objs), and therefore it
    cannot unconditionally assume bits/types headers are available.  What
    I did was have it include the appropriate bits/types headers only if
    including sys/types.h did not cause __BIT_TYPES_DEFINED__ to be
    defined.  This will do the right thing when an installed rpc/types.h
    is included by application code compiled without __USE_MISC in effect.
    During the build, we rely on the fact that we compile all of our own
    code with __USE_MISC in effect.  This is fragile, but should be
    acceptable for code that's no longer built by default anyway.
    
    scripts/check-obsolete-constructs.py ensures that only sys/types.h and
    rpc/types.h include the bits/types/ headers that define obsolete types.
    
    	* posix/bits/types/blkcnt64_t.h
    	* posix/bits/types/blkcnt_t.h
    	* posix/bits/types/blksize_t.h
    	* posix/bits/types/dev_t.h
    	* posix/bits/types/fsblkcnt64_t.h
    	* posix/bits/types/fsblkcnt_t.h
    	* posix/bits/types/fsfilcnt64_t.h
    	* posix/bits/types/fsfilcnt_t.h
    	* posix/bits/types/fsid_t.h
    	* posix/bits/types/gid_t.h
    	* posix/bits/types/id_t.h
    	* posix/bits/types/ino64_t.h
    	* posix/bits/types/ino_t.h
    	* posix/bits/types/intptr_t.h
    	* posix/bits/types/key_t.h
    	* posix/bits/types/loff_t.h
    	* posix/bits/types/mode_t.h
    	* posix/bits/types/nlink_t.h
    	* posix/bits/types/off64_t.h
    	* posix/bits/types/off_t.h
    	* posix/bits/types/pid_t.h
    	* posix/bits/types/socklen_t.h
    	* posix/bits/types/ssize_t.h
    	* posix/bits/types/suseconds_t.h
    	* posix/bits/types/uid_t.h
    	* posix/bits/types/useconds_t.h:
            New single-declaration headers for standard types canonically
    	defined by sys/types.h, sys/socket.h, or inttypes.h but also
    	exposed by other headers under some circumstances.  Code moved
            from posix/sys/types.h, socket/sys/socket.h, stdlib/inttypes.h
            as appropriate.
    
    	* posix/bits/types/uint.h
    	* posix/bits/types/u_int.h
    	* posix/bits/types/u_intN_t.h
    	* posix/bits/types/caddr_t.h
    	* posix/bits/types/daddr_t.h
    	* posix/bits/types/loff_t.h
    	* posix/bits/types/register_t.h:
            Similarly, but for obsolete BSD-derived types whose canonical
    	home is sys/types.h.  Some of these headers define more than
    	one type.
    
            * posix/Makefile (headers): Install the above new headers.
            Rewrap the list.
            * posix/sys/types.h: All definitions of public types now
            accomplished using the above new headers.  Consolidate
            groups of definitions controlled by the same feature
            selection macros.
    
            * inet/arpa/inet.h, bits/socket.h
            * sysdeps/mach/hurd/bits/socket.h
            * sysdeps/unix/sysv/linux/bits/socket.h:
            Use bits/types/socklen_t.h.
    
            * dirent/dirent.h: Use bits/types/ino_t.h and bits/types/ino64_t.h.
            * grp/grp.h: Use bits/types/gid_t.h.
            * io/fcntl.h: Use bits/types/mode_t.h, bits/types/off_t.h,
            bits/types/pid_t.h, and bits/types/off64_t.h.
            * io/sys/stat.h: Use bits/types/dev_t.h, bits/types/gid_t.h,
            bits/types/ino_t.h, bits/types/mode_t.h, bits/types/nlink_t.h,
            bits/types/off_t.h, bits/types/uid_t.h, and bits/types/blkcnt_t.h.
            * libio/stdio.h: Use bits/types/off_t.h, bits/types/off64_t.h,
            and bits/types/ssize_t.h.
            * misc/sys/mman.h: Use bits/types/off_t.h and bits/types/mode_t.h.
            * misc/sys/select.h: Use bits/types/suseconds_t.h.
            * posix/sched.h: Use bits/types/pid_t.h.
            * posix/sys/wait.h: Use bits/types/pid_t.h and bits/types/id_t.h.
            * posix/unistd.h: Use bits/types/gid_t.h, bits/types/uid_t.h,
            bits/types/off_t.h, bits/types/off64_t.h, bits/types/useconds_t.h,
            bits/types/intptr_t.h, and bits/types/socklen_t.h.
            * pwd/pwd.h: Use bits/types/gid_t.h and bits/types/uid_t.h.
            * resource/sys/resource.h: Use bits/types/id_t.h.
            * signal/signal.h: Use bits/types/pid_t.h and bits/types/uid_t.h.
            * stdlib/monetary.h: Use bits/types/ssize_t.h.
            * streams/stropts.h: Use bits/types/gid_t.h and bits/types/uid_t.h.
            * sysdeps/gnu/utmpx.h: Use bits/types/pid_t.h.
            * sysvipc/sys/ipc.h: Use bits/types/uid_t.h, bits/types/gid_t.h,
            bits/types/mode_t.h, and bits/types/key_t.h.
            * sysvipc/sys/msg.h: Use bits/types/pid_t.h and bits/types/ssize_t.h.
            * sysvipc/sys/shm.h: Use bits/types/pid_t.h.
            * termios/termios.h: Use bits/types/pid_t.h.
            * time/sys/time.h: Use bits/types/suseconds_t.h.
            * time/time.h: Use bits/types/pid_t.h.
    
            * sunrpc/rpc/types.h: Consolidate all #includes at the top of
            the file.  If __BIT_TYPES_DEFINED__ is not defined after
            including sys/types.h, also include bits/types/caddr_t.h,
            bits/types/daddr_t.h, bits/types/fsid_t.h, and bits/types/u_int.h.
    
            * scripts/check-obsolete-constructs.py (OBSOLETE_TYPE_HDR_RE_): New.
            (ObsoleteIndirectDefinitionsAllowed): New; allows inclusion of
            bits/types/ headers that define obsolete typedefs, but not
            direct definitions of those types.
            (ObsoleteNotAllowed, ObsoletePrivateDefinitionsAllowed)
            (ObsoletePublicDefinitionsAllowed): Do not allow inclusion of
            bits/types/ headers that define obsolete typedefs.
    
    	* include/bits/types/blkcnt64_t.h
    	* include/bits/types/blkcnt_t.h
    	* include/bits/types/blksize_t.h
    	* include/bits/types/caddr_t.h
    	* include/bits/types/daddr_t.h
    	* include/bits/types/dev_t.h
    	* include/bits/types/fsblkcnt64_t.h
    	* include/bits/types/fsblkcnt_t.h
    	* include/bits/types/fsfilcnt64_t.h
    	* include/bits/types/fsfilcnt_t.h
    	* include/bits/types/fsid_t.h
    	* include/bits/types/gid_t.h
    	* include/bits/types/id_t.h
    	* include/bits/types/ino64_t.h
    	* include/bits/types/ino_t.h
    	* include/bits/types/intptr_t.h
    	* include/bits/types/key_t.h
    	* include/bits/types/loff_t.h
    	* include/bits/types/mode_t.h
    	* include/bits/types/nlink_t.h
    	* include/bits/types/off64_t.h
    	* include/bits/types/off_t.h
    	* include/bits/types/pid_t.h
    	* include/bits/types/register_t.h
    	* include/bits/types/socklen_t.h
    	* include/bits/types/ssize_t.h
    	* include/bits/types/suseconds_t.h
    	* include/bits/types/u_char.h
    	* include/bits/types/u_intN_t.h
    	* include/bits/types/uchar.h
    	* include/bits/types/uid_t.h
    	* include/bits/types/useconds_t.h: New wrappers.

diff --git a/bits/socket.h b/bits/socket.h
index fdcf015..6687a47 100644
--- a/bits/socket.h
+++ b/bits/socket.h
@@ -28,13 +28,7 @@
 
 #include <bits/wordsize.h>
 #include <bits/types.h>
-
-/* Type for length arguments in socket calls.  */
-#ifndef __socklen_t_defined
-typedef __socklen_t socklen_t;
-# define __socklen_t_defined
-#endif
-
+#include <bits/types/socklen_t.h>
 
 /* Types of sockets.  */
 enum __socket_type
diff --git a/dirent/dirent.h b/dirent/dirent.h
index fc4d485..9639ae9 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -29,17 +29,9 @@ __BEGIN_DECLS
 #include <bits/types.h>
 
 #ifdef __USE_XOPEN
-# ifndef __ino_t_defined
-#  ifndef __USE_FILE_OFFSET64
-typedef __ino_t ino_t;
-#  else
-typedef __ino64_t ino_t;
-#  endif
-#  define __ino_t_defined
-# endif
-# if defined __USE_LARGEFILE64 && !defined __ino64_t_defined
-typedef __ino64_t ino64_t;
-#  define __ino64_t_defined
+# include <bits/types/ino_t.h>
+# ifdef __USE_LARGEFILE64
+#  include <bits/types/ino64_t.h>
 # endif
 #endif
 
diff --git a/grp/grp.h b/grp/grp.h
index 0663c8f..d8f7683 100644
--- a/grp/grp.h
+++ b/grp/grp.h
@@ -31,11 +31,9 @@ __BEGIN_DECLS
 #define __need_size_t
 #include <stddef.h>
 
-
 /* For the Single Unix specification we must define this type here.  */
-#if (defined __USE_XOPEN || defined __USE_XOPEN2K) && !defined __gid_t_defined
-typedef __gid_t gid_t;
-# define __gid_t_defined
+#if defined __USE_XOPEN || defined __USE_XOPEN2K
+# include <bits/types/gid_t.h>
 #endif
 
 /* The group structure.	 */
diff --git a/include/bits/types/blkcnt64_t.h b/include/bits/types/blkcnt64_t.h
new file mode 100644
index 0000000..c0c2ced
--- /dev/null
+++ b/include/bits/types/blkcnt64_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/blkcnt64_t.h>
diff --git a/include/bits/types/blkcnt_t.h b/include/bits/types/blkcnt_t.h
new file mode 100644
index 0000000..ad8ed24
--- /dev/null
+++ b/include/bits/types/blkcnt_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/blkcnt_t.h>
diff --git a/include/bits/types/blksize_t.h b/include/bits/types/blksize_t.h
new file mode 100644
index 0000000..d6ed861
--- /dev/null
+++ b/include/bits/types/blksize_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/blksize_t.h>
diff --git a/include/bits/types/caddr_t.h b/include/bits/types/caddr_t.h
new file mode 100644
index 0000000..9d499e7
--- /dev/null
+++ b/include/bits/types/caddr_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/caddr_t.h>
diff --git a/include/bits/types/daddr_t.h b/include/bits/types/daddr_t.h
new file mode 100644
index 0000000..90050fa
--- /dev/null
+++ b/include/bits/types/daddr_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/daddr_t.h>
diff --git a/include/bits/types/dev_t.h b/include/bits/types/dev_t.h
new file mode 100644
index 0000000..f0451c0
--- /dev/null
+++ b/include/bits/types/dev_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/dev_t.h>
diff --git a/include/bits/types/fsblkcnt64_t.h b/include/bits/types/fsblkcnt64_t.h
new file mode 100644
index 0000000..b5951d5
--- /dev/null
+++ b/include/bits/types/fsblkcnt64_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/fsblkcnt64_t.h>
diff --git a/include/bits/types/fsblkcnt_t.h b/include/bits/types/fsblkcnt_t.h
new file mode 100644
index 0000000..9fc9e41
--- /dev/null
+++ b/include/bits/types/fsblkcnt_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/fsblkcnt_t.h>
diff --git a/include/bits/types/fsfilcnt64_t.h b/include/bits/types/fsfilcnt64_t.h
new file mode 100644
index 0000000..d3152d4
--- /dev/null
+++ b/include/bits/types/fsfilcnt64_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/fsfilcnt64_t.h>
diff --git a/include/bits/types/fsfilcnt_t.h b/include/bits/types/fsfilcnt_t.h
new file mode 100644
index 0000000..fc092c5
--- /dev/null
+++ b/include/bits/types/fsfilcnt_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/fsfilcnt_t.h>
diff --git a/include/bits/types/fsid_t.h b/include/bits/types/fsid_t.h
new file mode 100644
index 0000000..9d1e517
--- /dev/null
+++ b/include/bits/types/fsid_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/fsid_t.h>
diff --git a/include/bits/types/gid_t.h b/include/bits/types/gid_t.h
new file mode 100644
index 0000000..d8cf23b
--- /dev/null
+++ b/include/bits/types/gid_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/gid_t.h>
diff --git a/include/bits/types/id_t.h b/include/bits/types/id_t.h
new file mode 100644
index 0000000..5eaae0b
--- /dev/null
+++ b/include/bits/types/id_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/id_t.h>
diff --git a/include/bits/types/ino64_t.h b/include/bits/types/ino64_t.h
new file mode 100644
index 0000000..4203764
--- /dev/null
+++ b/include/bits/types/ino64_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/ino64_t.h>
diff --git a/include/bits/types/ino_t.h b/include/bits/types/ino_t.h
new file mode 100644
index 0000000..2624ae5
--- /dev/null
+++ b/include/bits/types/ino_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/ino_t.h>
diff --git a/include/bits/types/intptr_t.h b/include/bits/types/intptr_t.h
new file mode 100644
index 0000000..455151b
--- /dev/null
+++ b/include/bits/types/intptr_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/intptr_t.h>
diff --git a/include/bits/types/key_t.h b/include/bits/types/key_t.h
new file mode 100644
index 0000000..c4d96aa
--- /dev/null
+++ b/include/bits/types/key_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/key_t.h>
diff --git a/include/bits/types/loff_t.h b/include/bits/types/loff_t.h
new file mode 100644
index 0000000..933175c
--- /dev/null
+++ b/include/bits/types/loff_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/loff_t.h>
diff --git a/include/bits/types/mode_t.h b/include/bits/types/mode_t.h
new file mode 100644
index 0000000..58602b5
--- /dev/null
+++ b/include/bits/types/mode_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/mode_t.h>
diff --git a/include/bits/types/nlink_t.h b/include/bits/types/nlink_t.h
new file mode 100644
index 0000000..f330ae2
--- /dev/null
+++ b/include/bits/types/nlink_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/nlink_t.h>
diff --git a/include/bits/types/off64_t.h b/include/bits/types/off64_t.h
new file mode 100644
index 0000000..002d920
--- /dev/null
+++ b/include/bits/types/off64_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/off64_t.h>
diff --git a/include/bits/types/off_t.h b/include/bits/types/off_t.h
new file mode 100644
index 0000000..1f18d15
--- /dev/null
+++ b/include/bits/types/off_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/off_t.h>
diff --git a/include/bits/types/pid_t.h b/include/bits/types/pid_t.h
new file mode 100644
index 0000000..6de6aff
--- /dev/null
+++ b/include/bits/types/pid_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/pid_t.h>
diff --git a/include/bits/types/register_t.h b/include/bits/types/register_t.h
new file mode 100644
index 0000000..6828620
--- /dev/null
+++ b/include/bits/types/register_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/register_t.h>
diff --git a/include/bits/types/socklen_t.h b/include/bits/types/socklen_t.h
new file mode 100644
index 0000000..229f676
--- /dev/null
+++ b/include/bits/types/socklen_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/socklen_t.h>
diff --git a/include/bits/types/ssize_t.h b/include/bits/types/ssize_t.h
new file mode 100644
index 0000000..374e438
--- /dev/null
+++ b/include/bits/types/ssize_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/ssize_t.h>
diff --git a/include/bits/types/suseconds_t.h b/include/bits/types/suseconds_t.h
new file mode 100644
index 0000000..85f0dbe
--- /dev/null
+++ b/include/bits/types/suseconds_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/suseconds_t.h>
diff --git a/include/bits/types/u_int.h b/include/bits/types/u_int.h
new file mode 100644
index 0000000..2b17d5b
--- /dev/null
+++ b/include/bits/types/u_int.h
@@ -0,0 +1 @@
+#include <posix/bits/types/u_int.h>
diff --git a/include/bits/types/u_intN_t.h b/include/bits/types/u_intN_t.h
new file mode 100644
index 0000000..ffb17bc
--- /dev/null
+++ b/include/bits/types/u_intN_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/u_intN_t.h>
diff --git a/include/bits/types/uid_t.h b/include/bits/types/uid_t.h
new file mode 100644
index 0000000..1e2b106
--- /dev/null
+++ b/include/bits/types/uid_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/uid_t.h>
diff --git a/include/bits/types/uint.h b/include/bits/types/uint.h
new file mode 100644
index 0000000..a446b7f
--- /dev/null
+++ b/include/bits/types/uint.h
@@ -0,0 +1 @@
+#include <posix/bits/types/uint.h>
diff --git a/include/bits/types/useconds_t.h b/include/bits/types/useconds_t.h
new file mode 100644
index 0000000..71f720b
--- /dev/null
+++ b/include/bits/types/useconds_t.h
@@ -0,0 +1 @@
+#include <posix/bits/types/useconds_t.h>
diff --git a/inet/arpa/inet.h b/inet/arpa/inet.h
index 4db2087..facee27 100644
--- a/inet/arpa/inet.h
+++ b/inet/arpa/inet.h
@@ -20,12 +20,7 @@
 
 #include <features.h>
 #include <netinet/in.h>		/* To define `struct in_addr'.  */
-
-/* Type for length arguments in socket calls.  */
-#ifndef __socklen_t_defined
-typedef __socklen_t socklen_t;
-# define __socklen_t_defined
-#endif
+#include <bits/types/socklen_t.h>
 
 __BEGIN_DECLS
 
diff --git a/io/fcntl.h b/io/fcntl.h
index 7af8dfb..2e973e6 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -46,28 +46,11 @@ __BEGIN_DECLS
 /* POSIX.1-2001 specifies that these types are defined by <fcntl.h>.
    Earlier POSIX standards permitted any type ending in `_t' to be defined
    by any POSIX header, so we don't conditionalize the definitions here.  */
-#ifndef __mode_t_defined
-typedef __mode_t mode_t;
-# define __mode_t_defined
-#endif
-
-#ifndef __off_t_defined
-# ifndef __USE_FILE_OFFSET64
-typedef __off_t off_t;
-# else
-typedef __off64_t off_t;
-# endif
-# define __off_t_defined
-#endif
-
-#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
-typedef __off64_t off64_t;
-# define __off64_t_defined
-#endif
-
-#ifndef __pid_t_defined
-typedef __pid_t pid_t;
-# define __pid_t_defined
+#include <bits/types/mode_t.h>
+#include <bits/types/off_t.h>
+#include <bits/types/pid_t.h>
+#ifdef __USE_LARGEFILE64
+#include <bits/types/off64_t.h>
 #endif
 
 /* For XPG all symbols from <sys/stat.h> should also be available.  */
diff --git a/io/sys/stat.h b/io/sys/stat.h
index 2de5eb6..e05985e 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -33,67 +33,19 @@
 #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
-# endif
-
-# ifndef __gid_t_defined
-typedef __gid_t gid_t;
-#  define __gid_t_defined
-# endif
-
-# ifndef __ino_t_defined
-#  ifndef __USE_FILE_OFFSET64
-typedef __ino_t ino_t;
-#  else
-typedef __ino64_t ino_t;
-#  endif
-#  define __ino_t_defined
-# endif
-
-# ifndef __mode_t_defined
-typedef __mode_t mode_t;
-#  define __mode_t_defined
-# endif
-
-# ifndef __nlink_t_defined
-typedef __nlink_t nlink_t;
-#  define __nlink_t_defined
-# endif
-
-# ifndef __off_t_defined
-#  ifndef __USE_FILE_OFFSET64
-typedef __off_t off_t;
-#  else
-typedef __off64_t off_t;
-#  endif
-#  define __off_t_defined
-# endif
-
-# ifndef __uid_t_defined
-typedef __uid_t uid_t;
-#  define __uid_t_defined
-# endif
+# include <bits/types/dev_t.h>
+# include <bits/types/gid_t.h>
+# include <bits/types/ino_t.h>
+# include <bits/types/mode_t.h>
+# include <bits/types/nlink_t.h>
+# include <bits/types/off_t.h>
+# include <bits/types/uid_t.h>
 #endif	/* X/Open */
 
 #ifdef __USE_UNIX98
-# ifndef __blkcnt_t_defined
-#  ifndef __USE_FILE_OFFSET64
-typedef __blkcnt_t blkcnt_t;
-#  else
-typedef __blkcnt64_t blkcnt_t;
-#  endif
-#  define __blkcnt_t_defined
-# endif
-
-# ifndef __blksize_t_defined
-typedef __blksize_t blksize_t;
-#  define __blksize_t_defined
-# endif
+# include <bits/types/blkcnt_t.h>
+# include <bits/types/blksize_t.h>
 #endif	/* Unix98 */
 
 __BEGIN_DECLS
diff --git a/io/sys/statvfs.h b/io/sys/statvfs.h
index 89abf02..d7283dd 100644
--- a/io/sys/statvfs.h
+++ b/io/sys/statvfs.h
@@ -24,25 +24,8 @@
 /* Get the system-specific definition of `struct statfs'.  */
 #include <bits/statvfs.h>
 
-#ifndef __USE_FILE_OFFSET64
-# ifndef __fsblkcnt_t_defined
-typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks.  */
-#  define __fsblkcnt_t_defined
-# endif
-# ifndef __fsfilcnt_t_defined
-typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes.  */
-#  define __fsfilcnt_t_defined
-# endif
-#else
-# ifndef __fsblkcnt_t_defined
-typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks.  */
-#  define __fsblkcnt_t_defined
-# endif
-# ifndef __fsfilcnt_t_defined
-typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes.  */
-#  define __fsfilcnt_t_defined
-# endif
-#endif
+#include <bits/types/fsblkcnt_t.h>
+#include <bits/types/fsfilcnt_t.h>
 
 __BEGIN_DECLS
 
diff --git a/libio/stdio.h b/libio/stdio.h
index b63ee88..6fabdbe 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -58,25 +58,14 @@ typedef __gnuc_va_list va_list;
 #endif
 
 #if defined __USE_UNIX98 || defined __USE_XOPEN2K
-# ifndef __off_t_defined
-# ifndef __USE_FILE_OFFSET64
-typedef __off_t off_t;
-# else
-typedef __off64_t off_t;
-# endif
-# define __off_t_defined
-# endif
-# if defined __USE_LARGEFILE64 && !defined __off64_t_defined
-typedef __off64_t off64_t;
-# define __off64_t_defined
+# include <bits/types/off_t.h>
+# ifdef __USE_LARGEFILE64
+#  include <bits/types/off64_t.h>
 # endif
 #endif
 
 #ifdef __USE_XOPEN2K8
-# ifndef __ssize_t_defined
-typedef __ssize_t ssize_t;
-# define __ssize_t_defined
-# endif
+# include <bits/types/ssize_t.h>
 #endif
 
 /* The type of the second argument to `fgetpos' and `fsetpos'.  */
diff --git a/misc/sys/mman.h b/misc/sys/mman.h
index b275120..43552c3 100644
--- a/misc/sys/mman.h
+++ b/misc/sys/mman.h
@@ -21,22 +21,12 @@
 
 #include <features.h>
 #include <bits/types.h>
+
 #define __need_size_t
 #include <stddef.h>
 
-#ifndef __off_t_defined
-# ifndef __USE_FILE_OFFSET64
-typedef __off_t off_t;
-# else
-typedef __off64_t off_t;
-# endif
-# define __off_t_defined
-#endif
-
-#ifndef __mode_t_defined
-typedef __mode_t mode_t;
-# define __mode_t_defined
-#endif
+#include <bits/types/off_t.h>
+#include <bits/types/mode_t.h>
 
 #include <bits/mman.h>
 
diff --git a/misc/sys/select.h b/misc/sys/select.h
index 8b10702..84e2ae3 100644
--- a/misc/sys/select.h
+++ b/misc/sys/select.h
@@ -38,12 +38,7 @@
 #ifdef __USE_XOPEN2K
 # include <bits/types/struct_timespec.h>
 #endif
-
-#ifndef __suseconds_t_defined
-typedef __suseconds_t suseconds_t;
-# define __suseconds_t_defined
-#endif
-
+#include <bits/types/suseconds_t.h>
 
 /* The fd_set member is required to be an array of longs.  */
 typedef long int __fd_mask;
diff --git a/posix/Makefile b/posix/Makefile
index 93c3a29..b0219f0 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -22,17 +22,32 @@ subdir	:= posix
 
 include ../Makeconfig
 
-headers	:= sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h	      \
-	   glob.h regex.h wordexp.h fnmatch.h 				      \
-	   getopt.h bits/getopt_core.h bits/getopt_ext.h bits/getopt_posix.h  \
-	   bits/types.h bits/typesizes.h bits/pthreadtypes.h		      \
-	   bits/pthreadtypes-arch.h bits/thread-shared-types.h		      \
-	   bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h		      \
-	   bits/local_lim.h tar.h bits/utsname.h bits/confname.h	      \
-	   bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h	      \
-	   bits/sched.h bits/cpu-set.h re_comp.h wait.h bits/environments.h   \
-	   cpio.h spawn.h bits/unistd.h bits/types/struct_sched_param.h	      \
-	   bits/unistd_ext.h
+headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h	\
+	   glob.h regex.h wordexp.h fnmatch.h getopt.h			\
+	   bits/getopt_core.h bits/getopt_ext.h bits/getopt_posix.h	\
+	   bits/types.h bits/typesizes.h bits/pthreadtypes.h		\
+	   bits/pthreadtypes-arch.h bits/thread-shared-types.h		\
+	   bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h		\
+	   bits/local_lim.h tar.h bits/utsname.h bits/confname.h	\
+	   bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h	\
+	   bits/sched.h bits/cpu-set.h re_comp.h wait.h			\
+	   bits/environments.h cpio.h spawn.h bits/unistd.h		\
+	   bits/types/struct_sched_param.h bits/unistd_ext.h		\
+	   bits/types/blkcnt64_t.h bits/types/blkcnt_t.h		\
+	   bits/types/blksize_t.h bits/types/caddr_t.h			\
+	   bits/types/daddr_t.h bits/types/dev_t.h			\
+	   bits/types/fsblkcnt64_t.h bits/types/fsblkcnt_t.h		\
+	   bits/types/fsfilcnt64_t.h bits/types/fsfilcnt_t.h		\
+	   bits/types/fsid_t.h bits/types/gid_t.h bits/types/id_t.h	\
+	   bits/types/ino64_t.h bits/types/ino_t.h			\
+	   bits/types/intptr_t.h bits/types/key_t.h			\
+	   bits/types/loff_t.h bits/types/mode_t.h			\
+	   bits/types/nlink_t.h bits/types/off64_t.h			\
+	   bits/types/off_t.h bits/types/pid_t.h			\
+	   bits/types/register_t.h bits/types/ssize_t.h			\
+	   bits/types/socklen_t.h bits/types/suseconds_t.h		\
+	   bits/types/uid_t.h bits/types/uint.h bits/types/u_int.h	\
+	   bits/types/u_intN_t.h bits/types/useconds_t.h
 
 routines :=								      \
 	uname								      \
diff --git a/posix/bits/types/blkcnt64_t.h b/posix/bits/types/blkcnt64_t.h
new file mode 100644
index 0000000..d5d81e7
--- /dev/null
+++ b/posix/bits/types/blkcnt64_t.h
@@ -0,0 +1,9 @@
+#ifndef __blkcnt64_t_defined
+#define __blkcnt64_t_defined 1
+
+#include <bits/types.h>
+
+/* Type to count disk blocks (LFS).  */
+typedef __blkcnt64_t blkcnt64_t;
+
+#endif
diff --git a/posix/bits/types/blkcnt_t.h b/posix/bits/types/blkcnt_t.h
new file mode 100644
index 0000000..badcd47
--- /dev/null
+++ b/posix/bits/types/blkcnt_t.h
@@ -0,0 +1,13 @@
+#ifndef __blkcnt_t_defined
+#define __blkcnt_t_defined 1
+
+#include <bits/types.h>
+
+/* Type to count number of disk blocks (POSIX).  */
+#ifndef __USE_FILE_OFFSET64
+typedef __blkcnt_t blkcnt_t;
+#else
+typedef __blkcnt64_t blkcnt_t;
+#endif
+
+#endif
diff --git a/posix/bits/types/blksize_t.h b/posix/bits/types/blksize_t.h
new file mode 100644
index 0000000..9d6ada4
--- /dev/null
+++ b/posix/bits/types/blksize_t.h
@@ -0,0 +1,9 @@
+#ifndef __blksize_t_defined
+#define __blksize_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for sizes of disk blocks (POSIX).  */
+typedef __blksize_t blksize_t;
+
+#endif
diff --git a/posix/bits/types/caddr_t.h b/posix/bits/types/caddr_t.h
new file mode 100644
index 0000000..fc010bd
--- /dev/null
+++ b/posix/bits/types/caddr_t.h
@@ -0,0 +1,9 @@
+#ifndef __caddr_t_defined
+#define __caddr_t_defined 1
+
+#include <bits/types.h>
+
+/* Obsolete type for a memory address (BSD).  */
+typedef __caddr_t caddr_t;
+
+#endif
diff --git a/posix/bits/types/daddr_t.h b/posix/bits/types/daddr_t.h
new file mode 100644
index 0000000..59f0b1b
--- /dev/null
+++ b/posix/bits/types/daddr_t.h
@@ -0,0 +1,9 @@
+#ifndef __daddr_t_defined
+#define __daddr_t_defined 1
+
+#include <bits/types.h>
+
+/* Obsolete type for a disk address (BSD).  */
+typedef __daddr_t daddr_t;
+
+#endif
diff --git a/posix/bits/types/dev_t.h b/posix/bits/types/dev_t.h
new file mode 100644
index 0000000..ff8beef
--- /dev/null
+++ b/posix/bits/types/dev_t.h
@@ -0,0 +1,10 @@
+#ifndef __dev_t_defined
+#define __dev_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for device IDs (POSIX).  */
+typedef __dev_t dev_t;
+
+#endif
+
diff --git a/posix/bits/types/fsblkcnt64_t.h b/posix/bits/types/fsblkcnt64_t.h
new file mode 100644
index 0000000..690d601
--- /dev/null
+++ b/posix/bits/types/fsblkcnt64_t.h
@@ -0,0 +1,9 @@
+#ifndef __fsblkcnt64_t_defined
+#define __fsblkcnt64_t_defined 1
+
+#include <bits/types.h>
+
+/* Type to count file system blocks (LFS).  */
+typedef __fsblkcnt64_t fsblkcnt64_t;
+
+#endif
diff --git a/posix/bits/types/fsblkcnt_t.h b/posix/bits/types/fsblkcnt_t.h
new file mode 100644
index 0000000..2c7e80d
--- /dev/null
+++ b/posix/bits/types/fsblkcnt_t.h
@@ -0,0 +1,13 @@
+#ifndef __fsblkcnt_t_defined
+#define __fsblkcnt_t_defined 1
+
+#include <bits/types.h>
+
+/* Type to count file system blocks (POSIX).  */
+#ifndef __USE_FILE_OFFSET64
+typedef __fsblkcnt_t fsblkcnt_t;
+#else
+typedef __fsblkcnt64_t fsblkcnt_t;
+#endif
+
+#endif
diff --git a/posix/bits/types/fsfilcnt64_t.h b/posix/bits/types/fsfilcnt64_t.h
new file mode 100644
index 0000000..56fcbc7
--- /dev/null
+++ b/posix/bits/types/fsfilcnt64_t.h
@@ -0,0 +1,9 @@
+#ifndef __fsfilcnt64_t_defined
+#define __fsfilcnt64_t_defined 1
+
+#include <bits/types.h>
+
+/* Type to count file system inodes (LFS).  */
+typedef __fsfilcnt64_t fsfilcnt64_t;
+
+#endif
diff --git a/posix/bits/types/fsfilcnt_t.h b/posix/bits/types/fsfilcnt_t.h
new file mode 100644
index 0000000..18d0f7e
--- /dev/null
+++ b/posix/bits/types/fsfilcnt_t.h
@@ -0,0 +1,13 @@
+#ifndef __fsfilcnt_t_defined
+#define __fsfilcnt_t_defined 1
+
+#include <bits/types.h>
+
+/* Type to count file system inodes (POSIX).  */
+#ifndef __USE_FILE_OFFSET64
+typedef __fsfilcnt_t fsfilcnt_t;
+#else
+typedef __fsfilcnt64_t fsfilcnt_t;
+#endif
+
+#endif
diff --git a/posix/bits/types/fsid_t.h b/posix/bits/types/fsid_t.h
new file mode 100644
index 0000000..a198d30
--- /dev/null
+++ b/posix/bits/types/fsid_t.h
@@ -0,0 +1,9 @@
+#ifndef __fsid_t_defined
+#define __fsid_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for a file system ID (BSD).  */
+typedef __fsid_t fsid_t;
+
+#endif
diff --git a/posix/bits/types/gid_t.h b/posix/bits/types/gid_t.h
new file mode 100644
index 0000000..52974a1
--- /dev/null
+++ b/posix/bits/types/gid_t.h
@@ -0,0 +1,9 @@
+#ifndef __gid_t_defined
+#define __gid_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for group IDs (POSIX).  */
+typedef __gid_t gid_t;
+
+#endif
diff --git a/posix/bits/types/id_t.h b/posix/bits/types/id_t.h
new file mode 100644
index 0000000..1cb3b76
--- /dev/null
+++ b/posix/bits/types/id_t.h
@@ -0,0 +1,10 @@
+#ifndef __id_t_defined
+#define __id_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for a general identifier, can hold any pid_t, uid_t, or gid_t
+   value (POSIX).  */
+typedef __id_t id_t;
+
+#endif
diff --git a/posix/bits/types/ino64_t.h b/posix/bits/types/ino64_t.h
new file mode 100644
index 0000000..e61e75a
--- /dev/null
+++ b/posix/bits/types/ino64_t.h
@@ -0,0 +1,9 @@
+#ifndef __ino64_t_defined
+#define __ino64_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for file serial numbers (LFS).  */
+typedef __ino64_t ino64_t;
+
+#endif
diff --git a/posix/bits/types/ino_t.h b/posix/bits/types/ino_t.h
new file mode 100644
index 0000000..808821f
--- /dev/null
+++ b/posix/bits/types/ino_t.h
@@ -0,0 +1,13 @@
+#ifndef __ino_t_defined
+#define __ino_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for file serial numbers (POSIX).  */
+# ifndef __USE_FILE_OFFSET64
+typedef __ino_t ino_t;
+# else
+typedef __ino64_t ino_t;
+# endif
+
+#endif
diff --git a/posix/bits/types/intptr_t.h b/posix/bits/types/intptr_t.h
new file mode 100644
index 0000000..47948f9
--- /dev/null
+++ b/posix/bits/types/intptr_t.h
@@ -0,0 +1,10 @@
+#ifndef __intptr_t_defined
+#define __intptr_t_defined 1
+
+#include <bits/types.h>
+
+/* Signed integral type capable of representing a `void *' without
+   data loss (C1999).  */
+typedef __intptr_t intptr_t;
+
+#endif
diff --git a/posix/bits/types/key_t.h b/posix/bits/types/key_t.h
new file mode 100644
index 0000000..424d250
--- /dev/null
+++ b/posix/bits/types/key_t.h
@@ -0,0 +1,9 @@
+#ifndef __key_t_defined
+#define __key_t_defined 1
+
+#include <bits/types.h>
+
+/* Type used by interprocess communication operations (XSI).  */
+typedef __key_t key_t;
+
+#endif
diff --git a/posix/bits/types/loff_t.h b/posix/bits/types/loff_t.h
new file mode 100644
index 0000000..ecb9989
--- /dev/null
+++ b/posix/bits/types/loff_t.h
@@ -0,0 +1,9 @@
+#ifndef __loff_t_defined
+#define __loff_t_defined 1
+
+#include <bits/types.h>
+
+/* Obsolete type for file sizes and offsets within a file (BSD).  */
+typedef __loff_t loff_t;
+
+#endif
diff --git a/posix/bits/types/mode_t.h b/posix/bits/types/mode_t.h
new file mode 100644
index 0000000..3aaa70d
--- /dev/null
+++ b/posix/bits/types/mode_t.h
@@ -0,0 +1,9 @@
+#ifndef __mode_t_defined
+#define __mode_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for file attribute bits (POSIX).  */
+typedef __mode_t mode_t;
+
+#endif
diff --git a/posix/bits/types/nlink_t.h b/posix/bits/types/nlink_t.h
new file mode 100644
index 0000000..2f9125b
--- /dev/null
+++ b/posix/bits/types/nlink_t.h
@@ -0,0 +1,9 @@
+#ifndef __nlink_t_defined
+#define __nlink_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for link counts (POSIX).  */
+typedef __nlink_t nlink_t;
+
+#endif
diff --git a/posix/bits/types/off64_t.h b/posix/bits/types/off64_t.h
new file mode 100644
index 0000000..f00bd82
--- /dev/null
+++ b/posix/bits/types/off64_t.h
@@ -0,0 +1,9 @@
+#ifndef __off64_t_defined
+#define __off64_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for file sizes and offsets within a file (LFS).  */
+typedef __off64_t off64_t;
+
+#endif
diff --git a/posix/bits/types/off_t.h b/posix/bits/types/off_t.h
new file mode 100644
index 0000000..9ef5395
--- /dev/null
+++ b/posix/bits/types/off_t.h
@@ -0,0 +1,13 @@
+#ifndef __off_t_defined
+#define __off_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for file sizes and offsets within a file (POSIX).  */
+# ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+# else
+typedef __off64_t off_t;
+# endif
+
+#endif
diff --git a/posix/bits/types/pid_t.h b/posix/bits/types/pid_t.h
new file mode 100644
index 0000000..249e070
--- /dev/null
+++ b/posix/bits/types/pid_t.h
@@ -0,0 +1,9 @@
+#ifndef __pid_t_defined
+#define __pid_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for process IDs and process group IDs (POSIX).  */
+typedef __pid_t pid_t;
+
+#endif
diff --git a/posix/bits/types/register_t.h b/posix/bits/types/register_t.h
new file mode 100644
index 0000000..099b472
--- /dev/null
+++ b/posix/bits/types/register_t.h
@@ -0,0 +1,9 @@
+#ifndef __register_t_defined
+#define __register_t_defined 1
+
+#include <bits/types.h>
+
+/* Type of a general-purpose integer register (BSD).  */
+typedef __register_t register_t;
+
+#endif
diff --git a/posix/bits/types/socklen_t.h b/posix/bits/types/socklen_t.h
new file mode 100644
index 0000000..8369630
--- /dev/null
+++ b/posix/bits/types/socklen_t.h
@@ -0,0 +1,9 @@
+#ifndef __socklen_t_defined
+#define __socklen_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for size of socket addresses (POSIX).  */
+typedef __socklen_t socklen_t;
+
+#endif
diff --git a/posix/bits/types/ssize_t.h b/posix/bits/types/ssize_t.h
new file mode 100644
index 0000000..41e1fd7
--- /dev/null
+++ b/posix/bits/types/ssize_t.h
@@ -0,0 +1,9 @@
+#ifndef __ssize_t_defined
+#define __ssize_t_defined 1
+
+#include <bits/types.h>
+
+/* Type used for a count of bytes or an error indication (POSIX).  */
+typedef __ssize_t ssize_t;
+
+#endif
diff --git a/posix/bits/types/suseconds_t.h b/posix/bits/types/suseconds_t.h
new file mode 100644
index 0000000..62ded6f
--- /dev/null
+++ b/posix/bits/types/suseconds_t.h
@@ -0,0 +1,9 @@
+#ifndef __suseconds_t_defined
+#define __suseconds_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for time in microseconds (signed) (XSI).  */
+typedef __suseconds_t suseconds_t;
+
+#endif
diff --git a/posix/bits/types/u_int.h b/posix/bits/types/u_int.h
new file mode 100644
index 0000000..4c9235f
--- /dev/null
+++ b/posix/bits/types/u_int.h
@@ -0,0 +1,15 @@
+#ifndef __u_int_defined
+#define __u_int_defined 1
+
+#include <bits/types.h>
+
+/* Obsolete shorthand names for unsigned types, used by old BSD
+   networking code and Sun RPC.  */
+typedef unsigned char u_char;
+typedef unsigned short int u_short;
+typedef unsigned int u_int;
+typedef unsigned long int u_long;
+typedef __int64_t quad_t;
+typedef __uint64_t u_quad_t;
+
+#endif
diff --git a/posix/bits/types/u_intN_t.h b/posix/bits/types/u_intN_t.h
new file mode 100644
index 0000000..6257674
--- /dev/null
+++ b/posix/bits/types/u_intN_t.h
@@ -0,0 +1,17 @@
+#ifndef __u_intN_t_defined
+#define __u_intN_t_defined 1
+
+#include <bits/types.h>
+
+/* These size-specific names are used by some of the inet code.
+   They were defined by ISO C without the first `_'.  */
+typedef __uint8_t u_int8_t;
+typedef __uint16_t u_int16_t;
+typedef __uint32_t u_int32_t;
+typedef __uint64_t u_int64_t;
+
+/* Some code from BIND tests this macro to see if the types above are
+   defined.  */
+#define __BIT_TYPES_DEFINED__	1
+
+#endif
diff --git a/posix/bits/types/uid_t.h b/posix/bits/types/uid_t.h
new file mode 100644
index 0000000..371cb05
--- /dev/null
+++ b/posix/bits/types/uid_t.h
@@ -0,0 +1,9 @@
+#ifndef __uid_t_defined
+#define __uid_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for user IDs (POSIX).  */
+typedef __uid_t uid_t;
+
+#endif
diff --git a/posix/bits/types/uint.h b/posix/bits/types/uint.h
new file mode 100644
index 0000000..69829c6
--- /dev/null
+++ b/posix/bits/types/uint.h
@@ -0,0 +1,10 @@
+#ifndef __uint_defined
+#define __uint_defined 1
+
+/* Obsolete shorthand names for unsigned types, used by old BSD
+   networking code and Sun RPC.  */
+typedef unsigned short int ushort;
+typedef unsigned int uint;
+typedef unsigned long int ulong;
+
+#endif
diff --git a/posix/bits/types/useconds_t.h b/posix/bits/types/useconds_t.h
new file mode 100644
index 0000000..a363558
--- /dev/null
+++ b/posix/bits/types/useconds_t.h
@@ -0,0 +1,9 @@
+#ifndef __useconds_t_defined
+#define __useconds_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for time in microseconds (unsigned) (XSI).  */
+typedef __useconds_t useconds_t;
+
+#endif
diff --git a/posix/sched.h b/posix/sched.h
index 90ef6fc..56c1470 100644
--- a/posix/sched.h
+++ b/posix/sched.h
@@ -33,11 +33,7 @@
 #ifndef __USE_XOPEN2K
 # include <time.h>
 #endif
-
-#ifndef __pid_t_defined
-typedef __pid_t pid_t;
-# define __pid_t_defined
-#endif
+#include <bits/types/pid_t.h>
 
 /* Get system specific constant and data structure definitions.  */
 #include <bits/sched.h>
diff --git a/posix/sys/types.h b/posix/sys/types.h
index 2d8cfd1..8f6d328 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -28,120 +28,51 @@ __BEGIN_DECLS
 
 #include <bits/types.h>
 
-#ifdef	__USE_MISC
-# ifndef __u_char_defined
-typedef unsigned char u_char;
-typedef unsigned short int u_short;
-typedef unsigned int u_int;
-typedef unsigned long int u_long;
-typedef __int64_t quad_t;
-typedef __uint64_t u_quad_t;
-typedef __fsid_t fsid_t;
-#  define __u_char_defined
-# endif
-typedef __loff_t loff_t;
-#endif
-
-#ifndef __ino_t_defined
-# ifndef __USE_FILE_OFFSET64
-typedef __ino_t ino_t;
-# else
-typedef __ino64_t ino_t;
-# endif
-# define __ino_t_defined
-#endif
-#if defined __USE_LARGEFILE64 && !defined __ino64_t_defined
-typedef __ino64_t ino64_t;
-# define __ino64_t_defined
-#endif
-
-#ifndef __dev_t_defined
-typedef __dev_t dev_t;
-# define __dev_t_defined
-#endif
-
-#ifndef __gid_t_defined
-typedef __gid_t gid_t;
-# define __gid_t_defined
-#endif
-
-#ifndef __mode_t_defined
-typedef __mode_t mode_t;
-# define __mode_t_defined
-#endif
-
-#ifndef __nlink_t_defined
-typedef __nlink_t nlink_t;
-# define __nlink_t_defined
-#endif
-
-#ifndef __uid_t_defined
-typedef __uid_t uid_t;
-# define __uid_t_defined
-#endif
-
-#ifndef __off_t_defined
-# ifndef __USE_FILE_OFFSET64
-typedef __off_t off_t;
-# else
-typedef __off64_t off_t;
-# endif
-# define __off_t_defined
-#endif
-#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
-typedef __off64_t off64_t;
-# define __off64_t_defined
-#endif
-
-#ifndef __pid_t_defined
-typedef __pid_t pid_t;
-# define __pid_t_defined
-#endif
-
-#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) \
-    && !defined __id_t_defined
-typedef __id_t id_t;
-# define __id_t_defined
-#endif
+#define __need_size_t
+#include <stddef.h>
 
-#ifndef __ssize_t_defined
-typedef __ssize_t ssize_t;
-# define __ssize_t_defined
-#endif
+#include <bits/types/blkcnt_t.h>
+#include <bits/types/clockid_t.h>
+#include <bits/types/dev_t.h>
+#include <bits/types/fsblkcnt_t.h>
+#include <bits/types/fsfilcnt_t.h>
+#include <bits/types/gid_t.h>
+#include <bits/types/ino_t.h>
+#include <bits/types/mode_t.h>
+#include <bits/types/nlink_t.h>
+#include <bits/types/off_t.h>
+#include <bits/types/pid_t.h>
+#include <bits/types/ssize_t.h>
+#include <bits/types/time_t.h>
+#include <bits/types/timer_t.h>
+#include <bits/types/uid_t.h>
 
-#ifdef	__USE_MISC
-# ifndef __daddr_t_defined
-typedef __daddr_t daddr_t;
-typedef __caddr_t caddr_t;
-#  define __daddr_t_defined
-# endif
+#ifdef __USE_LARGEFILE64
+# include <bits/types/blkcnt64_t.h>
+# include <bits/types/fsblkcnt64_t.h>
+# include <bits/types/fsfilcnt64_t.h>
+# include <bits/types/ino64_t.h>
+# include <bits/types/off64_t.h>
 #endif
 
-#if (defined __USE_MISC || defined __USE_XOPEN) && !defined __key_t_defined
-typedef __key_t key_t;
-# define __key_t_defined
+#ifdef __USE_XOPEN
+# include <bits/types/useconds_t.h>
+# include <bits/types/suseconds_t.h>
 #endif
 
 #if defined __USE_XOPEN || defined __USE_XOPEN2K8
 # include <bits/types/clock_t.h>
+# include <bits/types/id_t.h>
+# include <bits/types/key_t.h>
 #endif
-#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
-typedef __useconds_t useconds_t;
-#  define __useconds_t_defined
-# endif
-# ifndef __suseconds_t_defined
-typedef __suseconds_t suseconds_t;
-#  define __suseconds_t_defined
-# endif
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
+#include <bits/types/blksize_t.h>
 #endif
 
-#define	__need_size_t
-#include <stddef.h>
+#if defined __USE_POSIX199506 || defined __USE_UNIX98
+# include <bits/pthreadtypes.h>
+#endif
 
 /* POSIX does not require intN_t to be defined in this header, so
    technically this ought to be under __USE_MISC, but it doesn't
@@ -150,24 +81,17 @@ typedef __suseconds_t suseconds_t;
 #include <bits/stdint-intn.h>
 
 #ifdef __USE_MISC
-/* Old compatibility names for C types.  */
-typedef unsigned long int ulong;
-typedef unsigned short int ushort;
-typedef unsigned int uint;
-
-/* These size-specific names are used by some of the inet code.
-   They were defined by ISO C without the first `_'.  */
-typedef __uint8_t u_int8_t;
-typedef __uint16_t u_int16_t;
-typedef __uint32_t u_int32_t;
-typedef __uint64_t u_int64_t;
-
-/* Type of a general-purpose integer register (BSD).  */
-typedef __register_t register_t;
-
-/* Some code from BIND tests this macro to see if the types above are
-   defined.  */
-#define __BIT_TYPES_DEFINED__	1
+/* Additional typedefs from BSD, mostly obsolete.  */
+# include <bits/types/caddr_t.h>
+# include <bits/types/daddr_t.h>
+# include <bits/types/fsid_t.h>
+# include <bits/types/loff_t.h>
+# include <bits/types/register_t.h>
+
+/* Shorthand unsigned types, mostly superseded by stdint.h.  */
+# include <bits/types/uint.h>
+# include <bits/types/u_int.h>
+# include <bits/types/u_intN_t.h>
 
 /* In BSD <sys/types.h> is expected to define BYTE_ORDER.  */
 # include <endian.h>
@@ -176,54 +100,6 @@ typedef __register_t register_t;
 # include <sys/select.h>
 #endif /* Use misc.  */
 
-
-#if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \
-    && !defined __blksize_t_defined
-typedef __blksize_t blksize_t;
-# define __blksize_t_defined
-#endif
-
-/* Types from the Large File Support interface.  */
-#ifndef __USE_FILE_OFFSET64
-# ifndef __blkcnt_t_defined
-typedef __blkcnt_t blkcnt_t;	 /* Type to count number of disk blocks.  */
-#  define __blkcnt_t_defined
-# endif
-# ifndef __fsblkcnt_t_defined
-typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks.  */
-#  define __fsblkcnt_t_defined
-# endif
-# ifndef __fsfilcnt_t_defined
-typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes.  */
-#  define __fsfilcnt_t_defined
-# endif
-#else
-# ifndef __blkcnt_t_defined
-typedef __blkcnt64_t blkcnt_t;	   /* Type to count number of disk blocks.  */
-#  define __blkcnt_t_defined
-# endif
-# ifndef __fsblkcnt_t_defined
-typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks.  */
-#  define __fsblkcnt_t_defined
-# endif
-# ifndef __fsfilcnt_t_defined
-typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes.  */
-#  define __fsfilcnt_t_defined
-# endif
-#endif
-
-#ifdef __USE_LARGEFILE64
-typedef __blkcnt64_t blkcnt64_t;     /* Type to count number of disk blocks. */
-typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks.  */
-typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes.  */
-#endif
-
-
-/* Now add the thread types.  */
-#if defined __USE_POSIX199506 || defined __USE_UNIX98
-# include <bits/pthreadtypes.h>
-#endif
-
 __END_DECLS
 
 #endif /* sys/types.h */
diff --git a/posix/sys/wait.h b/posix/sys/wait.h
index 9bd4399..691be27 100644
--- a/posix/sys/wait.h
+++ b/posix/sys/wait.h
@@ -27,10 +27,7 @@
 __BEGIN_DECLS
 
 #include <bits/types.h>
-#ifndef __pid_t_defined
-typedef __pid_t pid_t;
-# define __pid_t_defined
-#endif
+#include <bits/types/pid_t.h>
 
 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
 # include <signal.h>
@@ -111,11 +108,7 @@ extern __pid_t wait (int *__stat_loc);
 extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options);
 
 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
-# ifndef __id_t_defined
-typedef __id_t id_t;
-#  define __id_t_defined
-# endif
-
+# include <bits/types/id_t.h>
 # include <bits/types/siginfo_t.h>
 
 /* Wait for a childing matching IDTYPE and ID to change the status and
diff --git a/posix/unistd.h b/posix/unistd.h
index 55a989f..407f2fe 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -215,11 +215,7 @@ __BEGIN_DECLS
 /* All functions that are not declared anywhere else.  */
 
 #include <bits/types.h>
-
-#ifndef	__ssize_t_defined
-typedef __ssize_t ssize_t;
-# define __ssize_t_defined
-#endif
+#include <bits/types/ssize_t.h>
 
 #define	__need_size_t
 #define __need_NULL
@@ -228,52 +224,22 @@ typedef __ssize_t ssize_t;
 #if defined __USE_XOPEN || defined __USE_XOPEN2K
 /* The Single Unix specification says that some more types are
    available here.  */
-# ifndef __gid_t_defined
-typedef __gid_t gid_t;
-#  define __gid_t_defined
-# endif
-
-# ifndef __uid_t_defined
-typedef __uid_t uid_t;
-#  define __uid_t_defined
-# endif
-
-# ifndef __off_t_defined
-#  ifndef __USE_FILE_OFFSET64
-typedef __off_t off_t;
-#  else
-typedef __off64_t off_t;
-#  endif
-#  define __off_t_defined
-# endif
-# if defined __USE_LARGEFILE64 && !defined __off64_t_defined
-typedef __off64_t off64_t;
-#  define __off64_t_defined
-# endif
-
-# ifndef __useconds_t_defined
-typedef __useconds_t useconds_t;
-#  define __useconds_t_defined
-# endif
-
-# ifndef __pid_t_defined
-typedef __pid_t pid_t;
-#  define __pid_t_defined
+# include <bits/types/gid_t.h>
+# include <bits/types/uid_t.h>
+# include <bits/types/off_t.h>
+# ifdef __USE_LARGEFILE64
+#  include <bits/types/off64_t.h>
 # endif
+# include <bits/types/useconds_t.h>
+# include <bits/types/pid_t.h>
 #endif	/* X/Open */
 
 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
-# ifndef __intptr_t_defined
-typedef __intptr_t intptr_t;
-#  define __intptr_t_defined
-# endif
+# include <bits/types/intptr_t.h>
 #endif
 
 #if defined __USE_MISC || defined __USE_XOPEN
-# ifndef __socklen_t_defined
-typedef __socklen_t socklen_t;
-#  define __socklen_t_defined
-# endif
+# include <bits/types/socklen_t.h>
 #endif
 
 /* Values for the second argument to access.
diff --git a/pwd/pwd.h b/pwd/pwd.h
index 1002ed3..ccb3bc0 100644
--- a/pwd/pwd.h
+++ b/pwd/pwd.h
@@ -34,15 +34,8 @@ __BEGIN_DECLS
 #if defined __USE_XOPEN || defined __USE_XOPEN2K
 /* The Single Unix specification says that some more types are
    available here.  */
-# ifndef __gid_t_defined
-typedef __gid_t gid_t;
-#  define __gid_t_defined
-# endif
-
-# ifndef __uid_t_defined
-typedef __uid_t uid_t;
-#  define __uid_t_defined
-# endif
+# include <bits/types/gid_t.h>
+# include <bits/types/uid_t.h>
 #endif
 
 /* A record in the user database.  */
diff --git a/resource/sys/resource.h b/resource/sys/resource.h
index 928646b..3ed33c4 100644
--- a/resource/sys/resource.h
+++ b/resource/sys/resource.h
@@ -22,11 +22,7 @@
 
 /* Get the system-dependent definitions of structures and bit values.  */
 #include <bits/resource.h>
-
-#ifndef __id_t_defined
-typedef __id_t id_t;
-# define __id_t_defined
-#endif
+#include <bits/types/id_t.h>
 
 __BEGIN_DECLS
 
diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
index 12dd19d..426e122 100755
--- a/scripts/check-obsolete-constructs.py
+++ b/scripts/check-obsolete-constructs.py
@@ -28,6 +28,7 @@
 
 import argparse
 import collections
+import os.path
 import re
 import sys
 
@@ -264,15 +265,40 @@ OBSOLETE_TYPE_RE_ = re.compile(r"""\A
          | _(?: char | short | int(?:[0-9]+_t)? | long | quad_t )))
 \Z""", re.VERBOSE)
 
+# The headers that declare them:
+OBSOLETE_TYPE_HDR_RE_ = re.compile(r"""\A
+   [<"] bits/types/
+        (?: [cd]addr_t
+          | loff_t
+          | register_t
+          | uint
+          | u_int
+          | u_intN_t ) \.h [">]
+\Z""", re.VERBOSE)
+
 class ObsoleteNotAllowed(ConstructChecker):
-    """Don't allow any use of the obsolete typedefs."""
+    """Don't allow any use of the obsolete typedefs,
+       or the headers that declare them."""
     def examine(self, tok):
-        if OBSOLETE_TYPE_RE_.match(tok.text):
+        if ((tok.kind == "IDENT"
+             and OBSOLETE_TYPE_RE_.match(tok.text))
+            or (tok.kind == "HEADER_NAME"
+                and OBSOLETE_TYPE_HDR_RE_.match(tok.text))):
+            self.reporter.error(tok, "use of {!r}")
+
+class ObsoleteIndirectDefinitionsAllowed(ConstructChecker):
+    """Don't allow any use of the obsolete typedefs,
+       but do allow inclusion of the headers that declare them."""
+    def examine(self, tok):
+        if (tok.kind == "IDENT"
+            and OBSOLETE_TYPE_RE_.match(tok.text)):
             self.reporter.error(tok, "use of {!r}")
 
 class ObsoletePrivateDefinitionsAllowed(ConstructChecker):
     """Allow definitions of the private versions of the
        obsolete typedefs; that is, 'typedef [anything] __obsolete;'
+       Don't allow inclusion of headers that declare the public
+       versions.
     """
     def __init__(self, reporter):
         super().__init__(reporter)
@@ -300,10 +326,14 @@ class ObsoletePrivateDefinitionsAllowed(ConstructChecker):
         self._check_prev()
 
     def _check_prev(self):
-        if (self.prev_token is not None
-            and self.prev_token.kind == "IDENT"
-            and OBSOLETE_TYPE_RE_.match(self.prev_token.text)):
-            self.reporter.error(self.prev_token, "use of {!r}")
+        tok = self.prev_token
+        if tok is None:
+            return
+        if ((tok.kind == "IDENT"
+             and OBSOLETE_TYPE_RE_.match(tok.text))
+            or (tok.kind == "HEADER_NAME"
+                and OBSOLETE_TYPE_HDR_RE_.match(tok.text))):
+            self.reporter.error(tok, "use of {!r}")
 
 class ObsoletePublicDefinitionsAllowed(ConstructChecker):
     """Allow definitions of the public versions of the obsolete
@@ -317,6 +347,9 @@ class ObsoletePublicDefinitionsAllowed(ConstructChecker):
            typedef unsigned char u_char;
            typedef __int64_t quad_t;
            typedef __uint64_t u_quad_t;
+
+       Don't allow inclusion of headers that declare public
+       versions of other obsolete typedefs.
     """
     def __init__(self, reporter):
         super().__init__(reporter)
@@ -337,6 +370,10 @@ class ObsoletePublicDefinitionsAllowed(ConstructChecker):
         elif tok.kind == "PUNCTUATOR" and tok.text == ";":
             self._finish()
 
+        elif tok.kind == "HEADER_NAME":
+            if OBSOLETE_TYPE_HDR_RE_.match(tok.text):
+                self.reporter.error(tok, "use of {!r}")
+
         elif self.typedef_tokens:
             self.typedef_tokens.append(tok)
 
@@ -406,19 +443,38 @@ def ObsoleteTypedefChecker(reporter, fname):
         or fname.startswith("rpcsvc/")
         or "/rpc/" in fname
         or "/rpcsvc/" in fname):
+        sys.stderr.write("# No typedef checks for {}\n".format(fname))
         return NoCheck(reporter)
 
     # bits/types.h is allowed to define the __-versions of the
     # obsolete types.
     if (fname == "bits/types.h"
         or fname.endswith("/bits/types.h")):
+        sys.stderr.write("# Obsolete private defs allowed for {}\n"
+                         .format(fname))
         return ObsoletePrivateDefinitionsAllowed(reporter)
 
-    # sys/types.h is allowed to use the __-versions of the
-    # obsolete types, but only to define the unprefixed versions.
+    # Certain bits/types/ headers are allowed to define the
+    # unprefixed versions of the obsolete types.
+    if ((fname.startswith("bits/types/")
+         or "/bits/types/" in fname)
+        and os.path.basename(fname) in ("caddr_t.h",
+                                        "daddr_t.h",
+                                        "loff_t.h",
+                                        "register_t.h",
+                                        "uint.h",
+                                        "u_int.h",
+                                        "u_intN_t.h")):
+        sys.stderr.write("# Obsolete public defs allowed for {}\n"
+                         .format(fname))
+        return ObsoletePublicDefinitionsAllowed(reporter)
+
+    # sys/types.h is allowed to include the above bits/types/ headers.
     if (fname == "sys/types.h"
         or fname.endswith("/sys/types.h")):
-        return ObsoletePublicDefinitionsAllowed(reporter)
+        sys.stderr.write("# Obsolete indirect defs allowed for {}\n"
+                         .format(fname))
+        return ObsoleteIndirectDefinitionsAllowed(reporter)
 
     return ObsoleteNotAllowed(reporter)
 
diff --git a/signal/signal.h b/signal/signal.h
index ee591fc..bfacf40 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -36,16 +36,8 @@ __BEGIN_DECLS
 #endif
 
 #if defined __USE_XOPEN || defined __USE_XOPEN2K
-# ifndef __pid_t_defined
-typedef __pid_t pid_t;
-#  define __pid_t_defined
-#endif
-#ifdef __USE_XOPEN
-# endif
-# ifndef __uid_t_defined
-typedef __uid_t uid_t;
-#  define __uid_t_defined
-# endif
+# include <bits/types/pid_t.h>
+# include <bits/types/uid_t.h>
 #endif	/* Unix98 */
 
 #ifdef __USE_POSIX199309
diff --git a/stdlib/monetary.h b/stdlib/monetary.h
index 1cecd05..1f3347a 100644
--- a/stdlib/monetary.h
+++ b/stdlib/monetary.h
@@ -25,12 +25,7 @@
 #define __need_size_t
 #include <stddef.h>
 #include <bits/types.h>
-
-#ifndef	__ssize_t_defined
-typedef __ssize_t ssize_t;
-# define __ssize_t_defined
-#endif
-
+#include <bits/types/ssize_t.h>
 
 __BEGIN_DECLS
 
diff --git a/stdlib/stdint.h b/stdlib/stdint.h
index 8645d91..aca50d1 100644
--- a/stdlib/stdint.h
+++ b/stdlib/stdint.h
@@ -82,10 +82,7 @@ typedef unsigned long long int	uint_fast64_t;
 
 
 /* Types for `void *' pointers.  */
-# ifndef __intptr_t_defined
-typedef __intptr_t		intptr_t;
-#  define __intptr_t_defined
-# endif
+#include <bits/types/intptr_t.h>
 typedef __uintptr_t		uintptr_t;
 
 /* Largest integral types.  */
diff --git a/streams/stropts.h b/streams/stropts.h
index 97b9428..a69b81a 100644
--- a/streams/stropts.h
+++ b/streams/stropts.h
@@ -21,16 +21,8 @@
 #include <features.h>
 #include <bits/types.h>
 #include <bits/xtitypes.h>
-
-#ifndef __gid_t_defined
-typedef __gid_t gid_t;
-# define __gid_t_defined
-#endif
-
-#ifndef __uid_t_defined
-typedef __uid_t uid_t;
-# define __uid_t_defined
-#endif
+#include <bits/types/gid_t.h>
+#include <bits/types/uid_t.h>
 
 typedef __t_scalar_t t_scalar_t;
 typedef __t_uscalar_t t_uscalar_t;
diff --git a/sunrpc/rpc/types.h b/sunrpc/rpc/types.h
index 99e5f4f..13ef47f 100644
--- a/sunrpc/rpc/types.h
+++ b/sunrpc/rpc/types.h
@@ -34,6 +34,19 @@
 #ifndef _RPC_TYPES_H
 #define _RPC_TYPES_H 1
 
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/param.h>
+#include <netinet/in.h>
+
+#ifndef __BIT_TYPES_DEFINED__
+#include <bits/types/caddr_t.h>
+#include <bits/types/daddr_t.h>
+#include <bits/types/fsid_t.h>
+#include <bits/types/u_int.h>
+#endif
+
 typedef int bool_t;
 typedef int enum_t;
 /* This needs to be changed to uint32_t in the future */
@@ -57,7 +70,6 @@ typedef unsigned long rpcport_t;
 #      define  NULL 0
 #endif
 
-#include <stdlib.h>		/* For malloc decl.  */
 #define mem_alloc(bsize)	malloc(bsize)
 /*
  * XXX: This must not use the second argument, or code in xdr_array.c needs
@@ -65,36 +77,6 @@ typedef unsigned long rpcport_t;
  */
 #define mem_free(ptr, bsize)	free(ptr)
 
-#ifndef makedev /* ie, we haven't already included it */
-#include <sys/types.h>
-#endif
-
-#if defined __APPLE_CC__ || defined __FreeBSD__
-# define __u_char_defined
-# define __daddr_t_defined
-#endif
-
-#ifndef __u_char_defined
-typedef unsigned char u_char;
-typedef unsigned short int u_short;
-typedef unsigned int u_int;
-typedef unsigned long int u_long;
-typedef __int64_t quad_t;
-typedef __uint64_t u_quad_t;
-typedef __fsid_t fsid_t;
-# define __u_char_defined
-#endif
-#ifndef __daddr_t_defined
-typedef __daddr_t daddr_t;
-typedef __caddr_t caddr_t;
-# define __daddr_t_defined
-#endif
-
-#include <sys/time.h>
-#include <sys/param.h>
-
-#include <netinet/in.h>
-
 #ifndef INADDR_LOOPBACK
 #define       INADDR_LOOPBACK         (u_long)0x7F000001
 #endif
diff --git a/sysdeps/gnu/utmpx.h b/sysdeps/gnu/utmpx.h
index 9274102..41c122d 100644
--- a/sysdeps/gnu/utmpx.h
+++ b/sysdeps/gnu/utmpx.h
@@ -22,10 +22,7 @@
 #include <sys/time.h>
 
 /* Required according to Unix98.  */
-#ifndef __pid_t_defined
-typedef __pid_t pid_t;
-# define __pid_t_defined
-#endif
+#include <bits/types/pid_t.h>
 
 /* Get system dependent values and data structures.  */
 #include <bits/utmpx.h>
diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h
index f7f3cc4..429e66c 100644
--- a/sysdeps/mach/hurd/bits/socket.h
+++ b/sysdeps/mach/hurd/bits/socket.h
@@ -29,13 +29,7 @@
 
 #include <bits/wordsize.h>
 #include <sys/types.h>
-
-/* Type for length arguments in socket calls.  */
-#ifndef __socklen_t_defined
-typedef __socklen_t socklen_t;
-# define __socklen_t_defined
-#endif
-
+#include <bits/types/socklen_t.h>
 
 /* Types of sockets.  */
 enum __socket_type
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 99af01d..cf3c03a 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -27,12 +27,7 @@
 #include <stddef.h>
 
 #include <sys/types.h>
-
-/* Type for length arguments in socket calls.  */
-#ifndef __socklen_t_defined
-typedef __socklen_t socklen_t;
-# define __socklen_t_defined
-#endif
+#include <bits/types/socklen_t.h>
 
 /* Get the architecture-dependent definition of enum __socket_type.  */
 #include <bits/socket_type.h>
diff --git a/sysvipc/sys/ipc.h b/sysvipc/sys/ipc.h
index 516e275..8aa7f38 100644
--- a/sysvipc/sys/ipc.h
+++ b/sysvipc/sys/ipc.h
@@ -23,26 +23,10 @@
 /* Get system dependent definition of `struct ipc_perm' and more.  */
 #include <bits/ipctypes.h>
 #include <bits/ipc.h>
-
-#ifndef __uid_t_defined
-typedef __uid_t uid_t;
-# define __uid_t_defined
-#endif
-
-#ifndef __gid_t_defined
-typedef __gid_t gid_t;
-# define __gid_t_defined
-#endif
-
-#ifndef __mode_t_defined
-typedef __mode_t mode_t;
-# define __mode_t_defined
-#endif
-
-#ifndef __key_t_defined
-typedef __key_t key_t;
-# define __key_t_defined
-#endif
+#include <bits/types/uid_t.h>
+#include <bits/types/gid_t.h>
+#include <bits/types/mode_t.h>
+#include <bits/types/key_t.h>
 
 __BEGIN_DECLS
 
diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h
index 1ce4672..f2f18f4 100644
--- a/sysvipc/sys/msg.h
+++ b/sysvipc/sys/msg.h
@@ -31,16 +31,8 @@
 
 /* Define types required by the standard.  */
 #include <bits/types/time_t.h>
-
-#ifndef __pid_t_defined
-typedef __pid_t pid_t;
-# define __pid_t_defined
-#endif
-
-#ifndef __ssize_t_defined
-typedef __ssize_t ssize_t;
-# define __ssize_t_defined
-#endif
+#include <bits/types/pid_t.h>
+#include <bits/types/ssize_t.h>
 
 /* The following System V style IPC functions implement a message queue
    system.  The definition is found in XPG2.  */
diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h
index c15f419..bf836a7 100644
--- a/sysvipc/sys/shm.h
+++ b/sysvipc/sys/shm.h
@@ -31,14 +31,9 @@
 
 /* Define types required by the standard.  */
 #include <bits/types/time_t.h>
-
 #ifdef __USE_XOPEN
-# ifndef __pid_t_defined
-typedef __pid_t pid_t;
-#  define __pid_t_defined
-# endif
-#endif	/* X/Open */
-
+# include <bits/types/pid_t.h>
+#endif
 
 __BEGIN_DECLS
 
diff --git a/termios/termios.h b/termios/termios.h
index 2234208..b883dc8 100644
--- a/termios/termios.h
+++ b/termios/termios.h
@@ -23,13 +23,9 @@
 #define	_TERMIOS_H	1
 
 #include <features.h>
+
 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
-/* We need `pid_t'.  */
-# include <bits/types.h>
-# ifndef __pid_t_defined
-typedef __pid_t pid_t;
-#  define __pid_t_defined
-# endif
+# include <bits/types/pid_t.h>
 #endif
 
 __BEGIN_DECLS
diff --git a/time/sys/time.h b/time/sys/time.h
index 5dbc7fc..1059d30 100644
--- a/time/sys/time.h
+++ b/time/sys/time.h
@@ -23,11 +23,7 @@
 #include <bits/types.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 <bits/types/suseconds_t.h>
 
 #include <sys/select.h>
 
diff --git a/time/time.h b/time/time.h
index cba6d15..232531c 100644
--- a/time/time.h
+++ b/time/time.h
@@ -50,10 +50,7 @@ struct sigevent;
 #endif
 
 #ifdef __USE_XOPEN2K
-# ifndef __pid_t_defined
-typedef __pid_t pid_t;
-#  define __pid_t_defined
-# endif
+# include <bits/types/pid_t.h>
 #endif
 
 #ifdef __USE_XOPEN2K8

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

commit fb94ec0647d2fd3b1243fc1668a421b30edca388
Author: Zack Weinberg <zackw@panix.com>
Date:   Sat Mar 9 18:01:48 2019 -0500

    Clean up bits/types.h.
    
    This makes four linked changes to bits/types.h.  First, we use
    __(u)?int(16|32|64)_t to define __[SU](16|32|64)_TYPE.  In addition
    to reducing the amount of ifdeffage, this means __STD_TYPE is no longer
    necessary, since gcc -std=c89 will complain about â??typedef long long foo_tâ??
    but not â??typedef __int64_t foo_tâ??, even if the underlying type
    of __int64_t is long long.
    
    Second, we eliminate __UQUAD_TYPE and __SQUAD_TYPE from the set of
    macros bits/typesizes.h should use to define __FOO_T_TYPE macros,
    since they are always the same as __U64_TYPE and __S64_TYPE
    respectively.
    
    Third, we remove __u_char, __u_short, __u_int, __u_long, __u_quad_t,
    and __quad_t, we add __uintptr_t, and we define __intmax_t and
    __uintmax_t as __int64_t and __uint64_t.
    
    Fourth, we reorganize the list of typedefs into groups by the
    standard (if any) that defines them, and sort them alphabetically within
    each group.
    
    	* posix/bits/types.h: Move #error for __WORDSIZE neither 32 nor 64
    	to first group of conditionals on __WORDSIZE, and make it more
    	explicit.  Update commentary.  Define all __foo_t types with
    	regular â??typedefâ??.  Reorganize all __foo_t types into the same
    	groups that sys/types.h uses.
    	(__u_char, __u_short, __u_int, __u_long, __quad_t, __u_quad_t)
    	(__UQUAD_TYPE, __SQUAD_TYPE, __STD_TYPE): Donâ??t define.
    	(__S16_TYPE): Define unconditionally as __int16_t.
    	(__U16_TYPE): Define unconditionally as __uint16_t.
    	(__S32_TYPE): Define unconditionally as __int32_t.
    	(__U32_TYPE): Define unconditionally as __uint32_t.
    	(__S64_TYPE): Define unconditionally as __int64_t.
    	(__U64_TYPE): Define unconditionally as __uint64_t.
    	(__intmax_t): Define unconditionally as __int64_t.
    	(__uintmax_t): Define unconditionally as __uint64_t.
            (__uintptr_t): New typedef.
    
    	* bits/time64.h
    	* bits/typesizes.h
    	* sysdeps/mach/hurd/bits/typesizes.h
    	* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
    	* sysdeps/unix/sysv/linux/generic/bits/typesizes.h
    	* sysdeps/unix/sysv/linux/mips/bits/typesizes.h
    	* sysdeps/unix/sysv/linux/s390/bits/typesizes.h
    	* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
    	* sysdeps/unix/sysv/linux/x86/bits/typesizes.h:
    	Replace all uses of __UQUAD_TYPE with __U64_TYPE, and all
    	uses of __SQUAD_TYPE with __S64_TYPE.
    
            * posix/sys/types.h, rpc/sys/types.h
            (u_char): Define as unsigned char.
            (u_short): Define as unsigned short.
            (u_int): Define as unsigned int.
            (u_long): Define as unsigned long.
            (quad_t): Define as __int64_t.
            (u_quad_t): Define as __uint64_t.
    
            * stdlib/stdint.h (intptr_t): Define as __intptr_t.
            (uintptr_t): Define as __uintptr_t.
    
            * scripts/check-obsolete-constructs.py: Update allowed
            definitions for the obsolete types.  No longer allow
            __STD_TYPE as an alias for typedef.

diff --git a/bits/time64.h b/bits/time64.h
index c0f8a24..de38d3d 100644
--- a/bits/time64.h
+++ b/bits/time64.h
@@ -30,7 +30,7 @@
 # define __TIME64_T_TYPE		__TIME_T_TYPE
 #else
 /* Define a 64-bit time type alongsize the 32-bit one.  */
-# define __TIME64_T_TYPE		__SQUAD_TYPE
+# define __TIME64_T_TYPE		__S64_TYPE
 #endif
 
 #endif /* bits/time64.h */
diff --git a/bits/typesizes.h b/bits/typesizes.h
index a729146..bd21cf3 100644
--- a/bits/typesizes.h
+++ b/bits/typesizes.h
@@ -26,24 +26,24 @@
 /* See <bits/types.h> for the meaning of these macros.  This file exists so
    that <bits/types.h> need not vary across different GNU platforms.  */
 
-#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __DEV_T_TYPE		__U64_TYPE
 #define __UID_T_TYPE		__U32_TYPE
 #define __GID_T_TYPE		__U32_TYPE
 #define __INO_T_TYPE		__ULONGWORD_TYPE
-#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __INO64_T_TYPE		__U64_TYPE
 #define __MODE_T_TYPE		__U32_TYPE
 #define __NLINK_T_TYPE		__UWORD_TYPE
 #define __OFF_T_TYPE		__SLONGWORD_TYPE
-#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __OFF64_T_TYPE		__S64_TYPE
 #define __PID_T_TYPE		__S32_TYPE
 #define __RLIM_T_TYPE		__ULONGWORD_TYPE
-#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define __RLIM64_T_TYPE		__U64_TYPE
 #define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
-#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__BLKCNT64_T_TYPE	__S64_TYPE
 #define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__U64_TYPE
 #define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT64_T_TYPE	__U64_TYPE
 #define	__FSWORD_T_TYPE		__SWORD_TYPE
 #define	__ID_T_TYPE		__U32_TYPE
 #define __CLOCK_T_TYPE		__SLONGWORD_TYPE
diff --git a/posix/bits/types.h b/posix/bits/types.h
index 1f07950..4a6043c 100644
--- a/posix/bits/types.h
+++ b/posix/bits/types.h
@@ -27,12 +27,6 @@
 #include <bits/wordsize.h>
 #include <bits/timesize.h>
 
-/* Convenience types.  */
-typedef unsigned char __u_char;
-typedef unsigned short int __u_short;
-typedef unsigned int __u_int;
-typedef unsigned long int __u_long;
-
 /* Fixed-size types, underlying types depend on word size and compiler.  */
 typedef signed char __int8_t;
 typedef unsigned char __uint8_t;
@@ -43,9 +37,11 @@ typedef unsigned int __uint32_t;
 #if __WORDSIZE == 64
 typedef signed long int __int64_t;
 typedef unsigned long int __uint64_t;
-#else
+#elif __WORDSIZE == 32
 __extension__ typedef signed long long int __int64_t;
 __extension__ typedef unsigned long long int __uint64_t;
+#else
+# error "Unsupported value for __WORDSIZE"
 #endif
 
 /* Smallest types with at least a given width.  */
@@ -58,24 +54,9 @@ typedef __uint32_t __uint_least32_t;
 typedef __int64_t __int_least64_t;
 typedef __uint64_t __uint_least64_t;
 
-/* quad_t is also 64 bits.  */
-#if __WORDSIZE == 64
-typedef long int __quad_t;
-typedef unsigned long int __u_quad_t;
-#else
-__extension__ typedef long long int __quad_t;
-__extension__ typedef unsigned long long int __u_quad_t;
-#endif
-
 /* Largest integral types.  */
-#if __WORDSIZE == 64
-typedef long int __intmax_t;
-typedef unsigned long int __uintmax_t;
-#else
-__extension__ typedef long long int __intmax_t;
-__extension__ typedef unsigned long long int __uintmax_t;
-#endif
-
+typedef __int64_t __intmax_t;
+typedef __uint64_t __uintmax_t;
 
 /* The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE
    macros for each of the OS types we define below.  The definitions
@@ -87,136 +68,107 @@ __extension__ typedef unsigned long long int __uintmax_t;
 	32		-- "natural" 32-bit type (always int)
 	64		-- "natural" 64-bit type (long or long long)
 	LONG32		-- 32-bit type, traditionally long
-	QUAD		-- 64-bit type, traditionally long long
 	WORD		-- natural type of __WORDSIZE bits (int or long)
 	LONGWORD	-- type of __WORDSIZE bits, traditionally long
 
-   We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the
-   conventional uses of `long' or `long long' type modifiers match the
-   types we define, even when a less-adorned type would be the same size.
-   This matters for (somewhat) portably writing printf/scanf formats for
-   these types, where using the appropriate l or ll format modifiers can
-   make the typedefs and the formats match up across all GNU platforms.  If
-   we used `long' when it's 64 bits where `long long' is expected, then the
-   compiler would warn about the formats not matching the argument types,
-   and the programmer changing them to shut up the compiler would break the
-   program's portability.
+   We distinguish WORD/LONGWORD and 64/QUAD so that the conventional
+   uses of `long' or `long long' type modifiers match the types we
+   define, even when a less-adorned type would be the same size.
+   This matters for (somewhat) portably writing printf/scanf formats
+   for these types, where using the appropriate l or ll format
+   modifiers can make the typedefs and the formats match up across all
+   GNU platforms.  If we used `long' when it's 64 bits where `long
+   long' is expected, then the compiler would warn about the formats
+   not matching the argument types, and the programmer changing them
+   to shut up the compiler would break the program's portability.
 
    Here we assume what is presently the case in all the GCC configurations
    we support: long long is always 64 bits, long is always word/address size,
    and int is always 32 bits.  */
 
-#define	__S16_TYPE		short int
-#define __U16_TYPE		unsigned short int
-#define	__S32_TYPE		int
-#define __U32_TYPE		unsigned int
+#define	__S16_TYPE		__int16_t
+#define __U16_TYPE		__uint16_t
+#define	__S32_TYPE		__int32_t
+#define __U32_TYPE		__uint32_t
+#define __S64_TYPE		__int64_t
+#define __U64_TYPE		__uint64_t
+
 #define __SLONGWORD_TYPE	long int
 #define __ULONGWORD_TYPE	unsigned long int
 #if __WORDSIZE == 32
-# define __SQUAD_TYPE		__int64_t
-# define __UQUAD_TYPE		__uint64_t
 # define __SWORD_TYPE		int
 # define __UWORD_TYPE		unsigned int
 # define __SLONG32_TYPE		long int
 # define __ULONG32_TYPE		unsigned long int
-# define __S64_TYPE		__int64_t
-# define __U64_TYPE		__uint64_t
-/* We want __extension__ before typedef's that use nonstandard base types
-   such as `long long' in C89 mode.  */
-# define __STD_TYPE		__extension__ typedef
-#elif __WORDSIZE == 64
-# define __SQUAD_TYPE		long int
-# define __UQUAD_TYPE		unsigned long int
+#else /* __WORDSIZE == 64 */
 # define __SWORD_TYPE		long int
 # define __UWORD_TYPE		unsigned long int
 # define __SLONG32_TYPE		int
 # define __ULONG32_TYPE		unsigned int
-# define __S64_TYPE		long int
-# define __U64_TYPE		unsigned long int
-/* No need to mark the typedef with __extension__.   */
-# define __STD_TYPE		typedef
-#else
-# error
 #endif
 #include <bits/typesizes.h>	/* Defines __*_T_TYPE macros.  */
 #include <bits/time64.h>	/* Defines __TIME*_T_TYPE macros.  */
 
-
-__STD_TYPE __DEV_T_TYPE __dev_t;	/* Type of device numbers.  */
-__STD_TYPE __UID_T_TYPE __uid_t;	/* Type of user identifications.  */
-__STD_TYPE __GID_T_TYPE __gid_t;	/* Type of group identifications.  */
-__STD_TYPE __INO_T_TYPE __ino_t;	/* Type of file serial numbers.  */
-__STD_TYPE __INO64_T_TYPE __ino64_t;	/* Type of file serial numbers (LFS).*/
-__STD_TYPE __MODE_T_TYPE __mode_t;	/* Type of file attribute bitmasks.  */
-__STD_TYPE __NLINK_T_TYPE __nlink_t;	/* Type of file link counts.  */
-__STD_TYPE __OFF_T_TYPE __off_t;	/* Type of file sizes and offsets.  */
-__STD_TYPE __OFF64_T_TYPE __off64_t;	/* Type of file sizes and offsets (LFS).  */
-__STD_TYPE __PID_T_TYPE __pid_t;	/* Type of process identifications.  */
-__STD_TYPE __FSID_T_TYPE __fsid_t;	/* Type of file system IDs.  */
-__STD_TYPE __CLOCK_T_TYPE __clock_t;	/* Type of CPU usage counts.  */
-__STD_TYPE __RLIM_T_TYPE __rlim_t;	/* Type for resource measurement.  */
-__STD_TYPE __RLIM64_T_TYPE __rlim64_t;	/* Type for resource measurement (LFS).  */
-__STD_TYPE __ID_T_TYPE __id_t;		/* General type for IDs.  */
-__STD_TYPE __TIME_T_TYPE __time_t;	/* Seconds since the Epoch.  */
-__STD_TYPE __TIME64_T_TYPE __time64_t;	/* Seconds since the Epoch (Y2038).  */
-__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds.  */
-__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds.  */
-
-__STD_TYPE __KEY_T_TYPE __key_t;	/* Type of an IPC key.  */
-
-/* Clock ID used in clock and timer functions.  */
-__STD_TYPE __CLOCKID_T_TYPE __clockid_t;
-
-/* Timer ID returned by `timer_create'.  */
-__STD_TYPE __TIMER_T_TYPE __timer_t;
-
-/* Type to represent block size.  */
-__STD_TYPE __BLKSIZE_T_TYPE __blksize_t;
-
-/* Types from the Large File Support interface.  */
-
-/* Type to count number of disk blocks.  */
-__STD_TYPE __BLKCNT_T_TYPE __blkcnt_t;
-__STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t;
-
-/* Type to count file system blocks.  */
-__STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t;
-__STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t;
-
-/* Type to count file system nodes.  */
-__STD_TYPE __FSFILCNT_T_TYPE __fsfilcnt_t;
-__STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t;
-
-/* Type of miscellaneous file system fields.  */
-__STD_TYPE __FSWORD_T_TYPE __fsword_t;
-
-__STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error.  */
-
-/* Signed long type used in system calls.  */
-__STD_TYPE __SYSCALL_SLONG_TYPE __syscall_slong_t;
-/* Unsigned long type used in system calls.  */
-__STD_TYPE __SYSCALL_ULONG_TYPE __syscall_ulong_t;
+/* Types from core POSIX:  */
+typedef __BLKCNT_T_TYPE __blkcnt_t;	/* Disk block counts.  */
+typedef __CLOCKID_T_TYPE __clockid_t;	/* Clock IDs.  */
+typedef __DEV_T_TYPE __dev_t;		/* Device numbers.  */
+typedef __FSBLKCNT_T_TYPE __fsblkcnt_t;	/* File system block counts.  */
+typedef __FSFILCNT_T_TYPE __fsfilcnt_t;	/* File system inode counts.  */
+typedef __GID_T_TYPE __gid_t;		/* Group IDs.  */
+typedef __INO_T_TYPE __ino_t;		/* File serial numbers.  */
+typedef __MODE_T_TYPE __mode_t;		/* File attribute bitmasks.  */
+typedef __NLINK_T_TYPE __nlink_t;	/* File link counts.  */
+typedef __OFF_T_TYPE __off_t;		/* File sizes and offsets.  */
+typedef __PID_T_TYPE __pid_t;		/* Process IDs.  */
+typedef __RLIM_T_TYPE __rlim_t;		/* Resource measurements.  */
+typedef __SSIZE_T_TYPE __ssize_t;	/* Byte count, or error.  */
+typedef __TIME_T_TYPE __time_t;		/* Seconds since the Epoch.  */
+typedef __TIMER_T_TYPE __timer_t;	/* Timer IDs.  */
+typedef __UID_T_TYPE __uid_t;		/* Type of user identifications.  */
+
+/* Types added by LFS:  */
+typedef __BLKCNT64_T_TYPE __blkcnt64_t;
+typedef __FSBLKCNT64_T_TYPE __fsblkcnt64_t;
+typedef __FSFILCNT64_T_TYPE __fsfilcnt64_t;
+typedef __INO64_T_TYPE __ino64_t;
+typedef __OFF64_T_TYPE __off64_t;
+typedef __RLIM64_T_TYPE __rlim64_t;
+
+/* Types added by Y2038:  */
+typedef __TIME64_T_TYPE __time64_t;
+
+/* Types added by XSI:  */
+typedef __BLKSIZE_T_TYPE __blksize_t;	  /* Size of a disk block.  */
+typedef __CLOCK_T_TYPE __clock_t;	  /* CPU usage counts.  */
+typedef __ID_T_TYPE __id_t;		  /* General IDs.  */
+typedef __KEY_T_TYPE __key_t;		  /* "SysV" IPC keys.  */
+typedef __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds.  */
+typedef __USECONDS_T_TYPE __useconds_t;	  /* Count of microseconds.  */
+
+/* Types added by BSD:  */
+typedef __FSID_T_TYPE __fsid_t;		/* File system IDs.  */
+typedef __REGISTER_T_TYPE __register_t;	/* Integer register.  */
+
+/* Types added by Linux:  */
+typedef __FSWORD_T_TYPE __fsword_t;	/* Miscellaneous file system fields.  */
+typedef __SYSCALL_SLONG_TYPE __syscall_slong_t;
+typedef __SYSCALL_ULONG_TYPE __syscall_ulong_t;
 
 /* These few don't really vary by system, they always correspond
    to one of the other defined types.  */
-typedef __off64_t __loff_t;	/* Type of file sizes and offsets (LFS).  */
-typedef char *__caddr_t;                /* Type of a memory address (BSD).  */
-__STD_TYPE __S32_TYPE __daddr_t;	/* Type of a disk address (BSD).  */
-
-/* Duplicates info from stdint.h but this is used in unistd.h.  */
-__STD_TYPE __SWORD_TYPE __intptr_t;
-
-/* Duplicate info from sys/socket.h.  */
-__STD_TYPE __U32_TYPE __socklen_t;
 
-/* C99: An integer type that can be accessed as an atomic entity,
-   even in the presence of asynchronous interrupts.
-   It is not currently necessary for this to be machine-specific.  */
-typedef int __sig_atomic_t;
+/* ISO C:  */
+typedef __SWORD_TYPE __intptr_t;	/* Signed type that can hold void*.  */
+typedef __UWORD_TYPE __uintptr_t;	/* Unsigned type that can hold void*.  */
+typedef int __sig_atomic_t;		/* Atomic access relative to signals.  */
 
-/* BSD: Size of a general-purpose integer register.  */
-__STD_TYPE __REGISTER_T_TYPE __register_t;
+/* POSIX:  */
+typedef __U32_TYPE __socklen_t;		/* Size of a socket address.  */
 
-#undef __STD_TYPE
+/* BSD:  */
+typedef char *__caddr_t;                /* Memory address.  */
+typedef __S32_TYPE __daddr_t;		/* Disk address.  */
+typedef __off64_t __loff_t;		/* File sizes and offsets.  */
 
 #endif /* bits/types.h */
diff --git a/posix/sys/types.h b/posix/sys/types.h
index 7327904..2d8cfd1 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -30,12 +30,12 @@ __BEGIN_DECLS
 
 #ifdef	__USE_MISC
 # ifndef __u_char_defined
-typedef __u_char u_char;
-typedef __u_short u_short;
-typedef __u_int u_int;
-typedef __u_long u_long;
-typedef __quad_t quad_t;
-typedef __u_quad_t u_quad_t;
+typedef unsigned char u_char;
+typedef unsigned short int u_short;
+typedef unsigned int u_int;
+typedef unsigned long int u_long;
+typedef __int64_t quad_t;
+typedef __uint64_t u_quad_t;
 typedef __fsid_t fsid_t;
 #  define __u_char_defined
 # endif
diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
index bf5e114..12dd19d 100755
--- a/scripts/check-obsolete-constructs.py
+++ b/scripts/check-obsolete-constructs.py
@@ -280,9 +280,8 @@ class ObsoletePrivateDefinitionsAllowed(ConstructChecker):
         self.prev_token = None
 
     def examine(self, tok):
-        # bits/types.h hides 'typedef' in a macro sometimes.
         if (tok.kind == "IDENT"
-            and tok.text in ("typedef", "__STD_TYPE")
+            and tok.text == "typedef"
             and tok.context is None):
             self.in_typedef = True
         elif tok.kind == "PUNCTUATOR" and tok.text == ";" and self.in_typedef:
@@ -312,9 +311,12 @@ class ObsoletePublicDefinitionsAllowed(ConstructChecker):
 
            typedef __obsolete obsolete;  // identifiers must agree
            typedef __uintN_t u_intN_t;   // N must agree
-           typedef unsigned long int ulong;
-           typedef unsigned short int ushort;
-           typedef unsigned int uint;
+           typedef unsigned long int u_?long;
+           typedef unsigned short int u_?short;
+           typedef unsigned int u_?int;
+           typedef unsigned char u_char;
+           typedef __int64_t quad_t;
+           typedef __uint64_t u_quad_t;
     """
     def __init__(self, reporter):
         super().__init__(reporter)
@@ -357,41 +359,40 @@ class ObsoletePublicDefinitionsAllowed(ConstructChecker):
         self._reset()
 
     def _permissible_public_definition(self, m):
-        if m.group(1) == "__": return False
+        if m.group(1) == "__":
+            return False
         name = m.group(2)
-        toks = self.typedef_tokens
-        ntok = len(toks)
-        if ntok == 3 and toks[1].kind == "IDENT":
-            defn = toks[1].text
-            n = OBSOLETE_TYPE_RE_.match(defn)
-            if n and n.group(1) == "__" and n.group(2) == name:
-                return True
-
-            if (name[:5] == "u_int" and name[-2:] == "_t"
-                and defn[:6] == "__uint" and defn[-2:] == "_t"
-                and name[5:-2] == defn[6:-2]):
-                return True
 
+        toks = self.typedef_tokens
+        if len(toks) > 5:
             return False
+        if any(tk.kind != "IDENT" for tk in toks):
+            return False
+        defn = " ".join(tk.text for tk in toks[1:-1])
+
+        if name == "u_char":
+            return defn == "unsigned char"
+
+        if name in ("ushort", "u_short"):
+            return defn == "unsigned short int"
+
+        if name in ("uint", "u_int"):
+            return defn == "unsigned int"
+
+        if name in ("ulong", "u_long"):
+            return defn == "unsigned long int"
+
+        if name == "quad_t":
+            return defn == "__int64_t"
 
-        if (name == "ulong" and ntok == 5
-            and toks[1].kind == "IDENT" and toks[1].text == "unsigned"
-            and toks[2].kind == "IDENT" and toks[2].text == "long"
-            and toks[3].kind == "IDENT" and toks[3].text == "int"):
-            return True
+        if name == "u_quad_t":
+            return defn == "__uint64_t"
 
-        if (name == "ushort" and ntok == 5
-            and toks[1].kind == "IDENT" and toks[1].text == "unsigned"
-            and toks[2].kind == "IDENT" and toks[2].text == "short"
-            and toks[3].kind == "IDENT" and toks[3].text == "int"):
-            return True
+        if name[:5] == "u_int" and name[-2:] == "_t":
+            return defn == "__uint" + name[5:-2] + "_t"
 
-        if (name == "uint" and ntok == 4
-            and toks[1].kind == "IDENT" and toks[1].text == "unsigned"
-            and toks[2].kind == "IDENT" and toks[2].text == "int"):
-            return True
+        return defn == "__" + name
 
-        return False
 
 def ObsoleteTypedefChecker(reporter, fname):
     """Factory: produce an instance of the appropriate
diff --git a/stdlib/stdint.h b/stdlib/stdint.h
index 1ad538f..8645d91 100644
--- a/stdlib/stdint.h
+++ b/stdlib/stdint.h
@@ -82,20 +82,11 @@ typedef unsigned long long int	uint_fast64_t;
 
 
 /* Types for `void *' pointers.  */
-#if __WORDSIZE == 64
 # ifndef __intptr_t_defined
-typedef long int		intptr_t;
+typedef __intptr_t		intptr_t;
 #  define __intptr_t_defined
 # endif
-typedef unsigned long int	uintptr_t;
-#else
-# ifndef __intptr_t_defined
-typedef int			intptr_t;
-#  define __intptr_t_defined
-# endif
-typedef unsigned int		uintptr_t;
-#endif
-
+typedef __uintptr_t		uintptr_t;
 
 /* Largest integral types.  */
 typedef __intmax_t		intmax_t;
diff --git a/sunrpc/rpc/types.h b/sunrpc/rpc/types.h
index beded52..99e5f4f 100644
--- a/sunrpc/rpc/types.h
+++ b/sunrpc/rpc/types.h
@@ -75,12 +75,12 @@ typedef unsigned long rpcport_t;
 #endif
 
 #ifndef __u_char_defined
-typedef __u_char u_char;
-typedef __u_short u_short;
-typedef __u_int u_int;
-typedef __u_long u_long;
-typedef __quad_t quad_t;
-typedef __u_quad_t u_quad_t;
+typedef unsigned char u_char;
+typedef unsigned short int u_short;
+typedef unsigned int u_int;
+typedef unsigned long int u_long;
+typedef __int64_t quad_t;
+typedef __uint64_t u_quad_t;
 typedef __fsid_t fsid_t;
 # define __u_char_defined
 #endif
diff --git a/sysdeps/mach/hurd/bits/typesizes.h b/sysdeps/mach/hurd/bits/typesizes.h
index 23ee7af..eaeaab1 100644
--- a/sysdeps/mach/hurd/bits/typesizes.h
+++ b/sysdeps/mach/hurd/bits/typesizes.h
@@ -30,20 +30,20 @@
 #define __UID_T_TYPE		__U32_TYPE
 #define __GID_T_TYPE		__U32_TYPE
 #define __INO_T_TYPE		__ULONGWORD_TYPE
-#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __INO64_T_TYPE		__U64_TYPE
 #define __MODE_T_TYPE		__U32_TYPE
 #define __NLINK_T_TYPE		__UWORD_TYPE
 #define __OFF_T_TYPE		__SLONGWORD_TYPE
-#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __OFF64_T_TYPE		__S64_TYPE
 #define __PID_T_TYPE		__S32_TYPE
 #define __RLIM_T_TYPE		__ULONGWORD_TYPE
-#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define __RLIM64_T_TYPE		__U64_TYPE
 #define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
-#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__BLKCNT64_T_TYPE	__S64_TYPE
 #define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__U64_TYPE
 #define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT64_T_TYPE	__U64_TYPE
 #define	__FSWORD_T_TYPE		__SWORD_TYPE
 #define	__ID_T_TYPE		__U32_TYPE
 #define __CLOCK_T_TYPE		__SLONGWORD_TYPE
@@ -54,7 +54,7 @@
 #define __CLOCKID_T_TYPE	__S32_TYPE
 #define __TIMER_T_TYPE		__S32_TYPE
 #define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
-#define __FSID_T_TYPE		__UQUAD_TYPE
+#define __FSID_T_TYPE		__U64_TYPE
 #define __SSIZE_T_TYPE		__SWORD_TYPE
 #define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
 #define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
index 26dabcf..fb4a560 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
@@ -27,24 +27,24 @@
 /* See <bits/types.h> for the meaning of these macros.  This file exists so
    that <bits/types.h> need not vary across different GNU platforms.  */
 
-#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __DEV_T_TYPE		__U64_TYPE
 #define __UID_T_TYPE		__U32_TYPE
 #define __GID_T_TYPE		__U32_TYPE
 #define __INO_T_TYPE		__ULONGWORD_TYPE
-#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __INO64_T_TYPE		__U64_TYPE
 #define __MODE_T_TYPE		__U32_TYPE
 #define __NLINK_T_TYPE		__U32_TYPE
 #define __OFF_T_TYPE		__SLONGWORD_TYPE
-#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __OFF64_T_TYPE		__S64_TYPE
 #define __PID_T_TYPE		__S32_TYPE
 #define __RLIM_T_TYPE		__ULONGWORD_TYPE
-#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define __RLIM64_T_TYPE		__U64_TYPE
 #define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
-#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__BLKCNT64_T_TYPE	__S64_TYPE
 #define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__U64_TYPE
 #define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT64_T_TYPE	__U64_TYPE
 #define	__FSWORD_T_TYPE		__SWORD_TYPE
 #define	__ID_T_TYPE		__U32_TYPE
 #define __CLOCK_T_TYPE		__SLONGWORD_TYPE
diff --git a/sysdeps/unix/sysv/linux/mips/bits/typesizes.h b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h
index 7c1bedd..e73bba4 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h
@@ -26,24 +26,24 @@
 /* See <bits/types.h> for the meaning of these macros.  This file exists so
    that <bits/types.h> need not vary across different GNU platforms.  */
 
-#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __DEV_T_TYPE		__U64_TYPE
 #define __UID_T_TYPE		__U32_TYPE
 #define __GID_T_TYPE		__U32_TYPE
 #define __INO_T_TYPE		__ULONGWORD_TYPE
-#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __INO64_T_TYPE		__U64_TYPE
 #define __MODE_T_TYPE		__U32_TYPE
 #define __NLINK_T_TYPE		__UWORD_TYPE
 #define __OFF_T_TYPE		__SLONGWORD_TYPE
-#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __OFF64_T_TYPE		__S64_TYPE
 #define __PID_T_TYPE		__S32_TYPE
 #define __RLIM_T_TYPE		__ULONGWORD_TYPE
-#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define __RLIM64_T_TYPE		__U64_TYPE
 #define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
-#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__BLKCNT64_T_TYPE	__S64_TYPE
 #define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__U64_TYPE
 #define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT64_T_TYPE	__U64_TYPE
 #define	__FSWORD_T_TYPE		__SWORD_TYPE
 #define	__ID_T_TYPE		__U32_TYPE
 #define __CLOCK_T_TYPE		__SLONGWORD_TYPE
@@ -61,7 +61,7 @@
 #define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
 
 #if defined _ABIN32 && _MIPS_SIM == _ABIN32
-#define __REGISTER_T_TYPE	__SQUAD_TYPE
+#define __REGISTER_T_TYPE	__S64_TYPE
 #else
 #define __REGISTER_T_TYPE	__SWORD_TYPE
 #endif
diff --git a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
index 712264a..741dfae 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
@@ -26,24 +26,24 @@
 /* See <bits/types.h> for the meaning of these macros.  This file exists so
    that <bits/types.h> need not vary across different GNU platforms.  */
 
-#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __DEV_T_TYPE		__U64_TYPE
 #define __UID_T_TYPE		__U32_TYPE
 #define __GID_T_TYPE		__U32_TYPE
 #define __INO_T_TYPE		__ULONGWORD_TYPE
-#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __INO64_T_TYPE		__U64_TYPE
 #define __MODE_T_TYPE		__U32_TYPE
 #define __NLINK_T_TYPE		__UWORD_TYPE
 #define __OFF_T_TYPE		__SLONGWORD_TYPE
-#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __OFF64_T_TYPE		__S64_TYPE
 #define __PID_T_TYPE		__S32_TYPE
 #define __RLIM_T_TYPE		__ULONGWORD_TYPE
-#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define __RLIM64_T_TYPE		__U64_TYPE
 #define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
-#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__BLKCNT64_T_TYPE	__S64_TYPE
 #define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__U64_TYPE
 #define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT64_T_TYPE	__U64_TYPE
 #define	__FSWORD_T_TYPE		__SWORD_TYPE
 #define	__ID_T_TYPE		__U32_TYPE
 #define __CLOCK_T_TYPE		__SLONGWORD_TYPE
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
index b2d3929..c084ebd 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
@@ -26,24 +26,24 @@
 /* See <bits/types.h> for the meaning of these macros.  This file exists so
    that <bits/types.h> need not vary across different GNU platforms.  */
 
-#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __DEV_T_TYPE		__U64_TYPE
 #define __UID_T_TYPE		__U32_TYPE
 #define __GID_T_TYPE		__U32_TYPE
 #define __INO_T_TYPE		__ULONGWORD_TYPE
-#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __INO64_T_TYPE		__U64_TYPE
 #define __MODE_T_TYPE		__U32_TYPE
 #define __NLINK_T_TYPE		__U32_TYPE
 #define __OFF_T_TYPE		__SLONGWORD_TYPE
-#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __OFF64_T_TYPE		__S64_TYPE
 #define __PID_T_TYPE		__S32_TYPE
 #define __RLIM_T_TYPE		__ULONGWORD_TYPE
-#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define __RLIM64_T_TYPE		__U64_TYPE
 #define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
-#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__BLKCNT64_T_TYPE	__S64_TYPE
 #define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__U64_TYPE
 #define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT64_T_TYPE	__U64_TYPE
 #define	__FSWORD_T_TYPE		__SWORD_TYPE
 #define	__ID_T_TYPE		__U32_TYPE
 #define __CLOCK_T_TYPE		__SLONGWORD_TYPE
diff --git a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h
index fb724e6..37fac92 100644
--- a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h
@@ -28,20 +28,20 @@
 
 /* X32 kernel interface is 64-bit.  */
 #if defined __x86_64__ && defined __ILP32__
-# define __SYSCALL_SLONG_TYPE	__SQUAD_TYPE
-# define __SYSCALL_ULONG_TYPE	__UQUAD_TYPE
-# define __REGISTER_T_TYPE	__SQUAD_TYPE
+# define __SYSCALL_SLONG_TYPE	__S64_TYPE
+# define __SYSCALL_ULONG_TYPE	__U64_TYPE
+# define __REGISTER_T_TYPE	__S64_TYPE
 #else
 # define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
 # define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 # define __REGISTER_T_TYPE	__SWORD_TYPE
 #endif
 
-#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __DEV_T_TYPE		__U64_TYPE
 #define __UID_T_TYPE		__U32_TYPE
 #define __GID_T_TYPE		__U32_TYPE
 #define __INO_T_TYPE		__SYSCALL_ULONG_TYPE
-#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __INO64_T_TYPE		__U64_TYPE
 #define __MODE_T_TYPE		__U32_TYPE
 #ifdef __x86_64__
 # define __NLINK_T_TYPE		__SYSCALL_ULONG_TYPE
@@ -51,16 +51,16 @@
 # define __FSWORD_T_TYPE	__SWORD_TYPE
 #endif
 #define __OFF_T_TYPE		__SYSCALL_SLONG_TYPE
-#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __OFF64_T_TYPE		__S64_TYPE
 #define __PID_T_TYPE		__S32_TYPE
 #define __RLIM_T_TYPE		__SYSCALL_ULONG_TYPE
-#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define __RLIM64_T_TYPE		__U64_TYPE
 #define __BLKCNT_T_TYPE		__SYSCALL_SLONG_TYPE
-#define __BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define __BLKCNT64_T_TYPE	__S64_TYPE
 #define __FSBLKCNT_T_TYPE	__SYSCALL_ULONG_TYPE
-#define __FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define __FSBLKCNT64_T_TYPE	__U64_TYPE
 #define __FSFILCNT_T_TYPE	__SYSCALL_ULONG_TYPE
-#define __FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define __FSFILCNT64_T_TYPE	__U64_TYPE
 #define __ID_T_TYPE		__U32_TYPE
 #define __CLOCK_T_TYPE		__SYSCALL_SLONG_TYPE
 #define __TIME_T_TYPE		__SYSCALL_SLONG_TYPE

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

commit 0ce3e22e38068c9857553dcd287c67d792a9f56b
Author: Zack Weinberg <zackw@panix.com>
Date:   Sat Mar 9 16:01:38 2019 -0500

    Simplify definition of __time64_t.
    
    bits/time64.h always sets __TIME64_T_TYPE to be __time_t when
    __TIMESIZE == 64, so we can unconditionally use __TIME64_T_TYPE to
    define __time64_t; we donâ??t need another conditional in bits/types.h.
    
    Also move the definition of __time64_t next to the definition of
    __time_t.
    
    	* posix/bits/types.h (__time64_t): Unconditionally define
            as __TIME64_T_TYPE.  Move definition next to __time_t.

diff --git a/posix/bits/types.h b/posix/bits/types.h
index 9ddbe87..1f07950 100644
--- a/posix/bits/types.h
+++ b/posix/bits/types.h
@@ -158,6 +158,7 @@ __STD_TYPE __RLIM_T_TYPE __rlim_t;	/* Type for resource measurement.  */
 __STD_TYPE __RLIM64_T_TYPE __rlim64_t;	/* Type for resource measurement (LFS).  */
 __STD_TYPE __ID_T_TYPE __id_t;		/* General type for IDs.  */
 __STD_TYPE __TIME_T_TYPE __time_t;	/* Seconds since the Epoch.  */
+__STD_TYPE __TIME64_T_TYPE __time64_t;	/* Seconds since the Epoch (Y2038).  */
 __STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds.  */
 __STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds.  */
 
@@ -213,12 +214,6 @@ __STD_TYPE __U32_TYPE __socklen_t;
    It is not currently necessary for this to be machine-specific.  */
 typedef int __sig_atomic_t;
 
-#if __TIMESIZE == 64
-# define __time64_t __time_t
-#else
-__STD_TYPE __TIME64_T_TYPE __time64_t;	/* Seconds since the Epoch.  */
-#endif
-
 /* BSD: Size of a general-purpose integer register.  */
 __STD_TYPE __REGISTER_T_TYPE __register_t;
 

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

commit 00f92123d619af57b3b29dc26b671991eed538f3
Author: Zack Weinberg <zackw@panix.com>
Date:   Sat Mar 9 11:59:02 2019 -0500

    Add caddr_t, daddr_t, and loff_t to the set of obsolete typedefs.
    
    caddr_t is a BSD-derived alias for â??char *â??, obsoleted by the
    introduction of â??void *â?? in C89 (!)  daddr_t is a â??disk address,â??
    but itâ??s always defined as â??intâ??, making it too small for modern
    disks and tapes.  loff_t is another name for off64_t, from early
    drafts of LFS.  All three are already only exposed by sys/types.h
    under __USE_MISC.
    
    This patch adds them to the set of types that shall not be used in
    installed headers (enforced by check-obsolete-constructs.py) and
    expunges all remaining uses, internally as well as in installed
    headers.  Since __DADDR_T_TYPE is always defined as __S32_TYPE, and
    daddr_t is obsolete so thereâ??s no need to worry about future
    variation, the patch also removes __DADDR_T_TYPE from the set of
    macros that bits/typesizes.h is required to define.  Instead
    bits/types.h always defines __daddr_t as __S32_TYPE, and the
    definition is moved to a more logical location within the file, next
    to __caddr_t.
    
    Itâ??s always safe to change (__)loff_t to the matching (__)off64_t;
    in a few internal files, I removed an unnecessary __ prefix.
    
    daddr_t is only used for struct ustat, which is obsoleted by struct
    statvfs and we already donâ??t declare it in public headers, and for an
    ioctl parameter block in sys/mtio.h (which may or may not be obsolete,
    I canâ??t tell).  In sys/mtio.h I replaced both uses with â??intâ?? to match
    the use of bare â??long intâ?? for most of the other fields of that
    structure.  In misc/ustat.c, the definition of struct ustat is not
    actually necessary so I removed it entirely.  In
    sysdeps/unix/sysv/linux/ustat.c a definition is necessary but only
    because INLINE_SYSCALL_CALL doesnâ??t work (on at least x86) when an
    argument is a pointer to an incomplete type, so I substituted a dummy
    definition.
    
    Most of the internal uses of caddr_t are in the sunrpc and nis
    directories, and since most of that code is obsolete, I mechanically
    replaced them with char * rather than consider whether void * might
    make more sense.  Because â??const caddr_t fooâ?? is semantically
    different from â??const char *fooâ?? (in the first case â??fooâ?? itself is
    const but the memory pointed to isnâ??t, in the second case the memory
    pointed to is const but â??fooâ?? isnâ??t) this change exposed some
    const-correctness errors in sunrpc, which I fixed minimally.  Outside
    of sunrpc and nis, I put a little more thought into whether uses of
    caddr_t should be void * instead.
    
    	* scripts/check-obsolete-constructs.py: Add caddr_t, daddr_t,
            and loff_t to the set of obsolete types forbidden in public
            headers.
    
    	* posix/bits/types.h: Unconditionally define __daddr_t as
            __S32_TYPE.  Move definition of __daddr_t next to definition
            of __caddr_t.
    	* bits/typesizes.h
    	* sysdeps/mach/hurd/bits/typesizes.h
    	* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
    	* sysdeps/unix/sysv/linux/generic/bits/typesizes.h
    	* sysdeps/unix/sysv/linux/mips/bits/typesizes.h
    	* sysdeps/unix/sysv/linux/s390/bits/typesizes.h
    	* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
    	* sysdeps/unix/sysv/linux/x86/bits/typesizes.h:
            Donâ??t define __DADDR_T_TYPE.
    
            * sysdeps/gnu/sys/mtio.h (struct mtget): Change all uses of
    	__daddr_t to int.
    	* misc/ustat.c: Remove definition of struct ustat; only
            forward-declare it.
    	* sysdeps/unix/sysv/linux/ustat.c: Replace fields of
            struct ustat with a size-preserving dummy field.
    
    	* hurd/Makefile (migheaderpipe): Rewrite loff_t as __off64_t.
            * hurd/fd-read.c (_hurd_fd_read): Use off64_t instead of loff_t.
            * hurd/fd-write.c (hurd_fd_write): Use off64_t instead of loff_t.
            * hurd/hurd/fd.h (_hurd_fd_read, _hurd_fd_write): Declare
            using __off64_t instead of __loff_t.
            * support/xunistd.h (xcopy_file_range): Declare using off64_t
            instead of loff_t.
    	* sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h
    	* sysdeps/unix/sysv/linux/lseek.c
    	* sysdeps/unix/sysv/linux/lseek64.c
    	* sysdeps/unix/sysv/linux/splice.c
            Throughout, use off64_t instead of loff_t.
    
    	* sysdeps/unix/sysv/linux/sys/quota.h
            (dqoff): Use __off64_t instead of __loff_t.
            (quotactl): Declare using char * instead of caddr_t.
    	* sysdeps/unix/sysv/linux/test-errno-linux.c
            (do_test): Cast to char * instead of caddr_t when calling quotactl.
    
    	* elf/dl-map-segments.h (_dl_map_segments): Cast to void *
            instead of caddr_t when calling __mprotect and __mmap.
            * elf/dl-minimal.c (malloc): Declare page as char *, not caddr_t.
            * elf/dl-reloc.c (_dl_relocate_object): Declare textrels.start
            as char *, not caddr_t.  Cast to char *, not caddr_t, in
            pointer arithmetic.
    
    	* intl/loadmsgcat.c: Remove two unnecessary casts to caddr_t
            when calling munmap. Change a third cast to target void *
            instead and add a comment explaining why this one is necessary.
    
    	* locale/loadlocale.c (_nl_load_locale): Use NULL instead of
            `(caddr_t)0`, and remove an unnecessary cast to caddr_t when
            calling munmap.
            (_nl_unload_locale): Change casts when calling free and munmap
            to target char *, and add a comment explaining why they are
            necessary.
    
    	* sysdeps/gnu/net/if.h
            (struct ifreq): Declare ifru_data as char *, not __caddr_t.
            (struct ifconf): Declare ifcu_buf as char *, not __caddr_t.
    
    	* nis/nis_add.c
    	* nis/nis_call.c
    	* nis/nis_callback.c
    	* nis/nis_checkpoint.c
    	* nis/nis_findserv.c
    	* nis/nis_intern.h
    	* nis/nis_lookup.c
    	* nis/nis_mkdir.c
    	* nis/nis_modify.c
    	* nis/nis_ping.c
    	* nis/nis_remove.c
    	* nis/nis_rmdir.c
    	* nis/nis_server.c
    	* nis/nis_table.c
    	* nis/nis_util.c
    	* nis/nss_nisplus/nisplus-grp.c
    	* nis/nss_nisplus/nisplus-pwd.c
    	* nis/rpcsvc/nis_callback.h
    	* nis/rpcsvc/yp.h
    	* nis/ypclnt.c
    	* sunrpc/auth_des.c
    	* sunrpc/auth_unix.c
    	* sunrpc/authdes_prot.c
    	* sunrpc/authuxprot.c
    	* sunrpc/clnt_raw.c
    	* sunrpc/clnt_tcp.c
    	* sunrpc/clnt_udp.c
    	* sunrpc/clnt_unix.c
    	* sunrpc/key_call.c
    	* sunrpc/pm_getmaps.c
    	* sunrpc/pm_getport.c
    	* sunrpc/pmap_clnt.c
    	* sunrpc/pmap_prot2.c
    	* sunrpc/pmap_rmt.c
    	* sunrpc/proto.h
    	* sunrpc/rpc/auth.h
    	* sunrpc/rpc/clnt.h
    	* sunrpc/rpc/pmap_clnt.h
    	* sunrpc/rpc/pmap_rmt.h
    	* sunrpc/rpc/rpc_msg.h
    	* sunrpc/rpc/svc.h
    	* sunrpc/rpc/xdr.h
    	* sunrpc/rpc_clntout.c
    	* sunrpc/rpc_cmsg.c
    	* sunrpc/rpc_hout.c
    	* sunrpc/rpc_prot.c
    	* sunrpc/rpc_sample.c
    	* sunrpc/rpc_svcout.c
    	* sunrpc/svc.c
    	* sunrpc/svc_authux.c
    	* sunrpc/svc_raw.c
    	* sunrpc/svc_tcp.c
    	* sunrpc/svc_udp.c
    	* sunrpc/svc_unix.c
    	* sunrpc/xdr.c
    	* sunrpc/xdr_array.c
    	* sunrpc/xdr_mem.c
    	* sunrpc/xdr_rec.c
    	* sunrpc/xdr_ref.c
    	* sunrpc/xdr_sizeof.c
    	* sunrpc/xdr_stdio.c:
            Mechanically replace all uses of caddr_t with char *.
    
            * sunrpc/xdr_mem.c (xdrmem_create): Cast away const when
            setting xdrs->x_private and xdrs->x_base.
            * sunrpc/xdr_stdio.c (xdrstdio_getbytes): Correct argument
            types in definition to match prototype.

diff --git a/bits/typesizes.h b/bits/typesizes.h
index 4541013..a729146 100644
--- a/bits/typesizes.h
+++ b/bits/typesizes.h
@@ -50,7 +50,6 @@
 #define __TIME_T_TYPE		__SLONGWORD_TYPE
 #define __USECONDS_T_TYPE	__U32_TYPE
 #define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
-#define __DADDR_T_TYPE		__S32_TYPE
 #define __KEY_T_TYPE		__S32_TYPE
 #define __CLOCKID_T_TYPE	__S32_TYPE
 #define __TIMER_T_TYPE		void *
diff --git a/elf/dl-map-segments.h b/elf/dl-map-segments.h
index a41f066..c981e88 100644
--- a/elf/dl-map-segments.h
+++ b/elf/dl-map-segments.h
@@ -71,7 +71,7 @@ _dl_map_segments (struct link_map *l, int fd,
              handle the portion of the segment past the end of the file
              mapping.  */
           if (__glibc_unlikely
-              (__mprotect ((caddr_t) (l->l_addr + c->mapend),
+              (__mprotect ((void *) (l->l_addr + c->mapend),
                            loadcmds[nloadcmds - 1].mapstart - c->mapend,
                            PROT_NONE) < 0))
             return DL_MAP_SEGMENTS_ERROR_MPROTECT;
@@ -123,22 +123,21 @@ _dl_map_segments (struct link_map *l, int fd,
               if (__glibc_unlikely ((c->prot & PROT_WRITE) == 0))
                 {
                   /* Dag nab it.  */
-                  if (__mprotect ((caddr_t) (zero
-                                             & ~(GLRO(dl_pagesize) - 1)),
-                                  GLRO(dl_pagesize), c->prot|PROT_WRITE) < 0)
-                    return DL_MAP_SEGMENTS_ERROR_MPROTECT;
+		  if (__mprotect ((void *) (zero & ~(GLRO(dl_pagesize) - 1)),
+				  GLRO(dl_pagesize), c->prot|PROT_WRITE) < 0)
+		    return DL_MAP_SEGMENTS_ERROR_MPROTECT;
                 }
               memset ((void *) zero, '\0', zeropage - zero);
               if (__glibc_unlikely ((c->prot & PROT_WRITE) == 0))
-                __mprotect ((caddr_t) (zero & ~(GLRO(dl_pagesize) - 1)),
+                __mprotect ((void *) (zero & ~(GLRO(dl_pagesize) - 1)),
                             GLRO(dl_pagesize), c->prot);
             }
 
           if (zeroend > zeropage)
             {
               /* Map the remaining zero pages in from the zero fill FD.  */
-              caddr_t mapat;
-              mapat = __mmap ((caddr_t) zeropage, zeroend - zeropage,
+              char *mapat;
+              mapat = __mmap ((void *) zeropage, zeroend - zeropage,
                               c->prot, MAP_ANON|MAP_PRIVATE|MAP_FIXED,
                               -1, 0);
               if (__glibc_unlikely (mapat == MAP_FAILED))
diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c
index fdb1341..78d9921 100644
--- a/elf/dl-minimal.c
+++ b/elf/dl-minimal.c
@@ -65,7 +65,7 @@ malloc (size_t n)
     {
       /* Insufficient space left; allocate another page plus one extra
 	 page to reduce number of mmap calls.  */
-      caddr_t page;
+      char *page;
       size_t nup = (n + GLRO(dl_pagesize) - 1) & ~(GLRO(dl_pagesize) - 1);
       if (__glibc_unlikely (nup == 0 && n != 0))
 	return NULL;
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index e7fb8da..fb99599 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -148,7 +148,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
 {
   struct textrels
   {
-    caddr_t start;
+    char *start;
     size_t len;
     int prot;
     struct textrels *next;
@@ -198,7 +198,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
 	    newp->len = ALIGN_UP (ph->p_vaddr + ph->p_memsz, GLRO(dl_pagesize))
 			- ALIGN_DOWN (ph->p_vaddr, GLRO(dl_pagesize));
 	    newp->start = PTR_ALIGN_DOWN (ph->p_vaddr, GLRO(dl_pagesize))
-			  + (caddr_t) l->l_addr;
+			  + (char *) l->l_addr;
 
 	    newp->prot = 0;
 	    if (ph->p_flags & PF_R)
diff --git a/hurd/Makefile b/hurd/Makefile
index 99d33f9..686e154 100644
--- a/hurd/Makefile
+++ b/hurd/Makefile
@@ -89,7 +89,7 @@ CFLAGS-hurdstartup.o = $(no-stack-protector)
 CFLAGS-RPC_exec_startup_get_info.o = $(no-stack-protector)
 
 # Make generated headers compatible with all support standards
-migheaderpipe := | sed -e 's/\<ino64_t\>/__ino64_t/' -e 's/\<loff_t\>/__loff_t/'
+migheaderpipe := | sed -e 's/\<ino64_t\>/__ino64_t/' -e 's/\<loff_t\>/__off64_t/'
 include ../mach/Machrules
 include ../Rules
 
diff --git a/hurd/fd-read.c b/hurd/fd-read.c
index 594b140..f07814a 100644
--- a/hurd/fd-read.c
+++ b/hurd/fd-read.c
@@ -22,7 +22,7 @@
 #include <string.h>
 
 error_t
-_hurd_fd_read (struct hurd_fd *fd, void *buf, size_t *nbytes, loff_t offset)
+_hurd_fd_read (struct hurd_fd *fd, void *buf, size_t *nbytes, off64_t offset)
 {
   error_t err;
   char *data;
diff --git a/hurd/fd-write.c b/hurd/fd-write.c
index b258924..e485f69 100644
--- a/hurd/fd-write.c
+++ b/hurd/fd-write.c
@@ -23,7 +23,7 @@
 
 error_t
 _hurd_fd_write (struct hurd_fd *fd,
-		const void *buf, size_t *nbytes, loff_t offset)
+		const void *buf, size_t *nbytes, off64_t offset)
 {
   error_t err;
   mach_msg_type_number_t wrote;
diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h
index 779ea4f..1e32405 100644
--- a/hurd/hurd/fd.h
+++ b/hurd/hurd/fd.h
@@ -255,9 +255,11 @@ extern error_t _hurd_fd_close (struct hurd_fd *fd);
    If successful, stores the amount actually read or written in *NBYTES.  */
 
 extern error_t _hurd_fd_read (struct hurd_fd *fd,
-			      void *buf, size_t *nbytes, __loff_t offset);
+			      void *buf, size_t *nbytes,
+                              __off64_t offset);
 extern error_t _hurd_fd_write (struct hurd_fd *fd,
-			       const void *buf, size_t *nbytes, __loff_t offset);
+			       const void *buf, size_t *nbytes,
+                               __off64_t offset);
 
 
 /* Call *RPC on PORT and/or CTTY; if a call on CTTY returns EBACKGROUND,
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
index 5f32290..179a575 100644
--- a/intl/loadmsgcat.c
+++ b/intl/loadmsgcat.c
@@ -871,7 +871,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
       /* The magic number is wrong: not a message catalog file.  */
 #ifdef HAVE_MMAP
       if (use_mmap)
-	munmap ((caddr_t) data, size);
+	munmap (data, size);
       else
 #endif
 	free (data);
@@ -1237,7 +1237,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
       free (domain->malloced);
 #ifdef HAVE_MMAP
       if (use_mmap)
-	munmap ((caddr_t) data, size);
+	munmap (data, size);
       else
 #endif
 	free (data);
@@ -1307,9 +1307,10 @@ _nl_unload_domain (struct loaded_domain *domain)
 
   free (domain->malloced);
 
+  /* Casts below are necessary because domain->data is const.  */
 # ifdef _POSIX_MAPPED_FILES
   if (domain->use_mmap)
-    munmap ((caddr_t) domain->data, domain->mmap_size);
+    munmap ((void *) domain->data, domain->mmap_size);
   else
 # endif	/* _POSIX_MAPPED_FILES */
     free ((void *) domain->data);
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index 571c94e..93b39d7 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -222,8 +222,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
   /* Some systems do not have this flag; it is superfluous.  */
 #  define MAP_FILE 0
 # endif
-  filedata = __mmap ((caddr_t) 0, st.st_size,
-		     PROT_READ, MAP_FILE|MAP_COPY, fd, 0);
+  filedata = __mmap (NULL, st.st_size, PROT_READ, MAP_FILE|MAP_COPY, fd, 0);
   if (__glibc_unlikely (filedata == MAP_FAILED))
     {
       filedata = NULL;
@@ -271,7 +270,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
     {
 #ifdef _POSIX_MAPPED_FILES
       if (alloc == ld_mapped)
-	__munmap ((caddr_t) filedata, st.st_size);
+	__munmap (filedata, st.st_size);
 #endif
       return;
     }
@@ -289,14 +288,16 @@ _nl_unload_locale (struct __locale_data *locale)
   if (locale->private.cleanup)
     (*locale->private.cleanup) (locale);
 
+  /* The casts below are necessary because locale->name and
+     locale->filedata are const.  */
   switch (__builtin_expect (locale->alloc, ld_mapped))
     {
     case ld_malloced:
-      free ((void *) locale->filedata);
+      free ((char *) locale->filedata);
       break;
     case ld_mapped:
 #ifdef _POSIX_MAPPED_FILES
-      __munmap ((caddr_t) locale->filedata, locale->filesize);
+      __munmap ((char *) locale->filedata, locale->filesize);
       break;
 #endif
     case ld_archive:		/* Nothing to do.  */
diff --git a/misc/ustat.c b/misc/ustat.c
index 7336ea9..b22adb1 100644
--- a/misc/ustat.c
+++ b/misc/ustat.c
@@ -24,13 +24,7 @@
 # include <unistd.h>
 # include <errno.h>
 
-struct ustat
- {
-   __daddr_t f_tfree;         /* Number of free blocks.  */
-   __ino_t f_tinode;          /* Number of free inodes.  */
-   char f_fname[6];
-   char f_fpack[6];
-};
+struct ustat;
 
 int
 __old_ustat (dev_t dev, struct ustat *ust)
diff --git a/nis/nis_add.c b/nis/nis_add.c
index ad91ac1..15734d5 100644
--- a/nis/nis_add.c
+++ b/nis/nis_add.c
@@ -63,8 +63,8 @@ nis_add (const_nis_name name, const nis_object *obj2)
 
   status = __do_niscall (req.ns_object.ns_object_val[0].zo_domain,
 			 NIS_ADD, (xdrproc_t) _xdr_ns_request,
-			 (caddr_t) &req, (xdrproc_t) _xdr_nis_result,
-			 (caddr_t) res, MASTER_ONLY, NULL);
+			 (char *) &req, (xdrproc_t) _xdr_nis_result,
+			 (char *) res, MASTER_ONLY, NULL);
   if (status != NIS_SUCCESS)
     NIS_RES_STATUS (res) = status;
 
diff --git a/nis/nis_call.c b/nis/nis_call.c
index a48ecc3..50c5125 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -217,7 +217,7 @@ __nisbind_connect (dir_binding *dbp)
   if (dbp->clnt == NULL)
     return NIS_RPCERROR;
 
-  clnt_control (dbp->clnt, CLSET_TIMEOUT, (caddr_t) &RPCTIMEOUT);
+  clnt_control (dbp->clnt, CLSET_TIMEOUT, (char *) &RPCTIMEOUT);
   /* If the program exists, close the socket */
   if (fcntl (dbp->socket, F_SETFD, 1) == -1)
     perror ("fcntl: F_SETFD");
@@ -296,8 +296,8 @@ libnsl_hidden_nolink_def (__nisbind_create, GLIBC_2_1)
 /* __nisbind_connect (dbp) must be run before calling this function !
    So we could use the same binding twice */
 nis_error
-__do_niscall3 (dir_binding *dbp, u_long prog, xdrproc_t xargs, caddr_t req,
-	       xdrproc_t xres, caddr_t resp, unsigned int flags, nis_cb *cb)
+__do_niscall3 (dir_binding *dbp, u_long prog, xdrproc_t xargs, char *req,
+	       xdrproc_t xres, char *resp, unsigned int flags, nis_cb *cb)
 {
   enum clnt_stat result;
   nis_error retcode;
@@ -381,7 +381,7 @@ libnsl_hidden_nolink_def (__do_niscall3, GLIBC_PRIVATE)
 
 nis_error
 __do_niscall2 (const nis_server *server, u_int server_len, u_long prog,
-	       xdrproc_t xargs, caddr_t req, xdrproc_t xres, caddr_t resp,
+	       xdrproc_t xargs, char *req, xdrproc_t xres, char *resp,
 	       unsigned int flags, nis_cb *cb)
 {
   dir_binding dbp;
@@ -823,7 +823,7 @@ libnsl_hidden_nolink_def (__prepare_niscall, GLIBC_PRIVATE)
 
 nis_error
 __do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs,
-	      caddr_t req, xdrproc_t xres, caddr_t resp, unsigned int flags,
+	      char *req, xdrproc_t xres, char *resp, unsigned int flags,
 	      nis_cb *cb)
 {
   dir_binding bptr;
diff --git a/nis/nis_callback.c b/nis/nis_callback.c
index 0a78b1c..58afea8 100644
--- a/nis/nis_callback.c
+++ b/nis/nis_callback.c
@@ -121,7 +121,7 @@ cb_prog_1 (struct svc_req *rqstp, SVCXPRT *transp)
 	xdr_argument = (xdrproc_t) xdr_cback_data;
 	xdr_result = (xdrproc_t) xdr_bool;
 	memset (&argument, 0, sizeof (argument));
-	if (!svc_getargs (transp, xdr_argument, (caddr_t) & argument))
+	if (!svc_getargs (transp, xdr_argument, (char *) & argument))
 	  {
 	    svcerr_decode (transp);
 	    return;
@@ -153,7 +153,7 @@ cb_prog_1 (struct svc_req *rqstp, SVCXPRT *transp)
       xdr_argument = (xdrproc_t) xdr_void;
       xdr_result = (xdrproc_t) xdr_void;
       memset (&argument, 0, sizeof (argument));
-      if (!svc_getargs (transp, xdr_argument, (caddr_t) & argument))
+      if (!svc_getargs (transp, xdr_argument, (char *) & argument))
 	{
 	  svcerr_decode (transp);
 	  return;
@@ -167,7 +167,7 @@ cb_prog_1 (struct svc_req *rqstp, SVCXPRT *transp)
       xdr_argument = (xdrproc_t) _xdr_nis_error;
       xdr_result = (xdrproc_t) xdr_void;
       memset (&argument, 0, sizeof (argument));
-      if (!svc_getargs (transp, xdr_argument, (caddr_t) & argument))
+      if (!svc_getargs (transp, xdr_argument, (char *) & argument))
 	{
 	  svcerr_decode (transp);
 	  return;
@@ -183,7 +183,7 @@ cb_prog_1 (struct svc_req *rqstp, SVCXPRT *transp)
     }
   if (result != NULL && !svc_sendreply (transp, xdr_result, result))
     svcerr_systemerr (transp);
-  if (!svc_freeargs (transp, xdr_argument, (caddr_t) & argument))
+  if (!svc_freeargs (transp, xdr_argument, (char *) & argument))
     {
       fputs (_ ("unable to free arguments"), stderr);
       exit (1);
@@ -224,8 +224,8 @@ internal_nis_do_callback (struct dir_binding *bptr, netobj *cookie,
 	  /* See if callback 'thread' in the server is still alive. */
 	  cb_is_running = FALSE;
 	  if (clnt_call (bptr->clnt, NIS_CALLBACK, (xdrproc_t) xdr_netobj,
-			 (caddr_t) cookie, (xdrproc_t) xdr_bool,
-			 (caddr_t) &cb_is_running, TIMEOUT) != RPC_SUCCESS)
+			 (char *) cookie, (xdrproc_t) xdr_bool,
+			 (char *) &cb_is_running, TIMEOUT) != RPC_SUCCESS)
 	    cb_is_running = FALSE;
 
 	  if (cb_is_running == FALSE)
diff --git a/nis/nis_checkpoint.c b/nis/nis_checkpoint.c
index 42e262b..b03582f 100644
--- a/nis/nis_checkpoint.c
+++ b/nis/nis_checkpoint.c
@@ -60,8 +60,8 @@ nis_checkpoint (const_nis_name dirname)
 	  memset (&cpres, '\0', sizeof (cp_result));
 	  if (__do_niscall2 (&NIS_RES_OBJECT(res2)->DI_data.do_servers.do_servers_val[i],
 			     1, NIS_CHECKPOINT, (xdrproc_t) _xdr_nis_name,
-			     (caddr_t) &dirname, (xdrproc_t) _xdr_cp_result,
-			     (caddr_t) &cpres, 0, NULL) != NIS_SUCCESS)
+			     (char *) &dirname, (xdrproc_t) _xdr_cp_result,
+			     (char *) &cpres, 0, NULL) != NIS_SUCCESS)
 	    NIS_RES_STATUS (res) = NIS_RPCERROR;
 	  else
 	    {
diff --git a/nis/nis_findserv.c b/nis/nis_findserv.c
index d0ce3e8..a87f9b3 100644
--- a/nis/nis_findserv.c
+++ b/nis/nis_findserv.c
@@ -163,15 +163,15 @@ __nis_findfastest_with_timeout (dir_binding *bind,
 	      sizeof (struct sockaddr_in));
       /* Transmit to NULLPROC, return immediately. */
       clnt_call (clnt, NULLPROC,
-		 (xdrproc_t) xdr_void, (caddr_t) 0,
-		 (xdrproc_t) xdr_void, (caddr_t) 0, TIMEOUT00);
+		 (xdrproc_t) xdr_void, (char *) 0,
+		 (xdrproc_t) xdr_void, (char *) 0, TIMEOUT00);
     }
 
   while (found == -1) {
     /* Receive reply from NULLPROC asynchronously. Note null inproc. */
     int rc = clnt_call (clnt, NULLPROC,
-			(xdrproc_t) NULL, (caddr_t) 0,
-			(xdrproc_t) xdr_void, (caddr_t) 0,
+			(xdrproc_t) NULL, (char *) 0,
+			(xdrproc_t) xdr_void, (char *) 0,
 			*timeout);
     if (RPC_SUCCESS == rc) {
       uint32_t val;
diff --git a/nis/nis_intern.h b/nis/nis_intern.h
index fcd60cb..6c0e234 100644
--- a/nis/nis_intern.h
+++ b/nis/nis_intern.h
@@ -54,16 +54,16 @@ typedef struct nis_cb nis_cb;
 extern unsigned long int inetstr2int (const char *str);
 extern long int __nis_findfastest (dir_binding *bind);
 extern nis_error __do_niscall2 (const nis_server *serv, u_int serv_len,
-				u_long prog, xdrproc_t xargs, caddr_t req,
-				xdrproc_t xres, caddr_t resp,
+				u_long prog, xdrproc_t xargs, char *req,
+				xdrproc_t xres, char *resp,
 				unsigned int flags, nis_cb *cb);
 extern nis_error __do_niscall (const_nis_name name, u_long prog,
-			       xdrproc_t xargs, caddr_t req,
-			       xdrproc_t xres, caddr_t resp,
+			       xdrproc_t xargs, char *req,
+			       xdrproc_t xres, char *resp,
 			       unsigned int flags, nis_cb *cb);
 extern nis_error __do_niscall3 (dir_binding *dbp, u_long prog,
-				xdrproc_t xargs, caddr_t req,
-				xdrproc_t xres, caddr_t resp,
+				xdrproc_t xargs, char *req,
+				xdrproc_t xres, char *resp,
 				unsigned int flags, nis_cb *cb);
 libnsl_hidden_proto (__do_niscall3)
 
diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c
index de5eb19..8871be7 100644
--- a/nis/nis_lookup.c
+++ b/nis/nis_lookup.c
@@ -78,8 +78,8 @@ nis_lookup (const_nis_name name, const unsigned int flags)
 	again:
 	  result = clnt_call (bptr.clnt, NIS_LOOKUP,
 			      (xdrproc_t) _xdr_ns_request,
-			      (caddr_t) &req, (xdrproc_t) _xdr_nis_result,
-			      (caddr_t) res, RPCTIMEOUT);
+			      (char *) &req, (xdrproc_t) _xdr_nis_result,
+			      (char *) res, RPCTIMEOUT);
 
 	  if (result != RPC_SUCCESS)
 	    status = NIS_RPCERROR;
diff --git a/nis/nis_mkdir.c b/nis/nis_mkdir.c
index 84630b4..a6daf8a 100644
--- a/nis/nis_mkdir.c
+++ b/nis/nis_mkdir.c
@@ -29,13 +29,13 @@ nis_mkdir (const_nis_name dir, const nis_server *server)
 
   if (server == NULL)
     res2 = __do_niscall (dir, NIS_MKDIR, (xdrproc_t) _xdr_nis_name,
-			 (caddr_t) &dir, (xdrproc_t) _xdr_nis_error,
-			 (caddr_t) &res, 0, NULL);
+			 (char *) &dir, (xdrproc_t) _xdr_nis_error,
+			 (char *) &res, 0, NULL);
   else
     res2 = __do_niscall2 (server, 1, NIS_MKDIR,
 			  (xdrproc_t) _xdr_nis_name,
-			  (caddr_t) &dir, (xdrproc_t) _xdr_nis_error,
-			  (caddr_t) &res, 0, NULL);
+			  (char *) &dir, (xdrproc_t) _xdr_nis_error,
+			  (char *) &res, 0, NULL);
   if (res2 != NIS_SUCCESS)
     return res2;
 
diff --git a/nis/nis_modify.c b/nis/nis_modify.c
index bb10ff1..d008797 100644
--- a/nis/nis_modify.c
+++ b/nis/nis_modify.c
@@ -62,8 +62,8 @@ nis_modify (const_nis_name name, const nis_object *obj2)
   req.ns_object.ns_object_len = 1;
 
   status = __do_niscall (name, NIS_MODIFY, (xdrproc_t) _xdr_ns_request,
-			 (caddr_t) & req, (xdrproc_t) _xdr_nis_result,
-			 (caddr_t) res, MASTER_ONLY,
+			 (char *) & req, (xdrproc_t) _xdr_nis_result,
+			 (char *) res, MASTER_ONLY,
 			 NULL);
   if (status != NIS_SUCCESS)
     NIS_RES_STATUS (res) = status;
diff --git a/nis/nis_ping.c b/nis/nis_ping.c
index 1d388d8..e2cb50b 100644
--- a/nis/nis_ping.c
+++ b/nis/nis_ping.c
@@ -64,8 +64,8 @@ nis_ping (const_nis_name dirname, unsigned int utime,
   for (i = 1; i < obj->DI_data.do_servers.do_servers_len; ++i)
     __do_niscall2 (&obj->DI_data.do_servers.do_servers_val[i], 1,
 		   NIS_PING, (xdrproc_t) _xdr_ping_args,
-		   (caddr_t) &args, (xdrproc_t) xdr_void,
-		   (caddr_t) NULL, 0, NULL);
+		   (char *) &args, (xdrproc_t) xdr_void,
+		   (char *) NULL, 0, NULL);
   nis_freeresult (res);
 }
 libnsl_hidden_nolink_def (nis_ping, GLIBC_2_1)
diff --git a/nis/nis_remove.c b/nis/nis_remove.c
index d879af1..5f4d507 100644
--- a/nis/nis_remove.c
+++ b/nis/nis_remove.c
@@ -47,8 +47,8 @@ nis_remove (const_nis_name name, const nis_object *obj)
     }
 
   if ((status = __do_niscall (name, NIS_REMOVE, (xdrproc_t) _xdr_ns_request,
-			      (caddr_t) &req, (xdrproc_t) _xdr_nis_result,
-			      (caddr_t) res, MASTER_ONLY,
+			      (char *) &req, (xdrproc_t) _xdr_nis_result,
+			      (char *) res, MASTER_ONLY,
 			      NULL)) != NIS_SUCCESS)
     NIS_RES_STATUS (res) = status;
 
diff --git a/nis/nis_rmdir.c b/nis/nis_rmdir.c
index 4063ebe..ebeddc6 100644
--- a/nis/nis_rmdir.c
+++ b/nis/nis_rmdir.c
@@ -32,8 +32,8 @@ nis_rmdir (const_nis_name dir, const nis_server *server)
 
   res2 = __do_niscall2 (server, 1, NIS_RMDIR,
 			(xdrproc_t) _xdr_nis_name,
-			(caddr_t) &dir, (xdrproc_t) _xdr_nis_error,
-			(caddr_t) &res, 0, NULL);
+			(char *) &dir, (xdrproc_t) _xdr_nis_error,
+			(char *) &res, 0, NULL);
   if (res2 != NIS_SUCCESS)
     return res2;
 
diff --git a/nis/nis_server.c b/nis/nis_server.c
index 537c7b3..a9ed987 100644
--- a/nis/nis_server.c
+++ b/nis/nis_server.c
@@ -40,8 +40,8 @@ nis_servstate (const nis_server *serv, const nis_tag *tags,
     return NIS_BADOBJECT;
 
   if (__do_niscall2 (serv, 1, NIS_SERVSTATE, (xdrproc_t) _xdr_nis_taglist,
-		     (caddr_t) &taglist, (xdrproc_t) _xdr_nis_taglist,
-		     (caddr_t) &tagres, 0, NULL) != NIS_SUCCESS)
+		     (char *) &taglist, (xdrproc_t) _xdr_nis_taglist,
+		     (char *) &tagres, 0, NULL) != NIS_SUCCESS)
     return NIS_RPCERROR;
 
   *result = tagres.tags.tags_val;
@@ -67,8 +67,8 @@ nis_stats (const nis_server *serv, const nis_tag *tags,
     return NIS_BADOBJECT;
 
   if (__do_niscall2 (serv, 1, NIS_STATUS, (xdrproc_t) _xdr_nis_taglist,
-		     (caddr_t) &taglist, (xdrproc_t) _xdr_nis_taglist,
-		     (caddr_t) &tagres, 0, NULL) != NIS_SUCCESS)
+		     (char *) &taglist, (xdrproc_t) _xdr_nis_taglist,
+		     (char *) &tagres, 0, NULL) != NIS_SUCCESS)
     return NIS_RPCERROR;
 
   *result = tagres.tags.tags_val;
diff --git a/nis/nis_table.c b/nis/nis_table.c
index c443f53..f31075f 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -146,8 +146,8 @@ get_tablepath (char *name, dir_binding *bptr)
   req.ns_object.ns_object_val = NULL;
 
   result = clnt_call (bptr->clnt, NIS_LOOKUP, (xdrproc_t) _xdr_ns_request,
-		      (caddr_t) &req, (xdrproc_t) _xdr_nis_result,
-		      (caddr_t) &res, RPCTIMEOUT);
+		      (char *) &req, (xdrproc_t) _xdr_nis_result,
+		      (char *) &res, RPCTIMEOUT);
 
   const char *cptr;
   if (result == RPC_SUCCESS && NIS_RES_STATUS (&res) == NIS_SUCCESS
@@ -308,9 +308,9 @@ nis_list (const_nis_name name, unsigned int flags,
 
     again:
       clnt_status = clnt_call (bptr.clnt, NIS_IBLIST,
-			       (xdrproc_t) _xdr_ib_request, (caddr_t) ibreq,
+			       (xdrproc_t) _xdr_ib_request, (char *) ibreq,
 			       (xdrproc_t) _xdr_nis_result,
-			       (caddr_t) res, RPCTIMEOUT);
+			       (char *) res, RPCTIMEOUT);
 
       if (__glibc_unlikely (clnt_status != RPC_SUCCESS))
 	NIS_RES_STATUS (res) = NIS_RPCERROR;
@@ -604,9 +604,9 @@ nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags)
 
   nis_error status = __do_niscall (ibreq->ibr_name, NIS_IBADD,
 				   (xdrproc_t) _xdr_ib_request,
-				   (caddr_t) ibreq,
+				   (char *) ibreq,
 				   (xdrproc_t) _xdr_nis_result,
-				   (caddr_t) res, 0, NULL);
+				   (char *) res, 0, NULL);
   if (__glibc_unlikely (status != NIS_SUCCESS))
     NIS_RES_STATUS (res) = status;
 
@@ -663,8 +663,8 @@ nis_modify_entry (const_nis_name name, const nis_object *obj2,
 
   status = __do_niscall (ibreq->ibr_name, NIS_IBMODIFY,
 			 (xdrproc_t) _xdr_ib_request,
-			 (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
-			 (caddr_t) res, 0, NULL);
+			 (char *) ibreq, (xdrproc_t) _xdr_nis_result,
+			 (char *) res, 0, NULL);
   if (__glibc_unlikely (status != NIS_SUCCESS))
     NIS_RES_STATUS (res) = status;
 
@@ -713,8 +713,8 @@ nis_remove_entry (const_nis_name name, const nis_object *obj,
 
   if ((status = __do_niscall (ibreq->ibr_name, NIS_IBREMOVE,
 			      (xdrproc_t) _xdr_ib_request,
-			      (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
-			      (caddr_t) res, 0, NULL)) != NIS_SUCCESS)
+			      (char *) ibreq, (xdrproc_t) _xdr_nis_result,
+			      (char *) res, 0, NULL)) != NIS_SUCCESS)
     NIS_RES_STATUS (res) = status;
 
   nis_free_request (ibreq);
@@ -749,8 +749,8 @@ nis_first_entry (const_nis_name name)
 
   status = __do_niscall (ibreq->ibr_name, NIS_IBFIRST,
 			 (xdrproc_t) _xdr_ib_request,
-			 (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
-			 (caddr_t) res, 0, NULL);
+			 (char *) ibreq, (xdrproc_t) _xdr_nis_result,
+			 (char *) res, 0, NULL);
 
   if (__glibc_unlikely (status != NIS_SUCCESS))
     NIS_RES_STATUS (res) = status;
@@ -793,8 +793,8 @@ nis_next_entry (const_nis_name name, const netobj *cookie)
 
   status = __do_niscall (ibreq->ibr_name, NIS_IBNEXT,
 			 (xdrproc_t) _xdr_ib_request,
-			 (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result,
-			 (caddr_t) res, 0, NULL);
+			 (char *) ibreq, (xdrproc_t) _xdr_nis_result,
+			 (char *) res, 0, NULL);
 
   if (__glibc_unlikely (status != NIS_SUCCESS))
     NIS_RES_STATUS (res) = status;
diff --git a/nis/nis_util.c b/nis/nis_util.c
index fdce926..550c563 100644
--- a/nis/nis_util.c
+++ b/nis/nis_util.c
@@ -39,8 +39,8 @@ __nis_finddirectory (directory_obj *dir, const_nis_name name)
   status = __do_niscall2 (dir->do_servers.do_servers_val,
 			  dir->do_servers.do_servers_len,
 			  NIS_FINDDIRECTORY, (xdrproc_t) _xdr_fd_args,
-			  (caddr_t) &fd_args, (xdrproc_t) _xdr_fd_result,
-			  (caddr_t) fd_res, NO_AUTHINFO|USE_DGRAM, NULL);
+			  (char *) &fd_args, (xdrproc_t) _xdr_fd_result,
+			  (char *) fd_res, NO_AUTHINFO|USE_DGRAM, NULL);
   if (status != NIS_SUCCESS)
     fd_res->status = status;
 
diff --git a/nis/nss_nisplus/nisplus-grp.c b/nis/nss_nisplus/nisplus-grp.c
index b7d7aa8..e448819 100644
--- a/nis/nss_nisplus/nisplus-grp.c
+++ b/nis/nss_nisplus/nisplus-grp.c
@@ -188,9 +188,9 @@ internal_nisplus_getgrent_r (struct group *gr, char *buffer, size_t buflen,
 
 	  status = __do_niscall3 (&bptr, NIS_IBFIRST,
 				  (xdrproc_t) _xdr_ib_request,
-				  (caddr_t) ibreq,
+				  (char *) ibreq,
 				  (xdrproc_t) _xdr_nis_result,
-				  (caddr_t) &result,
+				  (char *) &result,
 				  0, NULL);
 	}
       else
@@ -200,9 +200,9 @@ internal_nisplus_getgrent_r (struct group *gr, char *buffer, size_t buflen,
 
 	  status = __do_niscall3 (&bptr, NIS_IBNEXT,
 				  (xdrproc_t) _xdr_ib_request,
-				  (caddr_t) ibreq,
+				  (char *) ibreq,
 				  (xdrproc_t) _xdr_nis_result,
-				  (caddr_t) &result,
+				  (char *) &result,
 				  0, NULL);
 
 	  ibreq->ibr_cookie.n_bytes = NULL;
diff --git a/nis/nss_nisplus/nisplus-pwd.c b/nis/nss_nisplus/nisplus-pwd.c
index 736e466..da4c6c3 100644
--- a/nis/nss_nisplus/nisplus-pwd.c
+++ b/nis/nss_nisplus/nisplus-pwd.c
@@ -188,9 +188,9 @@ internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen,
 
 	  status = __do_niscall3 (&bptr, NIS_IBFIRST,
 				  (xdrproc_t) _xdr_ib_request,
-				  (caddr_t) ibreq,
+				  (char *) ibreq,
 				  (xdrproc_t) _xdr_nis_result,
-				  (caddr_t) &result,
+				  (char *) &result,
 				  0, NULL);
 	}
       else
@@ -200,9 +200,9 @@ internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen,
 
 	  status = __do_niscall3 (&bptr, NIS_IBNEXT,
 				  (xdrproc_t) _xdr_ib_request,
-				  (caddr_t) ibreq,
+				  (char *) ibreq,
 				  (xdrproc_t) _xdr_nis_result,
-				  (caddr_t) &result,
+				  (char *) &result,
 				  0, NULL);
 
 	  ibreq->ibr_cookie.n_bytes = NULL;
diff --git a/nis/rpcsvc/nis_callback.h b/nis/rpcsvc/nis_callback.h
index 6f05728..ecbd367 100644
--- a/nis/rpcsvc/nis_callback.h
+++ b/nis/rpcsvc/nis_callback.h
@@ -60,7 +60,7 @@ extern  void * cbproc_finish_1_svc (void *, struct svc_req *) __THROW;
 #define CBPROC_ERROR 3
 extern  void * cbproc_error_1 (nis_error *, CLIENT *) __THROW;
 extern  void * cbproc_error_1_svc (nis_error *, struct svc_req *) __THROW;
-extern int cb_prog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t) __THROW;
+extern int cb_prog_1_freeresult (SVCXPRT *, xdrproc_t, char *) __THROW;
 
 /* the xdr functions */
 
diff --git a/nis/rpcsvc/yp.h b/nis/rpcsvc/yp.h
index 968b74c..407e1fd 100644
--- a/nis/rpcsvc/yp.h
+++ b/nis/rpcsvc/yp.h
@@ -278,7 +278,7 @@ extern  ypresp_order *ypproc_order_2_svc (ypreq_nokey *, struct svc_req *);
 #define YPPROC_MAPLIST 11
 extern  ypresp_maplist *ypproc_maplist_2 (domainname *, CLIENT *);
 extern  ypresp_maplist *ypproc_maplist_2_svc (domainname *, struct svc_req *);
-extern int ypprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+extern int ypprog_2_freeresult (SVCXPRT *, xdrproc_t, char *);
 
 
 #define YPPUSH_XFRRESPPROG (0x40000000)
@@ -290,7 +290,7 @@ extern  void *yppushproc_null_1_svc (void *, struct svc_req *);
 #define YPPUSHPROC_XFRRESP 1
 extern  void *yppushproc_xfrresp_1 (yppushresp_xfr *, CLIENT *);
 extern  void *yppushproc_xfrresp_1_svc (yppushresp_xfr *, struct svc_req *);
-extern int yppush_xfrrespprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+extern int yppush_xfrrespprog_1_freeresult (SVCXPRT *, xdrproc_t, char *);
 
 
 #define YPBINDPROG 100007
@@ -305,7 +305,7 @@ extern  ypbind_resp *ypbindproc_domain_2_svc (domainname *, struct svc_req *);
 #define YPBINDPROC_SETDOM 2
 extern  void *ypbindproc_setdom_2 (ypbind_setdom *, CLIENT *);
 extern  void *ypbindproc_setdom_2_svc (ypbind_setdom *, struct svc_req *);
-extern int ypbindprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+extern int ypbindprog_2_freeresult (SVCXPRT *, xdrproc_t, char *);
 
 
 extern  bool_t xdr_ypstat (XDR *, ypstat*);
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 3201e37..55cae51 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -126,9 +126,9 @@ yp_bind_ypbindprog (const char *domain, dom_binding *ysd)
     }
 
   if (clnt_call (client, YPBINDPROC_DOMAIN,
-		 (xdrproc_t) xdr_domainname, (caddr_t) &domain,
+		 (xdrproc_t) xdr_domainname, (char *) &domain,
 		 (xdrproc_t) xdr_ypbind_resp,
-		 (caddr_t) &ypbr, RPCTIMEOUT) != RPC_SUCCESS)
+		 (char *) &ypbr, RPCTIMEOUT) != RPC_SUCCESS)
     {
       clnt_destroy (client);
       return YPERR_YPBIND;
@@ -271,7 +271,7 @@ libnsl_hidden_nolink_def(yp_unbind, GLIBC_2_0)
 
 static int
 __ypclnt_call (const char *domain, u_long prog, xdrproc_t xargs,
-	       caddr_t req, xdrproc_t xres, caddr_t resp, dom_binding **ydb,
+	       char *req, xdrproc_t xres, char *resp, dom_binding **ydb,
 	       int print_error)
 {
   enum clnt_stat result;
@@ -294,7 +294,7 @@ __ypclnt_call (const char *domain, u_long prog, xdrproc_t xargs,
 
 static int
 do_ypcall (const char *domain, u_long prog, xdrproc_t xargs,
-	   caddr_t req, xdrproc_t xres, caddr_t resp)
+	   char *req, xdrproc_t xres, char *resp)
 {
   dom_binding *ydb;
   int status;
@@ -365,7 +365,7 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs,
 /* Like do_ypcall, but translate the status value if necessary.  */
 static int
 do_ypcall_tr (const char *domain, u_long prog, xdrproc_t xargs,
-	      caddr_t req, xdrproc_t xres, caddr_t resp)
+	      char *req, xdrproc_t xres, char *resp)
 {
   int status = do_ypcall (domain, prog, xargs, req, xres, resp);
   if (status == YPERR_SUCCESS)
@@ -451,8 +451,8 @@ yp_match (const char *indomain, const char *inmap, const char *inkey,
   memset (&resp, '\0', sizeof (resp));
 
   result = do_ypcall_tr (indomain, YPPROC_MATCH, (xdrproc_t) xdr_ypreq_key,
-			 (caddr_t) &req, (xdrproc_t) xdr_ypresp_val,
-			 (caddr_t) &resp);
+			 (char *) &req, (xdrproc_t) xdr_ypresp_val,
+			 (char *) &resp);
 
   if (result != YPERR_SUCCESS)
     return result;
@@ -493,8 +493,8 @@ yp_first (const char *indomain, const char *inmap, char **outkey,
   memset (&resp, '\0', sizeof (resp));
 
   result = do_ypcall (indomain, YPPROC_FIRST, (xdrproc_t) xdr_ypreq_nokey,
-		      (caddr_t) &req, (xdrproc_t) xdr_ypresp_key_val,
-		      (caddr_t) &resp);
+		      (char *) &req, (xdrproc_t) xdr_ypresp_key_val,
+		      (char *) &resp);
 
   if (result != RPC_SUCCESS)
     return YPERR_RPC;
@@ -552,8 +552,8 @@ yp_next (const char *indomain, const char *inmap, const char *inkey,
   memset (&resp, '\0', sizeof (resp));
 
   result = do_ypcall_tr (indomain, YPPROC_NEXT, (xdrproc_t) xdr_ypreq_key,
-			 (caddr_t) &req, (xdrproc_t) xdr_ypresp_key_val,
-			 (caddr_t) &resp);
+			 (char *) &req, (xdrproc_t) xdr_ypresp_key_val,
+			 (char *) &resp);
 
   if (result != YPERR_SUCCESS)
     return result;
@@ -602,8 +602,8 @@ yp_master (const char *indomain, const char *inmap, char **outname)
   memset (&resp, '\0', sizeof (ypresp_master));
 
   result = do_ypcall_tr (indomain, YPPROC_MASTER, (xdrproc_t) xdr_ypreq_nokey,
-			 (caddr_t) &req, (xdrproc_t) xdr_ypresp_master,
-			 (caddr_t) &resp);
+			 (char *) &req, (xdrproc_t) xdr_ypresp_master,
+			 (char *) &resp);
 
   if (result != YPERR_SUCCESS)
     return result;
@@ -632,8 +632,8 @@ yp_order (const char *indomain, const char *inmap, unsigned int *outorder)
   memset (&resp, '\0', sizeof (resp));
 
   result = do_ypcall_tr (indomain, YPPROC_ORDER, (xdrproc_t) xdr_ypreq_nokey,
-			 (caddr_t) &req, (xdrproc_t) xdr_ypresp_order,
-			 (caddr_t) &resp);
+			 (char *) &req, (xdrproc_t) xdr_ypresp_order,
+			 (char *) &resp);
 
   if (result != YPERR_SUCCESS)
     return result;
@@ -760,8 +760,8 @@ yp_all (const char *indomain, const char *inmap,
       data.data = (void *) incallback->data;
 
       result = clnt_call (clnt, YPPROC_ALL, (xdrproc_t) xdr_ypreq_nokey,
-			  (caddr_t) &req, (xdrproc_t) __xdr_ypresp_all,
-			  (caddr_t) &data, RPCTIMEOUT);
+			  (char *) &req, (xdrproc_t) __xdr_ypresp_all,
+			  (char *) &data, RPCTIMEOUT);
 
       if (__glibc_unlikely (result != RPC_SUCCESS))
 	{
@@ -801,8 +801,8 @@ yp_maplist (const char *indomain, struct ypmaplist **outmaplist)
   memset (&resp, '\0', sizeof (resp));
 
   result = do_ypcall_tr (indomain, YPPROC_MAPLIST, (xdrproc_t) xdr_domainname,
-			 (caddr_t) &indomain, (xdrproc_t) xdr_ypresp_maplist,
-			 (caddr_t) &resp);
+			 (char *) &indomain, (xdrproc_t) xdr_ypresp_maplist,
+			 (char *) &resp);
 
   if (__glibc_likely (result == YPERR_SUCCESS))
     {
@@ -1007,8 +1007,8 @@ yp_update (char *domain, char *map, unsigned ypop,
     clnt->cl_auth = authunix_create_default ();
 
 again:
-  r = clnt_call (clnt, ypop, xdr_argument, (caddr_t) &args,
-		 (xdrproc_t) xdr_u_int, (caddr_t) &res, RPCTIMEOUT);
+  r = clnt_call (clnt, ypop, xdr_argument, (char *) &args,
+		 (xdrproc_t) xdr_u_int, (char *) &res, RPCTIMEOUT);
 
   if (r == RPC_AUTHERROR)
     {
diff --git a/posix/bits/types.h b/posix/bits/types.h
index 4521d9d..9ddbe87 100644
--- a/posix/bits/types.h
+++ b/posix/bits/types.h
@@ -161,7 +161,6 @@ __STD_TYPE __TIME_T_TYPE __time_t;	/* Seconds since the Epoch.  */
 __STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds.  */
 __STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds.  */
 
-__STD_TYPE __DADDR_T_TYPE __daddr_t;	/* The type of a disk address.  */
 __STD_TYPE __KEY_T_TYPE __key_t;	/* Type of an IPC key.  */
 
 /* Clock ID used in clock and timer functions.  */
@@ -200,7 +199,8 @@ __STD_TYPE __SYSCALL_ULONG_TYPE __syscall_ulong_t;
 /* These few don't really vary by system, they always correspond
    to one of the other defined types.  */
 typedef __off64_t __loff_t;	/* Type of file sizes and offsets (LFS).  */
-typedef char *__caddr_t;
+typedef char *__caddr_t;                /* Type of a memory address (BSD).  */
+__STD_TYPE __S32_TYPE __daddr_t;	/* Type of a disk address (BSD).  */
 
 /* Duplicates info from stdint.h but this is used in unistd.h.  */
 __STD_TYPE __SWORD_TYPE __intptr_t;
diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
index 4317aa3..bf5e114 100755
--- a/scripts/check-obsolete-constructs.py
+++ b/scripts/check-obsolete-constructs.py
@@ -18,7 +18,10 @@
 
 """Verifies that installed headers do not use any obsolete constructs:
  * legacy BSD typedefs superseded by <stdint.h>:
-   ushort uint ulong u_char u_short u_int u_long u_intNN_t quad_t u_quad_t
+      ushort uint ulong
+      u_char u_short u_int u_long
+      u_intNN_t quad_t u_quad_t
+      caddr_t daddr_t loff_t register_t
    (sys/types.h is allowed to _define_ these types, but not to use them
     to define anything else).
 """
@@ -254,6 +257,8 @@ class NoCheck(ConstructChecker):
 OBSOLETE_TYPE_RE_ = re.compile(r"""\A
   (__)?
   (   quad_t
+    | [cd]addr_t
+    | loff_t
     | register_t
     | u(?: short | int | long
          | _(?: char | short | int(?:[0-9]+_t)? | long | quad_t )))
diff --git a/sunrpc/auth_des.c b/sunrpc/auth_des.c
index 5b6f985..7e77f51 100644
--- a/sunrpc/auth_des.c
+++ b/sunrpc/auth_des.c
@@ -189,7 +189,7 @@ authdes_pk_create (const char *servername, netobj *pkey, u_int window,
   auth->ah_cred.oa_flavor = AUTH_DES;
   auth->ah_verf.oa_flavor = AUTH_DES;
   auth->ah_ops = (struct auth_ops *) &authdes_ops;
-  auth->ah_private = (caddr_t) ad;
+  auth->ah_private = (char *) ad;
 
   if (!authdes_refresh (auth))
     goto failed;
diff --git a/sunrpc/auth_unix.c b/sunrpc/auth_unix.c
index b035fdd..15de6d0 100644
--- a/sunrpc/auth_unix.c
+++ b/sunrpc/auth_unix.c
@@ -115,7 +115,7 @@ no_memory:
       return NULL;
     }
   auth->ah_ops = (struct auth_ops *) &auth_unix_ops;
-  auth->ah_private = (caddr_t) au;
+  auth->ah_private = (char *) au;
   auth->ah_verf = au->au_shcred = _null_auth;
   au->au_shfaults = 0;
 
@@ -329,7 +329,7 @@ authunix_destroy (AUTH *auth)
   if (auth->ah_verf.oa_base != NULL)
     mem_free (auth->ah_verf.oa_base, auth->ah_verf.oa_length);
 
-  mem_free ((caddr_t) auth, sizeof (*auth));
+  mem_free ((char *) auth, sizeof (*auth));
 }
 
 /*
diff --git a/sunrpc/authdes_prot.c b/sunrpc/authdes_prot.c
index 93b7cfc..bc23622 100644
--- a/sunrpc/authdes_prot.c
+++ b/sunrpc/authdes_prot.c
@@ -51,13 +51,13 @@ xdr_authdes_cred (XDR *xdrs, struct authdes_cred *cred)
     {
     case ADN_FULLNAME:
       ATTEMPT (xdr_string (xdrs, &cred->adc_fullname.name, MAXNETNAMELEN));
-      ATTEMPT (xdr_opaque (xdrs, (caddr_t) & cred->adc_fullname.key,
+      ATTEMPT (xdr_opaque (xdrs, (char *) & cred->adc_fullname.key,
 			   sizeof (des_block)));
-      ATTEMPT (xdr_opaque (xdrs, (caddr_t) & cred->adc_fullname.window,
+      ATTEMPT (xdr_opaque (xdrs, (char *) & cred->adc_fullname.window,
 			   sizeof (cred->adc_fullname.window)));
       return (TRUE);
     case ADN_NICKNAME:
-      ATTEMPT (xdr_opaque (xdrs, (caddr_t) & cred->adc_nickname,
+      ATTEMPT (xdr_opaque (xdrs, (char *) & cred->adc_nickname,
 			   sizeof (cred->adc_nickname)));
       return TRUE;
     default:
@@ -73,9 +73,9 @@ xdr_authdes_verf (register XDR *xdrs, register struct authdes_verf *verf)
   /*
    * Unrolled xdr
    */
-  ATTEMPT (xdr_opaque (xdrs, (caddr_t) & verf->adv_xtimestamp,
+  ATTEMPT (xdr_opaque (xdrs, (char *) & verf->adv_xtimestamp,
 		       sizeof (des_block)));
-  ATTEMPT (xdr_opaque (xdrs, (caddr_t) & verf->adv_int_u,
+  ATTEMPT (xdr_opaque (xdrs, (char *) & verf->adv_int_u,
 		       sizeof (verf->adv_int_u)));
   return TRUE;
 }
diff --git a/sunrpc/authuxprot.c b/sunrpc/authuxprot.c
index 14fe9f5..41fd999 100644
--- a/sunrpc/authuxprot.c
+++ b/sunrpc/authuxprot.c
@@ -54,7 +54,7 @@ xdr_authunix_parms (XDR * xdrs, struct authunix_parms *p)
       && (sizeof (gid_t) == sizeof (short int)
 	  ? xdr_u_short (xdrs, (u_short *) & (p->aup_gid))
 	  : xdr_u_int (xdrs, (u_int *) & (p->aup_gid)))
-      && xdr_array (xdrs, (caddr_t *) & (p->aup_gids),
+      && xdr_array (xdrs, (char **) & (p->aup_gids),
 		    & (p->aup_len), NGRPS, sizeof (gid_t),
 		    (sizeof (gid_t) == sizeof (short int)
 		     ? (xdrproc_t) xdr_u_short
diff --git a/sunrpc/clnt_raw.c b/sunrpc/clnt_raw.c
index 5b9bd48..a723dc2 100644
--- a/sunrpc/clnt_raw.c
+++ b/sunrpc/clnt_raw.c
@@ -61,11 +61,11 @@ struct clntraw_private_s
   };
 #define clntraw_private RPC_THREAD_VARIABLE(clntraw_private_s)
 
-static enum clnt_stat clntraw_call (CLIENT *, u_long, xdrproc_t, caddr_t,
-				    xdrproc_t, caddr_t, struct timeval);
+static enum clnt_stat clntraw_call (CLIENT *, u_long, xdrproc_t, char *,
+				    xdrproc_t, char *, struct timeval);
 static void clntraw_abort (void);
 static void clntraw_geterr (CLIENT *, struct rpc_err *);
-static bool_t clntraw_freeres (CLIENT *, xdrproc_t, caddr_t);
+static bool_t clntraw_freeres (CLIENT *, xdrproc_t, char *);
 static bool_t clntraw_control (CLIENT *, int, char *);
 static void clntraw_destroy (CLIENT *);
 
@@ -129,8 +129,8 @@ clntraw_create (u_long prog, u_long vers)
 libc_hidden_nolink_sunrpc (clntraw_create, GLIBC_2_0)
 
 static enum clnt_stat
-clntraw_call (CLIENT *h, u_long proc, xdrproc_t xargs, caddr_t argsp,
-	      xdrproc_t xresults, caddr_t resultsp, struct timeval timeout)
+clntraw_call (CLIENT *h, u_long proc, xdrproc_t xargs, char *argsp,
+	      xdrproc_t xresults, char *resultsp, struct timeval timeout)
 {
   struct clntraw_private_s *clp = clntraw_private;
   XDR *xdrs = &clp->xdr_stream;
@@ -214,7 +214,7 @@ clntraw_geterr (CLIENT *cl, struct rpc_err *err)
 
 
 static bool_t
-clntraw_freeres (CLIENT *cl, xdrproc_t xdr_res, caddr_t res_ptr)
+clntraw_freeres (CLIENT *cl, xdrproc_t xdr_res, char *res_ptr)
 {
   struct clntraw_private_s *clp = clntraw_private;
   XDR *xdrs = &clp->xdr_stream;
diff --git a/sunrpc/clnt_tcp.c b/sunrpc/clnt_tcp.c
index 249e9c3..4b3533e 100644
--- a/sunrpc/clnt_tcp.c
+++ b/sunrpc/clnt_tcp.c
@@ -76,11 +76,11 @@ struct ct_data
 static int readtcp (char *, char *, int);
 static int writetcp (char *, char *, int);
 
-static enum clnt_stat clnttcp_call (CLIENT *, u_long, xdrproc_t, caddr_t,
-				    xdrproc_t, caddr_t, struct timeval);
+static enum clnt_stat clnttcp_call (CLIENT *, u_long, xdrproc_t, char *,
+				    xdrproc_t, char *, struct timeval);
 static void clnttcp_abort (void);
 static void clnttcp_geterr (CLIENT *, struct rpc_err *);
-static bool_t clnttcp_freeres (CLIENT *, xdrproc_t, caddr_t);
+static bool_t clnttcp_freeres (CLIENT *, xdrproc_t, char *);
 static bool_t clnttcp_control (CLIENT *, int, char *);
 static void clnttcp_destroy (CLIENT *);
 
@@ -135,8 +135,8 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers,
       u_short port;
       if ((port = pmap_getport (raddr, prog, vers, IPPROTO_TCP)) == 0)
 	{
-	  mem_free ((caddr_t) ct, sizeof (struct ct_data));
-	  mem_free ((caddr_t) h, sizeof (CLIENT));
+	  mem_free ((char *) ct, sizeof (struct ct_data));
+	  mem_free ((char *) h, sizeof (CLIENT));
 	  return ((CLIENT *) NULL);
 	}
       raddr->sin_port = htons (port);
@@ -204,9 +204,9 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers,
    * and authnone for authentication.
    */
   xdrrec_create (&(ct->ct_xdrs), sendsz, recvsz,
-		 (caddr_t) ct, readtcp, writetcp);
+		 (char *) ct, readtcp, writetcp);
   h->cl_ops = (struct clnt_ops *) &tcp_ops;
-  h->cl_private = (caddr_t) ct;
+  h->cl_private = (char *) ct;
   h->cl_auth = authnone_create ();
   return h;
 
@@ -214,8 +214,8 @@ fooy:
   /*
    * Something goofed, free stuff and barf
    */
-  mem_free ((caddr_t) ct, sizeof (struct ct_data));
-  mem_free ((caddr_t) h, sizeof (CLIENT));
+  mem_free ((char *) ct, sizeof (struct ct_data));
+  mem_free ((char *) h, sizeof (CLIENT));
   return ((CLIENT *) NULL);
 }
 #ifdef EXPORT_RPC_SYMBOLS
@@ -225,8 +225,8 @@ libc_hidden_nolink_sunrpc (clnttcp_create, GLIBC_2_0)
 #endif
 
 static enum clnt_stat
-clnttcp_call (CLIENT *h, u_long proc, xdrproc_t xdr_args, caddr_t args_ptr,
-	      xdrproc_t xdr_results, caddr_t results_ptr,
+clnttcp_call (CLIENT *h, u_long proc, xdrproc_t xdr_args, char *args_ptr,
+	      xdrproc_t xdr_results, char *results_ptr,
 	      struct timeval timeout)
 {
   struct ct_data *ct = (struct ct_data *) h->cl_private;
@@ -337,7 +337,7 @@ clnttcp_geterr (CLIENT *h, struct rpc_err *errp)
 }
 
 static bool_t
-clnttcp_freeres (CLIENT *cl, xdrproc_t xdr_res, caddr_t res_ptr)
+clnttcp_freeres (CLIENT *cl, xdrproc_t xdr_res, char *res_ptr)
 {
   struct ct_data *ct = (struct ct_data *) cl->cl_private;
   XDR *xdrs = &(ct->ct_xdrs);
@@ -454,8 +454,8 @@ clnttcp_destroy (CLIENT *h)
       (void) __close (ct->ct_sock);
     }
   XDR_DESTROY (&(ct->ct_xdrs));
-  mem_free ((caddr_t) ct, sizeof (struct ct_data));
-  mem_free ((caddr_t) h, sizeof (CLIENT));
+  mem_free ((char *) ct, sizeof (struct ct_data));
+  mem_free ((char *) h, sizeof (CLIENT));
 }
 
 /*
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index c2436e3..99f3d7f 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -63,11 +63,11 @@ extern u_long _create_xid (void);
 /*
  * UDP bases client side rpc operations
  */
-static enum clnt_stat clntudp_call (CLIENT *, u_long, xdrproc_t, caddr_t,
-				    xdrproc_t, caddr_t, struct timeval);
+static enum clnt_stat clntudp_call (CLIENT *, u_long, xdrproc_t, char *,
+				    xdrproc_t, char *, struct timeval);
 static void clntudp_abort (void);
 static void clntudp_geterr (CLIENT *, struct rpc_err *);
-static bool_t clntudp_freeres (CLIENT *, xdrproc_t, caddr_t);
+static bool_t clntudp_freeres (CLIENT *, xdrproc_t, char *);
 static bool_t clntudp_control (CLIENT *, int, char *);
 static void clntudp_destroy (CLIENT *);
 
@@ -154,7 +154,7 @@ __libc_clntudp_bufcreate (struct sockaddr_in *raddr, u_long program,
       raddr->sin_port = htons (port);
     }
   cl->cl_ops = (struct clnt_ops *) &udp_ops;
-  cl->cl_private = (caddr_t) cu;
+  cl->cl_private = (char *) cu;
   cu->cu_raddr = *raddr;
   cu->cu_rlen = sizeof (cu->cu_raddr);
   cu->cu_wait = wait;
@@ -202,9 +202,9 @@ __libc_clntudp_bufcreate (struct sockaddr_in *raddr, u_long program,
   return cl;
 fooy:
   if (cu)
-    mem_free ((caddr_t) cu, sizeof (*cu) + sendsz + recvsz);
+    mem_free ((char *) cu, sizeof (*cu) + sendsz + recvsz);
   if (cl)
-    mem_free ((caddr_t) cl, sizeof (CLIENT));
+    mem_free ((char *) cl, sizeof (CLIENT));
   return (CLIENT *) NULL;
 }
 #ifdef EXPORT_RPC_SYMBOLS
@@ -268,11 +268,11 @@ clntudp_call (/* client handle */
 	      /* xdr routine for args */
 	      xdrproc_t xargs,
 	      /* pointer to args */
-	      caddr_t argsp,
+	      char *argsp,
 	      /* xdr routine for results */
 	      xdrproc_t xresults,
 	      /* pointer to results */
-	      caddr_t resultsp,
+	      char *resultsp,
 	      /* seconds to wait before giving up */
 	      struct timeval utimeout)
 {
@@ -524,7 +524,7 @@ clntudp_geterr (CLIENT *cl, struct rpc_err *errp)
 
 
 static bool_t
-clntudp_freeres (CLIENT *cl, xdrproc_t xdr_res, caddr_t res_ptr)
+clntudp_freeres (CLIENT *cl, xdrproc_t xdr_res, char *res_ptr)
 {
   struct cu_data *cu = (struct cu_data *) cl->cl_private;
   XDR *xdrs = &(cu->cu_outxdrs);
@@ -641,6 +641,6 @@ clntudp_destroy (CLIENT *cl)
       (void) __close (cu->cu_sock);
     }
   XDR_DESTROY (&(cu->cu_outxdrs));
-  mem_free ((caddr_t) cu, (sizeof (*cu) + cu->cu_sendsz + cu->cu_recvsz));
-  mem_free ((caddr_t) cl, sizeof (CLIENT));
+  mem_free ((char *) cu, (sizeof (*cu) + cu->cu_sendsz + cu->cu_recvsz));
+  mem_free ((char *) cl, sizeof (CLIENT));
 }
diff --git a/sunrpc/clnt_unix.c b/sunrpc/clnt_unix.c
index 33a02cc..51ed935 100644
--- a/sunrpc/clnt_unix.c
+++ b/sunrpc/clnt_unix.c
@@ -77,11 +77,11 @@ struct ct_data
 static int readunix (char *, char *, int);
 static int writeunix (char *, char *, int);
 
-static enum clnt_stat clntunix_call (CLIENT *, u_long, xdrproc_t, caddr_t,
-				    xdrproc_t, caddr_t, struct timeval);
+static enum clnt_stat clntunix_call (CLIENT *, u_long, xdrproc_t, char *,
+				    xdrproc_t, char *, struct timeval);
 static void clntunix_abort (void);
 static void clntunix_geterr (CLIENT *, struct rpc_err *);
-static bool_t clntunix_freeres (CLIENT *, xdrproc_t, caddr_t);
+static bool_t clntunix_freeres (CLIENT *, xdrproc_t, char *);
 static bool_t clntunix_control (CLIENT *, int, char *);
 static void clntunix_destroy (CLIENT *);
 
@@ -187,9 +187,9 @@ clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers,
    * and authnone for authentication.
    */
   xdrrec_create (&(ct->ct_xdrs), sendsz, recvsz,
-		 (caddr_t) ct, readunix, writeunix);
+		 (char *) ct, readunix, writeunix);
   h->cl_ops = (struct clnt_ops *) &unix_ops;
-  h->cl_private = (caddr_t) ct;
+  h->cl_private = (char *) ct;
   h->cl_auth = authnone_create ();
   return h;
 
@@ -197,15 +197,15 @@ fooy:
   /*
    * Something goofed, free stuff and barf
    */
-  mem_free ((caddr_t) ct, sizeof (struct ct_data));
-  mem_free ((caddr_t) h, sizeof (CLIENT));
+  mem_free ((char *) ct, sizeof (struct ct_data));
+  mem_free ((char *) h, sizeof (CLIENT));
   return (CLIENT *) NULL;
 }
 libc_hidden_nolink_sunrpc (clntunix_create, GLIBC_2_1)
 
 static enum clnt_stat
-clntunix_call (CLIENT *h, u_long proc, xdrproc_t xdr_args, caddr_t args_ptr,
-	       xdrproc_t xdr_results, caddr_t results_ptr,
+clntunix_call (CLIENT *h, u_long proc, xdrproc_t xdr_args, char *args_ptr,
+	       xdrproc_t xdr_results, char *results_ptr,
 	       struct timeval timeout)
 {
   struct ct_data *ct = (struct ct_data *) h->cl_private;
@@ -313,7 +313,7 @@ clntunix_geterr (CLIENT *h, struct rpc_err *errp)
 }
 
 static bool_t
-clntunix_freeres (CLIENT *cl, xdrproc_t xdr_res, caddr_t res_ptr)
+clntunix_freeres (CLIENT *cl, xdrproc_t xdr_res, char *res_ptr)
 {
   struct ct_data *ct = (struct ct_data *) cl->cl_private;
   XDR *xdrs = &(ct->ct_xdrs);
@@ -428,8 +428,8 @@ clntunix_destroy (CLIENT *h)
       (void) __close (ct->ct_sock);
     }
   XDR_DESTROY (&(ct->ct_xdrs));
-  mem_free ((caddr_t) ct, sizeof (struct ct_data));
-  mem_free ((caddr_t) h, sizeof (CLIENT));
+  mem_free ((char *) ct, sizeof (struct ct_data));
+  mem_free ((char *) h, sizeof (CLIENT));
 }
 
 static int
@@ -450,7 +450,7 @@ __msgread (int sock, void *data, size_t cnt)
   msg.msg_name = NULL;
   msg.msg_namelen = 0;
 #ifdef SCM_CREDENTIALS
-  msg.msg_control = (caddr_t) &cm;
+  msg.msg_control = (char *) &cm;
   msg.msg_controllen = CMSG_SPACE(sizeof (struct ucred));
 #endif
   msg.msg_flags = 0;
diff --git a/sunrpc/key_call.c b/sunrpc/key_call.c
index 9b8f981..270a1e9 100644
--- a/sunrpc/key_call.c
+++ b/sunrpc/key_call.c
@@ -228,7 +228,7 @@ key_gendes (des_block *key)
     return -1;
 
   stat = clnt_call (client, KEY_GEN, (xdrproc_t) xdr_void, NULL,
-		    (xdrproc_t) xdr_des_block, (caddr_t) key,
+		    (xdrproc_t) xdr_des_block, (char *) key,
 		    tottimeout);
   clnt_destroy (client);
   __close (socket);
diff --git a/sunrpc/pm_getmaps.c b/sunrpc/pm_getmaps.c
index 094492b..b1e8eab 100644
--- a/sunrpc/pm_getmaps.c
+++ b/sunrpc/pm_getmaps.c
@@ -72,7 +72,7 @@ pmap_getmaps (struct sockaddr_in *address)
   if (client != (CLIENT *) NULL)
     {
       if (CLNT_CALL (client, PMAPPROC_DUMP, (xdrproc_t)xdr_void, NULL,
-		     (xdrproc_t)xdr_pmaplist, (caddr_t)&head,
+		     (xdrproc_t)xdr_pmaplist, (char *)&head,
 		     minutetimeout) != RPC_SUCCESS)
 	{
 	  clnt_perror (client, _("pmap_getmaps.c: rpc problem"));
diff --git a/sunrpc/pm_getport.c b/sunrpc/pm_getport.c
index 3e6dd34..394c437 100644
--- a/sunrpc/pm_getport.c
+++ b/sunrpc/pm_getport.c
@@ -115,8 +115,8 @@ __libc_rpc_getport (struct sockaddr_in *address, u_long program,
       parms.pm_prot = protocol;
       parms.pm_port = 0;	/* not needed or used */
       if (CLNT_CALL (client, PMAPPROC_GETPORT, (xdrproc_t)xdr_pmap,
-		     (caddr_t)&parms, (xdrproc_t)xdr_u_short,
-		     (caddr_t)&port, tottimeout) != RPC_SUCCESS)
+		     (char *)&parms, (xdrproc_t)xdr_u_short,
+		     (char *)&port, tottimeout) != RPC_SUCCESS)
 	{
 	  ce->cf_stat = RPC_PMAPFAILURE;
 	  clnt_geterr (client, &ce->cf_error);
diff --git a/sunrpc/pmap_clnt.c b/sunrpc/pmap_clnt.c
index 69b4907..3b1ebe1 100644
--- a/sunrpc/pmap_clnt.c
+++ b/sunrpc/pmap_clnt.c
@@ -122,7 +122,7 @@ pmap_set (u_long program, u_long version, int protocol, u_short port)
   parms.pm_prot = protocol;
   parms.pm_port = port;
   if (CLNT_CALL (client, PMAPPROC_SET, (xdrproc_t)xdr_pmap,
-		 (caddr_t)&parms, (xdrproc_t)xdr_bool, (caddr_t)&rslt,
+		 (char *)&parms, (xdrproc_t)xdr_bool, (char *)&rslt,
 		 tottimeout) != RPC_SUCCESS)
     {
       clnt_perror (client, _("Cannot register service"));
@@ -157,7 +157,7 @@ pmap_unset (u_long program, u_long version)
   parms.pm_vers = version;
   parms.pm_port = parms.pm_prot = 0;
   CLNT_CALL (client, PMAPPROC_UNSET, (xdrproc_t)xdr_pmap,
-	     (caddr_t)&parms, (xdrproc_t)xdr_bool, (caddr_t)&rslt,
+	     (char *)&parms, (xdrproc_t)xdr_bool, (char *)&rslt,
 	     tottimeout);
   CLNT_DESTROY (client);
   /* (void)close(socket); CLNT_DESTROY already closed it */
diff --git a/sunrpc/pmap_prot2.c b/sunrpc/pmap_prot2.c
index c414db0..6825db7 100644
--- a/sunrpc/pmap_prot2.c
+++ b/sunrpc/pmap_prot2.c
@@ -102,7 +102,7 @@ xdr_pmaplist (XDR *xdrs, struct pmaplist **rp)
        */
       if (freeing)
 	next = (*rp)->pml_next;
-      if (!xdr_reference (xdrs, (caddr_t *) rp,
+      if (!xdr_reference (xdrs, (char **) rp,
 			  (u_int) sizeof (struct pmaplist),
 			  (xdrproc_t) xdr_pmap))
 	  return FALSE;
diff --git a/sunrpc/pmap_rmt.c b/sunrpc/pmap_rmt.c
index 6b142e5..0fc406c 100644
--- a/sunrpc/pmap_rmt.c
+++ b/sunrpc/pmap_rmt.c
@@ -66,7 +66,7 @@ static const struct timeval timeout = {3, 0};
  */
 enum clnt_stat
 pmap_rmtcall (struct sockaddr_in *addr, u_long prog, u_long vers, u_long proc,
-	      xdrproc_t xdrargs, caddr_t argsp, xdrproc_t xdrres, caddr_t resp,
+	      xdrproc_t xdrargs, char *argsp, xdrproc_t xdrres, char *resp,
 	      struct timeval tout, u_long *port_ptr)
 {
   int socket = -1;
@@ -89,8 +89,8 @@ pmap_rmtcall (struct sockaddr_in *addr, u_long prog, u_long vers, u_long proc,
       r.xdr_results = xdrres;
       stat = CLNT_CALL (client, PMAPPROC_CALLIT,
 			(xdrproc_t)xdr_rmtcall_args,
-			(caddr_t)&a, (xdrproc_t)xdr_rmtcallres,
-			(caddr_t)&r, tout);
+			(char *)&a, (xdrproc_t)xdr_rmtcallres,
+			(char *)&r, tout);
       CLNT_DESTROY (client);
     }
   else
@@ -143,9 +143,9 @@ libc_hidden_nolink_sunrpc (xdr_rmtcall_args, GLIBC_2_0)
 bool_t
 xdr_rmtcallres (XDR *xdrs, struct rmtcallres *crp)
 {
-  caddr_t port_ptr;
+  char *port_ptr;
 
-  port_ptr = (caddr_t) crp->port_ptr;
+  port_ptr = (char *) crp->port_ptr;
   if (xdr_reference (xdrs, &port_ptr, sizeof (u_long),
 		     (xdrproc_t) xdr_u_long)
       && xdr_u_long (xdrs, &crp->resultslen))
@@ -205,11 +205,11 @@ clnt_broadcast (/* program number */
 		/* xdr routine for args */
 		xdrproc_t xargs,
 		/* pointer to args */
-		caddr_t argsp,
+		char *argsp,
 		/* xdr routine for results */
 		xdrproc_t xresults,
 		/* pointer to results */
-		caddr_t resultsp,
+		char *resultsp,
 		/* call with each result obtained */
 		resultproc_t eachresult)
 {
@@ -312,7 +312,7 @@ clnt_broadcast (/* program number */
 	}
     recv_again:
       msg.acpted_rply.ar_verf = _null_auth;
-      msg.acpted_rply.ar_results.where = (caddr_t) & r;
+      msg.acpted_rply.ar_results.where = (char *) & r;
       msg.acpted_rply.ar_results.proc = (xdrproc_t) xdr_rmtcallres;
       milliseconds = t.tv_sec * 1000 + t.tv_usec / 1000;
       switch (__poll(&fd, 1, milliseconds))
diff --git a/sunrpc/proto.h b/sunrpc/proto.h
index ea28565..eef7b91 100644
--- a/sunrpc/proto.h
+++ b/sunrpc/proto.h
@@ -17,7 +17,7 @@ void pprocdef(proc_list *proc, version_list *vp,
 	      const char *addargtype, int server_p, int mode);
 void pdeclaration(const char *name, declaration *dec, int tab,
 		  const char *separator);
-void print_xdr_func_def (char* name, int pointerp, int i);
+void print_xdr_func_def (char *name, int pointerp, int i);
 
 /****** rpc_main.c ******/
 	/* nil */
diff --git a/sunrpc/rpc/auth.h b/sunrpc/rpc/auth.h
index e01b077..c506e53 100644
--- a/sunrpc/rpc/auth.h
+++ b/sunrpc/rpc/auth.h
@@ -81,7 +81,7 @@ extern bool_t xdr_des_block (XDR *__xdrs, des_block *__blkp) __THROW;
  */
 struct opaque_auth {
 	enum_t	oa_flavor;		/* flavor of auth */
-	caddr_t	oa_base;		/* address of more auth stuff */
+	char *	oa_base;		/* address of more auth stuff */
 	u_int	oa_length;		/* not to exceed MAX_AUTH_BYTES */
 };
 
@@ -101,7 +101,7 @@ struct AUTH {
     int  (*ah_refresh) (AUTH *);		/* refresh credentials */
     void (*ah_destroy) (AUTH *); 	    	/* destroy this structure */
   } *ah_ops;
-  caddr_t ah_private;
+  char *ah_private;
 };
 
 
diff --git a/sunrpc/rpc/clnt.h b/sunrpc/rpc/clnt.h
index f4d4a94..88ea9a2 100644
--- a/sunrpc/rpc/clnt.h
+++ b/sunrpc/rpc/clnt.h
@@ -130,19 +130,19 @@ typedef struct CLIENT CLIENT;
 struct CLIENT {
   AUTH	*cl_auth;		 /* authenticator */
   struct clnt_ops {
-    enum clnt_stat (*cl_call) (CLIENT *, u_long, xdrproc_t, caddr_t, xdrproc_t,
-			       caddr_t, struct timeval);
+    enum clnt_stat (*cl_call) (CLIENT *, u_long, xdrproc_t, char *, xdrproc_t,
+			       char *, struct timeval);
 				/* call remote procedure */
     void (*cl_abort) (void);	/* abort a call */
     void (*cl_geterr) (CLIENT *, struct rpc_err *);
 				/* get specific error code */
-    bool_t (*cl_freeres) (CLIENT *, xdrproc_t, caddr_t);
+    bool_t (*cl_freeres) (CLIENT *, xdrproc_t, char *);
 				/* frees results */
     void (*cl_destroy) (CLIENT *); /* destroy this structure */
     bool_t (*cl_control) (CLIENT *, int, char *);
 				/* the ioctl() of rpc */
   } *cl_ops;
-  caddr_t cl_private;		/* private stuff */
+  char *cl_private;		/* private stuff */
 };
 
 
@@ -159,9 +159,9 @@ struct CLIENT {
  * 	CLIENT *rh;
  *	u_long proc;
  *	xdrproc_t xargs;
- *	caddr_t argsp;
+ *	char *argsp;
  *	xdrproc_t xres;
- *	caddr_t resp;
+ *	char *resp;
  *	struct timeval timeout;
  */
 #define	CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs)	\
@@ -191,7 +191,7 @@ struct CLIENT {
  * CLNT_FREERES(rh, xres, resp);
  * 	CLIENT *rh;
  *	xdrproc_t xres;
- *	caddr_t resp;
+ *	char *resp;
  */
 #define	CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
 #define	clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
@@ -401,7 +401,7 @@ extern char *clnt_sperrno (enum clnt_stat __num) __THROW;	/* string */
 /*
  * get the port number on the host for the rpc program,version and proto
  */
-extern int getrpcport (const char * __host, u_long __prognum,
+extern int getrpcport (const char *__host, u_long __prognum,
 		       u_long __versnum, u_int __proto) __THROW;
 
 /*
diff --git a/sunrpc/rpc/pmap_clnt.h b/sunrpc/rpc/pmap_clnt.h
index 1cc94b8..1e7a4fb 100644
--- a/sunrpc/rpc/pmap_clnt.h
+++ b/sunrpc/rpc/pmap_clnt.h
@@ -42,7 +42,7 @@
 
 __BEGIN_DECLS
 
-typedef bool_t (*resultproc_t) (caddr_t __resp, struct sockaddr_in *__raddr);
+typedef bool_t (*resultproc_t) (char *__resp, struct sockaddr_in *__raddr);
 
 /*
  * Usage:
@@ -60,7 +60,7 @@ typedef bool_t (*resultproc_t) (caddr_t __resp, struct sockaddr_in *__raddr);
  *		the procedure eachresult is called.  Its form is:
  *	done = eachresult(resp, raddr)
  *		bool_t done;
- *		caddr_t resp;
+ *		char *resp;
  *		struct sockaddr_in raddr;
  *		where resp points to the results of the call and raddr is the
  *		address if the responder to the broadcast.
@@ -76,14 +76,14 @@ extern enum clnt_stat pmap_rmtcall (struct sockaddr_in *__addr,
 				    const u_long __vers,
 				    const u_long __proc,
 				    xdrproc_t __xdrargs,
-				    caddr_t __argsp, xdrproc_t __xdrres,
-				    caddr_t __resp, struct timeval __tout,
+				    char *__argsp, xdrproc_t __xdrres,
+				    char *__resp, struct timeval __tout,
 				    u_long *__port_ptr) __THROW;
 extern enum clnt_stat clnt_broadcast (const u_long __prog,
 				      const u_long __vers,
 				      const u_long __proc, xdrproc_t __xargs,
-				      caddr_t __argsp, xdrproc_t __xresults,
-				      caddr_t __resultsp,
+				      char *__argsp, xdrproc_t __xresults,
+				      char *__resultsp,
 				      resultproc_t __eachresult) __THROW;
 extern u_short pmap_getport (struct sockaddr_in *__address,
 			     const u_long __program,
diff --git a/sunrpc/rpc/pmap_rmt.h b/sunrpc/rpc/pmap_rmt.h
index f868014..7627b8e 100644
--- a/sunrpc/rpc/pmap_rmt.h
+++ b/sunrpc/rpc/pmap_rmt.h
@@ -44,7 +44,7 @@ __BEGIN_DECLS
 
 struct rmtcallargs {
 	u_long prog, vers, proc, arglen;
-	caddr_t args_ptr;
+	char *args_ptr;
 	xdrproc_t xdr_args;
 };
 
@@ -54,7 +54,7 @@ extern bool_t xdr_rmtcall_args (XDR *__xdrs, struct rmtcallargs *__crp)
 struct rmtcallres {
 	u_long *port_ptr;
 	u_long resultslen;
-	caddr_t results_ptr;
+	char *results_ptr;
 	xdrproc_t xdr_results;
 };
 
diff --git a/sunrpc/rpc/rpc_msg.h b/sunrpc/rpc/rpc_msg.h
index 273b187..a2cc516 100644
--- a/sunrpc/rpc/rpc_msg.h
+++ b/sunrpc/rpc/rpc_msg.h
@@ -93,7 +93,7 @@ struct accepted_reply {
 			u_long	high;
 		} AR_versions;
 		struct {
-			caddr_t	where;
+			char *	where;
 			xdrproc_t proc;
 		} AR_results;
 		/* and many other null cases */
diff --git a/sunrpc/rpc/svc.h b/sunrpc/rpc/svc.h
index d22f9f6..85d0183 100644
--- a/sunrpc/rpc/svc.h
+++ b/sunrpc/rpc/svc.h
@@ -97,11 +97,11 @@ struct SVCXPRT {
     enum xprt_stat (*xp_stat) (SVCXPRT *__xprt);
 				/* get transport status */
     bool_t	(*xp_getargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args,
-			       caddr_t __args_ptr); /* get arguments */
+			       char *__args_ptr); /* get arguments */
     bool_t	(*xp_reply) (SVCXPRT *__xprt, struct rpc_msg *__msg);
 				/* send reply */
     bool_t	(*xp_freeargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args,
-				caddr_t __args_ptr);
+				char *__args_ptr);
 				/* free mem allocated for args */
     void	(*xp_destroy) (SVCXPRT *__xprt);
 				/* destroy this struct */
@@ -109,8 +109,8 @@ struct SVCXPRT {
   int		xp_addrlen;	 /* length of remote address */
   struct sockaddr_in xp_raddr;	 /* remote address */
   struct opaque_auth xp_verf;	 /* raw response verifier */
-  caddr_t		xp_p1;		 /* private */
-  caddr_t		xp_p2;		 /* private */
+  char *		xp_p1;		 /* private */
+  char *		xp_p2;		 /* private */
   char		xp_pad [256];	/* padding, internal use */
 };
 
@@ -125,7 +125,7 @@ struct SVCXPRT {
  * SVCXPRT		*xprt;
  * struct rpc_msg	*msg;
  * xdrproc_t		 xargs;
- * caddr_t		 argsp;
+ * char *		 argsp;
  */
 #define SVC_RECV(xprt, msg)				\
 	(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
@@ -166,7 +166,7 @@ struct svc_req {
   rpcvers_t rq_vers;            /* service protocol version */
   rpcproc_t rq_proc;            /* the desired procedure */
   struct opaque_auth rq_cred;   /* raw creds from the wire */
-  caddr_t rq_clntcred;          /* read only cooked cred */
+  char *rq_clntcred;          /* read only cooked cred */
   SVCXPRT *rq_xprt;             /* associated transport */
 };
 
@@ -242,7 +242,7 @@ extern void xprt_unregister (SVCXPRT *__xprt) __THROW;
  */
 
 extern bool_t	svc_sendreply (SVCXPRT *__xprt, xdrproc_t __xdr_results,
-			       caddr_t __xdr_location) __THROW;
+			       char *__xdr_location) __THROW;
 
 extern void	svcerr_decode (SVCXPRT *__xprt) __THROW;
 
diff --git a/sunrpc/rpc/xdr.h b/sunrpc/rpc/xdr.h
index d80d8f7..3007e38 100644
--- a/sunrpc/rpc/xdr.h
+++ b/sunrpc/rpc/xdr.h
@@ -116,7 +116,7 @@ struct XDR
 	/* get a long from underlying stream */
 	bool_t (*x_putlong) (XDR *__xdrs, const long *__lp);
 	/* put a long to " */
-	bool_t (*x_getbytes) (XDR *__xdrs, caddr_t __addr, u_int __len);
+	bool_t (*x_getbytes) (XDR *__xdrs, char *__addr, u_int __len);
 	/* get some bytes from " */
 	bool_t (*x_putbytes) (XDR *__xdrs, const char *__addr, u_int __len);
 	/* put some bytes to " */
@@ -134,9 +134,9 @@ struct XDR
 	/* put a int to " */
       }
      *x_ops;
-    caddr_t x_public;		/* users' data */
-    caddr_t x_private;		/* pointer to private data */
-    caddr_t x_base;		/* private used for position info */
+    char *x_public;		/* users' data */
+    char *x_private;		/* pointer to private data */
+    char *x_base;		/* private used for position info */
     u_int x_handy;		/* extra private word */
   };
 
@@ -147,7 +147,7 @@ struct XDR
  * The opaque pointer generally points to a structure of the data type
  * to be decoded.  If this pointer is 0, then the type routines should
  * allocate dynamic storage of the appropriate size and return it.
- * bool_t       (*xdrproc_t)(XDR *, caddr_t *);
+ * bool_t       (*xdrproc_t)(XDR *, char **);
  */
 typedef bool_t (*xdrproc_t) (XDR *, void *,...);
 
@@ -158,7 +158,7 @@ typedef bool_t (*xdrproc_t) (XDR *, void *,...);
  * XDR          *xdrs;
  * int32_t      *int32p;
  * long         *longp;
- * caddr_t       addr;
+ * char         *addr;
  * u_int         len;
  * u_int         pos;
  */
@@ -305,12 +305,12 @@ extern bool_t xdr_quad_t (XDR *__xdrs, quad_t *__ip) __THROW;
 extern bool_t xdr_u_quad_t (XDR *__xdrs, u_quad_t *__up) __THROW;
 extern bool_t xdr_bool (XDR *__xdrs, bool_t *__bp) __THROW;
 extern bool_t xdr_enum (XDR *__xdrs, enum_t *__ep) __THROW;
-extern bool_t xdr_array (XDR * _xdrs, caddr_t *__addrp, u_int *__sizep,
+extern bool_t xdr_array (XDR * _xdrs, char **__addrp, u_int *__sizep,
 			 u_int __maxsize, u_int __elsize, xdrproc_t __elproc)
      __THROW;
 extern bool_t xdr_bytes (XDR *__xdrs, char **__cpp, u_int *__sizep,
 			 u_int __maxsize) __THROW;
-extern bool_t xdr_opaque (XDR *__xdrs, caddr_t __cp, u_int __cnt) __THROW;
+extern bool_t xdr_opaque (XDR *__xdrs, char *__cp, u_int __cnt) __THROW;
 extern bool_t xdr_string (XDR *__xdrs, char **__cpp, u_int __maxsize) __THROW;
 extern bool_t xdr_union (XDR *__xdrs, enum_t *__dscmp, char *__unp,
 			 const struct xdr_discrim *__choices,
@@ -321,7 +321,7 @@ extern bool_t xdr_vector (XDR *__xdrs, char *__basep, u_int __nelem,
 			  u_int __elemsize, xdrproc_t __xdr_elem) __THROW;
 extern bool_t xdr_float (XDR *__xdrs, float *__fp) __THROW;
 extern bool_t xdr_double (XDR *__xdrs, double *__dp) __THROW;
-extern bool_t xdr_reference (XDR *__xdrs, caddr_t *__xpp, u_int __size,
+extern bool_t xdr_reference (XDR *__xdrs, char **__xpp, u_int __size,
 			     xdrproc_t __proc) __THROW;
 extern bool_t xdr_pointer (XDR *__xdrs, char **__objpp,
 			   u_int __obj_size, xdrproc_t __xdr_obj) __THROW;
@@ -347,7 +347,7 @@ extern bool_t xdr_netobj (XDR *__xdrs, struct netobj *__np) __THROW;
  */
 
 /* XDR using memory buffers */
-extern void xdrmem_create (XDR *__xdrs, const caddr_t __addr,
+extern void xdrmem_create (XDR *__xdrs, const char *__addr,
 			   u_int __size, enum xdr_op __xop) __THROW;
 
 /* XDR using stdio library */
@@ -356,7 +356,7 @@ extern void xdrstdio_create (XDR *__xdrs, FILE *__file, enum xdr_op __xop)
 
 /* XDR pseudo records for tcp */
 extern void xdrrec_create (XDR *__xdrs, u_int __sendsize,
-			   u_int __recvsize, caddr_t __tcp_handle,
+			   u_int __recvsize, char *__tcp_handle,
 			   int (*__readit) (char *, char *, int),
 			   int (*__writeit) (char *, char *, int)) __THROW;
 
diff --git a/sunrpc/rpc_clntout.c b/sunrpc/rpc_clntout.c
index ce4d2a4..eaacdb6 100644
--- a/sunrpc/rpc_clntout.c
+++ b/sunrpc/rpc_clntout.c
@@ -262,7 +262,7 @@ printbody (proc_list * proc)
 	       "(clnt_call (clnt, %s, (xdrproc_t) xdr_void, ", proc->proc_name);
 
       fprintf (fout,
-	       "(caddr_t) NULL,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,",
+	       "(char *) NULL,\n\t\t(xdrproc_t) xdr_%s, (char *) %s%s,",
 	       stringfix(proc->res_type), (mtflag)?"":ampr(proc->res_type),
 	       RESULT);
       if (mtflag)
@@ -287,7 +287,7 @@ printbody (proc_list * proc)
 	       "(clnt_call (clnt, %s, (xdrproc_t) xdr_%s", proc->proc_name,
 	       proc->args.argname);
       fprintf (fout,
-	       ", (caddr_t) &arg,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,",
+	       ", (char *) &arg,\n\t\t(xdrproc_t) xdr_%s, (char *) %s%s,",
 	       stringfix(proc->res_type), (mtflag)?"":ampr(proc->res_type),
 	       RESULT);
       if (mtflag)
@@ -299,7 +299,7 @@ printbody (proc_list * proc)
     {				/* single argument, new or old style */
       if (!mtflag)
 	fprintf (fout,
-		 "\tif (clnt_call (clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\tTIMEOUT) != RPC_SUCCESS) {\n",
+		 "\tif (clnt_call (clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (char *) %s%s,\n\t\t(xdrproc_t) xdr_%s, (char *) %s%s,\n\t\tTIMEOUT) != RPC_SUCCESS) {\n",
 		 proc->proc_name,
 		 stringfix (proc->args.decls->decl.type),
 		 (newstyle ? "&" : ""),
@@ -308,7 +308,7 @@ printbody (proc_list * proc)
 		 RESULT);
       else
 	fprintf(fout,
-		"\treturn (clnt_call(clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\tTIMEOUT));\n",
+		"\treturn (clnt_call(clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (char *) %s%s,\n\t\t(xdrproc_t) xdr_%s, (char *) %s%s,\n\t\tTIMEOUT));\n",
 		proc->proc_name,
 		stringfix (proc->args.decls->decl.type),
 		(newstyle ? "&" : ""),
diff --git a/sunrpc/rpc_cmsg.c b/sunrpc/rpc_cmsg.c
index ec8cc6c..4164a84 100644
--- a/sunrpc/rpc_cmsg.c
+++ b/sunrpc/rpc_cmsg.c
@@ -76,7 +76,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg)
 	  (void) IXDR_PUT_INT32 (buf, oa->oa_length);
 	  if (oa->oa_length)
 	    {
-	      memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length);
+	      memcpy ((char *) buf, oa->oa_base, oa->oa_length);
 	      buf = (int32_t *) ((char *) buf + RNDUP (oa->oa_length));
 	    }
 	  oa = &cmsg->rm_call.cb_verf;
@@ -84,7 +84,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg)
 	  (void) IXDR_PUT_INT32 (buf, oa->oa_length);
 	  if (oa->oa_length)
 	    {
-	      memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length);
+	      memcpy ((char *) buf, oa->oa_base, oa->oa_length);
 	      /* no real need....
 		 buf = (long *) ((char *) buf + RNDUP(oa->oa_length));
 	       */
@@ -120,7 +120,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg)
 		return FALSE;
 	      if (oa->oa_base == NULL)
 		{
-		  oa->oa_base = (caddr_t)
+		  oa->oa_base = (char *)
 		    mem_alloc (oa->oa_length);
 		}
 	      buf = XDR_INLINE (xdrs, RNDUP (oa->oa_length));
@@ -132,7 +132,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg)
 		}
 	      else
 		{
-		  memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length);
+		  memcpy (oa->oa_base, (char *) buf, oa->oa_length);
 		  /* no real need....
 		     buf = (long *) ((char *) buf
 		     + RNDUP(oa->oa_length));
@@ -160,7 +160,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg)
 		return FALSE;
 	      if (oa->oa_base == NULL)
 		{
-		  oa->oa_base = (caddr_t)
+		  oa->oa_base = (char *)
 		    mem_alloc (oa->oa_length);
 		}
 	      buf = XDR_INLINE (xdrs, RNDUP (oa->oa_length));
@@ -172,7 +172,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg)
 		}
 	      else
 		{
-		  memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length);
+		  memcpy (oa->oa_base, (char *) buf, oa->oa_length);
 		  /* no real need...
 		     buf = (long *) ((char *) buf
 		     + RNDUP(oa->oa_length));
diff --git a/sunrpc/rpc_hout.c b/sunrpc/rpc_hout.c
index 10f793d..027d687 100644
--- a/sunrpc/rpc_hout.c
+++ b/sunrpc/rpc_hout.c
@@ -277,7 +277,7 @@ pfreeprocdef (const char *name, const char *vers, int mode)
   f_print (fout, "extern int ");
   pvname (name, vers);
   if (mode == 1)
-    f_print (fout,"_freeresult (SVCXPRT *, xdrproc_t, caddr_t);\n");
+    f_print (fout,"_freeresult (SVCXPRT *, xdrproc_t, char *);\n");
   else
     f_print (fout,"_freeresult ();\n");
 }
diff --git a/sunrpc/rpc_prot.c b/sunrpc/rpc_prot.c
index 46582f2..bd98264 100644
--- a/sunrpc/rpc_prot.c
+++ b/sunrpc/rpc_prot.c
@@ -65,7 +65,7 @@ libc_hidden_nolink_sunrpc (xdr_opaque_auth, GLIBC_2_0)
 bool_t
 xdr_des_block (XDR *xdrs, des_block *blkp)
 {
-  return xdr_opaque (xdrs, (caddr_t) blkp, sizeof (des_block));
+  return xdr_opaque (xdrs, (char *) blkp, sizeof (des_block));
 }
 libc_hidden_nolink_sunrpc (xdr_des_block, GLIBC_2_0)
 
@@ -136,7 +136,7 @@ xdr_replymsg (XDR *xdrs, struct rpc_msg *rmsg)
       xdr_enum (xdrs, (enum_t *) & (rmsg->rm_direction)) &&
       (rmsg->rm_direction == REPLY))
     return xdr_union (xdrs, (enum_t *) & (rmsg->rm_reply.rp_stat),
-		      (caddr_t) & (rmsg->rm_reply.ru), reply_dscrm,
+		      (char *) & (rmsg->rm_reply.ru), reply_dscrm,
 		      NULL_xdrproc_t);
   return FALSE;
 }
diff --git a/sunrpc/rpc_sample.c b/sunrpc/rpc_sample.c
index e90b58c..1a267f1 100644
--- a/sunrpc/rpc_sample.c
+++ b/sunrpc/rpc_sample.c
@@ -264,13 +264,13 @@ write_sample_server (definition * def)
 	  f_print(fout, "\nint\n");
 	  pvname(def->def_name, vp->vers_num);
 	  if (Cflag)
-	    f_print(fout,"_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)\n");
+	    f_print(fout,"_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, char *result)\n");
 	  else
 	    {
 	      f_print(fout,"_freeresult (transp, xdr_result, result)\n");
 	      f_print(fout,"\tSVCXPRT *transp;\n");
 	      f_print(fout,"\txdrproc_t xdr_result;\n");
-	      f_print(fout,"\tcaddr_t result;\n");
+	      f_print(fout,"\tchar *result;\n");
 	    }
 	  f_print(fout, "{\n");
 	  f_print(fout, "\txdr_free (xdr_result, result);\n");
diff --git a/sunrpc/rpc_svcout.c b/sunrpc/rpc_svcout.c
index 4f12a81..3eca750 100644
--- a/sunrpc/rpc_svcout.c
+++ b/sunrpc/rpc_svcout.c
@@ -624,7 +624,7 @@ write_program (const definition * def, const char *storage)
 	{
 	  f_print(fout,"\tif (!");
 	  pvname(def->def_name, vp->vers_num);
-	  f_print(fout,"_freeresult (%s, _xdr_%s, (caddr_t) &%s))\n",
+	  f_print(fout,"_freeresult (%s, _xdr_%s, (char *) &%s))\n",
 		  TRANSP, RESULT, RESULT);
 	  (void) sprintf(_errbuf, "unable to free results");
 	  print_err_message("\t\t");
@@ -644,7 +644,7 @@ printerr (const char *err, const char *transp)
 static void
 printif (const char *proc, const char *transp, const char *arg)
 {
-  f_print (fout, "\tif (!svc_%s (%s, (xdrproc_t) _xdr_%s, (caddr_t) &%s)) {\n",
+  f_print (fout, "\tif (!svc_%s (%s, (xdrproc_t) _xdr_%s, (char *) &%s)) {\n",
 	   proc, transp, arg, arg);
 }
 
@@ -773,7 +773,7 @@ write_msg_out (void)
     }
   else
     {
-      f_print (fout, "void _msgout (char* msg)\n");
+      f_print (fout, "void _msgout (char *msg)\n");
     }
   f_print (fout, "{\n");
   f_print (fout, "#ifdef RPC_SVC_FG\n");
diff --git a/sunrpc/svc.c b/sunrpc/svc.c
index 39279b4..95ecfbb 100644
--- a/sunrpc/svc.c
+++ b/sunrpc/svc.c
@@ -250,7 +250,7 @@ libc_hidden_nolink_sunrpc (svc_unregister, GLIBC_2_0)
 /* Send a reply to an rpc request */
 bool_t
 svc_sendreply (register SVCXPRT *xprt, xdrproc_t xdr_results,
-	       caddr_t xdr_location)
+	       char *xdr_location)
 {
   struct rpc_msg rply;
 
diff --git a/sunrpc/svc_authux.c b/sunrpc/svc_authux.c
index 0c6b024..1a70378 100644
--- a/sunrpc/svc_authux.c
+++ b/sunrpc/svc_authux.c
@@ -78,7 +78,7 @@ _svcauth_unix (struct svc_req *rqst, struct rpc_msg *msg)
 	  stat = AUTH_BADCRED;
 	  goto done;
 	}
-      memcpy (aup->aup_machname, (caddr_t) buf, (u_int) str_len);
+      memcpy (aup->aup_machname, (char *) buf, (u_int) str_len);
       aup->aup_machname[str_len] = 0;
       str_len = RNDUP (str_len);
       buf = (int32_t *) ((char *) buf + str_len);
diff --git a/sunrpc/svc_raw.c b/sunrpc/svc_raw.c
index f017631..f7a3f91 100644
--- a/sunrpc/svc_raw.c
+++ b/sunrpc/svc_raw.c
@@ -52,9 +52,9 @@ struct svcraw_private_s
 
 static bool_t svcraw_recv (SVCXPRT *, struct rpc_msg *);
 static enum xprt_stat svcraw_stat (SVCXPRT *);
-static bool_t svcraw_getargs (SVCXPRT *, xdrproc_t, caddr_t);
+static bool_t svcraw_getargs (SVCXPRT *, xdrproc_t, char *);
 static bool_t svcraw_reply (SVCXPRT *, struct rpc_msg *);
-static bool_t svcraw_freeargs (SVCXPRT *, xdrproc_t, caddr_t);
+static bool_t svcraw_freeargs (SVCXPRT *, xdrproc_t, char *);
 static void svcraw_destroy (SVCXPRT *);
 
 static const struct xp_ops server_ops =
@@ -127,7 +127,7 @@ svcraw_reply (SVCXPRT *xprt, struct rpc_msg *msg)
 }
 
 static bool_t
-svcraw_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
+svcraw_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr)
 {
   struct svcraw_private_s *srp = svcraw_private;
 
@@ -137,7 +137,7 @@ svcraw_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
 }
 
 static bool_t
-svcraw_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
+svcraw_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr)
 {
   struct svcraw_private_s *srp = svcraw_private;
   XDR *xdrs;
diff --git a/sunrpc/svc_tcp.c b/sunrpc/svc_tcp.c
index 484574c..4d712a7 100644
--- a/sunrpc/svc_tcp.c
+++ b/sunrpc/svc_tcp.c
@@ -71,9 +71,9 @@
  */
 static bool_t svctcp_recv (SVCXPRT *, struct rpc_msg *);
 static enum xprt_stat svctcp_stat (SVCXPRT *);
-static bool_t svctcp_getargs (SVCXPRT *, xdrproc_t, caddr_t);
+static bool_t svctcp_getargs (SVCXPRT *, xdrproc_t, char *);
 static bool_t svctcp_reply (SVCXPRT *, struct rpc_msg *);
-static bool_t svctcp_freeargs (SVCXPRT *, xdrproc_t, caddr_t);
+static bool_t svctcp_freeargs (SVCXPRT *, xdrproc_t, char *);
 static void svctcp_destroy (SVCXPRT *);
 
 static const struct xp_ops svctcp_op =
@@ -105,9 +105,9 @@ static const struct xp_ops svctcp_rendezvous_op =
 {
   rendezvous_request,
   rendezvous_stat,
-  (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svctcp_rendezvous_abort,
+  (bool_t (*) (SVCXPRT *, xdrproc_t, char *)) svctcp_rendezvous_abort,
   (bool_t (*) (SVCXPRT *, struct rpc_msg *)) svctcp_rendezvous_abort,
-  (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svctcp_rendezvous_abort,
+  (bool_t (*) (SVCXPRT *, xdrproc_t, char *)) svctcp_rendezvous_abort,
   svctcp_destroy
 };
 
@@ -194,7 +194,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize)
   r->sendsize = sendsize;
   r->recvsize = recvsize;
   xprt->xp_p2 = NULL;
-  xprt->xp_p1 = (caddr_t) r;
+  xprt->xp_p1 = (char *) r;
   xprt->xp_verf = _null_auth;
   xprt->xp_ops = &svctcp_rendezvous_op;
   xprt->xp_port = ntohs (addr.sin_port);
@@ -237,9 +237,9 @@ makefd_xprt (int fd, u_int sendsize, u_int recvsize)
     }
   cd->strm_stat = XPRT_IDLE;
   xdrrec_create (&(cd->xdrs), sendsize, recvsize,
-		 (caddr_t) xprt, readtcp, writetcp);
+		 (char *) xprt, readtcp, writetcp);
   xprt->xp_p2 = NULL;
-  xprt->xp_p1 = (caddr_t) cd;
+  xprt->xp_p1 = (char *) cd;
   xprt->xp_verf.oa_base = cd->verf_body;
   xprt->xp_addrlen = 0;
   xprt->xp_ops = &svctcp_op;	/* truly deals with calls */
@@ -299,8 +299,8 @@ svctcp_destroy (SVCXPRT *xprt)
       /* an actual connection socket */
       XDR_DESTROY (&(cd->xdrs));
     }
-  mem_free ((caddr_t) cd, sizeof (struct tcp_conn));
-  mem_free ((caddr_t) xprt, sizeof (SVCXPRT));
+  mem_free ((char *) cd, sizeof (struct tcp_conn));
+  mem_free ((char *) xprt, sizeof (SVCXPRT));
 }
 
 
@@ -351,7 +351,7 @@ readtcp (char *xprtptr, char *buf, int len)
  * Any error is fatal and the connection is closed.
  */
 static int
-writetcp (char *xprtptr, char * buf, int len)
+writetcp (char *xprtptr, char *buf, int len)
 {
   SVCXPRT *xprt = (SVCXPRT *)xprtptr;
   int i, cnt;
@@ -398,14 +398,14 @@ svctcp_recv (SVCXPRT *xprt, struct rpc_msg *msg)
 }
 
 static bool_t
-svctcp_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
+svctcp_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr)
 {
   return ((*xdr_args) (&(((struct tcp_conn *)
 			  (xprt->xp_p1))->xdrs), args_ptr));
 }
 
 static bool_t
-svctcp_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
+svctcp_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr)
 {
   XDR *xdrs = &(((struct tcp_conn *) (xprt->xp_p1))->xdrs);
 
diff --git a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c
index 17357c8..5193731 100644
--- a/sunrpc/svc_udp.c
+++ b/sunrpc/svc_udp.c
@@ -74,8 +74,8 @@
 static bool_t svcudp_recv (SVCXPRT *, struct rpc_msg *);
 static bool_t svcudp_reply (SVCXPRT *, struct rpc_msg *);
 static enum xprt_stat svcudp_stat (SVCXPRT *);
-static bool_t svcudp_getargs (SVCXPRT *, xdrproc_t, caddr_t);
-static bool_t svcudp_freeargs (SVCXPRT *, xdrproc_t, caddr_t);
+static bool_t svcudp_getargs (SVCXPRT *, xdrproc_t, char *);
+static bool_t svcudp_freeargs (SVCXPRT *, xdrproc_t, char *);
 static void svcudp_destroy (SVCXPRT *);
 
 static const struct xp_ops svcudp_op =
@@ -168,7 +168,7 @@ svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz)
   rpc_buffer (xprt) = buf;
   xdrmem_create (&(su->su_xdrs), rpc_buffer (xprt), su->su_iosz, XDR_DECODE);
   su->su_cache = NULL;
-  xprt->xp_p2 = (caddr_t) su;
+  xprt->xp_p2 = (char *) su;
   xprt->xp_verf.oa_base = su->su_verfbody;
   xprt->xp_ops = &svcudp_op;
   xprt->xp_port = ntohs (addr.sin_port);
@@ -368,14 +368,14 @@ svcudp_reply (SVCXPRT *xprt, struct rpc_msg *msg)
 }
 
 static bool_t
-svcudp_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
+svcudp_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr)
 {
 
   return (*xdr_args) (&(su_data (xprt)->su_xdrs), args_ptr);
 }
 
 static bool_t
-svcudp_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
+svcudp_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr)
 {
   XDR *xdrs = &(su_data (xprt)->su_xdrs);
 
@@ -392,8 +392,8 @@ svcudp_destroy (SVCXPRT *xprt)
   (void) __close (xprt->xp_sock);
   XDR_DESTROY (&(su->su_xdrs));
   mem_free (rpc_buffer (xprt), su->su_iosz);
-  mem_free ((caddr_t) su, sizeof (struct svcudp_data));
-  mem_free ((caddr_t) xprt, sizeof (SVCXPRT));
+  mem_free ((char *) su, sizeof (struct svcudp_data));
+  mem_free ((char *) xprt, sizeof (SVCXPRT));
 }
 
 
diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c
index eac1ae8..11e8797 100644
--- a/sunrpc/svc_unix.c
+++ b/sunrpc/svc_unix.c
@@ -71,9 +71,9 @@
  */
 static bool_t svcunix_recv (SVCXPRT *, struct rpc_msg *);
 static enum xprt_stat svcunix_stat (SVCXPRT *);
-static bool_t svcunix_getargs (SVCXPRT *, xdrproc_t, caddr_t);
+static bool_t svcunix_getargs (SVCXPRT *, xdrproc_t, char *);
 static bool_t svcunix_reply (SVCXPRT *, struct rpc_msg *);
-static bool_t svcunix_freeargs (SVCXPRT *, xdrproc_t, caddr_t);
+static bool_t svcunix_freeargs (SVCXPRT *, xdrproc_t, char *);
 static void svcunix_destroy (SVCXPRT *);
 
 static const struct xp_ops svcunix_op =
@@ -105,9 +105,9 @@ static const struct xp_ops svcunix_rendezvous_op =
 {
   rendezvous_request,
   rendezvous_stat,
-  (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svcunix_rendezvous_abort,
+  (bool_t (*) (SVCXPRT *, xdrproc_t, char *)) svcunix_rendezvous_abort,
   (bool_t (*) (SVCXPRT *, struct rpc_msg *)) svcunix_rendezvous_abort,
-  (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svcunix_rendezvous_abort,
+  (bool_t (*) (SVCXPRT *, xdrproc_t, char *)) svcunix_rendezvous_abort,
   svcunix_destroy
 };
 
@@ -194,7 +194,7 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path)
   r->sendsize = sendsize;
   r->recvsize = recvsize;
   xprt->xp_p2 = NULL;
-  xprt->xp_p1 = (caddr_t) r;
+  xprt->xp_p1 = (char *) r;
   xprt->xp_verf = _null_auth;
   xprt->xp_ops = &svcunix_rendezvous_op;
   xprt->xp_port = -1;
@@ -233,9 +233,9 @@ makefd_xprt (int fd, u_int sendsize, u_int recvsize)
     }
   cd->strm_stat = XPRT_IDLE;
   xdrrec_create (&(cd->xdrs), sendsize, recvsize,
-		 (caddr_t) xprt, readunix, writeunix);
+		 (char *) xprt, readunix, writeunix);
   xprt->xp_p2 = NULL;
-  xprt->xp_p1 = (caddr_t) cd;
+  xprt->xp_p1 = (char *) cd;
   xprt->xp_verf.oa_base = cd->verf_body;
   xprt->xp_addrlen = 0;
   xprt->xp_ops = &svcunix_op;	/* truly deals with calls */
@@ -298,8 +298,8 @@ svcunix_destroy (SVCXPRT *xprt)
       /* an actual connection socket */
       XDR_DESTROY (&(cd->xdrs));
     }
-  mem_free ((caddr_t) cd, sizeof (struct unix_conn));
-  mem_free ((caddr_t) xprt, sizeof (SVCXPRT));
+  mem_free ((char *) cd, sizeof (struct unix_conn));
+  mem_free ((char *) xprt, sizeof (SVCXPRT));
 }
 
 #ifdef SCM_CREDENTIALS
@@ -331,7 +331,7 @@ __msgread (int sock, void *data, size_t cnt)
   msg.msg_name = NULL;
   msg.msg_namelen = 0;
 #ifdef SCM_CREDENTIALS
-  msg.msg_control = (caddr_t) &cm;
+  msg.msg_control = (char *) &cm;
   msg.msg_controllen = sizeof (struct cmessage);
 #endif
   msg.msg_flags = 0;
@@ -453,7 +453,7 @@ readunix (char *xprtptr, char *buf, int len)
  * Any error is fatal and the connection is closed.
  */
 static int
-writeunix (char *xprtptr, char * buf, int len)
+writeunix (char *xprtptr, char *buf, int len)
 {
   SVCXPRT *xprt = (SVCXPRT *) xprtptr;
   int i, cnt;
@@ -496,7 +496,7 @@ svcunix_recv (SVCXPRT *xprt, struct rpc_msg *msg)
       /* set up verifiers */
 #ifdef SCM_CREDENTIALS
       msg->rm_call.cb_verf.oa_flavor = AUTH_UNIX;
-      msg->rm_call.cb_verf.oa_base = (caddr_t) &cm;
+      msg->rm_call.cb_verf.oa_base = (char *) &cm;
       msg->rm_call.cb_verf.oa_length = sizeof (cm);
 #endif
       return TRUE;
@@ -506,14 +506,14 @@ svcunix_recv (SVCXPRT *xprt, struct rpc_msg *msg)
 }
 
 static bool_t
-svcunix_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
+svcunix_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr)
 {
   return (*xdr_args) (&(((struct unix_conn *) (xprt->xp_p1))->xdrs),
 		      args_ptr);
 }
 
 static bool_t
-svcunix_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
+svcunix_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr)
 {
   XDR *xdrs = &(((struct unix_conn *) (xprt->xp_p1))->xdrs);
 
diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c
index b5fb745..98967df 100644
--- a/sunrpc/xdr.c
+++ b/sunrpc/xdr.c
@@ -539,7 +539,7 @@ libc_hidden_nolink_sunrpc (xdr_enum, GLIBC_2_0)
  * cp points to the opaque object and cnt gives the byte length.
  */
 bool_t
-xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt)
+xdr_opaque (XDR *xdrs, char *cp, u_int cnt)
 {
   u_int rndup;
   static char crud[BYTES_PER_XDR_UNIT];
@@ -566,7 +566,7 @@ xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt)
 	}
       if (rndup == 0)
 	return TRUE;
-      return XDR_GETBYTES (xdrs, (caddr_t)crud, rndup);
+      return XDR_GETBYTES (xdrs, (char *)crud, rndup);
 
     case XDR_ENCODE:
       if (!XDR_PUTBYTES (xdrs, cp, cnt))
diff --git a/sunrpc/xdr_array.c b/sunrpc/xdr_array.c
index 18383d4..a4f0853 100644
--- a/sunrpc/xdr_array.c
+++ b/sunrpc/xdr_array.c
@@ -56,7 +56,7 @@
 bool_t
 xdr_array (XDR *xdrs,
 	   /* array pointer */
-	   caddr_t *addrp,
+	   char **addrp,
 	   /* number of elements */
 	   u_int *sizep,
 	   /* max numberof elements */
@@ -67,7 +67,7 @@ xdr_array (XDR *xdrs,
 	   xdrproc_t elproc)
 {
   u_int i;
-  caddr_t target = *addrp;
+  char *target = *addrp;
   u_int c;		/* the actual element count */
   bool_t stat = TRUE;
 
diff --git a/sunrpc/xdr_mem.c b/sunrpc/xdr_mem.c
index 46a1f6f..f4af0ac 100644
--- a/sunrpc/xdr_mem.c
+++ b/sunrpc/xdr_mem.c
@@ -42,7 +42,7 @@
 
 static bool_t xdrmem_getlong (XDR *, long *);
 static bool_t xdrmem_putlong (XDR *, const long *);
-static bool_t xdrmem_getbytes (XDR *, caddr_t, u_int);
+static bool_t xdrmem_getbytes (XDR *, char *, u_int);
 static bool_t xdrmem_putbytes (XDR *, const char *, u_int);
 static u_int xdrmem_getpos (const XDR *);
 static bool_t xdrmem_setpos (XDR *, u_int);
@@ -70,13 +70,13 @@ static const struct xdr_ops xdrmem_ops =
  * memory buffer.
  */
 void
-xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op)
+xdrmem_create (XDR *xdrs, const char *addr, u_int size, enum xdr_op op)
 {
   xdrs->x_op = op;
   /* We have to add the const since the `struct xdr_ops' in `struct XDR'
      is not `const'.  */
   xdrs->x_ops = (struct xdr_ops *) &xdrmem_ops;
-  xdrs->x_private = xdrs->x_base = addr;
+  xdrs->x_private = xdrs->x_base = (char *)addr;
   xdrs->x_handy = size;
 }
 #ifdef EXPORT_RPC_SYMBOLS
@@ -134,7 +134,7 @@ xdrmem_putlong (XDR *xdrs, const long *lp)
  * a good idea.  None of the things pointed to are const.
  */
 static bool_t
-xdrmem_getbytes (XDR *xdrs, caddr_t addr, u_int len)
+xdrmem_getbytes (XDR *xdrs, char *addr, u_int len)
 {
   if (xdrs->x_handy < len)
     return FALSE;
@@ -175,8 +175,8 @@ xdrmem_getpos (const XDR *xdrs)
 static bool_t
 xdrmem_setpos (XDR *xdrs, u_int pos)
 {
-  caddr_t newaddr = xdrs->x_base + pos;
-  caddr_t lastaddr = xdrs->x_private + xdrs->x_handy;
+  char *newaddr = xdrs->x_base + pos;
+  char *lastaddr = xdrs->x_private + xdrs->x_handy;
   size_t handy = lastaddr - newaddr;
 
   if (newaddr > lastaddr
diff --git a/sunrpc/xdr_rec.c b/sunrpc/xdr_rec.c
index c9a1eaa..5d77780 100644
--- a/sunrpc/xdr_rec.c
+++ b/sunrpc/xdr_rec.c
@@ -54,7 +54,7 @@
 
 static bool_t xdrrec_getlong (XDR *, long *);
 static bool_t xdrrec_putlong (XDR *, const long *);
-static bool_t xdrrec_getbytes (XDR *, caddr_t, u_int);
+static bool_t xdrrec_getbytes (XDR *, char *, u_int);
 static bool_t xdrrec_putbytes (XDR *, const char *, u_int);
 static u_int xdrrec_getpos (const XDR *);
 static bool_t xdrrec_setpos (XDR *, u_int);
@@ -93,15 +93,15 @@ static const struct xdr_ops xdrrec_ops = {
 
 typedef struct rec_strm
   {
-    caddr_t tcp_handle;
-    caddr_t the_buffer;
+    char *tcp_handle;
+    char *the_buffer;
     /*
      * out-going bits
      */
     int (*writeit) (char *, char *, int);
-    caddr_t out_base;		/* output buffer (points to frag header) */
-    caddr_t out_finger;		/* next output position */
-    caddr_t out_boundry;	/* data cannot up to this address */
+    char *out_base;		/* output buffer (points to frag header) */
+    char *out_finger;		/* next output position */
+    char *out_boundry;	/* data cannot up to this address */
     uint32_t *frag_header;	/* beginning of curren fragment */
     bool_t frag_sent;		/* true if buffer sent in middle of record */
     /*
@@ -109,9 +109,9 @@ typedef struct rec_strm
      */
     int (*readit) (char *, char *, int);
     u_long in_size;		/* fixed size of the input buffer */
-    caddr_t in_base;
-    caddr_t in_finger;		/* location of next byte to be had */
-    caddr_t in_boundry;		/* can read up to this location */
+    char *in_base;
+    char *in_finger;		/* location of next byte to be had */
+    char *in_boundry;		/* can read up to this location */
     long fbtbc;			/* fragment bytes to be consumed */
     bool_t last_frag;
     u_int sendsize;
@@ -123,7 +123,7 @@ static u_int fix_buf_size (u_int);
 static bool_t skip_input_bytes (RECSTREAM *, long);
 static bool_t flush_out (RECSTREAM *, bool_t);
 static bool_t set_input_fragment (RECSTREAM *);
-static bool_t get_input_bytes (RECSTREAM *, caddr_t, int);
+static bool_t get_input_bytes (RECSTREAM *, char *, int);
 
 /*
  * Create an xdr handle for xdrrec
@@ -136,12 +136,12 @@ static bool_t get_input_bytes (RECSTREAM *, caddr_t, int);
  */
 void
 xdrrec_create (XDR *xdrs, u_int sendsize,
-	       u_int recvsize, caddr_t tcp_handle,
+	       u_int recvsize, char *tcp_handle,
 	       int (*readit) (char *, char *, int),
 	       int (*writeit) (char *, char *, int))
 {
   RECSTREAM *rstrm = (RECSTREAM *) mem_alloc (sizeof (RECSTREAM));
-  caddr_t tmp;
+  char *tmp;
   char *buf;
 
   sendsize = fix_buf_size (sendsize);
@@ -176,7 +176,7 @@ xdrrec_create (XDR *xdrs, u_int sendsize,
   /* We have to add the cast since the `struct xdr_ops' in `struct XDR'
      is not `const'.  */
   xdrs->x_ops = (struct xdr_ops *) &xdrrec_ops;
-  xdrs->x_private = (caddr_t) rstrm;
+  xdrs->x_private = (char *) rstrm;
   rstrm->tcp_handle = tcp_handle;
   rstrm->readit = readit;
   rstrm->writeit = writeit;
@@ -216,7 +216,7 @@ xdrrec_getlong (XDR *xdrs, long *lp)
     }
   else
     {
-      if (!xdrrec_getbytes (xdrs, (caddr_t) & mylong,
+      if (!xdrrec_getbytes (xdrs, (char *) & mylong,
 			    BYTES_PER_XDR_UNIT))
 	return FALSE;
       *lp = (int32_t) ntohl (mylong);
@@ -248,7 +248,7 @@ xdrrec_putlong (XDR *xdrs, const long *lp)
 }
 
 static bool_t	   /* must manage buffers, fragments, and records */
-xdrrec_getbytes (XDR *xdrs, caddr_t addr, u_int len)
+xdrrec_getbytes (XDR *xdrs, char *addr, u_int len)
 {
   RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
   u_int current;
@@ -330,7 +330,7 @@ xdrrec_setpos (XDR *xdrs, u_int pos)
   RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
   u_int currpos = xdrrec_getpos (xdrs);
   int delta = currpos - pos;
-  caddr_t newpos;
+  char *newpos;
 
   if ((int) currpos != -1)
     switch (xdrs->x_op)
@@ -338,7 +338,7 @@ xdrrec_setpos (XDR *xdrs, u_int pos)
 
       case XDR_ENCODE:
 	newpos = rstrm->out_finger - delta;
-	if (newpos > (caddr_t) rstrm->frag_header &&
+	if (newpos > (char *) rstrm->frag_header &&
 	    newpos < rstrm->out_boundry)
 	  {
 	    rstrm->out_finger = newpos;
@@ -404,7 +404,7 @@ xdrrec_destroy (XDR *xdrs)
 
   mem_free (rstrm->the_buffer,
 	    rstrm->sendsize + rstrm->recvsize + BYTES_PER_XDR_UNIT);
-  mem_free ((caddr_t) rstrm, sizeof (RECSTREAM));
+  mem_free ((char *) rstrm, sizeof (RECSTREAM));
 }
 
 static bool_t
@@ -424,7 +424,7 @@ xdrrec_getint32 (XDR *xdrs, int32_t *ip)
     }
   else
     {
-      if (!xdrrec_getbytes (xdrs, (caddr_t) &mylong,
+      if (!xdrrec_getbytes (xdrs, (char *) &mylong,
 			    BYTES_PER_XDR_UNIT))
 	return FALSE;
       *ip = ntohl (mylong);
@@ -549,14 +549,14 @@ flush_out (RECSTREAM *rstrm, bool_t eor)
       != (int) len)
     return FALSE;
   rstrm->frag_header = (uint32_t *) rstrm->out_base;
-  rstrm->out_finger = (caddr_t) rstrm->out_base + BYTES_PER_XDR_UNIT;
+  rstrm->out_finger = (char *) rstrm->out_base + BYTES_PER_XDR_UNIT;
   return TRUE;
 }
 
 static bool_t	/* knows nothing about records!  Only about input buffers */
 fill_input_buf (RECSTREAM *rstrm)
 {
-  caddr_t where;
+  char *where;
   size_t i;
   int len;
 
@@ -573,7 +573,7 @@ fill_input_buf (RECSTREAM *rstrm)
 }
 
 static bool_t	/* knows nothing about records!  Only about input buffers */
-get_input_bytes (RECSTREAM *rstrm, caddr_t addr, int len)
+get_input_bytes (RECSTREAM *rstrm, char *addr, int len)
 {
   int current;
 
@@ -600,7 +600,7 @@ set_input_fragment (RECSTREAM *rstrm)
 {
   uint32_t header;
 
-  if (! get_input_bytes (rstrm, (caddr_t)&header, BYTES_PER_XDR_UNIT))
+  if (! get_input_bytes (rstrm, (char *)&header, BYTES_PER_XDR_UNIT))
     return FALSE;
   header = ntohl (header);
   rstrm->last_frag = ((header & LAST_FRAG) == 0) ? FALSE : TRUE;
diff --git a/sunrpc/xdr_ref.c b/sunrpc/xdr_ref.c
index eab3b74..abb9ac2 100644
--- a/sunrpc/xdr_ref.c
+++ b/sunrpc/xdr_ref.c
@@ -57,13 +57,13 @@
 bool_t
 xdr_reference (XDR *xdrs,
 	       /* the pointer to work on */
-	       caddr_t *pp,
+	       char **pp,
 	       /* size of the object pointed to */
 	       u_int size,
 	       /* xdr routine to handle the object */
 	       xdrproc_t proc)
 {
-  caddr_t loc = *pp;
+  char *loc = *pp;
   bool_t stat;
 
   if (loc == NULL)
@@ -73,7 +73,7 @@ xdr_reference (XDR *xdrs,
 	return TRUE;
 
       case XDR_DECODE:
-	*pp = loc = (caddr_t) calloc (1, size);
+	*pp = loc = (char *) calloc (1, size);
 	if (loc == NULL)
 	  {
 	    (void) __fxprintf (NULL, "%s: %s", __func__, _("out of memory\n"));
diff --git a/sunrpc/xdr_sizeof.c b/sunrpc/xdr_sizeof.c
index 1592406..150d043 100644
--- a/sunrpc/xdr_sizeof.c
+++ b/sunrpc/xdr_sizeof.c
@@ -87,7 +87,7 @@ x_inline (XDR *xdrs, u_int len)
     {
       /* Free the earlier space and allocate new area */
       free (xdrs->x_private);
-      if ((xdrs->x_private = (caddr_t) malloc (len)) == NULL)
+      if ((xdrs->x_private = (char *) malloc (len)) == NULL)
 	{
 	  xdrs->x_base = 0;
 	  return NULL;
@@ -133,7 +133,7 @@ xdr_sizeof (xdrproc_t func, void *data)
   bool_t stat;
   /* to stop ANSI-C compiler from complaining */
   typedef bool_t (*dummyfunc1) (XDR *, long *);
-  typedef bool_t (*dummyfunc2) (XDR *, caddr_t, u_int);
+  typedef bool_t (*dummyfunc2) (XDR *, char *, u_int);
   typedef bool_t (*dummyfunc3) (XDR *, int32_t *);
 
   ops.x_putlong = x_putlong;
@@ -152,8 +152,8 @@ xdr_sizeof (xdrproc_t func, void *data)
   x.x_op = XDR_ENCODE;
   x.x_ops = &ops;
   x.x_handy = 0;
-  x.x_private = (caddr_t) NULL;
-  x.x_base = (caddr_t) 0;
+  x.x_private = (char *) NULL;
+  x.x_base = (char *) 0;
 
   stat = func (&x, data);
   free (x.x_private);
diff --git a/sunrpc/xdr_stdio.c b/sunrpc/xdr_stdio.c
index 0c2cbb7..459585b 100644
--- a/sunrpc/xdr_stdio.c
+++ b/sunrpc/xdr_stdio.c
@@ -49,7 +49,7 @@
 
 static bool_t xdrstdio_getlong (XDR *, long *);
 static bool_t xdrstdio_putlong (XDR *, const long *);
-static bool_t xdrstdio_getbytes (XDR *, caddr_t, u_int);
+static bool_t xdrstdio_getbytes (XDR *, char *, u_int);
 static bool_t xdrstdio_putbytes (XDR *, const char *, u_int);
 static u_int xdrstdio_getpos (const XDR *);
 static bool_t xdrstdio_setpos (XDR *, u_int);
@@ -87,7 +87,7 @@ xdrstdio_create (XDR *xdrs, FILE *file, enum xdr_op op)
   /* We have to add the const since the `struct xdr_ops' in `struct XDR'
      is not `const'.  */
   xdrs->x_ops = (struct xdr_ops *) &xdrstdio_ops;
-  xdrs->x_private = (caddr_t) file;
+  xdrs->x_private = (char *) file;
   xdrs->x_handy = 0;
   xdrs->x_base = 0;
 }
@@ -108,7 +108,7 @@ xdrstdio_getlong (XDR *xdrs, long *lp)
 {
   uint32_t mycopy;
 
-  if (fread ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
+  if (fread ((char *) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
     return FALSE;
   *lp = (long) ntohl (mycopy);
   return TRUE;
@@ -119,13 +119,13 @@ xdrstdio_putlong (XDR *xdrs, const long *lp)
 {
   int32_t mycopy = htonl ((uint32_t) *lp);
 
-  if (fwrite ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
+  if (fwrite ((char *) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
     return FALSE;
   return TRUE;
 }
 
 static bool_t
-xdrstdio_getbytes (XDR *xdrs, const caddr_t addr, u_int len)
+xdrstdio_getbytes (XDR *xdrs, char *addr, u_int len)
 {
   if ((len != 0) && (fread (addr, (int) len, 1,
 			    (FILE *) xdrs->x_private) != 1))
@@ -174,7 +174,7 @@ xdrstdio_getint32 (XDR *xdrs, int32_t *ip)
 {
   int32_t mycopy;
 
-  if (fread ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
+  if (fread ((char *) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
     return FALSE;
   *ip = ntohl (mycopy);
   return TRUE;
@@ -186,7 +186,7 @@ xdrstdio_putint32 (XDR *xdrs, const int32_t *ip)
   int32_t mycopy = htonl (*ip);
 
   ip = &mycopy;
-  if (fwrite ((caddr_t) ip, 4, 1, (FILE *) xdrs->x_private) != 1)
+  if (fwrite ((char *) ip, 4, 1, (FILE *) xdrs->x_private) != 1)
     return FALSE;
   return TRUE;
 }
diff --git a/support/xunistd.h b/support/xunistd.h
index 338eb86..76b74b5 100644
--- a/support/xunistd.h
+++ b/support/xunistd.h
@@ -64,8 +64,8 @@ void *xmmap (void *addr, size_t length, int prot, int flags, int fd);
 void xmprotect (void *addr, size_t length, int prot);
 void xmunmap (void *addr, size_t length);
 
-ssize_t xcopy_file_range(int fd_in, loff_t *off_in, int fd_out,
-			 loff_t *off_out, size_t len, unsigned int flags);
+ssize_t xcopy_file_range(int fd_in, off64_t *off_in, int fd_out,
+			 off64_t *off_out, size_t len, unsigned int flags);
 
 __END_DECLS
 
diff --git a/sysdeps/gnu/net/if.h b/sysdeps/gnu/net/if.h
index 303d092..e94ed67 100644
--- a/sysdeps/gnu/net/if.h
+++ b/sysdeps/gnu/net/if.h
@@ -145,7 +145,7 @@ struct ifreq
 	struct ifmap ifru_map;
 	char ifru_slave[IFNAMSIZ];	/* Just fits the size */
 	char ifru_newname[IFNAMSIZ];
-	__caddr_t ifru_data;
+	char *ifru_data;
       } ifr_ifru;
   };
 # define ifr_name	ifr_ifrn.ifrn_name	/* interface name 	*/
@@ -178,7 +178,7 @@ struct ifconf
     int	ifc_len;			/* Size of buffer.  */
     union
       {
-	__caddr_t ifcu_buf;
+	char *ifcu_buf;
 	struct ifreq *ifcu_req;
       } ifc_ifcu;
   };
diff --git a/sysdeps/gnu/sys/mtio.h b/sysdeps/gnu/sys/mtio.h
index 69a1dce..0ce41c5 100644
--- a/sysdeps/gnu/sys/mtio.h
+++ b/sysdeps/gnu/sys/mtio.h
@@ -90,8 +90,8 @@ struct mtget
     long int mt_gstat;		/* Generic (device independent) status.  */
     long int mt_erreg;		/* Error register.  */
     /* The next two fields are not always used.  */
-    __daddr_t mt_fileno;	/* Number of current file on tape.  */
-    __daddr_t mt_blkno;		/* Current block number.  */
+    int mt_fileno;		/* Number of current file on tape.  */
+    int mt_blkno;		/* Current block number.  */
   };
 #define _IOT_mtget /* Hurd ioctl type field.  */ \
   _IOT (_IOTS (long), 7, 0, 0, 0, 0)
diff --git a/sysdeps/mach/hurd/bits/typesizes.h b/sysdeps/mach/hurd/bits/typesizes.h
index 94b0afc..23ee7af 100644
--- a/sysdeps/mach/hurd/bits/typesizes.h
+++ b/sysdeps/mach/hurd/bits/typesizes.h
@@ -50,7 +50,6 @@
 #define __TIME_T_TYPE		__SLONGWORD_TYPE
 #define __USECONDS_T_TYPE	__U32_TYPE
 #define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
-#define __DADDR_T_TYPE		__S32_TYPE
 #define __KEY_T_TYPE		__S32_TYPE
 #define __CLOCKID_T_TYPE	__S32_TYPE
 #define __TIMER_T_TYPE		__S32_TYPE
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
index 0485dd1..d733e4b 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
@@ -49,7 +49,6 @@
 #define __TIME_T_TYPE		__SLONGWORD_TYPE
 #define __USECONDS_T_TYPE	__U32_TYPE
 #define __SUSECONDS_T_TYPE	__S64_TYPE
-#define __DADDR_T_TYPE		__S32_TYPE
 #define __KEY_T_TYPE		__S32_TYPE
 #define __CLOCKID_T_TYPE	__S32_TYPE
 #define __TIMER_T_TYPE		void *
diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
index c738ff5..26dabcf 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
@@ -51,7 +51,6 @@
 #define __TIME_T_TYPE		__SLONGWORD_TYPE
 #define __USECONDS_T_TYPE	__U32_TYPE
 #define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
-#define __DADDR_T_TYPE		__S32_TYPE
 #define __KEY_T_TYPE		__S32_TYPE
 #define __CLOCKID_T_TYPE	__S32_TYPE
 #define __TIMER_T_TYPE		void *
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h
index 6c17047..a8516e1 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h
@@ -24,7 +24,7 @@
    in with standard 64-bit syscalls but return them through APIs that
    only expose the low 32 bits of some fields.  */
 
-static inline off_t lseek_overflow (loff_t res)
+static inline off_t lseek_overflow (off64_t res)
 {
   off_t retval = (off_t) res;
   if (retval == res)
diff --git a/sysdeps/unix/sysv/linux/lseek.c b/sysdeps/unix/sysv/linux/lseek.c
index 6d17d0e..4a07892 100644
--- a/sysdeps/unix/sysv/linux/lseek.c
+++ b/sysdeps/unix/sysv/linux/lseek.c
@@ -28,7 +28,7 @@
    in with standard 64-bit syscalls but return them through APIs that
    only expose the low 32 bits of some fields.  */
 
-static inline off_t lseek_overflow (loff_t res)
+static inline off_t lseek_overflow (off64_t res)
 {
   off_t retval = (off_t) res;
   if (retval == res)
@@ -42,7 +42,7 @@ off_t
 __lseek (int fd, off_t offset, int whence)
 {
 # ifdef __NR__llseek
-  loff_t res;
+  off64_t res;
   int rc = INLINE_SYSCALL_CALL (_llseek, fd,
 				(long) (((uint64_t) (offset)) >> 32),
 				(long) offset, &res, whence);
diff --git a/sysdeps/unix/sysv/linux/lseek64.c b/sysdeps/unix/sysv/linux/lseek64.c
index ecf4338..4f53244 100644
--- a/sysdeps/unix/sysv/linux/lseek64.c
+++ b/sysdeps/unix/sysv/linux/lseek64.c
@@ -27,7 +27,7 @@ off64_t
 __lseek64 (int fd, off64_t offset, int whence)
 {
 #ifdef __NR__llseek
-  loff_t res;
+  off64_t res;
   int rc = INLINE_SYSCALL_CALL (_llseek, fd,
 				(long) (((uint64_t) (offset)) >> 32),
 				(long) offset, &res, whence);
diff --git a/sysdeps/unix/sysv/linux/mips/bits/typesizes.h b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h
index 1132670..7c1bedd 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h
@@ -50,7 +50,6 @@
 #define __TIME_T_TYPE		__SLONGWORD_TYPE
 #define __USECONDS_T_TYPE	__U32_TYPE
 #define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
-#define __DADDR_T_TYPE		__S32_TYPE
 #define __KEY_T_TYPE		__S32_TYPE
 #define __CLOCKID_T_TYPE	__S32_TYPE
 #define __TIMER_T_TYPE		void *
diff --git a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
index c578237..712264a 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
@@ -50,7 +50,6 @@
 #define __TIME_T_TYPE		__SLONGWORD_TYPE
 #define __USECONDS_T_TYPE	__U32_TYPE
 #define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
-#define __DADDR_T_TYPE		__S32_TYPE
 #define __KEY_T_TYPE		__S32_TYPE
 #define __CLOCKID_T_TYPE	__S32_TYPE
 #define __TIMER_T_TYPE		void *
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
index 0db18f4..b2d3929 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
@@ -50,7 +50,6 @@
 #define __TIME_T_TYPE		__SLONGWORD_TYPE
 #define __USECONDS_T_TYPE	__U32_TYPE
 #define __SUSECONDS_T_TYPE	__S32_TYPE
-#define __DADDR_T_TYPE		__S32_TYPE
 #define __KEY_T_TYPE		__S32_TYPE
 #define __CLOCKID_T_TYPE	__S32_TYPE
 #define __TIMER_T_TYPE		void *
diff --git a/sysdeps/unix/sysv/linux/splice.c b/sysdeps/unix/sysv/linux/splice.c
index 24dae37..392874a 100644
--- a/sysdeps/unix/sysv/linux/splice.c
+++ b/sysdeps/unix/sysv/linux/splice.c
@@ -20,7 +20,7 @@
 #include <sysdep-cancel.h>
 
 ssize_t
-splice (int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len,
+splice (int fd_in, off64_t *off_in, int fd_out, off64_t *off_out, size_t len,
 	unsigned int flags)
 {
   return SYSCALL_CANCEL (splice, fd_in, off_in, fd_out, off_out, len, flags);
diff --git a/sysdeps/unix/sysv/linux/sys/quota.h b/sysdeps/unix/sysv/linux/sys/quota.h
index 18b9f2e..8c3a5a1 100644
--- a/sysdeps/unix/sysv/linux/sys/quota.h
+++ b/sysdeps/unix/sysv/linux/sys/quota.h
@@ -114,7 +114,7 @@ struct dqblk
 #define	dq_btime	dq_dqb.dqb_btime
 #define	dq_itime	dq_dqb.dqb_itime
 
-#define dqoff(UID)      ((__loff_t)((UID) * sizeof (struct dqblk)))
+#define dqoff(UID)      ((__off64_t)((UID) * sizeof (struct dqblk)))
 
 /* Old name for struct if_dqinfo.  */
 struct dqinfo
@@ -128,7 +128,7 @@ struct dqinfo
 __BEGIN_DECLS
 
 extern int quotactl (int __cmd, const char *__special, int __id,
-		     __caddr_t __addr) __THROW;
+		     char *__addr) __THROW;
 
 __END_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/test-errno-linux.c b/sysdeps/unix/sysv/linux/test-errno-linux.c
index cb979d4..1cd4f4f 100644
--- a/sysdeps/unix/sysv/linux/test-errno-linux.c
+++ b/sysdeps/unix/sysv/linux/test-errno-linux.c
@@ -162,7 +162,7 @@ do_test (void)
      CONFIG_QUOTA, and may return EPERM if called within certain types
      of containers.  */
   fails |= test_wrp2 (LIST (ENODEV, ENOSYS, EPERM),
-		      quotactl, Q_GETINFO, NULL, -1, (caddr_t) &dqblk);
+		      quotactl, Q_GETINFO, NULL, -1, (char *) &dqblk);
   fails |= test_wrp (EINVAL, sched_getparam, -1, &sch_param);
   fails |= test_wrp (EINVAL, sched_getscheduler, -1);
   fails |= test_wrp (EINVAL, sched_get_priority_max, -1);
diff --git a/sysdeps/unix/sysv/linux/ustat.c b/sysdeps/unix/sysv/linux/ustat.c
index 39cb21f..6638ed5 100644
--- a/sysdeps/unix/sysv/linux/ustat.c
+++ b/sysdeps/unix/sysv/linux/ustat.c
@@ -36,12 +36,13 @@
   })
 # endif
 
+/* INLINE_SYSCALL_CALL requires all pointer arguments to point to
+   complete types, but we do not need to access any of the fields of
+   this structure.  It was formerly 20, 24, or 32 bytes, depending on
+   architecture and _FILE_OFFSET_BITS.  */
 struct ustat
 {
-  __daddr_t f_tfree;         /* Number of free blocks.  */
-  __ino_t f_tinode;          /* Number of free inodes.  */
-  char f_fname[6];
-  char f_fpack[6];
+  char dummy[32];
 };
 
 int
diff --git a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h
index 0a71e30..fb724e6 100644
--- a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h
@@ -66,7 +66,6 @@
 #define __TIME_T_TYPE		__SYSCALL_SLONG_TYPE
 #define __USECONDS_T_TYPE	__U32_TYPE
 #define __SUSECONDS_T_TYPE	__SYSCALL_SLONG_TYPE
-#define __DADDR_T_TYPE		__S32_TYPE
 #define __KEY_T_TYPE		__S32_TYPE
 #define __CLOCKID_T_TYPE	__S32_TYPE
 #define __TIMER_T_TYPE		void *

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

commit adf04a2ec1fb975659126f31ef9b547f409ccd7d
Author: Zack Weinberg <zackw@panix.com>
Date:   Mon Feb 18 21:00:34 2019 -0500

    sys/types.h: Donâ??t define u_intN_t or register_t unless __USE_MISC.
    
    sys/types.h unconditionally defines u_int8_t, u_int16_t, u_int32_t,
    u_int64_t, and register_t.  These are not part of any standard.  The
    u_intXX_t types are superseded by C99â??s uintXX_t types (defined in
    stdint.h).  Iâ??m not aware of a standardized exact equivalent of
    register_t, but also Iâ??ve never seen anyone use it for anything.
    I could be persuaded to leave that one alone.
    
    sys/types.h also unconditionally defines int8_t, int16_t, int32_t, and
    int64_t, which are the same as the C99 exact-width signed types in
    stdint.h.  POSIX doesnâ??t require these to appear in sys/types.h, so in
    principle they ought to be brought under __USE_MISC also.  But, when I
    tried that it broke about two dozen files just in our own source tree,
    and POSIX doesnâ??t *forbid* sys/types.h to define these types, so I
    think we should leave them alone.
    
    	* posix/sys/types.h (u_int8_t, u_int16_t, u_int32_t, u_int64_t)
            (register_t): Move under #ifdef __USE_MISC.
            Consolidate adjacent #ifdef __USE_MISC blocks.
            * scripts/check_obsolete_constructs.py: Add register_t to the
            set of obsolete typedefs that our headers should not use
            (but sys/types.h may still define).

diff --git a/NEWS b/NEWS
index 0d9236c..a4d3421 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,14 @@ Deprecated and removed features, and other changes affecting compatibility:
   definitions in libc will be used automatically, which have been available
   since glibc 2.17.
 
+* The typedefs u_int8_t, u_int16_t, u_int32_t, u_int64_t, and register_t
+  are no longer defined by <sys/types.h> in strict conformance modes.
+  These types were historically provided by <sys/types.h> on BSD systems,
+  but are not part of the POSIX specification for that header.  Applications
+  requiring fixed-width unsigned integer types should use the similarly
+  named uint8_t, uint16_t, etc. from <stdint.h>.  There is no standardized
+  replacement for register_t.
+
 Changes to build and runtime requirements:
 
 * GCC 6.2 or later is required to build the GNU C Library.
diff --git a/posix/sys/types.h b/posix/sys/types.h
index 1bbd896..7327904 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -143,18 +143,20 @@ typedef __suseconds_t suseconds_t;
 #define	__need_size_t
 #include <stddef.h>
 
+/* POSIX does not require intN_t to be defined in this header, so
+   technically this ought to be under __USE_MISC, but it doesn't
+   forbid them to be defined here either, and much existing code
+   expects them to be defined here.  */
+#include <bits/stdint-intn.h>
+
 #ifdef __USE_MISC
 /* Old compatibility names for C types.  */
 typedef unsigned long int ulong;
 typedef unsigned short int ushort;
 typedef unsigned int uint;
-#endif
-
-/* These size-specific names are used by some of the inet code.  */
 
-#include <bits/stdint-intn.h>
-
-/* These were defined by ISO C without the first `_'.  */
+/* These size-specific names are used by some of the inet code.
+   They were defined by ISO C without the first `_'.  */
 typedef __uint8_t u_int8_t;
 typedef __uint16_t u_int16_t;
 typedef __uint32_t u_int32_t;
@@ -167,8 +169,6 @@ typedef __register_t register_t;
    defined.  */
 #define __BIT_TYPES_DEFINED__	1
 
-
-#ifdef	__USE_MISC
 /* In BSD <sys/types.h> is expected to define BYTE_ORDER.  */
 # include <endian.h>
 
diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
index 46535af..4317aa3 100755
--- a/scripts/check-obsolete-constructs.py
+++ b/scripts/check-obsolete-constructs.py
@@ -254,6 +254,7 @@ class NoCheck(ConstructChecker):
 OBSOLETE_TYPE_RE_ = re.compile(r"""\A
   (__)?
   (   quad_t
+    | register_t
     | u(?: short | int | long
          | _(?: char | short | int(?:[0-9]+_t)? | long | quad_t )))
 \Z""", re.VERBOSE)

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

commit eb34f0ddc319c7e0f8bf841421a50d7182bcfff4
Author: Zack Weinberg <zackw@panix.com>
Date:   Tue Feb 19 08:45:22 2019 -0500

    Define register_t using bits/typesizes.h macros.
    
    Currently register_t is, unlike all other types in sys/types.h,
    defined using a GCC extension (__attribute__((mode(word)))), falling
    back to â??intâ?? if the extension is unavailable.  This is a potential
    ABI compatibility hazard for people using non-GNU compilers with
    glibc.  Itâ??s also unnecessary; the bits/typesizes.h mechanism can
    handle all of the existing variation in the definition.  In most
    cases, defining __REGISTER_T_TYPE as __SWORD_TYPE is sufficient.
    Special handling is necessary for MIPS n32 and x86-64 x32, where
    __SWORD_TYPE is â??intâ?? and the appropriate type for register_t is
    â??long longâ??.  Unfortunately, this means we need to create a new
    bits/typesizes.h variant for linux/mips.  This variant is based
    on the top-level bits/typesizes.h, not linux/generic/bits/typesizes.h,
    to match the existing MIPS ABIs.
    
    Tested using build-many-glibcs.  The c++-types test confirms that the
    physical type of register_t does not change on any supported platform.
    
    	* posix/sys/types.h: Typedef register_t as __register_t.
            * posix/bits/types.h: Typedef __register_t using __REGISTER_T_TYPE.
    
    	* bits/typesizes.h
            * sysdeps/mach/hurd/bits/typesizes.h
            * sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
            * sysdeps/unix/sysv/linux/generic/bits/typesizes.h
            * sysdeps/unix/sysv/linux/s390/bits/typesizes.h
            * sysdeps/unix/sysv/linux/sparc/bits/typesizes.h:
            Define __REGISTER_T_TYPE as __SWORD_TYPE.
    
            * sysdeps/unix/sysv/linux/mips/bits/typesizes.h:
            New file (copied from bits/typesizes.h).
            Define __REGISTER_T_TYPE as __SWORD_TYPE for o32 and n64 ABIs.
            Define __REGISTER_T_TYPE as __SQUAD_TYPE for n32.
            * sysdeps/unix/sysv/linux/x86/bits/typesizes.h:
            Define __REGISTER_T_TYPE as __SWORD_TYPE for o32 and 64-bit ABIs.
            Define __REGISTER_T_TYPE as __SQUAD_TYPE for x32.

diff --git a/bits/typesizes.h b/bits/typesizes.h
index 41c8924..4541013 100644
--- a/bits/typesizes.h
+++ b/bits/typesizes.h
@@ -60,6 +60,7 @@
 #define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
 #define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 #define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
+#define __REGISTER_T_TYPE	__SWORD_TYPE
 
 #ifdef __LP64__
 /* Tell the libc code that off_t and off64_t are actually the same type
diff --git a/posix/bits/types.h b/posix/bits/types.h
index 0de6c59..4521d9d 100644
--- a/posix/bits/types.h
+++ b/posix/bits/types.h
@@ -219,6 +219,9 @@ typedef int __sig_atomic_t;
 __STD_TYPE __TIME64_T_TYPE __time64_t;	/* Seconds since the Epoch.  */
 #endif
 
+/* BSD: Size of a general-purpose integer register.  */
+__STD_TYPE __REGISTER_T_TYPE __register_t;
+
 #undef __STD_TYPE
 
 #endif /* bits/types.h */
diff --git a/posix/sys/types.h b/posix/sys/types.h
index 0e37b1c..1bbd896 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -160,11 +160,8 @@ typedef __uint16_t u_int16_t;
 typedef __uint32_t u_int32_t;
 typedef __uint64_t u_int64_t;
 
-#if __GNUC_PREREQ (2, 7)
-typedef int register_t __attribute__ ((__mode__ (__word__)));
-#else
-typedef int register_t;
-#endif
+/* Type of a general-purpose integer register (BSD).  */
+typedef __register_t register_t;
 
 /* Some code from BIND tests this macro to see if the types above are
    defined.  */
diff --git a/sysdeps/mach/hurd/bits/typesizes.h b/sysdeps/mach/hurd/bits/typesizes.h
index 6bd9b43..94b0afc 100644
--- a/sysdeps/mach/hurd/bits/typesizes.h
+++ b/sysdeps/mach/hurd/bits/typesizes.h
@@ -60,6 +60,7 @@
 #define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
 #define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 #define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
+#define __REGISTER_T_TYPE	__SWORD_TYPE
 
 /* Number of descriptors that can fit in an `fd_set'.  */
 #define	__FD_SETSIZE		256
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
index cde275d..0485dd1 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
@@ -60,6 +60,7 @@
 #define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 #define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
 #define __FSWORD_T_TYPE		__S32_TYPE
+#define __REGISTER_T_TYPE	__SWORD_TYPE
 
 /* Tell the libc code that off_t and off64_t are actually the same type
    for all ABI purposes, even if possibly expressed as different base types
diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
index 3ef1281..c738ff5 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
@@ -61,6 +61,7 @@
 #define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
 #define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 #define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
+#define __REGISTER_T_TYPE	__SWORD_TYPE
 
 #ifdef __LP64__
 /* Tell the libc code that off_t and off64_t are actually the same type
diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h
similarity index 90%
copy from sysdeps/unix/sysv/linux/generic/bits/typesizes.h
copy to sysdeps/unix/sysv/linux/mips/bits/typesizes.h
index 3ef1281..1132670 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h
@@ -1,7 +1,6 @@
-/* bits/typesizes.h -- underlying types for *_t.  For the generic Linux ABI.
+/* bits/typesizes.h -- underlying types for *_t.  For the MIPS Linux ABI.
    Copyright (C) 2011-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -33,7 +32,7 @@
 #define __INO_T_TYPE		__ULONGWORD_TYPE
 #define __INO64_T_TYPE		__UQUAD_TYPE
 #define __MODE_T_TYPE		__U32_TYPE
-#define __NLINK_T_TYPE		__U32_TYPE
+#define __NLINK_T_TYPE		__UWORD_TYPE
 #define __OFF_T_TYPE		__SLONGWORD_TYPE
 #define __OFF64_T_TYPE		__SQUAD_TYPE
 #define __PID_T_TYPE		__S32_TYPE
@@ -55,13 +54,19 @@
 #define __KEY_T_TYPE		__S32_TYPE
 #define __CLOCKID_T_TYPE	__S32_TYPE
 #define __TIMER_T_TYPE		void *
-#define __BLKSIZE_T_TYPE	__S32_TYPE
+#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
 #define __FSID_T_TYPE		struct { int __val[2]; }
 #define __SSIZE_T_TYPE		__SWORD_TYPE
 #define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
 #define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 #define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
 
+#if defined _ABIN32 && _MIPS_SIM == _ABIN32
+#define __REGISTER_T_TYPE	__SQUAD_TYPE
+#else
+#define __REGISTER_T_TYPE	__SWORD_TYPE
+#endif
+
 #ifdef __LP64__
 /* Tell the libc code that off_t and off64_t are actually the same type
    for all ABI purposes, even if possibly expressed as different base types
diff --git a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
index e421057..c578237 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
@@ -66,6 +66,7 @@
 #define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
 #define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 #define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
+#define __REGISTER_T_TYPE	__SWORD_TYPE
 
 #ifdef __s390x__
 /* Tell the libc code that off_t and off64_t are actually the same type
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
index 115cc19..0db18f4 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
@@ -60,6 +60,7 @@
 #define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
 #define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
 #define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
+#define __REGISTER_T_TYPE	__SWORD_TYPE
 
 #if defined __arch64__ || defined __sparcv9
 /* Tell the libc code that off_t and off64_t are actually the same type
diff --git a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h
index 18d2c63..0a71e30 100644
--- a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h
@@ -30,9 +30,11 @@
 #if defined __x86_64__ && defined __ILP32__
 # define __SYSCALL_SLONG_TYPE	__SQUAD_TYPE
 # define __SYSCALL_ULONG_TYPE	__UQUAD_TYPE
+# define __REGISTER_T_TYPE	__SQUAD_TYPE
 #else
 # define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
 # define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
+# define __REGISTER_T_TYPE	__SWORD_TYPE
 #endif
 
 #define __DEV_T_TYPE		__UQUAD_TYPE

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

commit 8599cb1bbabc34c9a06c26443158fcf576e61efb
Author: Zack Weinberg <zackw@panix.com>
Date:   Sat Mar 9 10:26:58 2019 -0500

    Move inttypes.h and stdint.h to stdlib.
    
    inttypes.h and stdint.h are in sysdeps/generic, but there are no other
    versions of these headers anywhere in the source tree, so they arenâ??t
    actually system-dependent.  Move them to the subdirectory that
    installs them (stdlib).
    
    	* sysdeps/generic/inttypes.h, sysdeps/generic/stdint.h:
    	Move to stdlib.
    	* include/inttypes.h: Adjust to match.
    	* include/stdint.h: New wrapper.

diff --git a/include/inttypes.h b/include/inttypes.h
index 33219e2..3a583c6 100644
--- a/include/inttypes.h
+++ b/include/inttypes.h
@@ -1,5 +1,5 @@
 #ifndef _INTTYPES_H
-#include_next <inttypes.h>
+#include <stdlib/inttypes.h>
 #ifndef _ISOMAC
 libc_hidden_proto (strtoumax)
 #endif
diff --git a/include/stdint.h b/include/stdint.h
new file mode 100644
index 0000000..7f42874
--- /dev/null
+++ b/include/stdint.h
@@ -0,0 +1 @@
+#include <stdlib/stdint.h>
diff --git a/sysdeps/generic/inttypes.h b/stdlib/inttypes.h
similarity index 100%
rename from sysdeps/generic/inttypes.h
rename to stdlib/inttypes.h
diff --git a/sysdeps/generic/stdint.h b/stdlib/stdint.h
similarity index 100%
rename from sysdeps/generic/stdint.h
rename to stdlib/stdint.h

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

commit d11c36254bb5026091670a0c5ba8349e3fb98ebe
Author: Zack Weinberg <zackw@panix.com>
Date:   Sat Feb 23 19:08:54 2019 -0500

    Move most headers installed by top-level Makefile to misc/.
    
    The Makefile glue to run tests on installed headers is currently
    duplicated between the top-level Makefile and Rules, because the
    top-level Makefile doesn't read Rules but does install some headers.
    
    This patch moves most of the headers installed by the top-level Makefile
    to misc/ (chosen arbitrarily; I'm open to putting them somewhere else
    if reviewers feel it would be better) and removes the duplicated logic
    from the top-level Makefile.  I believe this also means that none of
    the headers in include/ are installed headers anymore.
    
    gnu/lib-names*.h are still generated by code in Makerules and installed
    by the top-level Makefile.  I tried to move them to misc/ as well, but
    that broke the generation process in a manner that didn't make any sense
    so I gave up.  The tests performed on installed headers are not
    especially useful for gnu/lib-names*.h so I think we can live with this
    for now.
    
    	* include/bits/xopen_lim.h
    	* include/features.h
    	* include/gnu-versions.h
    	* include/gnu/libc-version.h
    	* include/limits.h
    	* include/stdc-predef.h
    	* include/values.h:
    	Move to misc/ and replace with a trivial wrapper.
    	* Makefile (headers): Remove all headers moved to misc/.
    	Don't set a vpath for %.h.
    	(check-installed-headers-c.out, check-installed-headers-cxx.out)
    	(check-wrapper-headers.out): Remove rules.
    	* misc/Makefile (headers): Add all of the above headers and
    	sort the list.
    	* sysdeps/mach/hurd/bits/errno.h: Regenerate.

diff --git a/Makefile b/Makefile
index dc5de7a..d34aa8b 100644
--- a/Makefile
+++ b/Makefile
@@ -59,17 +59,11 @@ endif # $(AUTOCONF) = no
 		   subdir_objs subdir_stubs subdir_testclean		\
 		   $(addprefix install-, no-libc.a bin lib data headers others)
 
-headers := limits.h values.h features.h gnu-versions.h \
-	   bits/xopen_lim.h gnu/libc-version.h stdc-predef.h \
-	   bits/libc-header-start.h
+headers :=
 
 echo-headers: subdir_echo-headers
 
-# The headers are in the include directory.
-subdir-dirs = include
-vpath %.h $(subdir-dirs)
-
-# What to install.
+# This header is created during the install process.  See below.
 install-others = $(inst_includedir)/gnu/stubs.h
 install-bin-script =
 
@@ -311,34 +305,6 @@ $(objpfx)check-local-headers.out: scripts/check-local-headers.sh
 	  "$(includedir)" "$(objpfx)" < /dev/null > $@; \
 	$(evaluate-test)
 
-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 := testsuite
-$(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 := testsuite
-$(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 # $(CXX)
-
-tests-special += $(objpfx)check-wrapper-headers.out
-$(objpfx)check-wrapper-headers.out: scripts/check-wrapper-headers.py $(headers)
-	$(PYTHON) $< --root=. --subdir=. $(headers) \
-	  --generated $(common-generated) > $@; $(evaluate-test)
-endif # $(headers)
-
 define summarize-tests
 @egrep -v '^(PASS|XFAIL):' $(objpfx)$1 || true
 @echo "Summary of test results$2:"
diff --git a/include/bits/xopen_lim.h b/include/bits/xopen_lim.h
index b76a94b..9c2c1ec 100644
--- a/include/bits/xopen_lim.h
+++ b/include/bits/xopen_lim.h
@@ -1,148 +1 @@
-/* Copyright (C) 1996-2019 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/>.  */
-
-/*
- * Never include this file directly; use <limits.h> instead.
- */
-
-/* Additional definitions from X/Open Portability Guide, Issue 4, Version 2
-   System Interfaces and Headers, 4.16 <limits.h>
-
-   Please note only the values which are not greater than the minimum
-   stated in the standard document are listed.  The `sysconf' functions
-   should be used to obtain the actual value.  */
-
-#ifndef _XOPEN_LIM_H
-#define _XOPEN_LIM_H	1
-
-/* We do not provide fixed values for
-
-   ARG_MAX	Maximum length of argument to the `exec' function
-		including environment data.
-
-   ATEXIT_MAX	Maximum number of functions that may be registered
-		with `atexit'.
-
-   CHILD_MAX	Maximum number of simultaneous processes per real
-		user ID.
-
-   OPEN_MAX	Maximum number of files that one process can have open
-		at anyone time.
-
-   PAGESIZE
-   PAGE_SIZE	Size of bytes of a page.
-
-   PASS_MAX	Maximum number of significant bytes in a password.
-
-   We only provide a fixed limit for
-
-   IOV_MAX	Maximum number of `iovec' structures that one process has
-		available for use with `readv' or writev'.
-
-   if this is indeed fixed by the underlying system.
-*/
-
-
-/* Maximum number of `iovec' structures that may be used in a single call
-   to `readv', `writev', etc.  */
-#define	_XOPEN_IOV_MAX	_POSIX_UIO_MAXIOV
-
-#include <bits/uio_lim.h>
-#ifdef __IOV_MAX
-# define IOV_MAX __IOV_MAX
-#else
-# undef IOV_MAX
-#endif
-
-/* Maximum value of `digit' in calls to the `printf' and `scanf'
-   functions.  We have no limit, so return a reasonable value.  */
-#define NL_ARGMAX	_POSIX_ARG_MAX
-
-/* Maximum number of bytes in a `LANG' name.  We have no limit.  */
-#define NL_LANGMAX	_POSIX2_LINE_MAX
-
-/* Maximum message number.  We have no limit.  */
-#define NL_MSGMAX	INT_MAX
-
-/* Maximum number of bytes in N-to-1 collation mapping.  We have no
-   limit.  */
-#if defined __USE_GNU || !defined __USE_XOPEN2K8
-# define NL_NMAX	INT_MAX
-#endif
-
-/* Maximum set number.  We have no limit.  */
-#define NL_SETMAX	INT_MAX
-
-/* Maximum number of bytes in a message.  We have no limit.  */
-#define NL_TEXTMAX	INT_MAX
-
-/* Default process priority.  */
-#define NZERO		20
-
-
-/* Number of bits in a word of type `int'.  */
-#ifdef INT_MAX
-# if INT_MAX == 32767
-#  define WORD_BIT	16
-# else
-#  if INT_MAX == 2147483647
-#   define WORD_BIT	32
-#  else
-/* Safe assumption.  */
-#   define WORD_BIT	64
-#  endif
-# endif
-#elif defined __INT_MAX__
-# if __INT_MAX__ == 32767
-#  define WORD_BIT	16
-# else
-#  if __INT_MAX__ == 2147483647
-#   define WORD_BIT	32
-#  else
-/* Safe assumption.  */
-#   define WORD_BIT	64
-#  endif
-# endif
-#else
-# define WORD_BIT	32
-#endif
-
-/* Number of bits in a word of type `long int'.  */
-#ifdef LONG_MAX
-# if LONG_MAX == 2147483647
-#  define LONG_BIT	32
-# else
-/* Safe assumption.  */
-#  define LONG_BIT	64
-# endif
-#elif defined __LONG_MAX__
-# if __LONG_MAX__ == 2147483647
-#  define LONG_BIT	32
-# else
-/* Safe assumption.  */
-#  define LONG_BIT	64
-# endif
-#else
-# include <bits/wordsize.h>
-# if __WORDSIZE == 64
-#  define LONG_BIT	64
-# else
-#  define LONG_BIT	32
-# endif
-#endif
-
-#endif /* bits/xopen_lim.h */
+#include <misc/bits/xopen_lim.h>
diff --git a/include/features.h b/include/features.h
index e016b3e..504a684 100644
--- a/include/features.h
+++ b/include/features.h
@@ -1,477 +1 @@
-/* Copyright (C) 1991-2019 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/>.  */
-
-#ifndef	_FEATURES_H
-#define	_FEATURES_H	1
-
-/* These are defined by the user (or the compiler)
-   to specify the desired environment:
-
-   __STRICT_ANSI__	ISO Standard C.
-   _ISOC99_SOURCE	Extensions to ISO C89 from ISO C99.
-   _ISOC11_SOURCE	Extensions to ISO C99 from ISO C11.
-   __STDC_WANT_LIB_EXT2__
-			Extensions to ISO C99 from TR 27431-2:2010.
-   __STDC_WANT_IEC_60559_BFP_EXT__
-			Extensions to ISO C11 from TS 18661-1:2014.
-   __STDC_WANT_IEC_60559_FUNCS_EXT__
-			Extensions to ISO C11 from TS 18661-4:2015.
-   __STDC_WANT_IEC_60559_TYPES_EXT__
-			Extensions to ISO C11 from TS 18661-3:2015.
-
-   _POSIX_SOURCE	IEEE Std 1003.1.
-   _POSIX_C_SOURCE	If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
-			if >=199309L, add IEEE Std 1003.1b-1993;
-			if >=199506L, add IEEE Std 1003.1c-1995;
-			if >=200112L, all of IEEE 1003.1-2004
-			if >=200809L, all of IEEE 1003.1-2008
-   _XOPEN_SOURCE	Includes POSIX and XPG things.  Set to 500 if
-			Single Unix conformance is wanted, to 600 for the
-			sixth revision, to 700 for the seventh revision.
-   _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
-   _LARGEFILE_SOURCE	Some more functions for correct standard I/O.
-   _LARGEFILE64_SOURCE	Additional functionality from LFS for large files.
-   _FILE_OFFSET_BITS=N	Select default filesystem interface.
-   _ATFILE_SOURCE	Additional *at interfaces.
-   _GNU_SOURCE		All of the above, plus GNU extensions.
-   _DEFAULT_SOURCE	The default set of features (taking precedence over
-			__STRICT_ANSI__).
-
-   _FORTIFY_SOURCE	Add security hardening to many library functions.
-			Set to 1 or 2; 2 performs stricter checks than 1.
-
-   _REENTRANT, _THREAD_SAFE
-			Obsolete; equivalent to _POSIX_C_SOURCE=199506L.
-
-   The `-ansi' switch to the GNU C compiler, and standards conformance
-   options such as `-std=c99', define __STRICT_ANSI__.  If none of
-   these are defined, or if _DEFAULT_SOURCE is defined, the default is
-   to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
-   200809L, as well as enabling miscellaneous functions from BSD and
-   SVID.  If more than one of these are defined, they accumulate.  For
-   example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together
-   give you ISO C, 1003.1, and 1003.2, but nothing else.
-
-   These are defined by this file and are used by the
-   header files to decide what to declare or define:
-
-   __GLIBC_USE (F)	Define things from feature set F.  This is defined
-			to 1 or 0; the subsequent macros are either defined
-			or undefined, and those tests should be moved to
-			__GLIBC_USE.
-   __USE_ISOC11		Define ISO C11 things.
-   __USE_ISOC99		Define ISO C99 things.
-   __USE_ISOC95		Define ISO C90 AMD1 (C95) things.
-   __USE_ISOCXX11	Define ISO C++11 things.
-   __USE_POSIX		Define IEEE Std 1003.1 things.
-   __USE_POSIX2		Define IEEE Std 1003.2 things.
-   __USE_POSIX199309	Define IEEE Std 1003.1, and .1b things.
-   __USE_POSIX199506	Define IEEE Std 1003.1, .1b, .1c and .1i things.
-   __USE_XOPEN		Define XPG things.
-   __USE_XOPEN_EXTENDED	Define X/Open Unix things.
-   __USE_UNIX98		Define Single Unix V2 things.
-   __USE_XOPEN2K        Define XPG6 things.
-   __USE_XOPEN2KXSI     Define XPG6 XSI things.
-   __USE_XOPEN2K8       Define XPG7 things.
-   __USE_XOPEN2K8XSI    Define XPG7 XSI things.
-   __USE_LARGEFILE	Define correct standard I/O things.
-   __USE_LARGEFILE64	Define LFS things with separate names.
-   __USE_FILE_OFFSET64	Define 64bit interface as default.
-   __USE_MISC		Define things from 4.3BSD or System V Unix.
-   __USE_ATFILE		Define *at interfaces and AT_* constants for them.
-   __USE_GNU		Define GNU extensions.
-   __USE_FORTIFY_LEVEL	Additional security measures used, according to level.
-
-   The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
-   defined by this file unconditionally.  `__GNU_LIBRARY__' is provided
-   only for compatibility.  All new code should use the other symbols
-   to test for features.
-
-   All macros listed above as possibly being defined by this file are
-   explicitly undefined if they are not explicitly defined.
-   Feature-test macros that are not defined by the user or compiler
-   but are implied by the other feature-test macros defined (or by the
-   lack of any definitions) are defined by the file.
-
-   ISO C feature test macros depend on the definition of the macro
-   when an affected header is included, not when the first system
-   header is included, and so they are handled in
-   <bits/libc-header-start.h>, which does not have a multiple include
-   guard.  Feature test macros that can be handled from the first
-   system header included are handled here.  */
-
-
-/* Undefine everything, so we get a clean slate.  */
-#undef	__USE_ISOC11
-#undef	__USE_ISOC99
-#undef	__USE_ISOC95
-#undef	__USE_ISOCXX11
-#undef	__USE_POSIX
-#undef	__USE_POSIX2
-#undef	__USE_POSIX199309
-#undef	__USE_POSIX199506
-#undef	__USE_XOPEN
-#undef	__USE_XOPEN_EXTENDED
-#undef	__USE_UNIX98
-#undef	__USE_XOPEN2K
-#undef	__USE_XOPEN2KXSI
-#undef	__USE_XOPEN2K8
-#undef	__USE_XOPEN2K8XSI
-#undef	__USE_LARGEFILE
-#undef	__USE_LARGEFILE64
-#undef	__USE_FILE_OFFSET64
-#undef	__USE_MISC
-#undef	__USE_ATFILE
-#undef	__USE_GNU
-#undef	__USE_FORTIFY_LEVEL
-#undef	__KERNEL_STRICT_NAMES
-#undef	__GLIBC_USE_DEPRECATED_GETS
-#undef	__GLIBC_USE_DEPRECATED_SCANF
-
-/* Suppress kernel-name space pollution unless user expressedly asks
-   for it.  */
-#ifndef _LOOSE_KERNEL_NAMES
-# define __KERNEL_STRICT_NAMES
-#endif
-
-/* Convenience macro to test the version of gcc.
-   Use like this:
-   #if __GNUC_PREREQ (2,8)
-   ... code requiring gcc 2.8 or later ...
-   #endif
-   Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was
-   added in 2.0.  */
-#if defined __GNUC__ && defined __GNUC_MINOR__
-# define __GNUC_PREREQ(maj, min) \
-	((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
-#else
-# define __GNUC_PREREQ(maj, min) 0
-#endif
-
-/* Similarly for clang.  Features added to GCC after version 4.2 may
-   or may not also be available in clang, and clang's definitions of
-   __GNUC(_MINOR)__ are fixed at 4 and 2 respectively.  Not all such
-   features can be queried via __has_extension/__has_feature.  */
-#if defined __clang_major__ && defined __clang_minor__
-# define __glibc_clang_prereq(maj, min) \
-  ((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min))
-#else
-# define __glibc_clang_prereq(maj, min) 0
-#endif
-
-/* Whether to use feature set F.  */
-#define __GLIBC_USE(F)	__GLIBC_USE_ ## F
-
-/* _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for
-   _DEFAULT_SOURCE.  If _DEFAULT_SOURCE is present we do not
-   issue a warning; the expectation is that the source is being
-   transitioned to use the new macro.  */
-#if (defined _BSD_SOURCE || defined _SVID_SOURCE) \
-    && !defined _DEFAULT_SOURCE
-# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
-# undef  _DEFAULT_SOURCE
-# define _DEFAULT_SOURCE	1
-#endif
-
-/* If _GNU_SOURCE was defined by the user, turn on all the other features.  */
-#ifdef _GNU_SOURCE
-# undef  _ISOC95_SOURCE
-# define _ISOC95_SOURCE	1
-# undef  _ISOC99_SOURCE
-# define _ISOC99_SOURCE	1
-# undef  _ISOC11_SOURCE
-# define _ISOC11_SOURCE	1
-# undef  _POSIX_SOURCE
-# define _POSIX_SOURCE	1
-# undef  _POSIX_C_SOURCE
-# define _POSIX_C_SOURCE	200809L
-# undef  _XOPEN_SOURCE
-# define _XOPEN_SOURCE	700
-# undef  _XOPEN_SOURCE_EXTENDED
-# define _XOPEN_SOURCE_EXTENDED	1
-# undef	 _LARGEFILE64_SOURCE
-# define _LARGEFILE64_SOURCE	1
-# undef  _DEFAULT_SOURCE
-# define _DEFAULT_SOURCE	1
-# undef  _ATFILE_SOURCE
-# define _ATFILE_SOURCE	1
-#endif
-
-/* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,
-   define _DEFAULT_SOURCE.  */
-#if (defined _DEFAULT_SOURCE					\
-     || (!defined __STRICT_ANSI__				\
-	 && !defined _ISOC99_SOURCE && !defined _ISOC11_SOURCE	\
-	 && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE	\
-	 && !defined _XOPEN_SOURCE))
-# undef  _DEFAULT_SOURCE
-# define _DEFAULT_SOURCE	1
-#endif
-
-/* This is to enable the ISO C11 extension.  */
-#if (defined _ISOC11_SOURCE \
-     || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L))
-# define __USE_ISOC11	1
-#endif
-
-/* This is to enable the ISO C99 extension.  */
-#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \
-     || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
-# define __USE_ISOC99	1
-#endif
-
-/* This is to enable the ISO C90 Amendment 1:1995 extension.  */
-#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \
-     || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L))
-# define __USE_ISOC95	1
-#endif
-
-#ifdef __cplusplus
-/* This is to enable compatibility for ISO C++17.  */
-# if __cplusplus >= 201703L
-#  define __USE_ISOC11	1
-# endif
-/* This is to enable compatibility for ISO C++11.
-   Check the temporary macro for now, too.  */
-# if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__
-#  define __USE_ISOCXX11	1
-#  define __USE_ISOC99	1
-# endif
-#endif
-
-/* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE
-   is defined, use POSIX.1-2008 (or another version depending on
-   _XOPEN_SOURCE).  */
-#ifdef _DEFAULT_SOURCE
-# if !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE
-#  define __USE_POSIX_IMPLICITLY	1
-# endif
-# undef  _POSIX_SOURCE
-# define _POSIX_SOURCE	1
-# undef  _POSIX_C_SOURCE
-# define _POSIX_C_SOURCE	200809L
-#endif
-
-#if ((!defined __STRICT_ANSI__					\
-      || (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500))	\
-     && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE)
-# define _POSIX_SOURCE	1
-# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500
-#  define _POSIX_C_SOURCE	2
-# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 600
-#  define _POSIX_C_SOURCE	199506L
-# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 700
-#  define _POSIX_C_SOURCE	200112L
-# else
-#  define _POSIX_C_SOURCE	200809L
-# endif
-# define __USE_POSIX_IMPLICITLY	1
-#endif
-
-/* Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be
-   defined in all multithreaded code.  GNU libc has not required this
-   for many years.  We now treat them as compatibility synonyms for
-   _POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with
-   comprehensive support for multithreaded code.  Using them never
-   lowers the selected level of POSIX conformance, only raises it.  */
-#if ((!defined _POSIX_C_SOURCE || (_POSIX_C_SOURCE - 0) < 199506L) \
-     && (defined _REENTRANT || defined _THREAD_SAFE))
-# define _POSIX_SOURCE   1
-# undef  _POSIX_C_SOURCE
-# define _POSIX_C_SOURCE 199506L
-#endif
-
-#if (defined _POSIX_SOURCE					\
-     || (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 1)	\
-     || defined _XOPEN_SOURCE)
-# define __USE_POSIX	1
-#endif
-
-#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE
-# define __USE_POSIX2	1
-#endif
-
-#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L
-# define __USE_POSIX199309	1
-#endif
-
-#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199506L
-# define __USE_POSIX199506	1
-#endif
-
-#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200112L
-# define __USE_XOPEN2K		1
-# undef __USE_ISOC95
-# define __USE_ISOC95		1
-# undef __USE_ISOC99
-# define __USE_ISOC99		1
-#endif
-
-#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L
-# define __USE_XOPEN2K8		1
-# undef  _ATFILE_SOURCE
-# define _ATFILE_SOURCE	1
-#endif
-
-#ifdef	_XOPEN_SOURCE
-# define __USE_XOPEN	1
-# if (_XOPEN_SOURCE - 0) >= 500
-#  define __USE_XOPEN_EXTENDED	1
-#  define __USE_UNIX98	1
-#  undef _LARGEFILE_SOURCE
-#  define _LARGEFILE_SOURCE	1
-#  if (_XOPEN_SOURCE - 0) >= 600
-#   if (_XOPEN_SOURCE - 0) >= 700
-#    define __USE_XOPEN2K8	1
-#    define __USE_XOPEN2K8XSI	1
-#   endif
-#   define __USE_XOPEN2K	1
-#   define __USE_XOPEN2KXSI	1
-#   undef __USE_ISOC95
-#   define __USE_ISOC95		1
-#   undef __USE_ISOC99
-#   define __USE_ISOC99		1
-#  endif
-# else
-#  ifdef _XOPEN_SOURCE_EXTENDED
-#   define __USE_XOPEN_EXTENDED	1
-#  endif
-# endif
-#endif
-
-#ifdef _LARGEFILE_SOURCE
-# define __USE_LARGEFILE	1
-#endif
-
-#ifdef _LARGEFILE64_SOURCE
-# define __USE_LARGEFILE64	1
-#endif
-
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
-# define __USE_FILE_OFFSET64	1
-#endif
-
-#if defined _DEFAULT_SOURCE
-# define __USE_MISC	1
-#endif
-
-#ifdef	_ATFILE_SOURCE
-# define __USE_ATFILE	1
-#endif
-
-#ifdef	_GNU_SOURCE
-# define __USE_GNU	1
-#endif
-
-#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0
-# if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0
-#  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
-# elif !__GNUC_PREREQ (4, 1)
-#  warning _FORTIFY_SOURCE requires GCC 4.1 or later
-# elif _FORTIFY_SOURCE > 1
-#  define __USE_FORTIFY_LEVEL 2
-# else
-#  define __USE_FORTIFY_LEVEL 1
-# endif
-#endif
-#ifndef __USE_FORTIFY_LEVEL
-# define __USE_FORTIFY_LEVEL 0
-#endif
-
-/* The function 'gets' existed in C89, but is impossible to use
-   safely.  It has been removed from ISO C11 and ISO C++14.  Note: for
-   compatibility with various implementations of <cstdio>, this test
-   must consider only the value of __cplusplus when compiling C++.  */
-#if defined __cplusplus ? __cplusplus >= 201402L : defined __USE_ISOC11
-# define __GLIBC_USE_DEPRECATED_GETS 0
-#else
-# define __GLIBC_USE_DEPRECATED_GETS 1
-#endif
-
-/* GNU formerly extended the scanf functions with modified format
-   specifiers %as, %aS, and %a[...] that allocate a buffer for the
-   input using malloc.  This extension conflicts with ISO C99, which
-   defines %a as a standalone format specifier that reads a floating-
-   point number; moreover, POSIX.1-2008 provides the same feature
-   using the modifier letter 'm' instead (%ms, %mS, %m[...]).
-
-   We now follow C99 unless GNU extensions are active and the compiler
-   is specifically in C89 or C++98 mode (strict or not).  For
-   instance, with GCC, -std=gnu11 will have C99-compliant scanf with
-   or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the
-   old extension.  */
-#if (defined __USE_GNU							\
-     && (defined __cplusplus						\
-	 ? (__cplusplus < 201103L && !defined __GXX_EXPERIMENTAL_CXX0X__) \
-	 : (!defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L)))
-# define __GLIBC_USE_DEPRECATED_SCANF 1
-#else
-# define __GLIBC_USE_DEPRECATED_SCANF 0
-#endif
-
-/* Get definitions of __STDC_* predefined macros, if the compiler has
-   not preincluded this header automatically.  */
-#include <stdc-predef.h>
-
-/* This macro indicates that the installed library is the GNU C Library.
-   For historic reasons the value now is 6 and this will stay from now
-   on.  The use of this variable is deprecated.  Use __GLIBC__ and
-   __GLIBC_MINOR__ now (see below) when you want to test for a specific
-   GNU C library version and use the values in <gnu/lib-names.h> to get
-   the sonames of the shared libraries.  */
-#undef  __GNU_LIBRARY__
-#define __GNU_LIBRARY__ 6
-
-/* Major and minor version number of the GNU C library package.  Use
-   these macros to test for features in specific releases.  */
-#define	__GLIBC__	2
-#define	__GLIBC_MINOR__	29
-
-#define __GLIBC_PREREQ(maj, min) \
-	((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
-
-/* This is here only because every header file already includes this one.  */
-#ifndef __ASSEMBLER__
-# ifndef _SYS_CDEFS_H
-#  include <sys/cdefs.h>
-# endif
-
-/* If we don't have __REDIRECT, prototypes will be missing if
-   __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */
-# if defined __USE_FILE_OFFSET64 && !defined __REDIRECT
-#  define __USE_LARGEFILE	1
-#  define __USE_LARGEFILE64	1
-# endif
-
-#endif	/* !ASSEMBLER */
-
-/* Decide whether we can define 'extern inline' functions in headers.  */
-#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
-    && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \
-    && defined __extern_inline
-# define __USE_EXTERN_INLINES	1
-#endif
-
-
-/* This is here only because every header file already includes this one.
-   Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
-   <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
-   that will always return failure (and set errno to ENOSYS).  */
-#include <gnu/stubs.h>
-
-
-#endif	/* features.h  */
+#include <misc/features.h>
diff --git a/include/gnu-versions.h b/include/gnu-versions.h
index 6db552a..eafc8c8 100644
--- a/include/gnu-versions.h
+++ b/include/gnu-versions.h
@@ -1,52 +1 @@
-/* Header with interface version macros for library pieces copied elsewhere.
-   Copyright (C) 1995-2019 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/>.  */
-
-#ifndef _GNU_VERSIONS_H
-#define	_GNU_VERSIONS_H	1
-
-/* This file exists to define these few macros.  Each specifies a version
-   number associated with the library interface of a piece of the C library
-   which is also distributed with other GNU packages.  These pieces are
-   both part of the GNU C library and also distributed with other GNU
-   packages so those packages may use their facilities on systems lacking
-   the GNU C library.  The source files for each piece surround all their
-   code with `#ifndef ELIDE_CODE' after defining it with this:
-
-   #define OBSTACK_INTERFACE_VERSION 1
-   #if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
-   #include <gnu-versions.h>
-   #if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION
-   #define ELIDE_CODE
-   #endif
-   #endif
-
-   This allows those one to avoid compiling those files when part of a GNU
-   package not libc, on a system using a GNU C library that supports the
-   same interface.
-
-   Please preserve the format of the comments after each macro.  And
-   remember, if any of these versions change, the libc.so major version
-   number must change too (so avoid it)!  */
-
-#define _GNU_OBSTACK_INTERFACE_VERSION	1 /* vs malloc/obstack.c */
-#define _GNU_REGEX_INTERFACE_VERSION	1 /* vs posix/regex.c */
-#define _GNU_GLOB_INTERFACE_VERSION	2 /* vs posix/glob.c */
-#define _GNU_GETOPT_INTERFACE_VERSION	2 /* vs posix/getopt.c and
-					     posix/getopt1.c */
-
-#endif	/* gnu-versions.h */
+#include <misc/gnu-versions.h>
diff --git a/include/gnu/libc-version.h b/include/gnu/libc-version.h
index 0e2e91b..745fb5b 100644
--- a/include/gnu/libc-version.h
+++ b/include/gnu/libc-version.h
@@ -1,34 +1 @@
-/* Interface to GNU libc specific functions for version information.
-   Copyright (C) 1998-2019 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/>.  */
-
-#ifndef _GNU_LIBC_VERSION_H
-#define	_GNU_LIBC_VERSION_H	1
-
-#include <features.h>
-
-__BEGIN_DECLS
-
-/* Return string describing release status of currently running GNU libc.  */
-extern const char *gnu_get_libc_release (void) __THROW;
-
-/* Return string describing version of currently running GNU libc.  */
-extern const char *gnu_get_libc_version (void) __THROW;
-
-__END_DECLS
-
-#endif	/* gnu/libc-version.h */
+#include <misc/gnu/libc-version.h>
diff --git a/include/limits.h b/include/limits.h
index 08bb524..9eb278c 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -1,192 +1 @@
-/* Copyright (C) 1991-2019 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/>.  */
-
-/*
- *	ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types	<limits.h>
- */
-
-#ifndef _LIBC_LIMITS_H_
-#define _LIBC_LIMITS_H_	1
-
-#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
-#include <bits/libc-header-start.h>
-
-
-/* Maximum length of any multibyte character in any locale.
-   We define this value here since the gcc header does not define
-   the correct value.  */
-#define MB_LEN_MAX	16
-
-
-/* If we are not using GNU CC we have to define all the symbols ourself.
-   Otherwise use gcc's definitions (see below).  */
-#if !defined __GNUC__ || __GNUC__ < 2
-
-/* We only protect from multiple inclusion here, because all the other
-   #include's protect themselves, and in GCC 2 we may #include_next through
-   multiple copies of this file before we get to GCC's.  */
-# ifndef _LIMITS_H
-#  define _LIMITS_H	1
-
-#include <bits/wordsize.h>
-
-/* We don't have #include_next.
-   Define ANSI <limits.h> for standard 32-bit words.  */
-
-/* These assume 8-bit `char's, 16-bit `short int's,
-   and 32-bit `int's and `long int's.  */
-
-/* Number of bits in a `char'.	*/
-#  define CHAR_BIT	8
-
-/* Minimum and maximum values a `signed char' can hold.  */
-#  define SCHAR_MIN	(-128)
-#  define SCHAR_MAX	127
-
-/* Maximum value an `unsigned char' can hold.  (Minimum is 0.)  */
-#  define UCHAR_MAX	255
-
-/* Minimum and maximum values a `char' can hold.  */
-#  ifdef __CHAR_UNSIGNED__
-#   define CHAR_MIN	0
-#   define CHAR_MAX	UCHAR_MAX
-#  else
-#   define CHAR_MIN	SCHAR_MIN
-#   define CHAR_MAX	SCHAR_MAX
-#  endif
-
-/* Minimum and maximum values a `signed short int' can hold.  */
-#  define SHRT_MIN	(-32768)
-#  define SHRT_MAX	32767
-
-/* Maximum value an `unsigned short int' can hold.  (Minimum is 0.)  */
-#  define USHRT_MAX	65535
-
-/* Minimum and maximum values a `signed int' can hold.  */
-#  define INT_MIN	(-INT_MAX - 1)
-#  define INT_MAX	2147483647
-
-/* Maximum value an `unsigned int' can hold.  (Minimum is 0.)  */
-#  define UINT_MAX	4294967295U
-
-/* Minimum and maximum values a `signed long int' can hold.  */
-#  if __WORDSIZE == 64
-#   define LONG_MAX	9223372036854775807L
-#  else
-#   define LONG_MAX	2147483647L
-#  endif
-#  define LONG_MIN	(-LONG_MAX - 1L)
-
-/* Maximum value an `unsigned long int' can hold.  (Minimum is 0.)  */
-#  if __WORDSIZE == 64
-#   define ULONG_MAX	18446744073709551615UL
-#  else
-#   define ULONG_MAX	4294967295UL
-#  endif
-
-#  ifdef __USE_ISOC99
-
-/* Minimum and maximum values a `signed long long int' can hold.  */
-#   define LLONG_MAX	9223372036854775807LL
-#   define LLONG_MIN	(-LLONG_MAX - 1LL)
-
-/* Maximum value an `unsigned long long int' can hold.  (Minimum is 0.)  */
-#   define ULLONG_MAX	18446744073709551615ULL
-
-#  endif /* ISO C99 */
-
-# endif	/* limits.h  */
-#endif	/* GCC 2.  */
-
-#endif	/* !_LIBC_LIMITS_H_ */
-
- /* Get the compiler's limits.h, which defines almost all the ISO constants.
-
-    We put this #include_next outside the double inclusion check because
-    it should be possible to include this file more than once and still get
-    the definitions from gcc's header.  */
-#if defined __GNUC__ && !defined _GCC_LIMITS_H_
-/* `_GCC_LIMITS_H_' is what GCC's file defines.  */
-# include_next <limits.h>
-#endif
-
-/* The <limits.h> files in some gcc versions don't define LLONG_MIN,
-   LLONG_MAX, and ULLONG_MAX.  Instead only the values gcc defined for
-   ages are available.  */
-#if defined __USE_ISOC99 && defined __GNUC__
-# ifndef LLONG_MIN
-#  define LLONG_MIN	(-LLONG_MAX-1)
-# endif
-# ifndef LLONG_MAX
-#  define LLONG_MAX	__LONG_LONG_MAX__
-# endif
-# ifndef ULLONG_MAX
-#  define ULLONG_MAX	(LLONG_MAX * 2ULL + 1)
-# endif
-#endif
-
-/* The integer width macros are not defined by GCC's <limits.h> before
-   GCC 7, or if _GNU_SOURCE rather than
-   __STDC_WANT_IEC_60559_BFP_EXT__ is used to enable this feature.  */
-#if __GLIBC_USE (IEC_60559_BFP_EXT)
-# ifndef CHAR_WIDTH
-#  define CHAR_WIDTH 8
-# endif
-# ifndef SCHAR_WIDTH
-#  define SCHAR_WIDTH 8
-# endif
-# ifndef UCHAR_WIDTH
-#  define UCHAR_WIDTH 8
-# endif
-# ifndef SHRT_WIDTH
-#  define SHRT_WIDTH 16
-# endif
-# ifndef USHRT_WIDTH
-#  define USHRT_WIDTH 16
-# endif
-# ifndef INT_WIDTH
-#  define INT_WIDTH 32
-# endif
-# ifndef UINT_WIDTH
-#  define UINT_WIDTH 32
-# endif
-# ifndef LONG_WIDTH
-#  define LONG_WIDTH __WORDSIZE
-# endif
-# ifndef ULONG_WIDTH
-#  define ULONG_WIDTH __WORDSIZE
-# endif
-# ifndef LLONG_WIDTH
-#  define LLONG_WIDTH 64
-# endif
-# ifndef ULLONG_WIDTH
-#  define ULLONG_WIDTH 64
-# endif
-#endif /* Use IEC_60559_BFP_EXT.  */
-
-#ifdef	__USE_POSIX
-/* POSIX adds things to <limits.h>.  */
-# include <bits/posix1_lim.h>
-#endif
-
-#ifdef	__USE_POSIX2
-# include <bits/posix2_lim.h>
-#endif
-
-#ifdef	__USE_XOPEN
-# include <bits/xopen_lim.h>
-#endif
+#include <misc/limits.h>
diff --git a/include/stdc-predef.h b/include/stdc-predef.h
index 5cc5eef..0a8122a 100644
--- a/include/stdc-predef.h
+++ b/include/stdc-predef.h
@@ -1,60 +1 @@
-/* Copyright (C) 1991-2019 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/>.  */
-
-#ifndef	_STDC_PREDEF_H
-#define	_STDC_PREDEF_H	1
-
-/* This header is separate from features.h so that the compiler can
-   include it implicitly at the start of every compilation.  It must
-   not itself include <features.h> or any other header that includes
-   <features.h> because the implicit include comes before any feature
-   test macros that may be defined in a source file before it first
-   explicitly includes a system header.  GCC knows the name of this
-   header in order to preinclude it.  */
-
-/* glibc's intent is to support the IEC 559 math functionality, real
-   and complex.  If the GCC (4.9 and later) predefined macros
-   specifying compiler intent are available, use them to determine
-   whether the overall intent is to support these features; otherwise,
-   presume an older compiler has intent to support these features and
-   define these macros by default.  */
-
-#ifdef __GCC_IEC_559
-# if __GCC_IEC_559 > 0
-#  define __STDC_IEC_559__		1
-# endif
-#else
-# define __STDC_IEC_559__		1
-#endif
-
-#ifdef __GCC_IEC_559_COMPLEX
-# if __GCC_IEC_559_COMPLEX > 0
-#  define __STDC_IEC_559_COMPLEX__	1
-# endif
-#else
-# define __STDC_IEC_559_COMPLEX__	1
-#endif
-
-/* wchar_t uses Unicode 10.0.0.  Version 10.0 of the Unicode Standard is
-   synchronized with ISO/IEC 10646:2017, fifth edition, plus
-   the following additions from Amendment 1 to the fifth edition:
-   - 56 emoji characters
-   - 285 hentaigana
-   - 3 additional Zanabazar Square characters */
-#define __STDC_ISO_10646__		201706L
-
-#endif
+#include <misc/stdc-predef.h>
diff --git a/include/values.h b/include/values.h
index ae987a5..56ad18e 100644
--- a/include/values.h
+++ b/include/values.h
@@ -1,68 +1 @@
-/* Old compatibility names for <limits.h> and <float.h> constants.
-   Copyright (C) 1995-2019 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/>.  */
-
-/* This interface is obsolete.  New programs should use
-   <limits.h> and/or <float.h> instead of <values.h>.  */
-
-#ifndef	_VALUES_H
-#define	_VALUES_H	1
-
-#include <features.h>
-
-#include <limits.h>
-
-#define _TYPEBITS(type)	(sizeof (type) * CHAR_BIT)
-
-#define CHARBITS	_TYPEBITS (char)
-#define SHORTBITS	_TYPEBITS (short int)
-#define INTBITS		_TYPEBITS (int)
-#define LONGBITS	_TYPEBITS (long int)
-#define PTRBITS		_TYPEBITS (char *)
-#define DOUBLEBITS	_TYPEBITS (double)
-#define FLOATBITS	_TYPEBITS (float)
-
-#define MINSHORT	SHRT_MIN
-#define	MININT		INT_MIN
-#define	MINLONG		LONG_MIN
-
-#define	MAXSHORT	SHRT_MAX
-#define	MAXINT		INT_MAX
-#define	MAXLONG		LONG_MAX
-
-#define HIBITS		MINSHORT
-#define HIBITL		MINLONG
-
-
-#include <float.h>
-
-#define	MAXDOUBLE	DBL_MAX
-#define	MAXFLOAT	FLT_MAX
-#define	MINDOUBLE	DBL_MIN
-#define	MINFLOAT	FLT_MIN
-#define	DMINEXP		DBL_MIN_EXP
-#define	FMINEXP		FLT_MIN_EXP
-#define	DMAXEXP		DBL_MAX_EXP
-#define	FMAXEXP		FLT_MAX_EXP
-
-
-#ifdef __USE_MISC
-/* Some systems define this name instead of CHAR_BIT or CHARBITS.  */
-# define BITSPERBYTE	CHAR_BIT
-#endif
-
-#endif	/* values.h */
+#include <misc/values.h>
diff --git a/misc/Makefile b/misc/Makefile
index 032f28f..e6c7389 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -23,21 +23,22 @@ subdir	:= misc
 
 include ../Makeconfig
 
-headers	:= sys/uio.h bits/uio-ext.h bits/uio_lim.h \
-	   sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \
-	   sys/ptrace.h sys/file.h sys/dir.h sys/cdefs.h \
-	   ar.h a.out.h libgen.h stab.h bits/stab.def sgtty.h \
-	   ttyent.h paths.h sys/reboot.h \
-	   sys/mman.h sys/param.h bits/param.h \
-	   fstab.h mntent.h search.h err.h error.h \
-	   sys/queue.h sysexits.h syscall.h sys/syscall.h sys/swap.h \
-	   sys/select.h sys/sysinfo.h \
-	   regexp.h bits/select.h bits/mman.h sys/xattr.h \
-	   syslog.h sys/syslog.h \
-	   bits/syslog.h bits/syslog-ldbl.h bits/syslog-path.h bits/error.h \
-	   bits/select2.h bits/hwcap.h sys/auxv.h \
-	   sys/sysmacros.h bits/sysmacros.h bits/types/struct_iovec.h \
-	   bits/err-ldbl.h bits/error-ldbl.h
+headers :=								\
+	a.out.h ar.h err.h error.h features.h fstab.h gnu-versions.h	\
+	libgen.h limits.h mntent.h paths.h regexp.h search.h sgtty.h	\
+	stab.h stdc-predef.h syscall.h sysexits.h syslog.h ttyent.h	\
+	values.h							\
+	bits/err-ldbl.h bits/error-ldbl.h bits/error.h bits/hwcap.h	\
+	bits/ioctl-types.h bits/ioctls.h bits/libc-header-start.h	\
+	bits/mman.h bits/param.h bits/select.h bits/select2.h		\
+	bits/stab.def bits/syslog-ldbl.h bits/syslog-path.h		\
+	bits/syslog.h bits/sysmacros.h bits/types/struct_iovec.h	\
+	bits/uio-ext.h bits/uio_lim.h bits/xopen_lim.h			\
+	gnu/libc-version.h						\
+	sys/auxv.h sys/cdefs.h sys/dir.h sys/file.h sys/ioctl.h		\
+	sys/mman.h sys/param.h sys/ptrace.h sys/queue.h sys/reboot.h	\
+	sys/select.h sys/swap.h sys/syscall.h sys/sysinfo.h		\
+	sys/syslog.h sys/sysmacros.h sys/uio.h sys/xattr.h
 
 routines := brk sbrk sstk ioctl \
 	    readv writev preadv preadv64 pwritev pwritev64 \
diff --git a/include/bits/xopen_lim.h b/misc/bits/xopen_lim.h
similarity index 100%
copy from include/bits/xopen_lim.h
copy to misc/bits/xopen_lim.h
diff --git a/include/features.h b/misc/features.h
similarity index 100%
copy from include/features.h
copy to misc/features.h
diff --git a/include/gnu-versions.h b/misc/gnu-versions.h
similarity index 100%
copy from include/gnu-versions.h
copy to misc/gnu-versions.h
diff --git a/include/gnu/libc-version.h b/misc/gnu/libc-version.h
similarity index 100%
copy from include/gnu/libc-version.h
copy to misc/gnu/libc-version.h
diff --git a/include/limits.h b/misc/limits.h
similarity index 100%
copy from include/limits.h
copy to misc/limits.h
diff --git a/include/stdc-predef.h b/misc/stdc-predef.h
similarity index 100%
copy from include/stdc-predef.h
copy to misc/stdc-predef.h
diff --git a/include/values.h b/misc/values.h
similarity index 100%
copy from include/values.h
copy to misc/values.h
diff --git a/sysdeps/mach/hurd/bits/errno.h b/sysdeps/mach/hurd/bits/errno.h
index 8f2fbfd..8e8d1cc 100644
--- a/sysdeps/mach/hurd/bits/errno.h
+++ b/sysdeps/mach/hurd/bits/errno.h
@@ -1,6 +1,7 @@
 /* This file generated by errnos.awk from
      errno.texi
      stdc-predef.h
+     ../misc/stdc-predef.h
      libc-symbols.h
      mach/message.h
      mach/kern_return.h

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

commit 248aadd9bdea6054650cf4bea6fd08cbe3b4ddfe
Author: Zack Weinberg <zackw@panix.com>
Date:   Sat Jan 19 11:17:22 2019 -0500

    Use a proper C tokenizer to implement the obsolete typedefs test.
    
    The test for obsolete typedefs in installed headers was implemented
    using grep, and could therefore get false positives on e.g. â??ulongâ??
    in a comment.  It was also scanning all of the headers included by
    our headers, and therefore testing headers we donâ??t control, e.g.
    Linux kernel headers.
    
    This patch splits the obsolete-typedef test from
    scripts/check-installed-headers.sh to a separate program,
    scripts/check-obsolete-constructs.py.  Being implemented in Python,
    it is feasible to make it tokenize C accurately enough to avoid false
    positives on the contents of comments and strings.  It also only
    examines $(headers) in each subdirectory--all the headers we install,
    but not any external dependencies of those headers.  Headers whose
    installed name starts with finclude/ are ignored, on the assumption
    that they contain Fortran.
    
    It is also feasible to make the new test understand the difference
    between _defining_ the obsolete typedefs and _using_ the obsolete
    typedefs, which means posix/{bits,sys}/types.h no longer need to be
    exempted.  This uncovered an actual bug in bits/types.h: __quad_t and
    __u_quad_t were being used to define __S64_TYPE, __U64_TYPE,
    __SQUAD_TYPE and __UQUAD_TYPE.  These are changed to __int64_t and
    __uint64_t respectively.  This is a safe change, despite the comments
    in bits/types.h claiming a difference between __quad_t and __int64_t,
    because those comments are incorrect.  In all current ABIs, both
    __quad_t and __int64_t are â??longâ?? when â??longâ?? is a 64-bit type, and
    â??long longâ?? when â??longâ?? is a 32-bit type, and similarly for __u_quad_t
    and __uint64_t.  (Changing the types to be what the comments say they
    are would be an ABI break, as it affects C++ name mangling.)  This
    patch includes a minimal change to make the comments not completely
    wrong.  I plan to revise the comments thoroughly as part of a
    subsequent patch which removes __SQUAD_TYPE and __UQUAD_TYPE
    altogether, but that would be inappropriate for backporting to release
    branches.
    
    sys/types.h was defining the legacy BSD u_intN_t typedefs using a
    construct that was not necessarily consistent with how the C99 uintN_t
    typedefs are defined, and is also too complicated for the new script to
    understand (it lexes C relatively accurately, but it does not attempt
    to expand preprocessor macros, nor does it do any actual parsing).
    This patch cuts all of that out and uses bits/types.h's __uintN_t typedefs
    to define u_intN_t instead.  This is verified to not change the ABI on
    any supported architecture, via the c++-types test, which means u_intN_t
    and uintN_t were, in fact, consistent on all supported architectures.
    I plan to restrict u_intN_t and some other legacy typedefs (but not
    intN_t) to __USE_MISC in subsequent patches, but again that would be
    inappropriate for backporting to release branches.
    
    	* scripts/check-obsolete-constructs.py: New test script.
            * scripts/check-installed-headers.sh: Remove tests for
            obsolete typedefs, superseded by check-obsolete-constructs.py.
            * Rules: Run scripts/check-obsolete-constructs.py over $(headers)
            as a special test.  Update commentary.
            * posix/bits/types.h (__SQUAD_TYPE, __S64_TYPE): Define as __int64_t.
            (__UQUAD_TYPE, __U64_TYPE): Define as __uint64_t.
            Update commentary.
            * posix/sys/types.h (__u_intN_t): Remove.
            (u_int8_t): Typedef using __uint8_t.
            (u_int16_t): Typedef using __uint16_t.
            (u_int32_t): Typedef using __uint32_t.
            (u_int64_t): Typedef using __uint64_t.

diff --git a/Rules b/Rules
index e08a28d..222dba6 100644
--- a/Rules
+++ b/Rules
@@ -82,7 +82,8 @@ $(common-objpfx)dummy.c:
 common-generated += dummy.o dummy.c
 
 ifneq "$(headers)" ""
-# Special test of all the installed headers in this directory.
+# Test that all of the headers installed by this directory can be compiled
+# in isolation.
 tests-special += $(objpfx)check-installed-headers-c.out
 libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
@@ -93,6 +94,8 @@ $(objpfx)check-installed-headers-c.out: \
 	$(evaluate-test)
 
 ifneq "$(CXX)" ""
+# If a C++ compiler is available, also test that they can be compiled
+# in isolation as C++.
 tests-special += $(objpfx)check-installed-headers-cxx.out
 libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
@@ -103,12 +106,24 @@ $(objpfx)check-installed-headers-cxx.out: \
 	$(evaluate-test)
 endif # $(CXX)
 
+# Test that a wrapper header exists in include/ for each non-sysdeps header.
+# This script does not need $(py-env).
 tests-special += $(objpfx)check-wrapper-headers.out
 $(objpfx)check-wrapper-headers.out: \
   $(..)scripts/check-wrapper-headers.py $(headers)
 	$(PYTHON) $< --root=$(..) --subdir=$(subdir) $(headers) > $@; \
 	  $(evaluate-test)
 
+# Test that none of the headers installed by this directory use certain
+# obsolete constructs (e.g. legacy BSD typedefs superseded by stdint.h).
+# This script does not need $(py-env).
+tests-special += $(objpfx)check-obsolete-constructs.out
+libof-check-obsolete-constructs := testsuite
+$(objpfx)check-obsolete-constructs.out: \
+    $(..)scripts/check-obsolete-constructs.py $(headers)
+	$(PYTHON) $^ > $@ 2>&1; \
+	$(evaluate-test)
+
 endif # $(headers)
 
 # This makes all the auxiliary and test programs.
diff --git a/posix/bits/types.h b/posix/bits/types.h
index 27e065c..0de6c59 100644
--- a/posix/bits/types.h
+++ b/posix/bits/types.h
@@ -87,7 +87,7 @@ __extension__ typedef unsigned long long int __uintmax_t;
 	32		-- "natural" 32-bit type (always int)
 	64		-- "natural" 64-bit type (long or long long)
 	LONG32		-- 32-bit type, traditionally long
-	QUAD		-- 64-bit type, always long long
+	QUAD		-- 64-bit type, traditionally long long
 	WORD		-- natural type of __WORDSIZE bits (int or long)
 	LONGWORD	-- type of __WORDSIZE bits, traditionally long
 
@@ -113,14 +113,14 @@ __extension__ typedef unsigned long long int __uintmax_t;
 #define __SLONGWORD_TYPE	long int
 #define __ULONGWORD_TYPE	unsigned long int
 #if __WORDSIZE == 32
-# define __SQUAD_TYPE		__quad_t
-# define __UQUAD_TYPE		__u_quad_t
+# define __SQUAD_TYPE		__int64_t
+# define __UQUAD_TYPE		__uint64_t
 # define __SWORD_TYPE		int
 # define __UWORD_TYPE		unsigned int
 # define __SLONG32_TYPE		long int
 # define __ULONG32_TYPE		unsigned long int
-# define __S64_TYPE		__quad_t
-# define __U64_TYPE		__u_quad_t
+# define __S64_TYPE		__int64_t
+# define __U64_TYPE		__uint64_t
 /* We want __extension__ before typedef's that use nonstandard base types
    such as `long long' in C89 mode.  */
 # define __STD_TYPE		__extension__ typedef
diff --git a/posix/sys/types.h b/posix/sys/types.h
index 27129c5..0e37b1c 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -154,37 +154,20 @@ typedef unsigned int uint;
 
 #include <bits/stdint-intn.h>
 
-#if !__GNUC_PREREQ (2, 7)
-
 /* These were defined by ISO C without the first `_'.  */
-typedef	unsigned char u_int8_t;
-typedef	unsigned short int u_int16_t;
-typedef	unsigned int u_int32_t;
-# if __WORDSIZE == 64
-typedef unsigned long int u_int64_t;
-# else
-__extension__ typedef unsigned long long int u_int64_t;
-# endif
-
-typedef int register_t;
-
-#else
-
-/* For GCC 2.7 and later, we can use specific type-size attributes.  */
-# define __u_intN_t(N, MODE) \
-  typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
-
-__u_intN_t (8, __QI__);
-__u_intN_t (16, __HI__);
-__u_intN_t (32, __SI__);
-__u_intN_t (64, __DI__);
+typedef __uint8_t u_int8_t;
+typedef __uint16_t u_int16_t;
+typedef __uint32_t u_int32_t;
+typedef __uint64_t u_int64_t;
 
+#if __GNUC_PREREQ (2, 7)
 typedef int register_t __attribute__ ((__mode__ (__word__)));
-
+#else
+typedef int register_t;
+#endif
 
 /* Some code from BIND tests this macro to see if the types above are
    defined.  */
-#endif
 #define __BIT_TYPES_DEFINED__	1
 
 
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 1f44964..e4f37d3 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -16,11 +16,9 @@
 # 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.
+# For each installed header, confirm that it's possible to compile a
+# file that includes that header and does nothing else, in several
+# different compilation modes.
 
 # These compilation switches assume GCC or compatible, which is probably
 # fine since we also assume that when _building_ glibc.
@@ -31,13 +29,6 @@ cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
 # 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
@@ -46,14 +37,10 @@ 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
@@ -155,22 +142,8 @@ $expanded_lib_mode
 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
+            then :
+            else failed=1
             fi
         done
     done
diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
new file mode 100755
index 0000000..46535af
--- /dev/null
+++ b/scripts/check-obsolete-constructs.py
@@ -0,0 +1,466 @@
+#! /usr/bin/python3
+# Copyright (C) 2019 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/>.
+
+"""Verifies that installed headers do not use any obsolete constructs:
+ * legacy BSD typedefs superseded by <stdint.h>:
+   ushort uint ulong u_char u_short u_int u_long u_intNN_t quad_t u_quad_t
+   (sys/types.h is allowed to _define_ these types, but not to use them
+    to define anything else).
+"""
+
+import argparse
+import collections
+import re
+import sys
+
+# Simplified lexical analyzer for C preprocessing tokens.
+# Does not implement trigraphs.
+# Does not implement backslash-newline in the middle of any lexical
+#   item other than a string literal.
+# Does not implement universal-character-names in identifiers.
+# Treats prefixed strings (e.g. L"...") as two tokens (L and "...")
+# Accepts non-ASCII characters only within comments and strings.
+
+# Caution: The order of the outermost alternation matters.
+# STRING must be before BAD_STRING, CHARCONST before BAD_CHARCONST,
+# BLOCK_COMMENT before BAD_BLOCK_COM before PUNCTUATOR, and OTHER must
+# be last.
+# Caution: There should be no capturing groups other than the named
+# captures in the outermost alternation.
+
+# For reference, these are all of the C punctuators as of C11:
+#   [ ] ( ) { } , ; ? ~
+#   ! != * *= / /= ^ ^= = ==
+#   # ##
+#   % %= %> %: %:%:
+#   & &= &&
+#   | |= ||
+#   + += ++
+#   - -= -- ->
+#   . ...
+#   : :>
+#   < <% <: << <<= <=
+#   > >= >> >>=
+
+# The BAD_* tokens are not part of the official definition of pp-tokens;
+# they match unclosed strings, character constants, and block comments,
+# so that the regex engine doesn't have to backtrack all the way to the
+# beginning of a broken construct and then emit dozens of junk tokens.
+
+PP_TOKEN_RE_ = re.compile(r"""
+    (?P<STRING>        \"(?:[^\"\\\r\n]|\\(?:[\r\n -~]|\r\n))*\")
+   |(?P<BAD_STRING>    \"(?:[^\"\\\r\n]|\\[ -~])*)
+   |(?P<CHARCONST>     \'(?:[^\'\\\r\n]|\\(?:[\r\n -~]|\r\n))*\')
+   |(?P<BAD_CHARCONST> \'(?:[^\'\\\r\n]|\\[ -~])*)
+   |(?P<BLOCK_COMMENT> /\*(?:\*(?!/)|[^*])*\*/)
+   |(?P<BAD_BLOCK_COM> /\*(?:\*(?!/)|[^*])*\*?)
+   |(?P<LINE_COMMENT>  //[^\r\n]*)
+   |(?P<IDENT>         [_a-zA-Z][_a-zA-Z0-9]*)
+   |(?P<PP_NUMBER>     \.?[0-9](?:[0-9a-df-oq-zA-DF-OQ-Z_.]|[eEpP][+-]?)*)
+   |(?P<PUNCTUATOR>
+       [,;?~(){}\[\]]
+     | [!*/^=]=?
+     | \#\#?
+     | %(?:[=>]|:(?:%:)?)?
+     | &[=&]?
+     |\|[=|]?
+     |\+[=+]?
+     | -[=->]?
+     |\.(?:\.\.)?
+     | :>?
+     | <(?:[%:]|<(?:=|<=?)?)?
+     | >(?:=|>=?)?)
+   |(?P<ESCNL>         \\(?:\r|\n|\r\n))
+   |(?P<WHITESPACE>    [ \t\n\r\v\f]+)
+   |(?P<OTHER>         .)
+""", re.DOTALL | re.VERBOSE)
+
+HEADER_NAME_RE_ = re.compile(r"""
+    < [^>\r\n]+ >
+  | " [^"\r\n]+ "
+""", re.DOTALL | re.VERBOSE)
+
+ENDLINE_RE_ = re.compile(r"""\r|\n|\r\n""")
+
+# based on the sample code in the Python re documentation
+Token_ = collections.namedtuple("Token", (
+    "kind", "text", "line", "column", "context"))
+Token_.__doc__ = """
+   One C preprocessing token, comment, or chunk of whitespace.
+   'kind' identifies the token type, which will be one of:
+       STRING, CHARCONST, BLOCK_COMMENT, LINE_COMMENT, IDENT,
+       PP_NUMBER, PUNCTUATOR, ESCNL, WHITESPACE, HEADER_NAME,
+       or OTHER.  The BAD_* alternatives in PP_TOKEN_RE_ are
+       handled within tokenize_c, below.
+
+   'text' is the sequence of source characters making up the token;
+       no decoding whatsoever is performed.
+
+   'line' and 'column' give the position of the first character of the
+      token within the source file.  They are both 1-based.
+
+   'context' indicates whether or not this token occurred within a
+      preprocessing directive; it will be None for running text,
+      '<null>' for the leading '#' of a directive line (because '#'
+      all by itself on a line is a "null directive"), or the name of
+      the directive for tokens within a directive line, starting with
+      the IDENT for the name itself.
+"""
+
+def tokenize_c(file_contents, reporter):
+    """Yield a series of Token objects, one for each preprocessing
+       token, comment, or chunk of whitespace within FILE_CONTENTS.
+       The REPORTER object is expected to have one method,
+       reporter.error(token, message), which will be called to
+       indicate a lexical error at the position of TOKEN.
+       If MESSAGE contains the four-character sequence '{!r}', that
+       is expected to be replaced by repr(token.text).
+    """
+
+    Token = Token_
+    PP_TOKEN_RE = PP_TOKEN_RE_
+    ENDLINE_RE = ENDLINE_RE_
+    HEADER_NAME_RE = HEADER_NAME_RE_
+
+    line_num = 1
+    line_start = 0
+    pos = 0
+    limit = len(file_contents)
+    directive = None
+    at_bol = True
+    while pos < limit:
+        if directive == "include":
+            mo = HEADER_NAME_RE.match(file_contents, pos)
+            if mo:
+                kind = "HEADER_NAME"
+                directive = "after_include"
+            else:
+                mo = PP_TOKEN_RE.match(file_contents, pos)
+                kind = mo.lastgroup
+                if kind != "WHITESPACE":
+                    directive = "after_include"
+        else:
+            mo = PP_TOKEN_RE.match(file_contents, pos)
+            kind = mo.lastgroup
+
+        text = mo.group()
+        line = line_num
+        column = mo.start() - line_start
+        adj_line_start = 0
+        # only these kinds can contain a newline
+        if kind in ("WHITESPACE", "BLOCK_COMMENT", "LINE_COMMENT",
+                    "STRING", "CHARCONST", "BAD_BLOCK_COM", "ESCNL"):
+            for tmo in ENDLINE_RE.finditer(text):
+                line_num += 1
+                adj_line_start = tmo.end()
+            if adj_line_start:
+                line_start = mo.start() + adj_line_start
+
+        # Track whether or not we are scanning a preprocessing directive.
+        if kind == 'LINE_COMMENT' or (kind == "WHITESPACE" and adj_line_start):
+            at_bol = True
+            directive = None
+        else:
+            if kind == "PUNCTUATOR" and text == "#" and at_bol:
+                directive = "<null>"
+            elif kind == "IDENT" and directive == "<null>":
+                directive = text
+            at_bol = False
+
+        # Report ill-formed tokens and rewrite them as their well-formed
+        # equivalents, so downstream processing doesn't have to know about them.
+        # (Rewriting instead of discarding provides better error recovery.)
+        if kind == "BAD_BLOCK_COM":
+            reporter.error(Token("BAD_BLOCK_COM", "", line, column+1, ""),
+                           "unclosed block comment")
+            text += "*/"
+            kind = "BLOCK_COMMENT"
+        elif kind == "BAD_STRING":
+            reporter.error(Token("BAD_STRING", "", line, column+1, ""),
+                           "unclosed string")
+            text += "\""
+            kind = "STRING"
+        elif kind == "BAD_CHARCONST":
+            reporter.error(Token("BAD_CHARCONST", "", line, column+1, ""),
+                           "unclosed char constant")
+            text += "'"
+            kind = "CHARCONST"
+
+        tok = Token(kind, text, line, column+1,
+                    "include" if directive == "after_include" else directive)
+        # Do not complain about OTHER tokens inside macro definitions.
+        # $ and @ appear in macros defined by headers intended to be
+        # included from assembly language, e.g. sysdeps/mips/sys/asm.h.
+        if kind == "OTHER" and directive != "define":
+            self.error(tok, "stray {!r} in program")
+
+        yield tok
+        pos = mo.end()
+
+#
+# Base and generic classes for individual checks.
+#
+
+class ConstructChecker:
+    """Scan a stream of C preprocessing tokens and possibly report
+       problems with them.  The REPORTER object passed to __init__ has
+       one method, reporter.error(token, message), which should be
+       called to indicate a problem detected at the position of TOKEN.
+       If MESSAGE contains the four-character sequence '{!r}' then that
+       will be replaced with a textual representation of TOKEN.
+    """
+    def __init__(self, reporter):
+        self.reporter = reporter
+
+    def examine(self, tok):
+        """Called once for each token in a header file.
+           Call self.reporter.error if a problem is detected.
+        """
+        raise NotImplementedError
+
+    def eof(self):
+        """Called once at the end of the stream.  Subclasses need only
+           override this if it might have something to do."""
+        pass
+
+class NoCheck(ConstructChecker):
+    """Generic checker class which doesn't do anything.  Substitute this
+       class for a real checker when a particular check should be skipped
+       for some file."""
+
+    def examine(self, tok):
+        pass
+
+#
+# Check for obsolete type names.
+#
+
+# The obsolete type names we're looking for:
+OBSOLETE_TYPE_RE_ = re.compile(r"""\A
+  (__)?
+  (   quad_t
+    | u(?: short | int | long
+         | _(?: char | short | int(?:[0-9]+_t)? | long | quad_t )))
+\Z""", re.VERBOSE)
+
+class ObsoleteNotAllowed(ConstructChecker):
+    """Don't allow any use of the obsolete typedefs."""
+    def examine(self, tok):
+        if OBSOLETE_TYPE_RE_.match(tok.text):
+            self.reporter.error(tok, "use of {!r}")
+
+class ObsoletePrivateDefinitionsAllowed(ConstructChecker):
+    """Allow definitions of the private versions of the
+       obsolete typedefs; that is, 'typedef [anything] __obsolete;'
+    """
+    def __init__(self, reporter):
+        super().__init__(reporter)
+        self.in_typedef = False
+        self.prev_token = None
+
+    def examine(self, tok):
+        # bits/types.h hides 'typedef' in a macro sometimes.
+        if (tok.kind == "IDENT"
+            and tok.text in ("typedef", "__STD_TYPE")
+            and tok.context is None):
+            self.in_typedef = True
+        elif tok.kind == "PUNCTUATOR" and tok.text == ";" and self.in_typedef:
+            self.in_typedef = False
+            if self.prev_token.kind == "IDENT":
+                m = OBSOLETE_TYPE_RE_.match(self.prev_token.text)
+                if m and m.group(1) != "__":
+                    self.reporter.error(self.prev_token, "use of {!r}")
+            self.prev_token = None
+        else:
+            self._check_prev()
+
+        self.prev_token = tok
+
+    def eof(self):
+        self._check_prev()
+
+    def _check_prev(self):
+        if (self.prev_token is not None
+            and self.prev_token.kind == "IDENT"
+            and OBSOLETE_TYPE_RE_.match(self.prev_token.text)):
+            self.reporter.error(self.prev_token, "use of {!r}")
+
+class ObsoletePublicDefinitionsAllowed(ConstructChecker):
+    """Allow definitions of the public versions of the obsolete
+       typedefs.  Only specific forms of definition are allowed:
+
+           typedef __obsolete obsolete;  // identifiers must agree
+           typedef __uintN_t u_intN_t;   // N must agree
+           typedef unsigned long int ulong;
+           typedef unsigned short int ushort;
+           typedef unsigned int uint;
+    """
+    def __init__(self, reporter):
+        super().__init__(reporter)
+        self.typedef_tokens = []
+
+    def examine(self, tok):
+        if tok.kind in ("WHITESPACE", "BLOCK_COMMENT",
+                        "LINE_COMMENT", "NL", "ESCNL"):
+            pass
+
+        elif (tok.kind == "IDENT" and tok.text == "typedef"
+              and tok.context is None):
+            if self.typedef_tokens:
+                self.reporter.error(tok, "typedef inside typedef")
+                self._reset()
+            self.typedef_tokens.append(tok)
+
+        elif tok.kind == "PUNCTUATOR" and tok.text == ";":
+            self._finish()
+
+        elif self.typedef_tokens:
+            self.typedef_tokens.append(tok)
+
+    def eof(self):
+        self._reset()
+
+    def _reset(self):
+        while self.typedef_tokens:
+            tok = self.typedef_tokens.pop(0)
+            if tok.kind == "IDENT" and OBSOLETE_TYPE_RE_.match(tok.text):
+                self.reporter.error(tok, "use of {!r}")
+
+    def _finish(self):
+        if not self.typedef_tokens: return
+        if self.typedef_tokens[-1].kind == "IDENT":
+            m = OBSOLETE_TYPE_RE_.match(self.typedef_tokens[-1].text)
+            if m:
+                if self._permissible_public_definition(m):
+                    self.typedef_tokens.clear()
+        self._reset()
+
+    def _permissible_public_definition(self, m):
+        if m.group(1) == "__": return False
+        name = m.group(2)
+        toks = self.typedef_tokens
+        ntok = len(toks)
+        if ntok == 3 and toks[1].kind == "IDENT":
+            defn = toks[1].text
+            n = OBSOLETE_TYPE_RE_.match(defn)
+            if n and n.group(1) == "__" and n.group(2) == name:
+                return True
+
+            if (name[:5] == "u_int" and name[-2:] == "_t"
+                and defn[:6] == "__uint" and defn[-2:] == "_t"
+                and name[5:-2] == defn[6:-2]):
+                return True
+
+            return False
+
+        if (name == "ulong" and ntok == 5
+            and toks[1].kind == "IDENT" and toks[1].text == "unsigned"
+            and toks[2].kind == "IDENT" and toks[2].text == "long"
+            and toks[3].kind == "IDENT" and toks[3].text == "int"):
+            return True
+
+        if (name == "ushort" and ntok == 5
+            and toks[1].kind == "IDENT" and toks[1].text == "unsigned"
+            and toks[2].kind == "IDENT" and toks[2].text == "short"
+            and toks[3].kind == "IDENT" and toks[3].text == "int"):
+            return True
+
+        if (name == "uint" and ntok == 4
+            and toks[1].kind == "IDENT" and toks[1].text == "unsigned"
+            and toks[2].kind == "IDENT" and toks[2].text == "int"):
+            return True
+
+        return False
+
+def ObsoleteTypedefChecker(reporter, fname):
+    """Factory: produce an instance of the appropriate
+       obsolete-typedef checker for FNAME."""
+
+    # The obsolete rpc/ and rpcsvc/ headers are allowed to use the
+    # obsolete types, because it would be more trouble than it's
+    # worth to remove them from headers that we intend to stop
+    # installing eventually anyway.
+    if (fname.startswith("rpc/")
+        or fname.startswith("rpcsvc/")
+        or "/rpc/" in fname
+        or "/rpcsvc/" in fname):
+        return NoCheck(reporter)
+
+    # bits/types.h is allowed to define the __-versions of the
+    # obsolete types.
+    if (fname == "bits/types.h"
+        or fname.endswith("/bits/types.h")):
+        return ObsoletePrivateDefinitionsAllowed(reporter)
+
+    # sys/types.h is allowed to use the __-versions of the
+    # obsolete types, but only to define the unprefixed versions.
+    if (fname == "sys/types.h"
+        or fname.endswith("/sys/types.h")):
+        return ObsoletePublicDefinitionsAllowed(reporter)
+
+    return ObsoleteNotAllowed(reporter)
+
+#
+# Master control
+#
+
+class HeaderChecker:
+    """Perform all of the checks on each header.  This is also the
+       "reporter" object expected by tokenize_c and ConstructChecker.
+    """
+    def __init__(self):
+        self.fname = None
+        self.status = 0
+
+    def error(self, tok, message):
+        self.status = 1
+        if '{!r}' in message:
+            message = message.format(tok.text)
+        sys.stderr.write("{}:{}:{}: error: {}\n".format(
+            self.fname, tok.line, tok.column, message))
+
+    def check(self, fname):
+        self.fname = fname
+        try:
+            with open(fname, "rt") as fp:
+                contents = fp.read()
+        except OSError as e:
+            sys.stderr.write("{}: {}\n".format(fname, e.strerror))
+            self.status = 1
+            return
+
+        typedef_checker = ObsoleteTypedefChecker(self, self.fname)
+
+        for tok in tokenize_c(contents, self):
+            typedef_checker.examine(tok)
+
+def main():
+    ap = argparse.ArgumentParser(description=__doc__)
+    ap.add_argument("headers", metavar="header", nargs="+",
+                    help="one or more headers to scan for obsolete constructs")
+    args = ap.parse_args()
+
+    checker = HeaderChecker()
+    for fname in args.headers:
+        # Headers whose installed name begins with "finclude/" contain
+        # Fortran, not C, and this program should completely ignore them.
+        if not (fname.startswith("finclude/") or "/finclude/" in fname):
+            checker.check(fname)
+    sys.exit(checker.status)
+
+main()

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


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]