]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Create bits/types headers for most remaining __T_defined macros.
authorZack Weinberg <zackw@panix.com>
Sun, 10 Mar 2019 01:54:02 +0000 (20:54 -0500)
committerZack Weinberg <zackw@panix.com>
Wed, 8 Jan 2020 17:56:32 +0000 (12:56 -0500)
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.
        * 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.

95 files changed:
bits/socket.h
dirent/dirent.h
grp/grp.h
include/bits/types/blkcnt64_t.h [new file with mode: 0644]
include/bits/types/blkcnt_t.h [new file with mode: 0644]
include/bits/types/blksize_t.h [new file with mode: 0644]
include/bits/types/caddr_t.h [new file with mode: 0644]
include/bits/types/daddr_t.h [new file with mode: 0644]
include/bits/types/dev_t.h [new file with mode: 0644]
include/bits/types/fsblkcnt64_t.h [new file with mode: 0644]
include/bits/types/fsblkcnt_t.h [new file with mode: 0644]
include/bits/types/fsfilcnt64_t.h [new file with mode: 0644]
include/bits/types/fsfilcnt_t.h [new file with mode: 0644]
include/bits/types/fsid_t.h [new file with mode: 0644]
include/bits/types/gid_t.h [new file with mode: 0644]
include/bits/types/id_t.h [new file with mode: 0644]
include/bits/types/ino64_t.h [new file with mode: 0644]
include/bits/types/ino_t.h [new file with mode: 0644]
include/bits/types/intptr_t.h [new file with mode: 0644]
include/bits/types/key_t.h [new file with mode: 0644]
include/bits/types/loff_t.h [new file with mode: 0644]
include/bits/types/mode_t.h [new file with mode: 0644]
include/bits/types/nlink_t.h [new file with mode: 0644]
include/bits/types/off64_t.h [new file with mode: 0644]
include/bits/types/off_t.h [new file with mode: 0644]
include/bits/types/pid_t.h [new file with mode: 0644]
include/bits/types/register_t.h [new file with mode: 0644]
include/bits/types/socklen_t.h [new file with mode: 0644]
include/bits/types/ssize_t.h [new file with mode: 0644]
include/bits/types/suseconds_t.h [new file with mode: 0644]
include/bits/types/u_int.h [new file with mode: 0644]
include/bits/types/u_intN_t.h [new file with mode: 0644]
include/bits/types/uid_t.h [new file with mode: 0644]
include/bits/types/uint.h [new file with mode: 0644]
include/bits/types/useconds_t.h [new file with mode: 0644]
inet/arpa/inet.h
io/fcntl.h
io/sys/stat.h
io/sys/statvfs.h
libio/stdio.h
misc/sys/mman.h
misc/sys/select.h
posix/Makefile
posix/bits/types/blkcnt64_t.h [new file with mode: 0644]
posix/bits/types/blkcnt_t.h [new file with mode: 0644]
posix/bits/types/blksize_t.h [new file with mode: 0644]
posix/bits/types/caddr_t.h [new file with mode: 0644]
posix/bits/types/daddr_t.h [new file with mode: 0644]
posix/bits/types/dev_t.h [new file with mode: 0644]
posix/bits/types/fsblkcnt64_t.h [new file with mode: 0644]
posix/bits/types/fsblkcnt_t.h [new file with mode: 0644]
posix/bits/types/fsfilcnt64_t.h [new file with mode: 0644]
posix/bits/types/fsfilcnt_t.h [new file with mode: 0644]
posix/bits/types/fsid_t.h [new file with mode: 0644]
posix/bits/types/gid_t.h [new file with mode: 0644]
posix/bits/types/id_t.h [new file with mode: 0644]
posix/bits/types/ino64_t.h [new file with mode: 0644]
posix/bits/types/ino_t.h [new file with mode: 0644]
posix/bits/types/intptr_t.h [new file with mode: 0644]
posix/bits/types/key_t.h [new file with mode: 0644]
posix/bits/types/loff_t.h [new file with mode: 0644]
posix/bits/types/mode_t.h [new file with mode: 0644]
posix/bits/types/nlink_t.h [new file with mode: 0644]
posix/bits/types/off64_t.h [new file with mode: 0644]
posix/bits/types/off_t.h [new file with mode: 0644]
posix/bits/types/pid_t.h [new file with mode: 0644]
posix/bits/types/register_t.h [new file with mode: 0644]
posix/bits/types/socklen_t.h [new file with mode: 0644]
posix/bits/types/ssize_t.h [new file with mode: 0644]
posix/bits/types/suseconds_t.h [new file with mode: 0644]
posix/bits/types/u_int.h [new file with mode: 0644]
posix/bits/types/u_intN_t.h [new file with mode: 0644]
posix/bits/types/uid_t.h [new file with mode: 0644]
posix/bits/types/uint.h [new file with mode: 0644]
posix/bits/types/useconds_t.h [new file with mode: 0644]
posix/sched.h
posix/sys/types.h
posix/sys/wait.h
posix/unistd.h
pwd/pwd.h
resource/sys/resource.h
scripts/check-obsolete-constructs.py
signal/signal.h
stdlib/monetary.h
stdlib/stdint.h
sunrpc/rpc/types.h
sysdeps/gnu/utmpx.h
sysdeps/mach/hurd/bits/socket.h
sysdeps/unix/sysv/linux/bits/socket.h
sysvipc/sys/ipc.h
sysvipc/sys/msg.h
sysvipc/sys/shm.h
termios/termios.h
time/sys/time.h
time/time.h

