unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/8] sys/types.h cleanup and further typedef obsoletion
@ 2019-03-11 14:59 Zack Weinberg
  2019-03-11 14:59 ` [PATCH 1/8] Move inttypes.h and stdint.h to stdlib Zack Weinberg
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Zack Weinberg @ 2019-03-11 14:59 UTC (permalink / raw)
  To: libc-alpha

This patch series removes a fair amount of cruft from sys/types.h and
bits/types.h, obsoletes four additional typedefs that should not
be used in public interfaces anymore (caddr_t, daddr_t, loff_t,
register_t), and restricts sys/types.h’s definition of u_intN_t and
register_t to __USE_MISC (i.e. they are no longer present in strict
conformance modes).

It depends on the “Use a proper C tokenizer to implement the obsolete
typedefs test” patch, which has just been resubmitted separately.
Unlike that patch, this series is not intended to be appropriate for
backport to release branches.

Zack Weinberg (8):
  Move inttypes.h and stdint.h to stdlib.
  Define register_t using bits/typesizes.h macros.
  sys/types.h: Don’t define u_intN_t or register_t unless __USE_MISC.
  Add caddr_t, daddr_t, and loff_t to the set of obsolete typedefs.
  Simplify definition of __time64_t.
  Clean up bits/types.h.
  Create bits/types headers for most remaining __T_defined macros.
  Don’t conditionalize declarations of ldiv_t, lldiv_t, __gwchar_t.

 NEWS                                          |   8 +
 bits/socket.h                                 |   8 +-
 bits/time64.h                                 |   2 +-
 bits/typesizes.h                              |  16 +-
 dirent/dirent.h                               |  14 +-
 elf/dl-map-segments.h                         |  15 +-
 elf/dl-minimal.c                              |   2 +-
 elf/dl-reloc.c                                |   4 +-
 grp/grp.h                                     |   6 +-
 hurd/Makefile                                 |   2 +-
 hurd/fd-read.c                                |   2 +-
 hurd/fd-write.c                               |   2 +-
 hurd/hurd/fd.h                                |   6 +-
 include/bits/types/blkcnt64_t.h               |   1 +
 include/bits/types/blkcnt_t.h                 |   1 +
 include/bits/types/blksize_t.h                |   1 +
 include/bits/types/caddr_t.h                  |   1 +
 include/bits/types/daddr_t.h                  |   1 +
 include/bits/types/dev_t.h                    |   1 +
 include/bits/types/fsblkcnt64_t.h             |   1 +
 include/bits/types/fsblkcnt_t.h               |   1 +
 include/bits/types/fsfilcnt64_t.h             |   1 +
 include/bits/types/fsfilcnt_t.h               |   1 +
 include/bits/types/fsid_t.h                   |   1 +
 include/bits/types/gid_t.h                    |   1 +
 include/bits/types/id_t.h                     |   1 +
 include/bits/types/ino64_t.h                  |   1 +
 include/bits/types/ino_t.h                    |   1 +
 include/bits/types/intptr_t.h                 |   1 +
 include/bits/types/key_t.h                    |   1 +
 include/bits/types/loff_t.h                   |   1 +
 include/bits/types/mode_t.h                   |   1 +
 include/bits/types/nlink_t.h                  |   1 +
 include/bits/types/off64_t.h                  |   1 +
 include/bits/types/off_t.h                    |   1 +
 include/bits/types/pid_t.h                    |   1 +
 include/bits/types/register_t.h               |   1 +
 include/bits/types/socklen_t.h                |   1 +
 include/bits/types/ssize_t.h                  |   1 +
 include/bits/types/suseconds_t.h              |   1 +
 include/bits/types/u_int.h                    |   1 +
 include/bits/types/u_intN_t.h                 |   1 +
 include/bits/types/uid_t.h                    |   1 +
 include/bits/types/uint.h                     |   1 +
 include/bits/types/useconds_t.h               |   1 +
 include/inttypes.h                            |   2 +-
 include/stdint.h                              |   1 +
 inet/arpa/inet.h                              |   7 +-
 intl/loadmsgcat.c                             |   7 +-
 io/fcntl.h                                    |  27 +--
 io/sys/stat.h                                 |  66 +----
 io/sys/statvfs.h                              |  21 +-
 libio/stdio.h                                 |  19 +-
 locale/loadlocale.c                           |  11 +-
 misc/sys/mman.h                               |  16 +-
 misc/sys/select.h                             |   7 +-
 misc/ustat.c                                  |   8 +-
 nis/nis_add.c                                 |   4 +-
 nis/nis_call.c                                |  10 +-
 nis/nis_callback.c                            |  12 +-
 nis/nis_checkpoint.c                          |   4 +-
 nis/nis_findserv.c                            |   8 +-
 nis/nis_intern.h                              |  12 +-
 nis/nis_lookup.c                              |   4 +-
 nis/nis_mkdir.c                               |   8 +-
 nis/nis_modify.c                              |   4 +-
 nis/nis_ping.c                                |   4 +-
 nis/nis_remove.c                              |   4 +-
 nis/nis_rmdir.c                               |   4 +-
 nis/nis_server.c                              |   8 +-
 nis/nis_table.c                               |  28 +--
 nis/nis_util.c                                |   4 +-
 nis/nss_nisplus/nisplus-grp.c                 |   8 +-
 nis/nss_nisplus/nisplus-pwd.c                 |   8 +-
 nis/rpcsvc/nis_callback.h                     |   2 +-
 nis/rpcsvc/yp.h                               |   6 +-
 nis/ypclnt.c                                  |  42 ++--
 posix/Makefile                                |  37 ++-
 posix/bits/types.h                            | 206 ++++++----------
 posix/bits/types/blkcnt64_t.h                 |   9 +
 posix/bits/types/blkcnt_t.h                   |  13 +
 posix/bits/types/blksize_t.h                  |   9 +
 posix/bits/types/caddr_t.h                    |   9 +
 posix/bits/types/daddr_t.h                    |   9 +
 posix/bits/types/dev_t.h                      |  10 +
 posix/bits/types/fsblkcnt64_t.h               |   9 +
 posix/bits/types/fsblkcnt_t.h                 |  13 +
 posix/bits/types/fsfilcnt64_t.h               |   9 +
 posix/bits/types/fsfilcnt_t.h                 |  13 +
 posix/bits/types/fsid_t.h                     |   9 +
 posix/bits/types/gid_t.h                      |   9 +
 posix/bits/types/id_t.h                       |  10 +
 posix/bits/types/ino64_t.h                    |   9 +
 posix/bits/types/ino_t.h                      |  13 +
 posix/bits/types/intptr_t.h                   |  10 +
 posix/bits/types/key_t.h                      |   9 +
 posix/bits/types/loff_t.h                     |   9 +
 posix/bits/types/mode_t.h                     |   9 +
 posix/bits/types/nlink_t.h                    |   9 +
 posix/bits/types/off64_t.h                    |   9 +
 posix/bits/types/off_t.h                      |  13 +
 posix/bits/types/pid_t.h                      |   9 +
 posix/bits/types/register_t.h                 |   9 +
 posix/bits/types/socklen_t.h                  |   9 +
 posix/bits/types/ssize_t.h                    |   9 +
 posix/bits/types/suseconds_t.h                |   9 +
 posix/bits/types/u_int.h                      |  15 ++
 posix/bits/types/u_intN_t.h                   |  17 ++
 posix/bits/types/uid_t.h                      |   9 +
 posix/bits/types/uint.h                       |  10 +
 posix/bits/types/useconds_t.h                 |   9 +
 posix/sched.h                                 |   6 +-
 posix/sys/types.h                             | 227 ++++--------------
 posix/sys/wait.h                              |  11 +-
 posix/unistd.h                                |  56 +----
 pwd/pwd.h                                     |  11 +-
 resource/sys/resource.h                       |   6 +-
 scripts/check-obsolete-constructs.py          | 149 ++++++++----
 signal/signal.h                               |  12 +-
 {sysdeps/generic => stdlib}/inttypes.h        |  15 +-
 stdlib/monetary.h                             |   7 +-
 {sysdeps/generic => stdlib}/stdint.h          |  16 +-
 stdlib/stdlib.h                               |   6 +-
 streams/stropts.h                             |  12 +-
 sunrpc/auth_des.c                             |   2 +-
 sunrpc/auth_unix.c                            |   4 +-
 sunrpc/authdes_prot.c                         |  10 +-
 sunrpc/authuxprot.c                           |   2 +-
 sunrpc/clnt_raw.c                             |  12 +-
 sunrpc/clnt_tcp.c                             |  28 +--
 sunrpc/clnt_udp.c                             |  22 +-
 sunrpc/clnt_unix.c                            |  26 +-
 sunrpc/key_call.c                             |   2 +-
 sunrpc/pm_getmaps.c                           |   2 +-
 sunrpc/pm_getport.c                           |   4 +-
 sunrpc/pmap_clnt.c                            |   4 +-
 sunrpc/pmap_prot2.c                           |   2 +-
 sunrpc/pmap_rmt.c                             |  16 +-
 sunrpc/proto.h                                |   2 +-
 sunrpc/rpc/auth.h                             |   4 +-
 sunrpc/rpc/clnt.h                             |  16 +-
 sunrpc/rpc/pmap_clnt.h                        |  12 +-
 sunrpc/rpc/pmap_rmt.h                         |   4 +-
 sunrpc/rpc/rpc_msg.h                          |   2 +-
 sunrpc/rpc/svc.h                              |  14 +-
 sunrpc/rpc/types.h                            |  44 +---
 sunrpc/rpc/xdr.h                              |  22 +-
 sunrpc/rpc_clntout.c                          |   8 +-
 sunrpc/rpc_cmsg.c                             |  12 +-
 sunrpc/rpc_hout.c                             |   2 +-
 sunrpc/rpc_prot.c                             |   4 +-
 sunrpc/rpc_sample.c                           |   4 +-
 sunrpc/rpc_svcout.c                           |   6 +-
 sunrpc/svc.c                                  |   2 +-
 sunrpc/svc_authux.c                           |   2 +-
 sunrpc/svc_raw.c                              |   8 +-
 sunrpc/svc_tcp.c                              |  24 +-
 sunrpc/svc_udp.c                              |  14 +-
 sunrpc/svc_unix.c                             |  28 +--
 sunrpc/xdr.c                                  |   4 +-
 sunrpc/xdr_array.c                            |   4 +-
 sunrpc/xdr_mem.c                              |  12 +-
 sunrpc/xdr_rec.c                              |  46 ++--
 sunrpc/xdr_ref.c                              |   6 +-
 sunrpc/xdr_sizeof.c                           |   8 +-
 sunrpc/xdr_stdio.c                            |  14 +-
 support/xunistd.h                             |   4 +-
 sysdeps/gnu/net/if.h                          |   4 +-
 sysdeps/gnu/sys/mtio.h                        |   4 +-
 sysdeps/gnu/utmpx.h                           |   5 +-
 sysdeps/mach/hurd/bits/socket.h               |   8 +-
 sysdeps/mach/hurd/bits/typesizes.h            |  16 +-
 .../unix/sysv/linux/alpha/bits/typesizes.h    |   2 +-
 sysdeps/unix/sysv/linux/bits/socket.h         |   7 +-
 .../unix/sysv/linux/generic/bits/typesizes.h  |  16 +-
 .../sysv/linux/generic/wordsize-32/overflow.h |   2 +-
 sysdeps/unix/sysv/linux/lseek.c               |   4 +-
 sysdeps/unix/sysv/linux/lseek64.c             |   2 +-
 sysdeps/unix/sysv/linux/mips/bits/typesizes.h |  88 +++++++
 sysdeps/unix/sysv/linux/s390/bits/typesizes.h |  16 +-
 .../unix/sysv/linux/sparc/bits/typesizes.h    |  16 +-
 sysdeps/unix/sysv/linux/splice.c              |   2 +-
 sysdeps/unix/sysv/linux/sys/quota.h           |   4 +-
 sysdeps/unix/sysv/linux/test-errno-linux.c    |   2 +-
 sysdeps/unix/sysv/linux/ustat.c               |   9 +-
 sysdeps/unix/sysv/linux/x86/bits/typesizes.h  |  21 +-
 sysvipc/sys/ipc.h                             |  24 +-
 sysvipc/sys/msg.h                             |  12 +-
 sysvipc/sys/shm.h                             |   9 +-
 termios/termios.h                             |   8 +-
 time/sys/time.h                               |   6 +-
 time/time.h                                   |   5 +-
 192 files changed, 1209 insertions(+), 1149 deletions(-)
 create mode 100644 include/bits/types/blkcnt64_t.h
 create mode 100644 include/bits/types/blkcnt_t.h
 create mode 100644 include/bits/types/blksize_t.h
 create mode 100644 include/bits/types/caddr_t.h
 create mode 100644 include/bits/types/daddr_t.h
 create mode 100644 include/bits/types/dev_t.h
 create mode 100644 include/bits/types/fsblkcnt64_t.h
 create mode 100644 include/bits/types/fsblkcnt_t.h
 create mode 100644 include/bits/types/fsfilcnt64_t.h
 create mode 100644 include/bits/types/fsfilcnt_t.h
 create mode 100644 include/bits/types/fsid_t.h
 create mode 100644 include/bits/types/gid_t.h
 create mode 100644 include/bits/types/id_t.h
 create mode 100644 include/bits/types/ino64_t.h
 create mode 100644 include/bits/types/ino_t.h
 create mode 100644 include/bits/types/intptr_t.h
 create mode 100644 include/bits/types/key_t.h
 create mode 100644 include/bits/types/loff_t.h
 create mode 100644 include/bits/types/mode_t.h
 create mode 100644 include/bits/types/nlink_t.h
 create mode 100644 include/bits/types/off64_t.h
 create mode 100644 include/bits/types/off_t.h
 create mode 100644 include/bits/types/pid_t.h
 create mode 100644 include/bits/types/register_t.h
 create mode 100644 include/bits/types/socklen_t.h
 create mode 100644 include/bits/types/ssize_t.h
 create mode 100644 include/bits/types/suseconds_t.h
 create mode 100644 include/bits/types/u_int.h
 create mode 100644 include/bits/types/u_intN_t.h
 create mode 100644 include/bits/types/uid_t.h
 create mode 100644 include/bits/types/uint.h
 create mode 100644 include/bits/types/useconds_t.h
 create mode 100644 include/stdint.h
 create mode 100644 posix/bits/types/blkcnt64_t.h
 create mode 100644 posix/bits/types/blkcnt_t.h
 create mode 100644 posix/bits/types/blksize_t.h
 create mode 100644 posix/bits/types/caddr_t.h
 create mode 100644 posix/bits/types/daddr_t.h
 create mode 100644 posix/bits/types/dev_t.h
 create mode 100644 posix/bits/types/fsblkcnt64_t.h
 create mode 100644 posix/bits/types/fsblkcnt_t.h
 create mode 100644 posix/bits/types/fsfilcnt64_t.h
 create mode 100644 posix/bits/types/fsfilcnt_t.h
 create mode 100644 posix/bits/types/fsid_t.h
 create mode 100644 posix/bits/types/gid_t.h
 create mode 100644 posix/bits/types/id_t.h
 create mode 100644 posix/bits/types/ino64_t.h
 create mode 100644 posix/bits/types/ino_t.h
 create mode 100644 posix/bits/types/intptr_t.h
 create mode 100644 posix/bits/types/key_t.h
 create mode 100644 posix/bits/types/loff_t.h
 create mode 100644 posix/bits/types/mode_t.h
 create mode 100644 posix/bits/types/nlink_t.h
 create mode 100644 posix/bits/types/off64_t.h
 create mode 100644 posix/bits/types/off_t.h
 create mode 100644 posix/bits/types/pid_t.h
 create mode 100644 posix/bits/types/register_t.h
 create mode 100644 posix/bits/types/socklen_t.h
 create mode 100644 posix/bits/types/ssize_t.h
 create mode 100644 posix/bits/types/suseconds_t.h
 create mode 100644 posix/bits/types/u_int.h
 create mode 100644 posix/bits/types/u_intN_t.h
 create mode 100644 posix/bits/types/uid_t.h
 create mode 100644 posix/bits/types/uint.h
 create mode 100644 posix/bits/types/useconds_t.h
 rename {sysdeps/generic => stdlib}/inttypes.h (98%)
 rename {sysdeps/generic => stdlib}/stdint.h (96%)
 create mode 100644 sysdeps/unix/sysv/linux/mips/bits/typesizes.h

-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/8] Move inttypes.h and stdint.h to stdlib.
  2019-03-11 14:59 [PATCH 0/8] sys/types.h cleanup and further typedef obsoletion Zack Weinberg
@ 2019-03-11 14:59 ` Zack Weinberg
  2019-03-11 23:19   ` Joseph Myers
  2019-03-11 14:59 ` [PATCH 2/8] Define register_t using bits/typesizes.h macros Zack Weinberg
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Zack Weinberg @ 2019-03-11 14:59 UTC (permalink / raw)
  To: libc-alpha

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.
---
 include/inttypes.h                     | 2 +-
 include/stdint.h                       | 1 +
 {sysdeps/generic => stdlib}/inttypes.h | 0
 {sysdeps/generic => stdlib}/stdint.h   | 0
 4 files changed, 2 insertions(+), 1 deletion(-)
 create mode 100644 include/stdint.h
 rename {sysdeps/generic => stdlib}/inttypes.h (100%)
 rename {sysdeps/generic => stdlib}/stdint.h (100%)

