From patchwork Mon Mar 11 14:59:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 31813 Received: (qmail 32860 invoked by alias); 11 Mar 2019 15:00:28 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 31794 invoked by uid 89); 11 Mar 2019 15:00:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=database, gnulib, tempted, indication X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Subject: [PATCH 7/8] Create bits/types headers for most remaining __T_defined macros. Date: Mon, 11 Mar 2019 10:59:51 -0400 Message-Id: <697ed96c8e1d774f0f962c959c9988b1097a69f5.1552315664.git.zackw@panix.com> In-Reply-To: References: MIME-Version: 1.0 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 #include - -/* Type for length arguments in socket calls. */ -#ifndef __socklen_t_defined -typedef __socklen_t socklen_t; -# define __socklen_t_defined -#endif - +#include /* 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 #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 +# ifdef __USE_LARGEFILE64 +# include # 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 - /* 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 #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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 #include /* 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 __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 . 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 +#include +#include +#ifdef __USE_LARGEFILE64 +#include #endif /* For XPG all symbols from 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 - -# 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 +# include +# include +# include +# include +# include +# include #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 +# include #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 -#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 +#include __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 +# ifdef __USE_LARGEFILE64 +# include # endif #endif #ifdef __USE_XOPEN2K8 -# ifndef __ssize_t_defined -typedef __ssize_t ssize_t; -# define __ssize_t_defined -# endif +# include #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 #include + #define __need_size_t #include -#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 +#include #include 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 #endif - -#ifndef __suseconds_t_defined -typedef __suseconds_t suseconds_t; -# define __suseconds_t_defined -#endif - +#include /* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* 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 #endif - -#ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -#endif +#include /* Get system specific constant and data structure definitions. */ #include 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 -#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 -#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 -#endif +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#include + +#ifdef __USE_LARGEFILE64 +# include +# include +# include +# include +# include +#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 +# include #endif -#define __need_size_t -#include +#if defined __USE_XOPEN || defined __USE_XOPEN2K8 +# include +# include +# include +#endif + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K8 +#include +#endif + +#if defined __USE_POSIX199506 || defined __USE_UNIX98 +# include +#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 #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 +# include +# include +# include +# include -/* 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 +# include +# include /* In BSD is expected to define BYTE_ORDER. */ # include @@ -176,54 +100,6 @@ typedef __register_t register_t; # include #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 -#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 -#ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -#endif +#include #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 # include @@ -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 # include /* 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 - -#ifndef __ssize_t_defined -typedef __ssize_t ssize_t; -# define __ssize_t_defined -#endif +#include #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 +# include +# include +# ifdef __USE_LARGEFILE64 +# include +# endif +# include +# include #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 #endif #if defined __USE_MISC || defined __USE_XOPEN -# ifndef __socklen_t_defined -typedef __socklen_t socklen_t; -# define __socklen_t_defined -# endif +# include #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 +# include #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 - -#ifndef __id_t_defined -typedef __id_t id_t; -# define __id_t_defined -#endif +#include __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 +# include #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 #include - -#ifndef __ssize_t_defined -typedef __ssize_t ssize_t; -# define __ssize_t_defined -#endif - +#include __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 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 #include #include - -#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 +#include 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 +#include +#include +#include +#include + +#ifndef __BIT_TYPES_DEFINED__ +#include +#include +#include +#include +#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 /* 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 -#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 -#include - -#include - #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 /* Required according to Unix98. */ -#ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -#endif +#include /* Get system dependent values and data structures. */ #include 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 #include - -/* Type for length arguments in socket calls. */ -#ifndef __socklen_t_defined -typedef __socklen_t socklen_t; -# define __socklen_t_defined -#endif - +#include /* 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 #include - -/* Type for length arguments in socket calls. */ -#ifndef __socklen_t_defined -typedef __socklen_t socklen_t; -# define __socklen_t_defined -#endif +#include /* Get the architecture-dependent definition of enum __socket_type. */ #include 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 #include - -#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 +#include +#include +#include __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 - -#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 +#include /* 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 - #ifdef __USE_XOPEN -# ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -# endif -#endif /* X/Open */ - +# include +#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 + #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 -/* We need `pid_t'. */ -# include -# ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -# endif +# include #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 #include #include - -#ifndef __suseconds_t_defined -typedef __suseconds_t suseconds_t; -# define __suseconds_t_defined -#endif +#include #include 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 #endif #ifdef __USE_XOPEN2K8