index bebb2e7a572b80f1f15a4972f2c5b19c583940d4..e72dcfda40bad1c329ee141e6c2f8768a4c9761b 100644 (file)
 
 #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
index 92d09250471584fae8920e2135ee035fbabb26ee..0886b6d30d194c005545e5125b0f0c9b8800bdbc 100644 (file)
@@ -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
 
index 396ef0588575fef6d0f78ab085c7d44b85b721f6..5ef235ef210dd38ab8fbf1d08fffb568e18feaaf 100644 (file)
--- a/grp/grp.h
+++ b/grp/grp.h
@@ -31,11 +31,9 @@ __BEGIN_DECLS
 #define __need_size_t
 #include <stddef.h>
 
-
 /* For the Single Unix specification we must define this type here.  */
-#if (defined __USE_XOPEN || defined __USE_XOPEN2K) && !defined __gid_t_defined
-typedef __gid_t gid_t;
-# define __gid_t_defined
+#if defined __USE_XOPEN || defined __USE_XOPEN2K
+# include <bits/types/gid_t.h>
 #endif
 
 /* The group structure.         */
diff --git a/include/bits/types/blkcnt64_t.h b/include/bits/types/blkcnt64_t.h
new file mode 100644 (file)
index 0000000..c0c2ced
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/blkcnt64_t.h>
diff --git a/include/bits/types/blkcnt_t.h b/include/bits/types/blkcnt_t.h
new file mode 100644 (file)
index 0000000..ad8ed24
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/blkcnt_t.h>
diff --git a/include/bits/types/blksize_t.h b/include/bits/types/blksize_t.h
new file mode 100644 (file)
index 0000000..d6ed861
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/blksize_t.h>
diff --git a/include/bits/types/caddr_t.h b/include/bits/types/caddr_t.h
new file mode 100644 (file)
index 0000000..9d499e7
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/caddr_t.h>
diff --git a/include/bits/types/daddr_t.h b/include/bits/types/daddr_t.h
new file mode 100644 (file)
index 0000000..90050fa
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/daddr_t.h>
diff --git a/include/bits/types/dev_t.h b/include/bits/types/dev_t.h
new file mode 100644 (file)
index 0000000..f0451c0
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/dev_t.h>
diff --git a/include/bits/types/fsblkcnt64_t.h b/include/bits/types/fsblkcnt64_t.h
new file mode 100644 (file)
index 0000000..b5951d5
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/fsblkcnt64_t.h>
diff --git a/include/bits/types/fsblkcnt_t.h b/include/bits/types/fsblkcnt_t.h
new file mode 100644 (file)
index 0000000..9fc9e41
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/fsblkcnt_t.h>
diff --git a/include/bits/types/fsfilcnt64_t.h b/include/bits/types/fsfilcnt64_t.h
new file mode 100644 (file)
index 0000000..d3152d4
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/fsfilcnt64_t.h>
diff --git a/include/bits/types/fsfilcnt_t.h b/include/bits/types/fsfilcnt_t.h
new file mode 100644 (file)
index 0000000..fc092c5
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/fsfilcnt_t.h>
diff --git a/include/bits/types/fsid_t.h b/include/bits/types/fsid_t.h
new file mode 100644 (file)
index 0000000..9d1e517
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/fsid_t.h>
diff --git a/include/bits/types/gid_t.h b/include/bits/types/gid_t.h
new file mode 100644 (file)
index 0000000..d8cf23b
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/gid_t.h>
diff --git a/include/bits/types/id_t.h b/include/bits/types/id_t.h
new file mode 100644 (file)
index 0000000..5eaae0b
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/id_t.h>
diff --git a/include/bits/types/ino64_t.h b/include/bits/types/ino64_t.h
new file mode 100644 (file)
index 0000000..4203764
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/ino64_t.h>
diff --git a/include/bits/types/ino_t.h b/include/bits/types/ino_t.h
new file mode 100644 (file)
index 0000000..2624ae5
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/ino_t.h>
diff --git a/include/bits/types/intptr_t.h b/include/bits/types/intptr_t.h
new file mode 100644 (file)
index 0000000..455151b
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/intptr_t.h>
diff --git a/include/bits/types/key_t.h b/include/bits/types/key_t.h
new file mode 100644 (file)
index 0000000..c4d96aa
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/key_t.h>
diff --git a/include/bits/types/loff_t.h b/include/bits/types/loff_t.h
new file mode 100644 (file)
index 0000000..933175c
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/loff_t.h>
diff --git a/include/bits/types/mode_t.h b/include/bits/types/mode_t.h
new file mode 100644 (file)
index 0000000..58602b5
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/mode_t.h>
diff --git a/include/bits/types/nlink_t.h b/include/bits/types/nlink_t.h
new file mode 100644 (file)
index 0000000..f330ae2
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/nlink_t.h>
diff --git a/include/bits/types/off64_t.h b/include/bits/types/off64_t.h
new file mode 100644 (file)
index 0000000..002d920
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/off64_t.h>
diff --git a/include/bits/types/off_t.h b/include/bits/types/off_t.h
new file mode 100644 (file)
index 0000000..1f18d15
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/off_t.h>
diff --git a/include/bits/types/pid_t.h b/include/bits/types/pid_t.h
new file mode 100644 (file)
index 0000000..6de6aff
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/pid_t.h>
diff --git a/include/bits/types/register_t.h b/include/bits/types/register_t.h
new file mode 100644 (file)
index 0000000..6828620
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/register_t.h>
diff --git a/include/bits/types/socklen_t.h b/include/bits/types/socklen_t.h
new file mode 100644 (file)
index 0000000..229f676
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/socklen_t.h>
diff --git a/include/bits/types/ssize_t.h b/include/bits/types/ssize_t.h
new file mode 100644 (file)
index 0000000..374e438
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/ssize_t.h>
diff --git a/include/bits/types/suseconds_t.h b/include/bits/types/suseconds_t.h
new file mode 100644 (file)
index 0000000..85f0dbe
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/suseconds_t.h>
diff --git a/include/bits/types/u_int.h b/include/bits/types/u_int.h
new file mode 100644 (file)
index 0000000..2b17d5b
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/u_int.h>
diff --git a/include/bits/types/u_intN_t.h b/include/bits/types/u_intN_t.h
new file mode 100644 (file)
index 0000000..ffb17bc
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/u_intN_t.h>
diff --git a/include/bits/types/uid_t.h b/include/bits/types/uid_t.h
new file mode 100644 (file)
index 0000000..1e2b106
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/uid_t.h>
diff --git a/include/bits/types/uint.h b/include/bits/types/uint.h
new file mode 100644 (file)
index 0000000..a446b7f
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/uint.h>
diff --git a/include/bits/types/useconds_t.h b/include/bits/types/useconds_t.h
new file mode 100644 (file)
index 0000000..71f720b
--- /dev/null
@@ -0,0 +1 @@
+#include <posix/bits/types/useconds_t.h>
index 651fc69f1e6578b65a89b0d0cadff21ef32571b4..08837249fad891ab78d8cd067ff35bf3bfb3b1b5 100644 (file)
 
 #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
 