diff --git a/include/inttypes.h b/include/inttypes.h
index 33219e2a9f..3a583c6c07 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 0000000000..7f428741d7
--- /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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/8] Define register_t using bits/typesizes.h macros.
  2019-03-11 14:59 [PATCH 0/8] sys/types.h cleanup and further typedef obsoletion Zack Weinberg
  2019-03-11 14:59 ` [PATCH 1/8] Move inttypes.h and stdint.h to stdlib Zack Weinberg
@ 2019-03-11 14:59 ` Zack Weinberg
  2019-05-22 14:42   ` Florian Weimer
  2019-03-11 14:59 ` [PATCH 3/8] sys/types.h: Don’t define u_intN_t or register_t unless __USE_MISC Zack Weinberg
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Zack Weinberg @ 2019-03-11 14:59 UTC (permalink / raw)
  To: libc-alpha

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.
---
 bits/typesizes.h                                    |  1 +
 posix/bits/types.h                                  |  3 +++
 posix/sys/types.h                                   |  7 ++-----
 sysdeps/mach/hurd/bits/typesizes.h                  |  1 +
 sysdeps/unix/sysv/linux/alpha/bits/typesizes.h      |  1 +
 sysdeps/unix/sysv/linux/generic/bits/typesizes.h    |  1 +
 .../sysv/linux/{generic => mips}/bits/typesizes.h   | 13 +++++++++----
 sysdeps/unix/sysv/linux/s390/bits/typesizes.h       |  1 +
 sysdeps/unix/sysv/linux/sparc/bits/typesizes.h      |  1 +
 sysdeps/unix/sysv/linux/x86/bits/typesizes.h        |  2 ++
 10 files changed, 22 insertions(+), 9 deletions(-)
 copy sysdeps/unix/sysv/linux/{generic => mips}/bits/typesizes.h (90%)

