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, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. /*
  17. * POSIX Standard: 2.6 Primitive System Data Types <sys/types.h>
  18. */
  19. #ifndef _SYS_TYPES_H
  20. #define _SYS_TYPES_H 1
  21. #include <features.h>
  22. __BEGIN_DECLS
  23. #include <bits/types.h>
  24. #ifdef __USE_BSD
  25. # ifndef __u_char_defined
  26. typedef __u_char u_char;
  27. typedef __u_short u_short;
  28. typedef __u_int u_int;
  29. typedef __u_long u_long;
  30. typedef __quad_t quad_t;
  31. typedef __u_quad_t u_quad_t;
  32. typedef __fsid_t fsid_t;
  33. # define __u_char_defined
  34. # endif
  35. #endif
  36. typedef __loff_t loff_t;
  37. #ifndef __ino_t_defined
  38. # ifndef __USE_FILE_OFFSET64
  39. typedef __ino_t ino_t;
  40. # else
  41. typedef __ino64_t ino_t;
  42. # endif
  43. # define __ino_t_defined
  44. #endif
  45. #if defined __USE_LARGEFILE64 && !defined __ino64_t_defined
  46. typedef __ino64_t ino64_t;
  47. # define __ino64_t_defined
  48. #endif
  49. #ifndef __dev_t_defined
  50. typedef __dev_t dev_t;
  51. # define __dev_t_defined
  52. #endif
  53. #ifndef __gid_t_defined
  54. typedef __gid_t gid_t;
  55. # define __gid_t_defined
  56. #endif
  57. #ifndef __mode_t_defined
  58. typedef __mode_t mode_t;
  59. # define __mode_t_defined
  60. #endif
  61. #ifndef __nlink_t_defined
  62. typedef __nlink_t nlink_t;
  63. # define __nlink_t_defined
  64. #endif
  65. #ifndef __uid_t_defined
  66. typedef __uid_t uid_t;
  67. # define __uid_t_defined
  68. #endif
  69. #ifndef __off_t_defined
  70. # ifndef __USE_FILE_OFFSET64
  71. typedef __off_t off_t;
  72. # else
  73. typedef __off64_t off_t;
  74. # endif
  75. # define __off_t_defined
  76. #endif
  77. #if defined __USE_LARGEFILE64 && !defined __off64_t_defined
  78. typedef __off64_t off64_t;
  79. # define __off64_t_defined
  80. #endif
  81. #ifndef __pid_t_defined
  82. typedef __pid_t pid_t;
  83. # define __pid_t_defined
  84. #endif
  85. #if (defined __USE_SVID || defined __USE_XOPEN) && !defined __id_t_defined
  86. typedef __id_t id_t;
  87. # define __id_t_defined
  88. #endif
  89. #ifndef __ssize_t_defined
  90. typedef __ssize_t ssize_t;
  91. # define __ssize_t_defined
  92. #endif
  93. #ifdef __USE_BSD
  94. # ifndef __daddr_t_defined
  95. typedef __daddr_t daddr_t;
  96. typedef __caddr_t caddr_t;
  97. # define __daddr_t_defined
  98. # endif
  99. #endif
  100. #if (defined __USE_SVID || defined __USE_XOPEN) && !defined __key_t_defined
  101. typedef __key_t key_t;
  102. # define __key_t_defined
  103. #endif
  104. #ifdef __USE_XOPEN
  105. # define __need_clock_t
  106. #endif
  107. #define __need_time_t
  108. #define __need_timer_t
  109. #define __need_clockid_t
  110. #include <time.h>
  111. #ifdef __USE_XOPEN
  112. # ifndef __useconds_t_defined
  113. typedef __useconds_t useconds_t;
  114. # define __useconds_t_defined
  115. # endif
  116. # ifndef __suseconds_t_defined
  117. typedef __suseconds_t suseconds_t;
  118. # define __suseconds_t_defined
  119. # endif
  120. #endif
  121. #define __need_size_t
  122. #include <stddef.h>
  123. #ifdef __USE_MISC
  124. /* Old compatibility names for C types. */
  125. typedef unsigned long int ulong;
  126. typedef unsigned short int ushort;
  127. typedef unsigned int uint;
  128. #endif
  129. /* These size-specific names are used by some of the inet code. */
  130. #if !__GNUC_PREREQ (2, 7)
  131. /* These types are defined by the ISO C99 header <inttypes.h>. */
  132. # ifndef __int8_t_defined
  133. # define __int8_t_defined
  134. typedef char int8_t;
  135. typedef short int int16_t;
  136. typedef int int32_t;
  137. # if __WORDSIZE == 64
  138. typedef long int int64_t;
  139. # elif defined __GNUC__ || defined __ICC
  140. __extension__ typedef long long int int64_t;
  141. # endif
  142. # endif
  143. /* But these were defined by ISO C without the first `_'. */
  144. typedef unsigned char u_int8_t;
  145. typedef unsigned short int u_int16_t;
  146. typedef unsigned int u_int32_t;
  147. # if __WORDSIZE == 64
  148. typedef unsigned long int u_int64_t;
  149. # elif defined __GNUC__ || defined __ICC
  150. __extension__ typedef unsigned long long int u_int64_t;
  151. # endif
  152. typedef int register_t;
  153. #else
  154. /* For GCC 2.7 and later, we can use specific type-size attributes. */
  155. # define __intN_t(N, MODE) \
  156. typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
  157. # define __u_intN_t(N, MODE) \
  158. typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
  159. # ifndef __int8_t_defined
  160. # define __int8_t_defined
  161. __intN_t (8, __QI__);
  162. __intN_t (16, __HI__);
  163. __intN_t (32, __SI__);
  164. __intN_t (64, __DI__);
  165. # endif
  166. __u_intN_t (8, __QI__);
  167. __u_intN_t (16, __HI__);
  168. __u_intN_t (32, __SI__);
  169. __u_intN_t (64, __DI__);
  170. typedef int register_t __attribute__ ((__mode__ (__word__)));
  171. /* Some code from BIND tests this macro to see if the types above are
  172. defined. */
  173. #endif
  174. #define __BIT_TYPES_DEFINED__ 1
  175. #ifdef __USE_BSD
  176. /* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
  177. # include <endian.h>
  178. /* It also defines `fd_set' and the FD_* macros for `select'. */
  179. # include <sys/select.h>
  180. /* BSD defines these symbols, so we follow. */
  181. # include <sys/sysmacros.h>
  182. #endif /* Use BSD. */
  183. #if defined __USE_UNIX98 && !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 */