index 21b60c264de030aac2a1ee60286e214804705e1c..0ca71e33108c8597401ad4cf0d10e96e2fce84d1 100644 (file)
@@ -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.  */
index ce014d03a588ef5e2064b25594c69b9746c37976..cbadf67d704bf673627cb3b2bc93474963381dd4 100644 (file)
 #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
index 568e2649bc7d69a314fd9c47422424e4f5fce173..41cb37922944ea9adb49b7e280cd53d7dc6d2850 100644 (file)
 /* 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
 
index 5a10a4d3ee94e8d960c6a2dadbea4355cccab77e..cf99970f90b1c286ebead9c175751e0bc3f05230 100644 (file)
@@ -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'.  */
index 02abf589a0a5d863d26cdb11b0fc2b4033ca5b52..01cc6407045b2a878d00bf0ffece6bcae459555c 100644 (file)
 
 #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>
 
index 29d011c2d57d166f766b7120962a93f69a99cdb7..c7d1a95e51d9d0283a9fe2b77ed6169e573185d4 100644 (file)
 #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;
index 4507d84bf1f48b13053b531702b1e28038898b4a..64fad14abd50a4f9a22db55d84b682209671a301 100644 (file)
@@ -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 (file)
index 0000000..d5d81e7
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __blkcnt64_t_defined
+#define __blkcnt64_t_defined 1
+
+#include <bits/types.h>
+
+/* Type to count disk blocks (LFS).  */
+typedef __blkcnt64_t blkcnt64_t;
+
+#endif
diff --git a/posix/bits/types/blkcnt_t.h b/posix/bits/types/blkcnt_t.h
new file mode 100644 (file)
index 0000000..badcd47
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __blkcnt_t_defined
+#define __blkcnt_t_defined 1
+
+#include <bits/types.h>
+
+/* Type to count number of disk blocks (POSIX).  */
+#ifndef __USE_FILE_OFFSET64
+typedef __blkcnt_t blkcnt_t;
+#else
+typedef __blkcnt64_t blkcnt_t;
+#endif
+
+#endif
diff --git a/posix/bits/types/blksize_t.h b/posix/bits/types/blksize_t.h
new file mode 100644 (file)
index 0000000..9d6ada4
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __blksize_t_defined
+#define __blksize_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for sizes of disk blocks (POSIX).  */
+typedef __blksize_t blksize_t;
+
+#endif
diff --git a/posix/bits/types/caddr_t.h b/posix/bits/types/caddr_t.h
new file mode 100644 (file)
index 0000000..fc010bd
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __caddr_t_defined
+#define __caddr_t_defined 1
+
+#include <bits/types.h>
+
+/* Obsolete type for a memory address (BSD).  */
+typedef __caddr_t caddr_t;
+
+#endif
diff --git a/posix/bits/types/daddr_t.h b/posix/bits/types/daddr_t.h
new file mode 100644 (file)
index 0000000..59f0b1b
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __daddr_t_defined
+#define __daddr_t_defined 1
+
+#include <bits/types.h>
+
+/* Obsolete type for a disk address (BSD).  */
+typedef __daddr_t daddr_t;
+
+#endif
diff --git a/posix/bits/types/dev_t.h b/posix/bits/types/dev_t.h
new file mode 100644 (file)
index 0000000..0b45f91
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __dev_t_defined
+#define __dev_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for device IDs (POSIX).  */
+typedef __dev_t dev_t;
+
+#endif
diff --git a/posix/bits/types/fsblkcnt64_t.h b/posix/bits/types/fsblkcnt64_t.h
new file mode 100644 (file)
index 0000000..690d601
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __fsblkcnt64_t_defined
+#define __fsblkcnt64_t_defined 1
+
+#include <bits/types.h>
+
+/* Type to count file system blocks (LFS).  */
+typedef __fsblkcnt64_t fsblkcnt64_t;
+
+#endif
diff --git a/posix/bits/types/fsblkcnt_t.h b/posix/bits/types/fsblkcnt_t.h
new file mode 100644 (file)
index 0000000..2c7e80d
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __fsblkcnt_t_defined
+#define __fsblkcnt_t_defined 1
+
+#include <bits/types.h>
+
+/* Type to count file system blocks (POSIX).  */
+#ifndef __USE_FILE_OFFSET64
+typedef __fsblkcnt_t fsblkcnt_t;
+#else
+typedef __fsblkcnt64_t fsblkcnt_t;
+#endif
+
+#endif
diff --git a/posix/bits/types/fsfilcnt64_t.h b/posix/bits/types/fsfilcnt64_t.h
new file mode 100644 (file)
index 0000000..56fcbc7
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __fsfilcnt64_t_defined
+#define __fsfilcnt64_t_defined 1
+
+#include <bits/types.h>
+
+/* Type to count file system inodes (LFS).  */
+typedef __fsfilcnt64_t fsfilcnt64_t;
+
+#endif
diff --git a/posix/bits/types/fsfilcnt_t.h b/posix/bits/types/fsfilcnt_t.h
new file mode 100644 (file)
index 0000000..18d0f7e
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __fsfilcnt_t_defined
+#define __fsfilcnt_t_defined 1
+
+#include <bits/types.h>
+
+/* Type to count file system inodes (POSIX).  */
+#ifndef __USE_FILE_OFFSET64
+typedef __fsfilcnt_t fsfilcnt_t;
+#else
+typedef __fsfilcnt64_t fsfilcnt_t;
+#endif
+
+#endif
diff --git a/posix/bits/types/fsid_t.h b/posix/bits/types/fsid_t.h
new file mode 100644 (file)
index 0000000..a198d30
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __fsid_t_defined
+#define __fsid_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for a file system ID (BSD).  */
+typedef __fsid_t fsid_t;
+
+#endif
diff --git a/posix/bits/types/gid_t.h b/posix/bits/types/gid_t.h
new file mode 100644 (file)
index 0000000..52974a1
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __gid_t_defined
+#define __gid_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for group IDs (POSIX).  */
+typedef __gid_t gid_t;
+
+#endif
diff --git a/posix/bits/types/id_t.h b/posix/bits/types/id_t.h
new file mode 100644 (file)
index 0000000..1cb3b76
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __id_t_defined
+#define __id_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for a general identifier, can hold any pid_t, uid_t, or gid_t
+   value (POSIX).  */
+typedef __id_t id_t;
+
+#endif
diff --git a/posix/bits/types/ino64_t.h b/posix/bits/types/ino64_t.h
new file mode 100644 (file)
index 0000000..e61e75a
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __ino64_t_defined
+#define __ino64_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for file serial numbers (LFS).  */
+typedef __ino64_t ino64_t;
+
+#endif
diff --git a/posix/bits/types/ino_t.h b/posix/bits/types/ino_t.h
new file mode 100644 (file)
index 0000000..808821f
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __ino_t_defined
+#define __ino_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for file serial numbers (POSIX).  */
+# ifndef __USE_FILE_OFFSET64
+typedef __ino_t ino_t;
+# else
+typedef __ino64_t ino_t;
+# endif
+
+#endif
diff --git a/posix/bits/types/intptr_t.h b/posix/bits/types/intptr_t.h
new file mode 100644 (file)
index 0000000..47948f9
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __intptr_t_defined
+#define __intptr_t_defined 1
+
+#include <bits/types.h>
+
+/* Signed integral type capable of representing a `void *' without
+   data loss (C1999).  */
+typedef __intptr_t intptr_t;
+
+#endif
diff --git a/posix/bits/types/key_t.h b/posix/bits/types/key_t.h
new file mode 100644 (file)
index 0000000..424d250
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __key_t_defined
+#define __key_t_defined 1
+
+#include <bits/types.h>
+
+/* Type used by interprocess communication operations (XSI).  */
+typedef __key_t key_t;
+
+#endif
diff --git a/posix/bits/types/loff_t.h b/posix/bits/types/loff_t.h
new file mode 100644 (file)
index 0000000..ecb9989
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __loff_t_defined
+#define __loff_t_defined 1
+
+#include <bits/types.h>
+
+/* Obsolete type for file sizes and offsets within a file (BSD).  */
+typedef __loff_t loff_t;
+
+#endif
diff --git a/posix/bits/types/mode_t.h b/posix/bits/types/mode_t.h
new file mode 100644 (file)
index 0000000..3aaa70d
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __mode_t_defined
+#define __mode_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for file attribute bits (POSIX).  */
+typedef __mode_t mode_t;
+
+#endif
diff --git a/posix/bits/types/nlink_t.h b/posix/bits/types/nlink_t.h
new file mode 100644 (file)
index 0000000..2f9125b
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __nlink_t_defined
+#define __nlink_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for link counts (POSIX).  */
+typedef __nlink_t nlink_t;
+
+#endif
diff --git a/posix/bits/types/off64_t.h b/posix/bits/types/off64_t.h
new file mode 100644 (file)
index 0000000..f00bd82
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __off64_t_defined
+#define __off64_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for file sizes and offsets within a file (LFS).  */
+typedef __off64_t off64_t;
+
+#endif
diff --git a/posix/bits/types/off_t.h b/posix/bits/types/off_t.h
new file mode 100644 (file)
index 0000000..9ef5395
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __off_t_defined
+#define __off_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for file sizes and offsets within a file (POSIX).  */
+# ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+# else
+typedef __off64_t off_t;
+# endif
+
+#endif
diff --git a/posix/bits/types/pid_t.h b/posix/bits/types/pid_t.h
new file mode 100644 (file)
index 0000000..249e070
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __pid_t_defined
+#define __pid_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for process IDs and process group IDs (POSIX).  */
+typedef __pid_t pid_t;
+
+#endif
diff --git a/posix/bits/types/register_t.h b/posix/bits/types/register_t.h
new file mode 100644 (file)
index 0000000..099b472
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __register_t_defined
+#define __register_t_defined 1
+
+#include <bits/types.h>
+
+/* Type of a general-purpose integer register (BSD).  */
+typedef __register_t register_t;
+
+#endif
diff --git a/posix/bits/types/socklen_t.h b/posix/bits/types/socklen_t.h
new file mode 100644 (file)
index 0000000..8369630
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __socklen_t_defined
+#define __socklen_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for size of socket addresses (POSIX).  */
+typedef __socklen_t socklen_t;
+
+#endif
diff --git a/posix/bits/types/ssize_t.h b/posix/bits/types/ssize_t.h
new file mode 100644 (file)
index 0000000..41e1fd7
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __ssize_t_defined
+#define __ssize_t_defined 1
+
+#include <bits/types.h>
+
+/* Type used for a count of bytes or an error indication (POSIX).  */
+typedef __ssize_t ssize_t;
+
+#endif
diff --git a/posix/bits/types/suseconds_t.h b/posix/bits/types/suseconds_t.h
new file mode 100644 (file)
index 0000000..62ded6f
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __suseconds_t_defined
+#define __suseconds_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for time in microseconds (signed) (XSI).  */
+typedef __suseconds_t suseconds_t;
+
+#endif
diff --git a/posix/bits/types/u_int.h b/posix/bits/types/u_int.h
new file mode 100644 (file)
index 0000000..4c9235f
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef __u_int_defined
+#define __u_int_defined 1
+
+#include <bits/types.h>
+
+/* Obsolete shorthand names for unsigned types, used by old BSD
+   networking code and Sun RPC.  */
+typedef unsigned char u_char;
+typedef unsigned short int u_short;
+typedef unsigned int u_int;
+typedef unsigned long int u_long;
+typedef __int64_t quad_t;
+typedef __uint64_t u_quad_t;
+
+#endif
diff --git a/posix/bits/types/u_intN_t.h b/posix/bits/types/u_intN_t.h
new file mode 100644 (file)
index 0000000..6257674
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef __u_intN_t_defined
+#define __u_intN_t_defined 1
+
+#include <bits/types.h>
+
+/* These size-specific names are used by some of the inet code.
+   They were defined by ISO C without the first `_'.  */
+typedef __uint8_t u_int8_t;
+typedef __uint16_t u_int16_t;
+typedef __uint32_t u_int32_t;
+typedef __uint64_t u_int64_t;
+
+/* Some code from BIND tests this macro to see if the types above are
+   defined.  */
+#define __BIT_TYPES_DEFINED__  1
+
+#endif
diff --git a/posix/bits/types/uid_t.h b/posix/bits/types/uid_t.h
new file mode 100644 (file)
index 0000000..371cb05
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __uid_t_defined
+#define __uid_t_defined 1
+
+#include <bits/types.h>
+
+/* Type for user IDs (POSIX).  */
+typedef __uid_t uid_t;
+
+#endif
diff --git a/posix/bits/types/uint.h b/posix/bits/types/uint.h
new file mode 100644 (file)
index 0000000..69829c6
--- /dev/null
@@ -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 (file)
index 0000000..a363558
--- /dev/null
@@ -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
index 60c9c3c710ff1c180d7e4df3a6eeb13c2ea56f67..bb7e727da0877117e8ad1e104da40f2aeeccaec7 100644 (file)
 #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>