diff --git a/bits/typesizes.h b/bits/typesizes.h
index 41c8924336..4541013361 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 0de6c59bb4..4521d9d06e 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 0e37b1ce6a..1bbd896ad4 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 6bd9b43599..94b0afcdaf 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 cde275defd..0485dd1eb7 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 3ef1281c8a..c738ff50a5 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 3ef1281c8a..1132670b1c 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 e42105700a..c578237817 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 115cc1995b..0db18f4913 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 18d2c63b0a..0a71e30681 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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/8] sys/types.h: Don’t define u_intN_t or register_t unless __USE_MISC.
  2019-03-11 14:59 [PATCH 0/8] sys/types.h cleanup and further typedef obsoletion Zack Weinberg
  2019-03-11 14:59 ` [PATCH 1/8] Move inttypes.h and stdint.h to stdlib Zack Weinberg
  2019-03-11 14:59 ` [PATCH 2/8] Define register_t using bits/typesizes.h macros Zack Weinberg
@ 2019-03-11 14:59 ` Zack Weinberg
  2019-05-09  8:34   ` Florian Weimer
  2019-03-11 14:59 ` [PATCH 4/8] Add caddr_t, daddr_t, and loff_t to the set of obsolete typedefs Zack Weinberg
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Zack Weinberg @ 2019-03-11 14:59 UTC (permalink / raw)
  To: libc-alpha

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).
---
 NEWS                                 |  8 ++++++++
 posix/sys/types.h                    | 16 ++++++++--------
 scripts/check-obsolete-constructs.py |  1 +
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index 0d9236c38d..a4d34213b4 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 1bbd896ad4..7327904346 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 46535afcac..4317aa320d 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)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 4/8] Add caddr_t, daddr_t, and loff_t to the set of obsolete typedefs.
  2019-03-11 14:59 [PATCH 0/8] sys/types.h cleanup and further typedef obsoletion Zack Weinberg
                   ` (2 preceding siblings ...)
  2019-03-11 14:59 ` [PATCH 3/8] sys/types.h: Don’t define u_intN_t or register_t unless __USE_MISC Zack Weinberg
@ 2019-03-11 14:59 ` Zack Weinberg
  2019-03-11 14:59 ` [PATCH 5/8] Simplify definition of __time64_t Zack Weinberg
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Zack Weinberg @ 2019-03-11 14:59 UTC (permalink / raw)
  To: libc-alpha

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.
---
 bits/typesizes.h                              |  1 -
 elf/dl-map-segments.h                         | 15 +++---
 elf/dl-minimal.c                              |  2 +-
 elf/dl-reloc.c                                |  4 +-
 hurd/Makefile                                 |  2 +-
 hurd/fd-read.c                                |  2 +-
 hurd/fd-write.c                               |  2 +-
 hurd/hurd/fd.h                                |  6 ++-
 intl/loadmsgcat.c                             |  7 +--
 locale/loadlocale.c                           | 11 +++--
 misc/ustat.c                                  |  8 +---
 nis/nis_add.c                                 |  4 +-
 nis/nis_call.c                                | 10 ++--
 nis/nis_callback.c                            | 12 ++---
 nis/nis_checkpoint.c                          |  4 +-
 nis/nis_findserv.c                            |  8 ++--
 nis/nis_intern.h                              | 12 ++---
 nis/nis_lookup.c                              |  4 +-
 nis/nis_mkdir.c                               |  8 ++--
 nis/nis_modify.c                              |  4 +-
 nis/nis_ping.c                                |  4 +-
 nis/nis_remove.c                              |  4 +-
 nis/nis_rmdir.c                               |  4 +-
 nis/nis_server.c                              |  8 ++--
 nis/nis_table.c                               | 28 +++++------
 nis/nis_util.c                                |  4 +-
 nis/nss_nisplus/nisplus-grp.c                 |  8 ++--
 nis/nss_nisplus/nisplus-pwd.c                 |  8 ++--
 nis/rpcsvc/nis_callback.h                     |  2 +-
 nis/rpcsvc/yp.h                               |  6 +--
 nis/ypclnt.c                                  | 42 ++++++++---------
 posix/bits/types.h                            |  4 +-
 scripts/check-obsolete-constructs.py          |  7 ++-
 sunrpc/auth_des.c                             |  2 +-
 sunrpc/auth_unix.c                            |  4 +-
 sunrpc/authdes_prot.c                         | 10 ++--
 sunrpc/authuxprot.c                           |  2 +-
 sunrpc/clnt_raw.c                             | 12 ++---
 sunrpc/clnt_tcp.c                             | 28 +++++------
 sunrpc/clnt_udp.c                             | 22 ++++-----
 sunrpc/clnt_unix.c                            | 26 +++++------
 sunrpc/key_call.c                             |  2 +-
 sunrpc/pm_getmaps.c                           |  2 +-
 sunrpc/pm_getport.c                           |  4 +-
 sunrpc/pmap_clnt.c                            |  4 +-
 sunrpc/pmap_prot2.c                           |  2 +-
 sunrpc/pmap_rmt.c                             | 16 +++----
 sunrpc/proto.h                                |  2 +-
 sunrpc/rpc/auth.h                             |  4 +-
 sunrpc/rpc/clnt.h                             | 16 +++----
 sunrpc/rpc/pmap_clnt.h                        | 12 ++---
 sunrpc/rpc/pmap_rmt.h                         |  4 +-
 sunrpc/rpc/rpc_msg.h                          |  2 +-
 sunrpc/rpc/svc.h                              | 14 +++---
 sunrpc/rpc/xdr.h                              | 22 ++++-----
 sunrpc/rpc_clntout.c                          |  8 ++--
 sunrpc/rpc_cmsg.c                             | 12 ++---
 sunrpc/rpc_hout.c                             |  2 +-
 sunrpc/rpc_prot.c                             |  4 +-
 sunrpc/rpc_sample.c                           |  4 +-
 sunrpc/rpc_svcout.c                           |  6 +--
 sunrpc/svc.c                                  |  2 +-
 sunrpc/svc_authux.c                           |  2 +-
 sunrpc/svc_raw.c                              |  8 ++--
 sunrpc/svc_tcp.c                              | 24 +++++-----
 sunrpc/svc_udp.c                              | 14 +++---
 sunrpc/svc_unix.c                             | 28 +++++------
 sunrpc/xdr.c                                  |  4 +-
 sunrpc/xdr_array.c                            |  4 +-
 sunrpc/xdr_mem.c                              | 12 ++---
 sunrpc/xdr_rec.c                              | 46 +++++++++----------
 sunrpc/xdr_ref.c                              |  6 +--
 sunrpc/xdr_sizeof.c                           |  8 ++--
 sunrpc/xdr_stdio.c                            | 14 +++---
 support/xunistd.h                             |  4 +-
 sysdeps/gnu/net/if.h                          |  4 +-
 sysdeps/gnu/sys/mtio.h                        |  4 +-
 sysdeps/mach/hurd/bits/typesizes.h            |  1 -
 .../unix/sysv/linux/alpha/bits/typesizes.h    |  1 -
 .../unix/sysv/linux/generic/bits/typesizes.h  |  1 -
 .../sysv/linux/generic/wordsize-32/overflow.h |  2 +-
 sysdeps/unix/sysv/linux/lseek.c               |  4 +-
 sysdeps/unix/sysv/linux/lseek64.c             |  2 +-
 sysdeps/unix/sysv/linux/mips/bits/typesizes.h |  1 -
 sysdeps/unix/sysv/linux/s390/bits/typesizes.h |  1 -
 .../unix/sysv/linux/sparc/bits/typesizes.h    |  1 -
 sysdeps/unix/sysv/linux/splice.c              |  2 +-
 sysdeps/unix/sysv/linux/sys/quota.h           |  4 +-
 sysdeps/unix/sysv/linux/test-errno-linux.c    |  2 +-
 sysdeps/unix/sysv/linux/ustat.c               |  9 ++--
 sysdeps/unix/sysv/linux/x86/bits/typesizes.h  |  1 -
 91 files changed, 357 insertions(+), 362 deletions(-)

diff --git a/bits/typesizes.h b/bits/typesizes.h
index 4541013361..a7291465ca 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 a41f0667f0..c981e882f0 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 fdb1341832..78d992180a 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 e7fb8da276..fb99599b09 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 99d33f9562..686e154f71 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)
 \f
 # 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
 \f
diff --git a/hurd/fd-read.c b/hurd/fd-read.c
index 594b14003b..f07814a775 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 b2589245b1..e485f69758 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 779ea4fc9d..1e324057aa 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 5f32290331..179a575065 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 571c94e1de..93b39d73ad 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 7336ea9318..b22adb1184 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 ad91ac1f79..15734d5bdd 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 a48ecc39a8..50c51255af 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 0a78b1c41e..58afea804b 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 42e262b0c0..b03582fc00 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 d0ce3e8693..a87f9b34f4 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 fcd60cb3a2..6c0e234c76 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 de5eb193ef..8871be7362 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 84630b4230..a6daf8a2da 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 bb10ff1600..d00879746a 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 1d388d8151..e2cb50b90e 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 d879af1f3e..5f4d50728c 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 4063ebed94..ebeddc66de 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 537c7b3907..a9ed987d61 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 c443f53133..f31075f1ca 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 fdce926e16..550c563a99 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 b7d7aa832f..e44881957e 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 736e46604c..da4c6c3817 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 6f05728e2a..ecbd367621 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 968b74c42e..407e1fde9c 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 3201e375a2..55cae519ea 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 4521d9d06e..9ddbe8733c 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 4317aa320d..bf5e11431e 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 5b6f985bc2..7e77f510d2 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 b035fdd870..15de6d06db 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 93b7cfc04b..bc23622ae8 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 14fe9f56c8..41fd999979 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 5b9bd48247..a723dc2b07 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 249e9c3584..4b3533eba7 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 c2436e3ebc..99f3d7f703 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 33a02cc8af..51ed935359 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 9b8f9819c9..270a1e9c86 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 094492b2b4..b1e8eab7c4 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 3e6dd34e58..394c437039 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 69b4907b3a..3b1ebe1868 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 c414db0298..6825db7fe3 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 6b142e5441..0fc406c125 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 ea28565b1e..eef7b91614 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 e01b077214..c506e53749 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 f4d4a941c7..88ea9a2ae7 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 1cc94b8fee..1e7a4fb31f 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 f8680141ae..7627b8edfe 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 273b187d14..a2cc516cd6 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 d22f9f6a38..85d0183d48 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 d80d8f735d..3007e38d09 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 ce4d2a4c95..eaacdb637c 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 ec8cc6ccca..4164a849f5 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 10f793d233..027d687219 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 46582f2a35..bd98264de1 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 e90b58c080..1a267f1cfa 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 4f12a8146c..3eca750d46 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 39279b40b5..95ecfbb2d1 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 0c6b0242cd..1a703782f4 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 f0176311d5..f7a3f913bf 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 484574c11a..4d712a75d8 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 17357c8ced..5193731beb 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 eac1ae8fb9..11e8797007 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 b5fb7455e2..98967dfd35 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 18383d437e..a4f0853843 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 46a1f6f190..f4af0acb39 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 c9a1eaad63..5d777803ed 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 eab3b74227..abb9ac24f5 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 1592406d64..150d043078 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 0c2cbb78de..459585bf0d 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 338eb86a1b..76b74b5f76 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 303d092739..e94ed67c21 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 69a1dce02d..0ce41c58df 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 94b0afcdaf..23ee7af95c 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 0485dd1eb7..d733e4b6a8 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 c738ff50a5..26dabcfb39 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 6c17047e4c..a8516e1aed 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 6d17d0e667..4a078920b6 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 ecf4338cdb..4f53244387 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 1132670b1c..7c1bedd9af 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 c578237817..712264a84f 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 0db18f4913..b2d39294e9 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 24dae37841..392874ad39 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 18b9f2e317..8c3a5a1da6 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 cb979d44bd..1cd4f4f6aa 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 39cb21fbe0..6638ed59f2 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 0a71e30681..fb724e6a7a 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 *
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 5/8] Simplify definition of __time64_t.
  2019-03-11 14:59 [PATCH 0/8] sys/types.h cleanup and further typedef obsoletion Zack Weinberg
                   ` (3 preceding siblings ...)
  2019-03-11 14:59 ` [PATCH 4/8] Add caddr_t, daddr_t, and loff_t to the set of obsolete typedefs Zack Weinberg
@ 2019-03-11 14:59 ` Zack Weinberg
  2019-05-22 14:44   ` Florian Weimer
  2019-03-11 14:59 ` [PATCH 6/8] Clean up bits/types.h Zack Weinberg
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Zack Weinberg @ 2019-03-11 14:59 UTC (permalink / raw)
  To: libc-alpha

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.
---
 posix/bits/types.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/posix/bits/types.h b/posix/bits/types.h
