types.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. /* Copyright (C) 1991,1992,1994,1995,1996,1997,1998,1999,2000,2001,2002
  2. Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  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. # ifndef __u_char_defined
  25. typedef __u_char u_char;
  26. typedef __u_short u_short;
  27. typedef __u_int u_int;
  28. typedef __u_long u_long;
  29. typedef __quad_t quad_t;
  30. typedef __u_quad_t u_quad_t;
  31. typedef __fsid_t fsid_t;
  32. # define __u_char_defined
  33. # endif
  34. #endif
  35. typedef __loff_t loff_t;
  36. #ifndef __ino_t_defined
  37. # ifndef __USE_FILE_OFFSET64
  38. typedef __ino_t ino_t;
  39. # else
  40. typedef __ino64_t ino_t;
  41. # endif
  42. # define __ino_t_defined
  43. #endif
  44. #if defined __USE_LARGEFILE64 && !defined __ino64_t_defined
  45. typedef __ino64_t ino64_t;
  46. # define __ino64_t_defined
  47. #endif
  48. #ifndef __dev_t_defined
  49. typedef __dev_t dev_t;
  50. # define __dev_t_defined
  51. #endif
  52. #ifndef __gid_t_defined
  53. typedef __gid_t gid_t;
  54. # define __gid_t_defined
  55. #endif
  56. #ifndef __mode_t_defined
  57. typedef __mode_t mode_t;
  58. # define __mode_t_defined
  59. #endif
  60. #ifndef __nlink_t_defined
  61. typedef __nlink_t nlink_t;
  62. # define __nlink_t_defined
  63. #endif
  64. #ifndef __uid_t_defined
  65. typedef __uid_t uid_t;
  66. # define __uid_t_defined
  67. #endif
  68. #ifndef __off_t_defined
  69. # ifndef __USE_FILE_OFFSET64
  70. typedef __off_t off_t;
  71. # else
  72. typedef __off64_t off_t;
  73. # endif
  74. # define __off_t_defined
  75. #endif
  76. #if defined __USE_LARGEFILE64 && !defined __off64_t_defined
  77. typedef __off64_t off64_t;
  78. # define __off64_t_defined
  79. #endif
  80. #ifndef __pid_t_defined
  81. typedef __pid_t pid_t;
  82. # define __pid_t_defined
  83. #endif
  84. #if (defined __USE_SVID || defined __USE_XOPEN) && !defined __id_t_defined
  85. typedef __id_t id_t;
  86. # define __id_t_defined
  87. #endif
  88. #ifndef __ssize_t_defined
  89. typedef __ssize_t ssize_t;
  90. # define __ssize_t_defined
  91. #endif
  92. #ifdef __USE_BSD
  93. # ifndef __daddr_t_defined
  94. typedef __daddr_t daddr_t;
  95. typedef __caddr_t caddr_t;
  96. # define __daddr_t_defined
  97. # endif
  98. #endif
  99. #if (defined __USE_SVID || defined __USE_XOPEN) && !defined __key_t_defined
  100. typedef __key_t key_t;
  101. # define __key_t_defined
  102. #endif
  103. #ifdef __USE_XOPEN
  104. # define __need_clock_t
  105. #endif
  106. #define __need_time_t
  107. #define __need_timer_t
  108. #define __need_clockid_t
  109. #include <time.h>
  110. #ifdef __USE_XOPEN
  111. # ifndef __useconds_t_defined
  112. typedef __useconds_t useconds_t;
  113. # define __useconds_t_defined
  114. # endif
  115. # ifndef __suseconds_t_defined
  116. typedef __suseconds_t suseconds_t;
  117. # define __suseconds_t_defined
  118. # endif
  119. #endif
  120. #define __need_size_t
  121. #include <stddef.h>
  122. #ifdef __USE_MISC
  123. /* Old compatibility names for C types. */
  124. typedef unsigned long int ulong;
  125. typedef unsigned short int ushort;
  126. typedef unsigned int uint;
  127. #endif
  128. /* These size-specific names are used by some of the inet code. */
  129. #if !__GNUC_PREREQ (2, 7)
  130. /* These types are defined by the ISO C99 header <inttypes.h>. */
  131. # ifndef __int8_t_defined
  132. # define __int8_t_defined
  133. typedef char int8_t;
  134. typedef short int int16_t;
  135. typedef int int32_t;
  136. # if __WORDSIZE == 64
  137. typedef long int int64_t;
  138. # elif defined __GNUC__ || defined __ICC || defined __TenDRA__
  139. __extension__ typedef long long int int64_t;
  140. # endif
  141. # endif
  142. /* But these were defined by ISO C without the first `_'. */
  143. typedef unsigned char u_int8_t;
  144. typedef unsigned short int u_int16_t;
  145. typedef unsigned int u_int32_t;
  146. # if __WORDSIZE == 64
  147. typedef unsigned long int u_int64_t;
  148. # elif defined __GNUC__ || defined __ICC || defined __TenDRA__
  149. __extension__ typedef unsigned long long int u_int64_t;
  150. # endif
  151. typedef int register_t;
  152. #else
  153. /* For GCC 2.7 and later, we can use specific type-size attributes. */
  154. # define __intN_t(N, MODE) \
  155. typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
  156. # define __u_intN_t(N, MODE) \
  157. typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
  158. # ifndef __int8_t_defined
  159. # define __int8_t_defined
  160. __intN_t (8, __QI__);
  161. __intN_t (16, __HI__);
  162. __intN_t (32, __SI__);
  163. __intN_t (64, __DI__);
  164. # endif
  165. __u_intN_t (8, __QI__);
  166. __u_intN_t (16, __HI__);
  167. __u_intN_t (32, __SI__);
  168. __u_intN_t (64, __DI__);
  169. typedef int register_t __attribute__ ((__mode__ (__word__)));
  170. /* Some code from BIND tests this macro to see if the types above are
  171. defined. */
  172. #endif
  173. #define __BIT_TYPES_DEFINED__ 1
  174. #ifdef __USE_BSD
  175. /* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
  176. # include <endian.h>
  177. /* It also defines `fd_set' and the FD_* macros for `select'. */
  178. # include <sys/select.h>
  179. /* BSD defines these symbols, so we follow. */
  180. # include <sys/sysmacros.h>
  181. #endif /* Use BSD. */
  182. #if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \
  183. && !defined __blksize_t_defined
  184. typedef __blksize_t blksize_t;
  185. # define __blksize_t_defined
  186. #endif
  187. /* Types from the Large File Support interface. */
  188. #ifndef __USE_FILE_OFFSET64
  189. # ifndef __blkcnt_t_defined
  190. typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */
  191. # define __blkcnt_t_defined
  192. # endif
  193. # ifndef __fsblkcnt_t_defined
  194. typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */
  195. # define __fsblkcnt_t_defined
  196. # endif
  197. # ifndef __fsfilcnt_t_defined
  198. typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */
  199. # define __fsfilcnt_t_defined
  200. # endif
  201. #else
  202. # ifndef __blkcnt_t_defined
  203. typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */
  204. # define __blkcnt_t_defined
  205. # endif
  206. # ifndef __fsblkcnt_t_defined
  207. typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */
  208. # define __fsblkcnt_t_defined
  209. # endif
  210. # ifndef __fsfilcnt_t_defined
  211. typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */
  212. # define __fsfilcnt_t_defined
  213. # endif
  214. #endif
  215. #ifdef __USE_LARGEFILE64
  216. typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */
  217. typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */
  218. typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */
  219. #endif
  220. /* Now add the thread types. */
  221. #if (defined __USE_POSIX199506 || defined __USE_UNIX98) && defined __UCLIBC_HAS_THREADS__
  222. # include <bits/pthreadtypes.h>
  223. #endif
  224. __END_DECLS
  225. #endif /* sys/types.h */