index f7452aeef4948e8aabb8627acb6016b108c76df9..ba8e72a2150b3fadeafdd0bd5bd7d6672ab3eaf4 100644 (file)
@@ -28,120 +28,51 @@ __BEGIN_DECLS
 
 #include <bits/types.h>
 
-#ifdef __USE_MISC
-# ifndef __u_char_defined
-typedef unsigned char u_char;
-typedef unsigned short int u_short;
-typedef unsigned int u_int;
-typedef unsigned long int u_long;
-typedef __int64_t quad_t;
-typedef __uint64_t u_quad_t;
-typedef __fsid_t fsid_t;
-#  define __u_char_defined
-# endif
-typedef __loff_t loff_t;
-#endif
-
-#ifndef __ino_t_defined
-# ifndef __USE_FILE_OFFSET64
-typedef __ino_t ino_t;
-# else
-typedef __ino64_t ino_t;
-# endif
-# define __ino_t_defined
-#endif
-#if defined __USE_LARGEFILE64 && !defined __ino64_t_defined
-typedef __ino64_t ino64_t;
-# define __ino64_t_defined
-#endif
-
-#ifndef __dev_t_defined
-typedef __dev_t dev_t;
-# define __dev_t_defined
-#endif
-
-#ifndef __gid_t_defined
-typedef __gid_t gid_t;
-# define __gid_t_defined
-#endif
-
-#ifndef __mode_t_defined
-typedef __mode_t mode_t;
-# define __mode_t_defined
-#endif
-
-#ifndef __nlink_t_defined
-typedef __nlink_t nlink_t;
-# define __nlink_t_defined
-#endif
-
-#ifndef __uid_t_defined
-typedef __uid_t uid_t;
-# define __uid_t_defined
-#endif
-
-#ifndef __off_t_defined
-# ifndef __USE_FILE_OFFSET64
-typedef __off_t off_t;
-# else
-typedef __off64_t off_t;
-# endif
-# define __off_t_defined
-#endif
-#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
-typedef __off64_t off64_t;
-# define __off64_t_defined
-#endif
-
-#ifndef __pid_t_defined
-typedef __pid_t pid_t;
-# define __pid_t_defined
-#endif
-
-#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) \
-    && !defined __id_t_defined
-typedef __id_t id_t;
-# define __id_t_defined
-#endif
+#define __need_size_t
+#include <stddef.h>
 