index 9ddbe8733c..1f079505a7 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;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 6/8] Clean up bits/types.h.
  2019-03-11 14:59 [PATCH 0/8] sys/types.h cleanup and further typedef obsoletion Zack Weinberg
                   ` (4 preceding siblings ...)
  2019-03-11 14:59 ` [PATCH 5/8] Simplify definition of __time64_t Zack Weinberg
@ 2019-03-11 14:59 ` Zack Weinberg
  2019-03-11 14:59 ` [PATCH 7/8] Create bits/types headers for most remaining __T_defined macros Zack Weinberg
  2019-03-11 14:59 ` [PATCH 8/8] Don’t conditionalize declarations of ldiv_t, lldiv_t, __gwchar_t Zack Weinberg
  7 siblings, 0 replies; 17+ messages in thread
From: Zack Weinberg @ 2019-03-11 14:59 UTC (permalink / raw)
  To: libc-alpha

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.
---
 bits/time64.h                                 |   2 +-
 bits/typesizes.h                              |  14 +-
 posix/bits/types.h                            | 204 +++++++-----------
 posix/sys/types.h                             |  12 +-
 scripts/check-obsolete-constructs.py          |  67 +++---
 stdlib/stdint.h                               |  13 +-
 sunrpc/rpc/types.h                            |  12 +-
 sysdeps/mach/hurd/bits/typesizes.h            |  14 +-
 .../unix/sysv/linux/generic/bits/typesizes.h  |  14 +-
 sysdeps/unix/sysv/linux/mips/bits/typesizes.h |  16 +-
 sysdeps/unix/sysv/linux/s390/bits/typesizes.h |  14 +-
 .../unix/sysv/linux/sparc/bits/typesizes.h    |  14 +-
 sysdeps/unix/sysv/linux/x86/bits/typesizes.h  |  20 +-
 13 files changed, 180 insertions(+), 236 deletions(-)

diff --git a/bits/time64.h b/bits/time64.h
index c0f8a24d8a..de38d3da03 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 a7291465ca..bd21cf31cd 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 1f079505a7..4a6043cdc8 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;
+/* 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.  */
 
-/* Duplicate info from sys/socket.h.  */
-__STD_TYPE __U32_TYPE __socklen_t;
+/* POSIX:  */
+typedef __U32_TYPE __socklen_t;		/* Size of a socket address.  */
 
-/* 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;
-
-/* BSD: Size of a general-purpose integer register.  */
-__STD_TYPE __REGISTER_T_TYPE __register_t;
-
-#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 7327904346..2d8cfd19d2 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 bf5e11431e..12dd19db36 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
-
+        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 1ad538fc48..8645d91cfc 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 beded52555..99e5f4f151 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 23ee7af95c..eaeaab1e32 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 26dabcfb39..fb4a5605f2 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 7c1bedd9af..e73bba4ee7 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 712264a84f..741dfaed77 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 b2d39294e9..c084ebd6b6 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 fb724e6a7a..37fac92bf8 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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 7/8] Create bits/types headers for most remaining __T_defined macros.
  2019-03-11 14:59 [PATCH 0/8] sys/types.h cleanup and further typedef obsoletion Zack Weinberg
                   ` (5 preceding siblings ...)
  2019-03-11 14:59 ` [PATCH 6/8] Clean up bits/types.h Zack Weinberg
@ 2019-03-11 14:59 ` Zack Weinberg
  2019-03-11 14:59 ` [PATCH 8/8] Don’t conditionalize declarations of ldiv_t, lldiv_t, __gwchar_t Zack Weinberg
  7 siblings, 0 replies; 17+ messages in thread
From: Zack Weinberg @ 2019-03-11 14:59 UTC (permalink / raw)
  To: libc-alpha

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.
---
 bits/socket.h                         |   8 +-
 dirent/dirent.h                       |  14 +-
 grp/grp.h                             |   6 +-
 include/bits/types/blkcnt64_t.h       |   1 +
 include/bits/types/blkcnt_t.h         |   1 +
 include/bits/types/blksize_t.h        |   1 +
 include/bits/types/caddr_t.h          |   1 +
 include/bits/types/daddr_t.h          |   1 +
 include/bits/types/dev_t.h            |   1 +
 include/bits/types/fsblkcnt64_t.h     |   1 +
 include/bits/types/fsblkcnt_t.h       |   1 +
 include/bits/types/fsfilcnt64_t.h     |   1 +
 include/bits/types/fsfilcnt_t.h       |   1 +
 include/bits/types/fsid_t.h           |   1 +
 include/bits/types/gid_t.h            |   1 +
 include/bits/types/id_t.h             |   1 +
 include/bits/types/ino64_t.h          |   1 +
 include/bits/types/ino_t.h            |   1 +
 include/bits/types/intptr_t.h         |   1 +
 include/bits/types/key_t.h            |   1 +
 include/bits/types/loff_t.h           |   1 +
 include/bits/types/mode_t.h           |   1 +
 include/bits/types/nlink_t.h          |   1 +
 include/bits/types/off64_t.h          |   1 +
 include/bits/types/off_t.h            |   1 +
 include/bits/types/pid_t.h            |   1 +
 include/bits/types/register_t.h       |   1 +
 include/bits/types/socklen_t.h        |   1 +
 include/bits/types/ssize_t.h          |   1 +
 include/bits/types/suseconds_t.h      |   1 +
 include/bits/types/u_int.h            |   1 +
 include/bits/types/u_intN_t.h         |   1 +
 include/bits/types/uid_t.h            |   1 +
 include/bits/types/uint.h             |   1 +
 include/bits/types/useconds_t.h       |   1 +
 inet/arpa/inet.h                      |   7 +-
 io/fcntl.h                            |  27 +---
 io/sys/stat.h                         |  66 ++------
 io/sys/statvfs.h                      |  21 +--
 libio/stdio.h                         |  19 +--
 misc/sys/mman.h                       |  16 +-
 misc/sys/select.h                     |   7 +-
 posix/Makefile                        |  37 +++--
 posix/bits/types/blkcnt64_t.h         |   9 ++
 posix/bits/types/blkcnt_t.h           |  13 ++
 posix/bits/types/blksize_t.h          |   9 ++
 posix/bits/types/caddr_t.h            |   9 ++
 posix/bits/types/daddr_t.h            |   9 ++
 posix/bits/types/dev_t.h              |  10 ++
 posix/bits/types/fsblkcnt64_t.h       |   9 ++
 posix/bits/types/fsblkcnt_t.h         |  13 ++
 posix/bits/types/fsfilcnt64_t.h       |   9 ++
 posix/bits/types/fsfilcnt_t.h         |  13 ++
 posix/bits/types/fsid_t.h             |   9 ++
 posix/bits/types/gid_t.h              |   9 ++
 posix/bits/types/id_t.h               |  10 ++
 posix/bits/types/ino64_t.h            |   9 ++
 posix/bits/types/ino_t.h              |  13 ++
 posix/bits/types/intptr_t.h           |  10 ++
 posix/bits/types/key_t.h              |   9 ++
 posix/bits/types/loff_t.h             |   9 ++
 posix/bits/types/mode_t.h             |   9 ++
 posix/bits/types/nlink_t.h            |   9 ++
 posix/bits/types/off64_t.h            |   9 ++
 posix/bits/types/off_t.h              |  13 ++
 posix/bits/types/pid_t.h              |   9 ++
 posix/bits/types/register_t.h         |   9 ++
 posix/bits/types/socklen_t.h          |   9 ++
 posix/bits/types/ssize_t.h            |   9 ++
 posix/bits/types/suseconds_t.h        |   9 ++
 posix/bits/types/u_int.h              |  15 ++
 posix/bits/types/u_intN_t.h           |  17 ++
 posix/bits/types/uid_t.h              |   9 ++
 posix/bits/types/uint.h               |  10 ++
 posix/bits/types/useconds_t.h         |   9 ++
 posix/sched.h                         |   6 +-
 posix/sys/types.h                     | 218 ++++++--------------------
 posix/sys/wait.h                      |  11 +-
 posix/unistd.h                        |  56 ++-----
 pwd/pwd.h                             |  11 +-
 resource/sys/resource.h               |   6 +-
 scripts/check-obsolete-constructs.py  |  74 +++++++--
 signal/signal.h                       |  12 +-
 stdlib/monetary.h                     |   7 +-
 stdlib/stdint.h                       |   5 +-
 streams/stropts.h                     |  12 +-
 sunrpc/rpc/types.h                    |  44 ++----
 sysdeps/gnu/utmpx.h                   |   5 +-
 sysdeps/mach/hurd/bits/socket.h       |   8 +-
 sysdeps/unix/sysv/linux/bits/socket.h |   7 +-
 sysvipc/sys/ipc.h                     |  24 +--
 sysvipc/sys/msg.h                     |  12 +-
 sysvipc/sys/shm.h                     |   9 +-
 termios/termios.h                     |   8 +-
 time/sys/time.h                       |   6 +-
 time/time.h                           |   5 +-
 96 files changed, 578 insertions(+), 554 deletions(-)
 create mode 100644 include/bits/types/blkcnt64_t.h
 create mode 100644 include/bits/types/blkcnt_t.h
 create mode 100644 include/bits/types/blksize_t.h
 create mode 100644 include/bits/types/caddr_t.h
 create mode 100644 include/bits/types/daddr_t.h
 create mode 100644 include/bits/types/dev_t.h
 create mode 100644 include/bits/types/fsblkcnt64_t.h
 create mode 100644 include/bits/types/fsblkcnt_t.h
 create mode 100644 include/bits/types/fsfilcnt64_t.h
 create mode 100644 include/bits/types/fsfilcnt_t.h
 create mode 100644 include/bits/types/fsid_t.h
 create mode 100644 include/bits/types/gid_t.h
 create mode 100644 include/bits/types/id_t.h
 create mode 100644 include/bits/types/ino64_t.h
 create mode 100644 include/bits/types/ino_t.h
 create mode 100644 include/bits/types/intptr_t.h
 create mode 100644 include/bits/types/key_t.h
 create mode 100644 include/bits/types/loff_t.h
 create mode 100644 include/bits/types/mode_t.h
 create mode 100644 include/bits/types/nlink_t.h
 create mode 100644 include/bits/types/off64_t.h
 create mode 100644 include/bits/types/off_t.h
 create mode 100644 include/bits/types/pid_t.h
 create mode 100644 include/bits/types/register_t.h
 create mode 100644 include/bits/types/socklen_t.h
 create mode 100644 include/bits/types/ssize_t.h
 create mode 100644 include/bits/types/suseconds_t.h
 create mode 100644 include/bits/types/u_int.h
 create mode 100644 include/bits/types/u_intN_t.h
 create mode 100644 include/bits/types/uid_t.h
 create mode 100644 include/bits/types/uint.h
 create mode 100644 include/bits/types/useconds_t.h
 create mode 100644 posix/bits/types/blkcnt64_t.h
 create mode 100644 posix/bits/types/blkcnt_t.h
 create mode 100644 posix/bits/types/blksize_t.h
 create mode 100644 posix/bits/types/caddr_t.h
 create mode 100644 posix/bits/types/daddr_t.h
 create mode 100644 posix/bits/types/dev_t.h
 create mode 100644 posix/bits/types/fsblkcnt64_t.h
 create mode 100644 posix/bits/types/fsblkcnt_t.h
 create mode 100644 posix/bits/types/fsfilcnt64_t.h
 create mode 100644 posix/bits/types/fsfilcnt_t.h
 create mode 100644 posix/bits/types/fsid_t.h
 create mode 100644 posix/bits/types/gid_t.h
 create mode 100644 posix/bits/types/id_t.h
 create mode 100644 posix/bits/types/ino64_t.h
 create mode 100644 posix/bits/types/ino_t.h
 create mode 100644 posix/bits/types/intptr_t.h
 create mode 100644 posix/bits/types/key_t.h
 create mode 100644 posix/bits/types/loff_t.h
 create mode 100644 posix/bits/types/mode_t.h
 create mode 100644 posix/bits/types/nlink_t.h
 create mode 100644 posix/bits/types/off64_t.h
 create mode 100644 posix/bits/types/off_t.h
 create mode 100644 posix/bits/types/pid_t.h
 create mode 100644 posix/bits/types/register_t.h
 create mode 100644 posix/bits/types/socklen_t.h
 create mode 100644 posix/bits/types/ssize_t.h
 create mode 100644 posix/bits/types/suseconds_t.h
 create mode 100644 posix/bits/types/u_int.h
 create mode 100644 posix/bits/types/u_intN_t.h
 create mode 100644 posix/bits/types/uid_t.h
 create mode 100644 posix/bits/types/uint.h
 create mode 100644 posix/bits/types/useconds_t.h

diff --git a/bits/socket.h b/bits/socket.h
index fdcf015192..6687a47740 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 fc4d4859fe..9639ae96d4 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 0663c8f83c..d8f7683d1f 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 0000000000..c0c2ceded0
--- /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 0000000000..ad8ed2455b
--- /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 0000000000..d6ed861acb
--- /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 0000000000..9d499e7fff
--- /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 0000000000..90050fae5e
--- /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 0000000000..f0451c00ad
--- /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 0000000000..b5951d5121
--- /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 0000000000..9fc9e4104b
--- /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 0000000000..d3152d44a8
--- /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 0000000000..fc092c5673
--- /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 0000000000..9d1e517229
--- /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 0000000000..d8cf23be0e
--- /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 0000000000..5eaae0bf76
--- /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 0000000000..42037642c9
--- /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 0000000000..2624ae5034
--- /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 0000000000..455151b5b6
--- /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 0000000000..c4d96aa4e0
--- /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 0000000000..933175cbcb
--- /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 0000000000..58602b5d76
--- /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 0000000000..f330ae2d9e
--- /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 0000000000..002d92055b
--- /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 0000000000..1f18d157b7
--- /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 0000000000..6de6affc13
--- /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 0000000000..68286206d1
--- /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 0000000000..229f676c50
--- /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 0000000000..374e4386c7
--- /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 0000000000..85f0dbe6f0
--- /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 0000000000..2b17d5b831
--- /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 0000000000..ffb17bceb1
--- /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 0000000000..1e2b106f52
--- /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 0000000000..a446b7fb06
--- /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 0000000000..71f720bd7c
--- /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 4db2087af8..facee279a8 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 7af8dfba69..2e973e6eb0 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 2de5eb65d9..e05985e782 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 89abf02447..d7283ddcba 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 b63ee88a77..6fabdbedc2 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 b27512063b..43552c3dfa 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 8b10702bdc..84e2ae3a66 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 93c3a290d7..b0219f09bc 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 0000000000..d5d81e75be
--- /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 0000000000..badcd47ccc
--- /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 0000000000..9d6ada4e4d
--- /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 0000000000..fc010bd8a6
--- /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 0000000000..59f0b1b85b
--- /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 0000000000..ff8beefcc9
--- /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 0000000000..690d6016aa
--- /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 0000000000..2c7e80d41a
--- /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 0000000000..56fcbc7930
--- /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 0000000000..18d0f7ebdb
--- /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 0000000000..a198d30a07
--- /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 0000000000..52974a1fa3
--- /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 0000000000..1cb3b76ef8
--- /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 0000000000..e61e75a3ef
--- /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 0000000000..808821f2c8
--- /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 0000000000..47948f9161
--- /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 0000000000..424d250268
--- /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 0000000000..ecb9989681
--- /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 0000000000..3aaa70dc70
--- /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 0000000000..2f9125b488
--- /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 0000000000..f00bd82f48
--- /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 0000000000..9ef5395e99
--- /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 0000000000..249e070953
--- /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 0000000000..099b472f9e
--- /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 0000000000..836963058e
--- /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 0000000000..41e1fd7ea7
--- /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 0000000000..62ded6fd84
--- /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 0000000000..4c9235f3fc
--- /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 0000000000..625767412f
--- /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 0000000000..371cb055c8
--- /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 0000000000..69829c6f16
--- /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 0000000000..a363558b2d
--- /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 90ef6fcfd1..56c1470521 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 2d8cfd19d2..8f6d328692 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
+#define __need_size_t
+#include <stddef.h>
 
-#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
-
-#ifndef __ssize_t_defined
-typedef __ssize_t ssize_t;
-# define __ssize_t_defined
-#endif
-
-#ifdef	__USE_MISC
-# ifndef __daddr_t_defined
-typedef __daddr_t daddr_t;
-typedef __caddr_t caddr_t;
-#  define __daddr_t_defined
-# endif
-#endif
-
-#if (defined __USE_MISC || defined __USE_XOPEN) && !defined __key_t_defined
-typedef __key_t key_t;
-# define __key_t_defined
-#endif
-
-#if defined __USE_XOPEN || defined __USE_XOPEN2K8
-# include <bits/types/clock_t.h>
-#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_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
 
 #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
+# include <bits/types/useconds_t.h>
+# include <bits/types/suseconds_t.h>
 #endif
 
-#define	__need_size_t
-#include <stddef.h>
+#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
+
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
+#include <bits/types/blksize_t.h>
+#endif
+
+#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;
+/* 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>
 
-/* 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
+/* 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 9bd4399ed7..691be2759c 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 55a989f7bb..407f2fee5f 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
-# endif
+# 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 1002ed39b6..ccb3bc0ff8 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 928646b074..3ed33c4bcd 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 12dd19db36..426e122ab3 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 ee591fcb2d..bfacf4096e 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 1cecd05012..1f3347a6ec 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 8645d91cfc..aca50d1bc9 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 97b9428ee8..a69b81a2bb 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 99e5f4f151..13ef47f3c9 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 927410234d..41c122d970 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 f7f3cc4059..429e66c56a 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 99af01d2a4..cf3c03a9ec 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 516e275d49..8aa7f38d0d 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 1ce4672cc1..f2f18f4dc5 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 c15f419f09..bf836a75f1 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 223420883d..b883dc8aae 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 5dbc7fc627..1059d30ab7 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 cba6d15260..232531c6f0 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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 8/8] Don’t conditionalize declarations of ldiv_t, lldiv_t, __gwchar_t.
  2019-03-11 14:59 [PATCH 0/8] sys/types.h cleanup and further typedef obsoletion Zack Weinberg
                   ` (6 preceding siblings ...)
  2019-03-11 14:59 ` [PATCH 7/8] Create bits/types headers for most remaining __T_defined macros Zack Weinberg
@ 2019-03-11 14:59 ` Zack Weinberg
  7 siblings, 0 replies; 17+ messages in thread
