@@ -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
@@ -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
@@ -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. */
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/blkcnt64_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/blkcnt_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/blksize_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/caddr_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/daddr_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/dev_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/fsblkcnt64_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/fsblkcnt_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/fsfilcnt64_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/fsfilcnt_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/fsid_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/gid_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/id_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/ino64_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/ino_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/intptr_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/key_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/loff_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/mode_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/nlink_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/off64_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/off_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/pid_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/register_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/socklen_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/ssize_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/suseconds_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/u_int.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/u_intN_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/uid_t.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/uint.h>
new file mode 100644
@@ -0,0 +1 @@
+#include <posix/bits/types/useconds_t.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
@@ -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. */
@@ -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
@@ -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
@@ -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'. */
@@ -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>
@@ -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;
@@ -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 \
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
+
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
new file mode 100644
@@ -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
@@ -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>
@@ -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 */
@@ -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
@@ -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.
@@ -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. */
@@ -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
@@ -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)
@@ -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
@@ -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
@@ -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. */
@@ -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;
@@ -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
@@ -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>
@@ -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
@@ -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>
@@ -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
@@ -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. */
@@ -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
@@ -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
@@ -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>
@@ -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