-#ifndef __ssize_t_defined
-typedef __ssize_t ssize_t;
-# define __ssize_t_defined
-#endif
+#include <bits/types/blkcnt_t.h>
+#include <bits/types/clockid_t.h>
+#include <bits/types/dev_t.h>
+#include <bits/types/fsblkcnt_t.h>
+#include <bits/types/fsfilcnt_t.h>
+#include <bits/types/gid_t.h>
+#include <bits/types/ino_t.h>
+#include <bits/types/mode_t.h>
+#include <bits/types/nlink_t.h>
+#include <bits/types/off_t.h>
+#include <bits/types/pid_t.h>
+#include <bits/types/ssize_t.h>
+#include <bits/types/time_t.h>
+#include <bits/types/timer_t.h>
+#include <bits/types/uid_t.h>
 
-#ifdef __USE_MISC
-# ifndef __daddr_t_defined
-typedef __daddr_t daddr_t;
-typedef __caddr_t caddr_t;
-#  define __daddr_t_defined
-# endif
+#ifdef __USE_LARGEFILE64
+# include <bits/types/blkcnt64_t.h>
+# include <bits/types/fsblkcnt64_t.h>
+# include <bits/types/fsfilcnt64_t.h>
+# include <bits/types/ino64_t.h>
+# include <bits/types/off64_t.h>
 #endif
 
