types.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /* Copyright (C) 1991,92,94,95,96,97,98,99, 2000 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If not,
  13. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. Boston, MA 02111-1307, USA. */
  15. /*
  16. * POSIX Standard: 2.6 Primitive System Data Types <sys/types.h>
  17. */
  18. #ifndef _SYS_TYPES_H
  19. #define _SYS_TYPES_H 1
  20. #include <features.h>
  21. __BEGIN_DECLS
  22. #include <bits/types.h>
  23. #ifdef __USE_BSD
  24. typedef __u_char u_char;
  25. typedef __u_short u_short;
  26. typedef __u_int u_int;
  27. typedef __u_long u_long;
  28. typedef __quad_t quad_t;
  29. typedef __u_quad_t u_quad_t;
  30. typedef __fsid_t fsid_t;
  31. #endif
  32. typedef __loff_t loff_t;
  33. #ifndef ino_t
  34. # ifndef __USE_FILE_OFFSET64
  35. typedef __ino_t ino_t;
  36. # else
  37. typedef __ino64_t ino_t;
  38. # endif
  39. # define ino_t ino_t
  40. #endif
  41. #if defined __USE_LARGEFILE64 && !defined ino64_t
  42. typedef __ino64_t ino64_t;
  43. # define ino64_t ino64_t
  44. #endif
  45. #ifndef dev_t
  46. typedef __dev_t dev_t;
  47. # define dev_t dev_t
  48. #endif
  49. #ifndef gid_t
  50. typedef __gid_t gid_t;
  51. # define gid_t gid_t
  52. #endif
  53. #ifndef mode_t
  54. typedef __mode_t mode_t;
  55. # define mode_t mode_t
  56. #endif
  57. #ifndef nlink_t
  58. typedef __nlink_t nlink_t;
  59. # define nlink_t nlink_t
  60. #endif
  61. #ifndef uid_t
  62. typedef __uid_t uid_t;
  63. # define uid_t uid_t
  64. #endif
  65. #ifndef off_t
  66. # ifndef __USE_FILE_OFFSET64
  67. typedef __off_t off_t;
  68. # else
  69. typedef __off64_t off_t;
  70. # endif
  71. # define off_t off_t
  72. #endif
  73. #if defined __USE_LARGEFILE64 && !defined off64_t
  74. typedef __off64_t off64_t;
  75. # define off64_t off64_t
  76. #endif
  77. #ifndef pid_t
  78. typedef __pid_t pid_t;
  79. # define pid_t pid_t
  80. #endif
  81. #if defined __USE_SVID || defined __USE_XOPEN
  82. typedef __id_t id_t;
  83. #endif
  84. #ifndef ssize_t
  85. typedef __ssize_t ssize_t;
  86. # define ssize_t ssize_t
  87. #endif
  88. #ifdef __USE_BSD
  89. typedef __daddr_t daddr_t;
  90. typedef __caddr_t caddr_t;
  91. #endif
  92. #if defined __USE_SVID || defined __USE_XOPEN
  93. typedef __key_t key_t;
  94. #endif
  95. #ifdef __USE_XOPEN
  96. # define __need_clock_t
  97. #endif
  98. #define __need_time_t
  99. #include <time.h>
  100. #define __need_size_t
  101. #include <stddef.h>
  102. #ifdef __USE_MISC
  103. /* Old compatibility names for C types. */
  104. typedef unsigned long int ulong;
  105. typedef unsigned short int ushort;
  106. typedef unsigned int uint;
  107. #endif
  108. /* These size-specific names are used by some of the inet code. */
  109. #if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
  110. /* These types are defined by the ISO C 9x header <inttypes.h>. */
  111. # ifndef __int8_t_defined
  112. # define __int8_t_defined
  113. typedef char int8_t;
  114. typedef short int int16_t;
  115. typedef int int32_t;
  116. # ifdef __GNUC__
  117. __extension__ typedef long long int int64_t;
  118. # endif
  119. # endif
  120. /* But these were defined by ISO C without the first `_'. */
  121. typedef unsigned char u_int8_t;
  122. typedef unsigned short int u_int16_t;
  123. typedef unsigned int u_int32_t;
  124. # ifdef __GNUC__
  125. __extension__ typedef unsigned long long int u_int64_t;
  126. # endif
  127. typedef int register_t;
  128. #else
  129. /* For GCC 2.7 and later, we can use specific type-size attributes. */
  130. # define __intN_t(N, MODE) \
  131. typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
  132. # define __u_intN_t(N, MODE) \
  133. typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
  134. # ifndef __int8_t_defined
  135. # define __int8_t_defined
  136. __intN_t (8, __QI__);
  137. __intN_t (16, __HI__);
  138. __intN_t (32, __SI__);
  139. __intN_t (64, __DI__);
  140. # endif
  141. __u_intN_t (8, __QI__);
  142. __u_intN_t (16, __HI__);
  143. __u_intN_t (32, __SI__);
  144. __u_intN_t (64, __DI__);
  145. typedef int register_t __attribute__ ((__mode__ (__word__)));
  146. /* Some code from BIND tests this macro to see if the types above are
  147. defined. */
  148. #endif
  149. #define __BIT_TYPES_DEFINED__ 1
  150. #ifdef __USE_BSD
  151. /* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
  152. # include <endian.h>
  153. /* It also defines `fd_set' and the FD_* macros for `select'. */
  154. # include <sys/select.h>
  155. /* BSD defines these symbols, so we follow. */
  156. # include <sys/sysmacros.h>
  157. #endif /* Use BSD. */
  158. /* Types from the Large File Support interface. */
  159. #ifndef __USE_FILE_OFFSET64
  160. typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */
  161. typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */
  162. typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */
  163. #else
  164. typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */
  165. typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */
  166. typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */
  167. #endif
  168. #ifdef __USE_LARGEFILE64
  169. typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */
  170. typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */
  171. typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */
  172. #endif
  173. __END_DECLS
  174. #endif /* sys/types.h */