From: Zack Weinberg @ 2019-03-11 14:59 UTC (permalink / raw)
  To: libc-alpha

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.
---
 stdlib/inttypes.h | 15 ++++++---------
 stdlib/stdlib.h   |  6 ++----
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/stdlib/inttypes.h b/stdlib/inttypes.h
index ddcb171b09..c5fb12056e 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 15debe1e31..5e5d966c6a 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
   {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/8] Move inttypes.h and stdint.h to stdlib.
  2019-03-11 14:59 ` [PATCH 1/8] Move inttypes.h and stdint.h to stdlib Zack Weinberg
@ 2019-03-11 23:19   ` Joseph Myers
  2019-03-13 13:46     ` Zack Weinberg
  0 siblings, 1 reply; 17+ messages in thread
From: Joseph Myers @ 2019-03-11 23:19 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 572 bytes --]

On Mon, 11 Mar 2019, Zack Weinberg wrote:

> 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.

OK.  (Any system dependencies in these files ought to be handled via 
bits/* headers.)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/8] Move inttypes.h and stdint.h to stdlib.
  2019-03-11 23:19   ` Joseph Myers
@ 2019-03-13 13:46     ` Zack Weinberg
  0 siblings, 0 replies; 17+ messages in thread
From: Zack Weinberg @ 2019-03-13 13:46 UTC (permalink / raw)
  To: GNU C Library

On Mon, Mar 11, 2019 at 7:19 PM Joseph Myers <joseph@codesourcery.com> wrote:
> On Mon, 11 Mar 2019, Zack Weinberg wrote:
> > 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).
>
> OK.  (Any system dependencies in these files ought to be handled via
> bits/* headers.)

Committed.

zw

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/8] sys/types.h: Don’t define u_intN_t or register_t unless __USE_MISC.
  2019-03-11 14:59 ` [PATCH 3/8] sys/types.h: Don’t define u_intN_t or register_t unless __USE_MISC Zack Weinberg