-#if (defined __USE_MISC || defined __USE_XOPEN) && !defined __key_t_defined
-typedef __key_t key_t;
-# define __key_t_defined
+#ifdef __USE_XOPEN
+# include <bits/types/useconds_t.h>
+# include <bits/types/suseconds_t.h>
 #endif
 
 #if defined __USE_XOPEN || defined __USE_XOPEN2K8
 # include <bits/types/clock_t.h>
+# include <bits/types/id_t.h>
+# include <bits/types/key_t.h>
 #endif
-#include <bits/types/clockid_t.h>
-#include <bits/types/time_t.h>
-#include <bits/types/timer_t.h>
 
-#ifdef __USE_XOPEN
-# ifndef __useconds_t_defined
-typedef __useconds_t useconds_t;
-#  define __useconds_t_defined
-# endif
-# ifndef __suseconds_t_defined
-typedef __suseconds_t suseconds_t;
-#  define __suseconds_t_defined
-# endif
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
+#include <bits/types/blksize_t.h>
 #endif
 
-#define        __need_size_t
-#include <stddef.h>
+#if defined __USE_POSIX199506 || defined __USE_UNIX98
+# include <bits/pthreadtypes.h>
+#endif
 
 /* POSIX does not require intN_t to be defined in this header, so
    technically this ought to be under __USE_MISC, but it doesn't
@@ -150,24 +81,17 @@ typedef __suseconds_t suseconds_t;
 #include <bits/stdint-intn.h>
 
 #ifdef __USE_MISC
-/* Old compatibility names for C types.  */
-typedef unsigned long int ulong;
-typedef unsigned short int ushort;
-typedef unsigned int uint;
-
-/* These size-specific names are used by some of the inet code.
-   They were defined by ISO C without the first `_'.  */
-typedef __uint8_t u_int8_t;
-typedef __uint16_t u_int16_t;
-typedef __uint32_t u_int32_t;
-typedef __uint64_t u_int64_t;
-
-/* Type of a general-purpose integer register (BSD).  */
-typedef __register_t register_t;
-
-/* Some code from BIND tests this macro to see if the types above are
-   defined.  */
-#define __BIT_TYPES_DEFINED__  1
+/* Additional typedefs from BSD, mostly obsolete.  */
+# include <bits/types/caddr_t.h>
+# include <bits/types/daddr_t.h>
+# include <bits/types/fsid_t.h>
+# include <bits/types/loff_t.h>
+# include <bits/types/register_t.h>
+
+/* Shorthand unsigned types, mostly superseded by stdint.h.  */
+# include <bits/types/uint.h>
+# include <bits/types/u_int.h>
+# include <bits/types/u_intN_t.h>
 
 /* In BSD <sys/types.h> is expected to define BYTE_ORDER.  */
 # include <endian.h>
