types.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. #ifndef _LINUX_TYPES_H
  2. #define _LINUX_TYPES_H
  3. #ifdef __KERNEL__
  4. #include <linux/config.h>
  5. #endif
  6. #include <linux/posix_types.h>
  7. #include <asm/types.h>
  8. #ifndef __KERNEL_STRICT_NAMES
  9. typedef __kernel_fd_set fd_set;
  10. typedef __kernel_dev_t dev_t;
  11. typedef __kernel_ino_t ino_t;
  12. typedef __kernel_mode_t mode_t;
  13. typedef __kernel_nlink_t nlink_t;
  14. typedef __kernel_off_t off_t;
  15. typedef __kernel_pid_t pid_t;
  16. typedef __kernel_daddr_t daddr_t;
  17. typedef __kernel_key_t key_t;
  18. typedef __kernel_suseconds_t suseconds_t;
  19. #ifdef __KERNEL__
  20. typedef __kernel_uid32_t uid_t;
  21. typedef __kernel_gid32_t gid_t;
  22. typedef __kernel_uid16_t        uid16_t;
  23. typedef __kernel_gid16_t        gid16_t;
  24. #ifdef CONFIG_UID16
  25. /* This is defined by include/asm-{arch}/posix_types.h */
  26. typedef __kernel_old_uid_t old_uid_t;
  27. typedef __kernel_old_gid_t old_gid_t;
  28. #endif /* CONFIG_UID16 */
  29. /* libc5 includes this file to define uid_t, thus uid_t can never change
  30.  * when it is included by non-kernel code
  31.  */
  32. #else
  33. typedef __kernel_uid_t uid_t;
  34. typedef __kernel_gid_t gid_t;
  35. #endif /* __KERNEL__ */
  36. #if defined(__GNUC__)
  37. typedef __kernel_loff_t loff_t;
  38. #endif
  39. /*
  40.  * The following typedefs are also protected by individual ifdefs for
  41.  * historical reasons:
  42.  */
  43. #ifndef _SIZE_T
  44. #define _SIZE_T
  45. typedef __kernel_size_t size_t;
  46. #endif
  47. #ifndef _SSIZE_T
  48. #define _SSIZE_T
  49. typedef __kernel_ssize_t ssize_t;
  50. #endif
  51. #ifndef _PTRDIFF_T
  52. #define _PTRDIFF_T
  53. typedef __kernel_ptrdiff_t ptrdiff_t;
  54. #endif
  55. #ifndef _TIME_T
  56. #define _TIME_T
  57. typedef __kernel_time_t time_t;
  58. #endif
  59. #ifndef _CLOCK_T
  60. #define _CLOCK_T
  61. typedef __kernel_clock_t clock_t;
  62. #endif
  63. #ifndef _CADDR_T
  64. #define _CADDR_T
  65. typedef __kernel_caddr_t caddr_t;
  66. #endif
  67. /* bsd */
  68. typedef unsigned char u_char;
  69. typedef unsigned short u_short;
  70. typedef unsigned int u_int;
  71. typedef unsigned long u_long;
  72. /* sysv */
  73. typedef unsigned char unchar;
  74. typedef unsigned short ushort;
  75. typedef unsigned int uint;
  76. typedef unsigned long ulong;
  77. #ifndef __BIT_TYPES_DEFINED__
  78. #define __BIT_TYPES_DEFINED__
  79. typedef __u8 u_int8_t;
  80. typedef __s8 int8_t;
  81. typedef __u16 u_int16_t;
  82. typedef __s16 int16_t;
  83. typedef __u32 u_int32_t;
  84. typedef __s32 int32_t;
  85. #endif /* !(__BIT_TYPES_DEFINED__) */
  86. typedef __u8 uint8_t;
  87. typedef __u16 uint16_t;
  88. typedef __u32 uint32_t;
  89. #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
  90. typedef __u64 uint64_t;
  91. typedef __u64 u_int64_t;
  92. typedef __s64 int64_t;
  93. #endif
  94. #endif /* __KERNEL_STRICT_NAMES */
  95. /*
  96.  * Below are truly Linux-specific types that should never collide with
  97.  * any application/library that wants linux/types.h.
  98.  */
  99. struct ustat {
  100. __kernel_daddr_t f_tfree;
  101. __kernel_ino_t f_tinode;
  102. char f_fname[6];
  103. char f_fpack[6];
  104. };
  105. #endif /* _LINUX_TYPES_H */