@ 2019-05-09  8:34   ` Florian Weimer
  2019-05-22 14:34     ` Zack Weinberg
  0 siblings, 1 reply; 17+ messages in thread
From: Florian Weimer @ 2019-05-09  8:34 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: libc-alpha

* Zack Weinberg:

> +* 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.

The challenge with register_t is that it's long long on x32 and MIPS64
with -mabi=n32.

And ideally, it would be the return type of the syscall function (which
is long int by incorrect tradition).

> diff --git a/posix/sys/types.h b/posix/sys/types.h
> index 1bbd896ad4..7327904346 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;

I think the comment refers to the same types as the comment above the
inclusion of <bits/stdint-intn.h>.  Maybe that could be made more clear
to the casual reader?

Rest of the patch looks fine to me.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/8] sys/types.h: Don’t define u_intN_t or register_t unless __USE_MISC.
  2019-05-09  8:34   ` Florian Weimer
@ 2019-05-22 14:34     ` Zack Weinberg
  0 siblings, 0 replies; 17+ messages in thread
From: Zack Weinberg @ 2019-05-22 14:34 UTC (permalink / raw)
  To: Florian Weimer; +Cc: GNU C Library

On Thu, May 9, 2019 at 4:34 AM Florian Weimer <fweimer@redhat.com> wrote:
> > +* 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.
>
> The challenge with register_t is that it's long long on x32 and MIPS64
> with -mabi=n32.

