types.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. /* unified sys/types.h:
  2. start with sef's sysvi386 version.
  3. merge go32 version -- a few ifdefs.
  4. h8300hms, h8300xray, and sysvnecv70 disagree on the following types:
  5. typedef int gid_t;
  6. typedef int uid_t;
  7. typedef int dev_t;
  8. typedef int ino_t;
  9. typedef int mode_t;
  10. typedef int caddr_t;
  11. however, these aren't "reasonable" values, the sysvi386 ones make far
  12. more sense, and should work sufficiently well (in particular, h8300
  13. doesn't have a stat, and the necv70 doesn't matter.) -- eichin
  14. */
  15. #ifndef _SYS_TYPES_H
  16. #include <_ansi.h>
  17. #include <sys/cdefs.h>
  18. #include <machine/_types.h>
  19. /* BSD types permitted by POSIX and always exposed as in Glibc. Only provided
  20. for backward compatibility with BSD code. The uintN_t standard types should
  21. be preferred in new code. */
  22. #if ___int8_t_defined
  23. typedef __uint8_t u_int8_t;
  24. #endif
  25. #if ___int16_t_defined
  26. typedef __uint16_t u_int16_t;
  27. #endif
  28. #if ___int32_t_defined
  29. typedef __uint32_t u_int32_t;
  30. #endif
  31. #if ___int64_t_defined
  32. typedef __uint64_t u_int64_t;
  33. #endif
  34. typedef int register_t;
  35. #define __BIT_TYPES_DEFINED__ 1
  36. #if defined(__rtems__) || defined(__XMK__)
  37. /*
  38. * The following section is RTEMS specific and is needed to more
  39. * closely match the types defined in the BSD sys/types.h.
  40. * This is needed to let the RTEMS/BSD TCP/IP stack compile.
  41. */
  42. /* deprecated */
  43. #if ___int64_t_defined
  44. typedef __uint64_t u_quad_t;
  45. typedef __int64_t quad_t;
  46. typedef quad_t * qaddr_t;
  47. #endif
  48. #endif /* __rtems__ || __XMK__ */
  49. #ifndef __need_inttypes
  50. #define _SYS_TYPES_H
  51. /* <stddef.h> must be before <sys/_types.h> for __size_t considerations */
  52. #include <stddef.h>
  53. #include <sys/_types.h>
  54. #include <sys/_stdint.h>
  55. #if __BSD_VISIBLE
  56. #include <machine/endian.h>
  57. #include <sys/select.h>
  58. # define physadr physadr_t
  59. # define quad quad_t
  60. #ifndef _IN_ADDR_T_DECLARED
  61. typedef __uint32_t in_addr_t; /* base type for internet address */
  62. #define _IN_ADDR_T_DECLARED
  63. #endif
  64. #ifndef _IN_PORT_T_DECLARED
  65. typedef __uint16_t in_port_t;
  66. #define _IN_PORT_T_DECLARED
  67. #endif
  68. #endif /* __BSD_VISIBLE */
  69. #if __MISC_VISIBLE
  70. #ifndef _BSDTYPES_DEFINED
  71. /* also defined in mingw/gmon.h and in w32api/winsock[2].h */
  72. #ifndef __u_char_defined
  73. typedef unsigned char u_char;
  74. #define __u_char_defined
  75. #endif
  76. #ifndef __u_short_defined
  77. typedef unsigned short u_short;
  78. #define __u_short_defined
  79. #endif
  80. #ifndef __u_int_defined
  81. typedef unsigned int u_int;
  82. #define __u_int_defined
  83. #endif
  84. #ifndef __u_long_defined
  85. typedef unsigned long u_long;
  86. #define __u_long_defined
  87. #endif
  88. #define _BSDTYPES_DEFINED
  89. #endif
  90. #endif /*__BSD_VISIBLE || __CYGWIN__ */
  91. #if __MISC_VISIBLE
  92. typedef unsigned short ushort; /* System V compatibility */
  93. typedef unsigned int uint; /* System V compatibility */
  94. typedef unsigned long ulong; /* System V compatibility */
  95. #endif
  96. #ifndef _BLKCNT_T_DECLARED
  97. typedef __blkcnt_t blkcnt_t;
  98. #define _BLKCNT_T_DECLARED
  99. #endif
  100. #ifndef _BLKSIZE_T_DECLARED
  101. typedef __blksize_t blksize_t;
  102. #define _BLKSIZE_T_DECLARED
  103. #endif
  104. #if !defined(__clock_t_defined) && !defined(_CLOCK_T_DECLARED)
  105. typedef _CLOCK_T_ clock_t;
  106. #define __clock_t_defined
  107. #define _CLOCK_T_DECLARED
  108. #endif
  109. #if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED)
  110. typedef _TIME_T_ time_t;
  111. #define __time_t_defined
  112. #define _TIME_T_DECLARED
  113. #endif
  114. #ifndef __daddr_t_defined
  115. typedef long daddr_t;
  116. #define __daddr_t_defined
  117. #endif
  118. #ifndef __caddr_t_defined
  119. typedef char * caddr_t;
  120. #define __caddr_t_defined
  121. #endif
  122. #ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */
  123. typedef __fsblkcnt_t fsblkcnt_t;
  124. typedef __fsfilcnt_t fsfilcnt_t;
  125. #define _FSBLKCNT_T_DECLARED
  126. #endif
  127. #ifndef _ID_T_DECLARED
  128. typedef __id_t id_t; /* can hold a uid_t or pid_t */
  129. #define _ID_T_DECLARED
  130. #endif
  131. #ifndef _INO_T_DECLARED
  132. typedef __ino_t ino_t; /* inode number */
  133. #define _INO_T_DECLARED
  134. #endif
  135. #if defined(__i386__) && (defined(GO32) || defined(__MSDOS__))
  136. typedef char * addr_t;
  137. typedef unsigned long vm_offset_t;
  138. typedef unsigned long vm_size_t;
  139. #endif /* __i386__ && (GO32 || __MSDOS__) */
  140. /*
  141. * All these should be machine specific - right now they are all broken.
  142. * However, for all of Cygnus' embedded targets, we want them to all be
  143. * the same. Otherwise things like sizeof (struct stat) might depend on
  144. * how the file was compiled (e.g. -mint16 vs -mint32, etc.).
  145. */
  146. #ifndef _OFF_T_DECLARED
  147. typedef __off_t off_t; /* file offset */
  148. #define _OFF_T_DECLARED
  149. #endif
  150. #ifndef _DEV_T_DECLARED
  151. typedef __dev_t dev_t; /* device number or struct cdev */
  152. #define _DEV_T_DECLARED
  153. #endif
  154. #ifndef _UID_T_DECLARED
  155. typedef __uid_t uid_t; /* user id */
  156. #define _UID_T_DECLARED
  157. #endif
  158. #ifndef _GID_T_DECLARED
  159. typedef __gid_t gid_t; /* group id */
  160. #define _GID_T_DECLARED
  161. #endif
  162. #ifndef _PID_T_DECLARED
  163. typedef __pid_t pid_t; /* process id */
  164. #define _PID_T_DECLARED
  165. #endif
  166. #ifndef _KEY_T_DECLARED
  167. typedef __key_t key_t; /* IPC key */
  168. #define _KEY_T_DECLARED
  169. #endif
  170. #ifndef _SSIZE_T_DECLARED
  171. typedef _ssize_t ssize_t;
  172. #define _SSIZE_T_DECLARED
  173. #endif
  174. #ifndef _MODE_T_DECLARED
  175. typedef __mode_t mode_t; /* permissions */
  176. #define _MODE_T_DECLARED
  177. #endif
  178. #ifndef _NLINK_T_DECLARED
  179. typedef __nlink_t nlink_t; /* link count */
  180. #define _NLINK_T_DECLARED
  181. #endif
  182. #if !defined(__clockid_t_defined) && !defined(_CLOCKID_T_DECLARED)
  183. typedef __clockid_t clockid_t;
  184. #define __clockid_t_defined
  185. #define _CLOCKID_T_DECLARED
  186. #endif
  187. #if !defined(__timer_t_defined) && !defined(_TIMER_T_DECLARED)
  188. typedef __timer_t timer_t;
  189. #define __timer_t_defined
  190. #define _TIMER_T_DECLARED
  191. #endif
  192. #ifndef _USECONDS_T_DECLARED
  193. typedef __useconds_t useconds_t; /* microseconds (unsigned) */
  194. #define _USECONDS_T_DECLARED
  195. #endif
  196. #ifndef _SUSECONDS_T_DECLARED
  197. typedef __suseconds_t suseconds_t;
  198. #define _SUSECONDS_T_DECLARED
  199. #endif
  200. typedef __int64_t sbintime_t;
  201. #include <sys/features.h>
  202. #include <sys/_pthreadtypes.h>
  203. #include <machine/types.h>
  204. #endif /* !__need_inttypes */
  205. #undef __need_inttypes
  206. #endif /* _SYS_TYPES_H */