@@ -176,54 +100,6 @@ typedef __register_t register_t;
 # include <sys/select.h>
 #endif /* Use misc.  */
 
-
-#if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \
-    && !defined __blksize_t_defined
-typedef __blksize_t blksize_t;
-# define __blksize_t_defined
-#endif
-
-/* Types from the Large File Support interface.  */
-#ifndef __USE_FILE_OFFSET64
-# ifndef __blkcnt_t_defined
-typedef __blkcnt_t blkcnt_t;    /* Type to count number of disk blocks.  */
-#  define __blkcnt_t_defined
-# endif
-# ifndef __fsblkcnt_t_defined
-typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks.  */
-#  define __fsblkcnt_t_defined
-# endif
-# ifndef __fsfilcnt_t_defined
-typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes.  */
-#  define __fsfilcnt_t_defined
-# endif
-#else
-# ifndef __blkcnt_t_defined
-typedef __blkcnt64_t blkcnt_t;    /* Type to count number of disk blocks.  */
-#  define __blkcnt_t_defined
-# endif
-# ifndef __fsblkcnt_t_defined
-typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks.  */
-#  define __fsblkcnt_t_defined
-# endif
-# ifndef __fsfilcnt_t_defined
-typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes.  */
-#  define __fsfilcnt_t_defined
-# endif
-#endif
-
-#ifdef __USE_LARGEFILE64
-typedef __blkcnt64_t blkcnt64_t;     /* Type to count number of disk blocks. */
-typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks.  */
-typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes.  */
-#endif
-
-
-/* Now add the thread types.  */
-#if defined __USE_POSIX199506 || defined __USE_UNIX98
-# include <bits/pthreadtypes.h>
-#endif
-
 __END_DECLS
 
 #endif /* sys/types.h */
index a42e16c1b065e9955514c55f909e50ec34a50d35..d4646ac89fdb54728c229160dc73b2e91cb2d9cf 100644 (file)
 __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
index 0dd4200ad63e9bf6620699796907f95209eab052..e5958e3d36ce6529e0bda36c890b5332b9d78cbd 100644 (file)
@@ -215,11 +215,7 @@ __BEGIN_DECLS
 /* All functions that are not declared anywhere else.  */
 
 #include <bits/types.h>
-
-#ifndef        __ssize_t_defined
-typedef __ssize_t ssize_t;
-# define __ssize_t_defined
-#endif
+#include <bits/types/ssize_t.h>
 
 #define        __need_size_t
 #define __need_NULL
@@ -228,52 +224,22 @@ typedef __ssize_t ssize_t;
 #if defined __USE_XOPEN || defined __USE_XOPEN2K
 /* The Single Unix specification says that some more types are
    available here.  */