Yes, patch 2 of this series had to introduce a MIPS-specific
bits/typesizes.h because of this.

> And ideally, it would be the return type of the syscall function (which
> is long int by incorrect tradition).

I don't want to change that in this patch series.

[sys/types.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>
...
> > -/* 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;
>
> I think the comment refers to the same types as the comment above the
> inclusion of <bits/stdint-intn.h>.  Maybe that could be made more clear
> to the casual reader?

The important difference here is that intN_t are standard types (but
not standardized as provided by sys/types.h) so it's less troublesome
for us to provide them unconditionally, as existing code expects.
u_intN_t are not standard types so we really shouldn't provide them
unconditionally.  How's this for a comment?

/* These alternative names for uintN_t were used by pre-C99 networking code.
   Provided for backward compatibility only.  */

> Rest of the patch looks fine to me.

Thanks.  Nobody's looked at most of the rest of the patch series; do
you think you might have time to do it in the near future?

zw

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/8] Define register_t using bits/typesizes.h macros.
  2019-03-11 14:59 ` [PATCH 2/8] Define register_t using bits/typesizes.h macros Zack Weinberg
@ 2019-05-22 14:42   ` Florian Weimer
  2019-05-22 15:31     ` Zack Weinberg
  0 siblings, 1 reply; 17+ messages in thread
From: Florian Weimer @ 2019-05-22 14:42 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: libc-alpha

* Zack Weinberg:

>         * 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.

Are you sure you used the correct template for this?  I would have
expected mips to use sysdeps/unix/sysv/linux/generic/bits/typesizes.h
before.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 5/8] Simplify definition of __time64_t.
  2019-03-11 14:59 ` [PATCH 5/8] Simplify definition of __time64_t Zack Weinberg
