compat.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #ifndef _ASM_COMPAT_H
  2. #define _ASM_COMPAT_H
  3. /*
  4. * Architecture specific compatibility types
  5. */
  6. #include <linux/types.h>
  7. #include <asm/page.h>
  8. #define COMPAT_USER_HZ 100
  9. typedef u32 compat_size_t;
  10. typedef s32 compat_ssize_t;
  11. typedef s32 compat_time_t;
  12. typedef s32 compat_clock_t;
  13. typedef s32 compat_suseconds_t;
  14. typedef s32 compat_pid_t;
  15. typedef s32 __compat_uid_t;
  16. typedef s32 __compat_gid_t;
  17. typedef __compat_uid_t __compat_uid32_t;
  18. typedef __compat_gid_t __compat_gid32_t;
  19. typedef u32 compat_mode_t;
  20. typedef u32 compat_ino_t;
  21. typedef u32 compat_dev_t;
  22. typedef s32 compat_off_t;
  23. typedef s64 compat_loff_t;
  24. typedef u32 compat_nlink_t;
  25. typedef s32 compat_ipc_pid_t;
  26. typedef s32 compat_daddr_t;
  27. typedef s32 compat_caddr_t;
  28. typedef struct {
  29. s32 val[2];
  30. } compat_fsid_t;
  31. typedef s32 compat_timer_t;
  32. typedef s32 compat_int_t;
  33. typedef s32 compat_long_t;
  34. typedef u32 compat_uint_t;
  35. typedef u32 compat_ulong_t;
  36. struct compat_timespec {
  37. compat_time_t tv_sec;
  38. s32 tv_nsec;
  39. };
  40. struct compat_timeval {
  41. compat_time_t tv_sec;
  42. s32 tv_usec;
  43. };
  44. struct compat_stat {
  45. compat_dev_t st_dev;
  46. s32 st_pad1[3];
  47. compat_ino_t st_ino;
  48. compat_mode_t st_mode;
  49. compat_nlink_t st_nlink;
  50. __compat_uid_t st_uid;
  51. __compat_gid_t st_gid;
  52. compat_dev_t st_rdev;
  53. s32 st_pad2[2];
  54. compat_off_t st_size;
  55. s32 st_pad3;
  56. compat_time_t st_atime;
  57. s32 st_atime_nsec;
  58. compat_time_t st_mtime;
  59. s32 st_mtime_nsec;
  60. compat_time_t st_ctime;
  61. s32 st_ctime_nsec;
  62. s32 st_blksize;
  63. s32 st_blocks;
  64. s32 st_pad4[14];
  65. };
  66. struct compat_flock {
  67. short l_type;
  68. short l_whence;
  69. compat_off_t l_start;
  70. compat_off_t l_len;
  71. s32 l_sysid;
  72. compat_pid_t l_pid;
  73. short __unused;
  74. s32 pad[4];
  75. };
  76. #define F_GETLK64 33
  77. #define F_SETLK64 34
  78. #define F_SETLKW64 35
  79. struct compat_flock64 {
  80. short l_type;
  81. short l_whence;
  82. compat_loff_t l_start;
  83. compat_loff_t l_len;
  84. compat_pid_t l_pid;
  85. };
  86. struct compat_statfs {
  87. int f_type;
  88. int f_bsize;
  89. int f_frsize;
  90. int f_blocks;
  91. int f_bfree;
  92. int f_files;
  93. int f_ffree;
  94. int f_bavail;
  95. compat_fsid_t f_fsid;
  96. int f_namelen;
  97. int f_spare[6];
  98. };
  99. #define COMPAT_RLIM_INFINITY 0x7fffffffUL
  100. typedef u32 compat_old_sigset_t; /* at least 32 bits */
  101. #define _COMPAT_NSIG 128 /* Don't ask !$@#% ... */
  102. #define _COMPAT_NSIG_BPW 32
  103. typedef u32 compat_sigset_word;
  104. #define COMPAT_OFF_T_MAX 0x7fffffff
  105. #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
  106. /*
  107. * A pointer passed in from user mode. This should not
  108. * be used for syscall parameters, just declare them
  109. * as pointers because the syscall entry code will have
  110. * appropriately comverted them already.
  111. */
  112. typedef u32 compat_uptr_t;
  113. static inline void *compat_ptr(compat_uptr_t uptr)
  114. {
  115. return (void *)(long)uptr;
  116. }
  117. static inline void *compat_alloc_user_space(long len)
  118. {
  119. struct pt_regs *regs = (struct pt_regs *)
  120. ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
  121. return (void *) (regs->regs[29] - len);
  122. }
  123. #if defined (__MIPSEL__)
  124. #define __COMPAT_ENDIAN_SWAP__ 1
  125. #endif
  126. #endif /* _ASM_COMPAT_H */