-# ifndef __gid_t_defined
-typedef __gid_t gid_t;
-#  define __gid_t_defined
-# endif
-
-# ifndef __uid_t_defined
-typedef __uid_t uid_t;
-#  define __uid_t_defined
-# endif
-
-# ifndef __off_t_defined
-#  ifndef __USE_FILE_OFFSET64
-typedef __off_t off_t;
-#  else
-typedef __off64_t off_t;
-#  endif
-#  define __off_t_defined
-# endif
-# if defined __USE_LARGEFILE64 && !defined __off64_t_defined
-typedef __off64_t off64_t;
-#  define __off64_t_defined
-# endif
-
-# ifndef __useconds_t_defined
-typedef __useconds_t useconds_t;
-#  define __useconds_t_defined
-# endif
-
-# ifndef __pid_t_defined
-typedef __pid_t pid_t;
-#  define __pid_t_defined
+# include <bits/types/gid_t.h>
+# include <bits/types/uid_t.h>
+# include <bits/types/off_t.h>
+# ifdef __USE_LARGEFILE64
+#  include <bits/types/off64_t.h>
 # endif
+# include <bits/types/useconds_t.h>
+# include <bits/types/pid_t.h>
 #endif /* X/Open */
 
 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
-# ifndef __intptr_t_defined
-typedef __intptr_t intptr_t;
-#  define __intptr_t_defined
-# endif
+# include <bits/types/intptr_t.h>
 #endif
 
 #if defined __USE_MISC || defined __USE_XOPEN
-# ifndef __socklen_t_defined
-typedef __socklen_t socklen_t;
-#  define __socklen_t_defined
-# endif
+# include <bits/types/socklen_t.h>
 #endif
 
 /* Values for the second argument to access.
index bbc29479cd25b8ca8b2ad04f20dc52e910435ea2..7f490f57debb629f4164ec15d5adb60d10745263 100644 (file)
--- a/pwd/pwd.h
+++ b/pwd/pwd.h
@@ -34,15 +34,8 @@ __BEGIN_DECLS
 #if defined __USE_XOPEN || defined __USE_XOPEN2K
 /* The Single Unix specification says that some more types are
    available here.  */
-# ifndef __gid_t_defined
-typedef __gid_t gid_t;
-#  define __gid_t_defined
-# endif
-
-# ifndef __uid_t_defined
-typedef __uid_t uid_t;
-#  define __uid_t_defined
-# endif
+# include <bits/types/gid_t.h>
+# include <bits/types/uid_t.h>
 #endif
 
 /* A record in the user database.  */
index 4edafb50d57616b2fa22224748a48fc97441bfc3..5355da84bf0f948a9d17ddcf7b628d251773183b 100644 (file)
 
 /* 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
 
index ae740993ef9d67839db187e222ef7c784b1ee529..e458e2b8b39089beb4c08a495ce4426529250856 100755 (executable)
@@ -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)
 
index 40825e95ecbd895f617744365b44c3b13766f6c7..f7f50c82d4fd67823604e070cb15d2944feac733 100644 (file)
@@ -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
index dfb6ed5c0c3bc4457e6607a80b9cc263360d905f..8f268a0060a328336eb406df1b0b6692065ad34c 100644 (file)
 #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
 
index 391e3d2500744e093432adec0a3ea7fce5837ada..94d6e71a82a5812c30d8a64525012b04cb48addf 100644 (file)
@@ -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.  */
index 99e5f4f151d53a171f007a6a65c7c756def47546..13ef47f3c995d0c2af1a43b86046a15aacae4e2f 100644 (file)
 #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
index f50a0dbeb9453490e7b30b986923b3c308b3176c..b1a82a46cf08e99e5a4308d7e6ad6adf59c403e5 100644 (file)
 #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>
index ff898aa18822656957f39e0025301d2f7394dc67..06a731184b4ecddbfc7309215d524f6139b76109 100644 (file)
 
 #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
index 50f89db2ace4862247522cc4d67fa12de9f7699f..f275b33499333b5e98245dcd770dbb85ba77c6e4 100644 (file)
 #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>
index 0c7f3567db48f2d4c6b09420d2cee7f663a23c70..ca2b989074490bbf1c67b6b00067001be26bde3d 100644 (file)
 /* 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
 
index c70cfa582c2a2c2fc462ea55e344f1e8df4bfcf2..b110e16eff5e3142b4304a51e582a05dcca4b2f1 100644 (file)
 
 /* 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.  */
index 6c58742c4f387674355dddc06946f89228693801..c1cc2951c4a7578e0ec5deee65a24e08447e57f6 100644 (file)
 
 /* 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
 
index 41cd79bfd7df77bd23541879abfa0328a7c31600..0af77e397c151e87531684154971cfc3a449a178 100644 (file)
 #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
index 21fa9ed4518108337cde0380305c329f7db90a46..3769f85605f02ca7137fa035edde5bdb02987207 100644 (file)
 #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>
 
index 015bc1c7f3b5d3db689f68de2a0c6ebbbc94f138..c12d5e2fb385eb71a9b96cc32d178baa119f201e 100644 (file)
@@ -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