types.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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. typedef __daddr_t daddr_t;
  101. #ifndef __caddr_t_defined
  102. typedef char * caddr_t;
  103. #define __caddr_t_defined
  104. #endif
  105. #ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */
  106. typedef __fsblkcnt_t fsblkcnt_t;
  107. typedef __fsfilcnt_t fsfilcnt_t;
  108. #define _FSBLKCNT_T_DECLARED
  109. #endif
  110. #ifndef _ID_T_DECLARED
  111. typedef __id_t id_t; /* can hold a uid_t or pid_t */
  112. #define _ID_T_DECLARED
  113. #endif
  114. #ifndef _INO_T_DECLARED
  115. typedef __ino_t ino_t; /* inode number */
  116. #define _INO_T_DECLARED
  117. #endif
  118. #if defined(__i386__) && (defined(GO32) || defined(__MSDOS__))
  119. typedef char * addr_t;
  120. typedef unsigned long vm_offset_t;
  121. typedef unsigned long vm_size_t;
  122. #endif /* __i386__ && (GO32 || __MSDOS__) */
  123. /*
  124. * All these should be machine specific - right now they are all broken.
  125. * However, for all of Cygnus' embedded targets, we want them to all be
  126. * the same. Otherwise things like sizeof (struct stat) might depend on
  127. * how the file was compiled (e.g. -mint16 vs -mint32, etc.).
  128. */
  129. #ifndef _OFF_T_DECLARED
  130. typedef __off_t off_t; /* file offset */
  131. #define _OFF_T_DECLARED
  132. #endif
  133. #ifndef _DEV_T_DECLARED
  134. typedef __dev_t dev_t; /* device number or struct cdev */
  135. #define _DEV_T_DECLARED
  136. #endif
  137. #ifndef _UID_T_DECLARED
  138. typedef __uid_t uid_t; /* user id */
  139. #define _UID_T_DECLARED
  140. #endif
  141. #ifndef _GID_T_DECLARED
  142. typedef __gid_t gid_t; /* group id */
  143. #define _GID_T_DECLARED
  144. #endif
  145. #ifndef _PID_T_DECLARED
  146. typedef __pid_t pid_t; /* process id */
  147. #define _PID_T_DECLARED
  148. #endif
  149. #ifndef _KEY_T_DECLARED
  150. typedef __key_t key_t; /* IPC key */
  151. #define _KEY_T_DECLARED
  152. #endif
  153. #ifndef _SSIZE_T_DECLARED
  154. typedef _ssize_t ssize_t;
  155. #define _SSIZE_T_DECLARED
  156. #endif
  157. #ifndef _MODE_T_DECLARED
  158. typedef __mode_t mode_t; /* permissions */
  159. #define _MODE_T_DECLARED
  160. #endif
  161. #ifndef _NLINK_T_DECLARED
  162. typedef __nlink_t nlink_t; /* link count */
  163. #define _NLINK_T_DECLARED
  164. #endif
  165. #if !defined(__clockid_t_defined) && !defined(_CLOCKID_T_DECLARED)
  166. typedef __clockid_t clockid_t;
  167. #define __clockid_t_defined
  168. #define _CLOCKID_T_DECLARED
  169. #endif
  170. #if !defined(__timer_t_defined) && !defined(_TIMER_T_DECLARED)
  171. typedef __timer_t timer_t;
  172. #define __timer_t_defined
  173. #define _TIMER_T_DECLARED
  174. #endif
  175. #ifndef _USECONDS_T_DECLARED
  176. typedef __useconds_t useconds_t; /* microseconds (unsigned) */
  177. #define _USECONDS_T_DECLARED
  178. #endif
  179. #ifndef _SUSECONDS_T_DECLARED
  180. typedef __suseconds_t suseconds_t;
  181. #define _SUSECONDS_T_DECLARED
  182. #endif
  183. typedef __int64_t sbintime_t;
  184. #include <sys/features.h>
  185. #include <sys/_pthreadtypes.h>
  186. #include <machine/types.h>
  187. #endif /* !__need_inttypes */
  188. #undef __need_inttypes
  189. #endif /* _SYS_TYPES_H */