types.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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 __intptr_t register_t;
  35. #define __BIT_TYPES_DEFINED__ 1
  36. #ifndef __need_inttypes
  37. #define _SYS_TYPES_H
  38. #include <sys/_types.h>
  39. #include <sys/_stdint.h>
  40. #if __BSD_VISIBLE
  41. #include <machine/endian.h>
  42. #include <sys/select.h>
  43. # define physadr physadr_t
  44. # define quad quad_t
  45. #ifndef _IN_ADDR_T_DECLARED
  46. typedef __uint32_t in_addr_t; /* base type for internet address */
  47. #define _IN_ADDR_T_DECLARED
  48. #endif
  49. #ifndef _IN_PORT_T_DECLARED
  50. typedef __uint16_t in_port_t;
  51. #define _IN_PORT_T_DECLARED
  52. #endif
  53. typedef __uintptr_t u_register_t;
  54. #endif /* __BSD_VISIBLE */
  55. #if __MISC_VISIBLE
  56. #ifndef _BSDTYPES_DEFINED
  57. /* also defined in mingw/gmon.h and in w32api/winsock[2].h */
  58. #ifndef __u_char_defined
  59. typedef unsigned char u_char;
  60. #define __u_char_defined
  61. #endif
  62. #ifndef __u_short_defined
  63. typedef unsigned short u_short;
  64. #define __u_short_defined
  65. #endif
  66. #ifndef __u_int_defined
  67. typedef unsigned int u_int;
  68. #define __u_int_defined
  69. #endif
  70. #ifndef __u_long_defined
  71. typedef unsigned long u_long;
  72. #define __u_long_defined
  73. #endif
  74. #define _BSDTYPES_DEFINED
  75. #endif
  76. #endif /* __MISC_VISIBLE */
  77. #if __MISC_VISIBLE
  78. typedef unsigned short ushort; /* System V compatibility */
  79. typedef unsigned int uint; /* System V compatibility */
  80. typedef unsigned long ulong; /* System V compatibility */
  81. #endif
  82. #ifndef _BLKCNT_T_DECLARED
  83. typedef __blkcnt_t blkcnt_t;
  84. #define _BLKCNT_T_DECLARED
  85. #endif
  86. #ifndef _BLKSIZE_T_DECLARED
  87. typedef __blksize_t blksize_t;
  88. #define _BLKSIZE_T_DECLARED
  89. #endif
  90. #if !defined(__clock_t_defined) && !defined(_CLOCK_T_DECLARED)
  91. typedef _CLOCK_T_ clock_t;
  92. #define __clock_t_defined
  93. #define _CLOCK_T_DECLARED
  94. #endif
  95. #if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED)
  96. typedef _TIME_T_ time_t;
  97. #define __time_t_defined
  98. #define _TIME_T_DECLARED
  99. #endif
  100. #ifndef __daddr_t_defined
  101. typedef long daddr_t;
  102. #define __daddr_t_defined
  103. #endif
  104. #ifndef __caddr_t_defined
  105. typedef char * caddr_t;
  106. #define __caddr_t_defined
  107. #endif
  108. #ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */
  109. typedef __fsblkcnt_t fsblkcnt_t;
  110. typedef __fsfilcnt_t fsfilcnt_t;
  111. #define _FSBLKCNT_T_DECLARED
  112. #endif
  113. #ifndef _ID_T_DECLARED
  114. typedef __id_t id_t; /* can hold a uid_t or pid_t */
  115. #define _ID_T_DECLARED
  116. #endif
  117. #ifndef _INO_T_DECLARED
  118. typedef __ino_t ino_t; /* inode number */
  119. #define _INO_T_DECLARED
  120. #endif
  121. #if defined(__i386__) && (defined(GO32) || defined(__MSDOS__))
  122. typedef char * addr_t;
  123. typedef unsigned long vm_offset_t;
  124. typedef unsigned long vm_size_t;
  125. #endif /* __i386__ && (GO32 || __MSDOS__) */
  126. /*
  127. * All these should be machine specific - right now they are all broken.
  128. * However, for all of Cygnus' embedded targets, we want them to all be
  129. * the same. Otherwise things like sizeof (struct stat) might depend on
  130. * how the file was compiled (e.g. -mint16 vs -mint32, etc.).
  131. */
  132. #ifndef _OFF_T_DECLARED
  133. typedef __off_t off_t; /* file offset */
  134. #define _OFF_T_DECLARED
  135. #endif
  136. #ifndef _DEV_T_DECLARED
  137. typedef __dev_t dev_t; /* device number or struct cdev */
  138. #define _DEV_T_DECLARED
  139. #endif
  140. #ifndef _UID_T_DECLARED
  141. typedef __uid_t uid_t; /* user id */
  142. #define _UID_T_DECLARED
  143. #endif
  144. #ifndef _GID_T_DECLARED
  145. typedef __gid_t gid_t; /* group id */
  146. #define _GID_T_DECLARED
  147. #endif
  148. #ifndef _PID_T_DECLARED
  149. typedef __pid_t pid_t; /* process id */
  150. #define _PID_T_DECLARED
  151. #endif
  152. #ifndef _KEY_T_DECLARED
  153. typedef __key_t key_t; /* IPC key */
  154. #define _KEY_T_DECLARED
  155. #endif
  156. #ifndef _SSIZE_T_DECLARED
  157. typedef _ssize_t ssize_t;
  158. #define _SSIZE_T_DECLARED
  159. #endif
  160. #ifndef _MODE_T_DECLARED
  161. typedef __mode_t mode_t; /* permissions */
  162. #define _MODE_T_DECLARED
  163. #endif
  164. #ifndef _NLINK_T_DECLARED
  165. typedef __nlink_t nlink_t; /* link count */
  166. #define _NLINK_T_DECLARED
  167. #endif
  168. #if !defined(__clockid_t_defined) && !defined(_CLOCKID_T_DECLARED)
  169. typedef __clockid_t clockid_t;
  170. #define __clockid_t_defined
  171. #define _CLOCKID_T_DECLARED
  172. #endif
  173. #if !defined(__timer_t_defined) && !defined(_TIMER_T_DECLARED)
  174. typedef __timer_t timer_t;
  175. #define __timer_t_defined
  176. #define _TIMER_T_DECLARED
  177. #endif
  178. #ifndef _USECONDS_T_DECLARED
  179. typedef __useconds_t useconds_t; /* microseconds (unsigned) */
  180. #define _USECONDS_T_DECLARED
  181. #endif
  182. #ifndef _SUSECONDS_T_DECLARED
  183. typedef __suseconds_t suseconds_t;
  184. #define _SUSECONDS_T_DECLARED
  185. #endif
  186. typedef __int64_t sbintime_t;
  187. #include <sys/features.h>
  188. #include <sys/_pthreadtypes.h>
  189. #include <machine/types.h>
  190. #endif /* !__need_inttypes */
  191. #undef __need_inttypes
  192. #endif /* _SYS_TYPES_H */