@ 2019-05-22 14:44   ` Florian Weimer
  0 siblings, 0 replies; 17+ messages in thread
From: Florian Weimer @ 2019-05-22 14:44 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: libc-alpha

* Zack Weinberg:

> 	* posix/bits/types.h (__time64_t): Unconditionally define
>         as __TIME64_T_TYPE.  Move definition next to __time_t.

I think this is okay.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/8] Define register_t using bits/typesizes.h macros.
  2019-05-22 14:42   ` Florian Weimer
@ 2019-05-22 15:31     ` Zack Weinberg
  2019-05-22 16:27       ` Florian Weimer
  0 siblings, 1 reply; 17+ messages in thread
From: Zack Weinberg @ 2019-05-22 15:31 UTC (permalink / raw)
  To: Florian Weimer; +Cc: GNU C Library

On Wed, May 22, 2019 at 10:42 AM Florian Weimer <fweimer@redhat.com> wrote:
> * Zack Weinberg:
> >         * 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.
>
> Are you sure you used the correct template for this?  I would have
> expected mips to use sysdeps/unix/sysv/linux/generic/bits/typesizes.h
> before.

Yes, I am sure; I initially wrote this patch by copying
linux/generic/bits/typesizes.h and the ABI checks barfed.  Only
aarch64, nios2, riscv, and csky mention linux/generic in their Implies
files at present.

zw

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/8] Define register_t using bits/typesizes.h macros.
  2019-05-22 15:31     ` Zack Weinberg
@ 2019-05-22 16:27       ` Florian Weimer
  0 siblings, 0 replies; 17+ messages in thread
From: Florian Weimer @ 2019-05-22 16:27 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: GNU C Library

* Zack Weinberg:

> On Wed, May 22, 2019 at 10:42 AM Florian Weimer <fweimer@redhat.com> wrote:
>> * Zack Weinberg:
>> >         * 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.
>>
>> Are you sure you used the correct template for this?  I would have
>> expected mips to use sysdeps/unix/sysv/linux/generic/bits/typesizes.h
>> before.
>
> Yes, I am sure; I initially wrote this patch by copying
> linux/generic/bits/typesizes.h and the ABI checks barfed.  Only
> aarch64, nios2, riscv, and csky mention linux/generic in their Implies
> files at present.

Ahh.  So sysdeps/generic and sysdeps/unix/sysv/linux/generic serve
very different roles.  I'll keep this in mind for the future.

The diff against bits/typesizes.h looks indeed reasonable.

I have reviewed the other changes as well and they look good to me.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-05-22 16:27 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-11 14:59 [PATCH 0/8] sys/types.h cleanup and further typedef obsoletion Zack Weinberg
2019-03-11 14:59 ` [PATCH 1/8] Move inttypes.h and stdint.h to stdlib Zack Weinberg
2019-03-11 23:19   ` Joseph Myers
2019-03-13 13:46     ` Zack Weinberg
2019-03-11 14:59 ` [PATCH 2/8] Define register_t using bits/typesizes.h macros Zack Weinberg
2019-05-22 14:42   ` Florian Weimer
2019-05-22 15:31     ` Zack Weinberg
2019-05-22 16:27       ` Florian Weimer
2019-03-11 14:59 ` [PATCH 3/8] sys/types.h: Don’t define u_intN_t or register_t unless __USE_MISC Zack Weinberg
2019-05-09  8:34   ` Florian Weimer
2019-05-22 14:34     ` Zack Weinberg
2019-03-11 14:59 ` [PATCH 4/8] Add caddr_t, daddr_t, and loff_t to the set of obsolete typedefs Zack Weinberg
2019-03-11 14:59 ` [PATCH 5/8] Simplify definition of __time64_t Zack Weinberg
2019-05-22 14:44   ` Florian Weimer
2019-03-11 14:59 ` [PATCH 6/8] Clean up bits/types.h Zack Weinberg
2019-03-11 14:59 ` [PATCH 7/8] Create bits/types headers for most remaining __T_defined macros Zack Weinberg
2019-03-11 14:59 ` [PATCH 8/8] Don’t conditionalize declarations of ldiv_t, lldiv_t, __gwchar_t Zack Weinberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).