types.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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 Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the 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. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 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. # 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. # ifdef __GNUC__
  137. __extension__ typedef long long int int64_t;
  138. # endif
  139. # endif
  140. /* But these were defined by ISO C without the first `_'. */
  141. typedef unsigned char u_int8_t;
  142. typedef unsigned short int u_int16_t;
  143. typedef unsigned int u_int32_t;
  144. # ifdef __GNUC__
  145. __extension__ typedef unsigned long long int u_int64_t;
  146. # endif
  147. typedef int register_t;
  148. #else
  149. /* For GCC 2.7 and later, we can use specific type-size attributes. */
  150. # define __intN_t(N, MODE) \
  151. typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
  152. # define __u_intN_t(N, MODE) \
  153. typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
  154. # ifndef __int8_t_defined
  155. # define __int8_t_defined
  156. __intN_t (8, __QI__);
  157. __intN_t (16, __HI__);
  158. __intN_t (32, __SI__);
  159. __intN_t (64, __DI__);
  160. # endif
  161. __u_intN_t (8, __QI__);
  162. __u_intN_t (16, __HI__);
  163. __u_intN_t (32, __SI__);
  164. __u_intN_t (64, __DI__);
  165. typedef int register_t __attribute__ ((__mode__ (__word__)));
  166. /* Some code from BIND tests this macro to see if the types above are
  167. defined. */
  168. #endif
  169. #define __BIT_TYPES_DEFINED__ 1
  170. #ifdef __USE_BSD
  171. /* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
  172. # include <endian.h>
  173. /* It also defines `fd_set' and the FD_* macros for `select'. */
  174. # include <sys/select.h>
  175. /* BSD defines these symbols, so we follow. */
  176. # include <sys/sysmacros.h>
  177. #endif /* Use BSD. */
  178. #if defined __USE_UNIX98 && !defined __blksize_t_defined
  179. typedef __blksize_t blksize_t;
  180. # define __blksize_t_defined
  181. #endif
  182. /* Types from the Large File Support interface. */
  183. #ifndef __USE_FILE_OFFSET64
  184. # ifndef __blkcnt_t_defined
  185. typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */
  186. # define __blkcnt_t_defined
  187. # endif
  188. # ifndef __fsblkcnt_t_defined
  189. typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */
  190. # define __fsblkcnt_t_defined
  191. # endif
  192. # ifndef __fsfilcnt_t_defined
  193. typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */
  194. # define __fsfilcnt_t_defined
  195. # endif
  196. #else
  197. # ifndef __blkcnt_t_defined
  198. typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */
  199. # define __blkcnt_t_defined
  200. # endif
  201. # ifndef __fsblkcnt_t_defined
  202. typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */
  203. # define __fsblkcnt_t_defined
  204. # endif
  205. # ifndef __fsfilcnt_t_defined
  206. typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */
  207. # define __fsfilcnt_t_defined
  208. # endif
  209. #endif
  210. #ifdef __USE_LARGEFILE64
  211. typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */
  212. typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */
  213. typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */
  214. #endif
  215. __END_DECLS
  216. #endif /* sys/types.h */