types.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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. # define __pid_t_defined
  81. #endif
  82. #if defined __USE_SVID || defined __USE_XOPEN
  83. typedef __id_t id_t;
  84. # define __id_t_defined
  85. #endif
  86. #ifndef ssize_t
  87. typedef __ssize_t ssize_t;
  88. # define ssize_t ssize_t
  89. # define __ssize_t_defined
  90. #endif
  91. #ifdef __USE_BSD
  92. typedef __daddr_t daddr_t;
  93. typedef __caddr_t caddr_t;
  94. #endif
  95. #if defined __USE_SVID || defined __USE_XOPEN
  96. typedef __key_t key_t;
  97. #endif
  98. #ifdef __USE_XOPEN
  99. # define __need_clock_t
  100. #endif
  101. #define __need_time_t
  102. #include <time.h>
  103. #define __need_size_t
  104. #include <stddef.h>
  105. #ifdef __USE_MISC
  106. /* Old compatibility names for C types. */
  107. typedef unsigned long int ulong;
  108. typedef unsigned short int ushort;
  109. typedef unsigned int uint;
  110. #endif
  111. /* These size-specific names are used by some of the inet code. */
  112. #if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
  113. /* These types are defined by the ISO C 9x header <inttypes.h>. */
  114. # ifndef __int8_t_defined
  115. # define __int8_t_defined
  116. typedef char int8_t;
  117. typedef short int int16_t;
  118. typedef int int32_t;
  119. # ifdef __GNUC__
  120. __extension__ typedef long long int int64_t;
  121. # endif
  122. # endif
  123. /* But these were defined by ISO C without the first `_'. */
  124. typedef unsigned char u_int8_t;
  125. typedef unsigned short int u_int16_t;
  126. typedef unsigned int u_int32_t;
  127. # ifdef __GNUC__
  128. __extension__ typedef unsigned long long int u_int64_t;
  129. # endif
  130. typedef int register_t;
  131. #else
  132. /* For GCC 2.7 and later, we can use specific type-size attributes. */
  133. # define __intN_t(N, MODE) \
  134. typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
  135. # define __u_intN_t(N, MODE) \
  136. typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
  137. # ifndef __int8_t_defined
  138. # define __int8_t_defined
  139. __intN_t (8, __QI__);
  140. __intN_t (16, __HI__);
  141. __intN_t (32, __SI__);
  142. __intN_t (64, __DI__);
  143. # endif
  144. __u_intN_t (8, __QI__);
  145. __u_intN_t (16, __HI__);
  146. __u_intN_t (32, __SI__);
  147. __u_intN_t (64, __DI__);
  148. typedef int register_t __attribute__ ((__mode__ (__word__)));
  149. /* Some code from BIND tests this macro to see if the types above are
  150. defined. */
  151. #endif
  152. #define __BIT_TYPES_DEFINED__ 1
  153. #ifdef __USE_BSD
  154. /* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
  155. # include <endian.h>
  156. /* It also defines `fd_set' and the FD_* macros for `select'. */
  157. # include <sys/select.h>
  158. /* BSD defines these symbols, so we follow. */
  159. # include <sys/sysmacros.h>
  160. #endif /* Use BSD. */
  161. /* Types from the Large File Support interface. */
  162. #ifndef __USE_FILE_OFFSET64
  163. typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */
  164. typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */
  165. typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */
  166. #else
  167. typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */
  168. typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */
  169. typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */
  170. #endif
  171. #ifdef __USE_LARGEFILE64
  172. typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */
  173. typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */
  174. typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */
  175. #endif
  176. __END_DECLS
  177. #endif /* sys/types.h */