/kern_2.6.32/arch/mips/include/asm/compat.h

http://omnia2droid.googlecode.com/ · C++ Header · 227 lines · 190 code · 27 blank · 10 comment · 0 complexity · e08917c5aa44ac189dd2f10a213adfc2 MD5 · raw file

  1. #ifndef _ASM_COMPAT_H
  2. #define _ASM_COMPAT_H
  3. /*
  4. * Architecture specific compatibility types
  5. */
  6. #include <linux/thread_info.h>
  7. #include <linux/types.h>
  8. #include <asm/page.h>
  9. #include <asm/ptrace.h>
  10. #define COMPAT_USER_HZ 100
  11. typedef u32 compat_size_t;
  12. typedef s32 compat_ssize_t;
  13. typedef s32 compat_time_t;
  14. typedef s32 compat_clock_t;
  15. typedef s32 compat_suseconds_t;
  16. typedef s32 compat_pid_t;
  17. typedef s32 __compat_uid_t;
  18. typedef s32 __compat_gid_t;
  19. typedef __compat_uid_t __compat_uid32_t;
  20. typedef __compat_gid_t __compat_gid32_t;
  21. typedef u32 compat_mode_t;
  22. typedef u32 compat_ino_t;
  23. typedef u32 compat_dev_t;
  24. typedef s32 compat_off_t;
  25. typedef s64 compat_loff_t;
  26. typedef u32 compat_nlink_t;
  27. typedef s32 compat_ipc_pid_t;
  28. typedef s32 compat_daddr_t;
  29. typedef s32 compat_caddr_t;
  30. typedef struct {
  31. s32 val[2];
  32. } compat_fsid_t;
  33. typedef s32 compat_timer_t;
  34. typedef s32 compat_key_t;
  35. typedef s32 compat_int_t;
  36. typedef s32 compat_long_t;
  37. typedef s64 compat_s64;
  38. typedef u32 compat_uint_t;
  39. typedef u32 compat_ulong_t;
  40. typedef u64 compat_u64;
  41. struct compat_timespec {
  42. compat_time_t tv_sec;
  43. s32 tv_nsec;
  44. };
  45. struct compat_timeval {
  46. compat_time_t tv_sec;
  47. s32 tv_usec;
  48. };
  49. struct compat_stat {
  50. compat_dev_t st_dev;
  51. s32 st_pad1[3];
  52. compat_ino_t st_ino;
  53. compat_mode_t st_mode;
  54. compat_nlink_t st_nlink;
  55. __compat_uid_t st_uid;
  56. __compat_gid_t st_gid;
  57. compat_dev_t st_rdev;
  58. s32 st_pad2[2];
  59. compat_off_t st_size;
  60. s32 st_pad3;
  61. compat_time_t st_atime;
  62. s32 st_atime_nsec;
  63. compat_time_t st_mtime;
  64. s32 st_mtime_nsec;
  65. compat_time_t st_ctime;
  66. s32 st_ctime_nsec;
  67. s32 st_blksize;
  68. s32 st_blocks;
  69. s32 st_pad4[14];
  70. };
  71. struct compat_flock {
  72. short l_type;
  73. short l_whence;
  74. compat_off_t l_start;
  75. compat_off_t l_len;
  76. s32 l_sysid;
  77. compat_pid_t l_pid;
  78. short __unused;
  79. s32 pad[4];
  80. };
  81. #define F_GETLK64 33
  82. #define F_SETLK64 34
  83. #define F_SETLKW64 35
  84. struct compat_flock64 {
  85. short l_type;
  86. short l_whence;
  87. compat_loff_t l_start;
  88. compat_loff_t l_len;
  89. compat_pid_t l_pid;
  90. };
  91. struct compat_statfs {
  92. int f_type;
  93. int f_bsize;
  94. int f_frsize;
  95. int f_blocks;
  96. int f_bfree;
  97. int f_files;
  98. int f_ffree;
  99. int f_bavail;
  100. compat_fsid_t f_fsid;
  101. int f_namelen;
  102. int f_spare[6];
  103. };
  104. #define COMPAT_RLIM_INFINITY 0x7fffffffUL
  105. typedef u32 compat_old_sigset_t; /* at least 32 bits */
  106. #define _COMPAT_NSIG 128 /* Don't ask !$@#% ... */
  107. #define _COMPAT_NSIG_BPW 32
  108. typedef u32 compat_sigset_word;
  109. #define COMPAT_OFF_T_MAX 0x7fffffff
  110. #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
  111. /*
  112. * A pointer passed in from user mode. This should not
  113. * be used for syscall parameters, just declare them
  114. * as pointers because the syscall entry code will have
  115. * appropriately converted them already.
  116. */
  117. typedef u32 compat_uptr_t;
  118. static inline void __user *compat_ptr(compat_uptr_t uptr)
  119. {
  120. /* cast to a __user pointer via "unsigned long" makes sparse happy */
  121. return (void __user *)(unsigned long)(long)uptr;
  122. }
  123. static inline compat_uptr_t ptr_to_compat(void __user *uptr)
  124. {
  125. return (u32)(unsigned long)uptr;
  126. }
  127. static inline void __user *compat_alloc_user_space(long len)
  128. {
  129. struct pt_regs *regs = (struct pt_regs *)
  130. ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
  131. return (void __user *) (regs->regs[29] - len);
  132. }
  133. struct compat_ipc64_perm {
  134. compat_key_t key;
  135. __compat_uid32_t uid;
  136. __compat_gid32_t gid;
  137. __compat_uid32_t cuid;
  138. __compat_gid32_t cgid;
  139. compat_mode_t mode;
  140. unsigned short seq;
  141. unsigned short __pad2;
  142. compat_ulong_t __unused1;
  143. compat_ulong_t __unused2;
  144. };
  145. struct compat_semid64_ds {
  146. struct compat_ipc64_perm sem_perm;
  147. compat_time_t sem_otime;
  148. compat_time_t sem_ctime;
  149. compat_ulong_t sem_nsems;
  150. compat_ulong_t __unused1;
  151. compat_ulong_t __unused2;
  152. };
  153. struct compat_msqid64_ds {
  154. struct compat_ipc64_perm msg_perm;
  155. #ifndef CONFIG_CPU_LITTLE_ENDIAN
  156. compat_ulong_t __unused1;
  157. #endif
  158. compat_time_t msg_stime;
  159. #ifdef CONFIG_CPU_LITTLE_ENDIAN
  160. compat_ulong_t __unused1;
  161. #endif
  162. #ifndef CONFIG_CPU_LITTLE_ENDIAN
  163. compat_ulong_t __unused2;
  164. #endif
  165. compat_time_t msg_rtime;
  166. #ifdef CONFIG_CPU_LITTLE_ENDIAN
  167. compat_ulong_t __unused2;
  168. #endif
  169. #ifndef CONFIG_CPU_LITTLE_ENDIAN
  170. compat_ulong_t __unused3;
  171. #endif
  172. compat_time_t msg_ctime;
  173. #ifdef CONFIG_CPU_LITTLE_ENDIAN
  174. compat_ulong_t __unused3;
  175. #endif
  176. compat_ulong_t msg_cbytes;
  177. compat_ulong_t msg_qnum;
  178. compat_ulong_t msg_qbytes;
  179. compat_pid_t msg_lspid;
  180. compat_pid_t msg_lrpid;
  181. compat_ulong_t __unused4;
  182. compat_ulong_t __unused5;
  183. };
  184. struct compat_shmid64_ds {
  185. struct compat_ipc64_perm shm_perm;
  186. compat_size_t shm_segsz;
  187. compat_time_t shm_atime;
  188. compat_time_t shm_dtime;
  189. compat_time_t shm_ctime;
  190. compat_pid_t shm_cpid;
  191. compat_pid_t shm_lpid;
  192. compat_ulong_t shm_nattch;
  193. compat_ulong_t __unused1;
  194. compat_ulong_t __unused2;
  195. };
  196. static inline int is_compat_task(void)
  197. {
  198. return test_thread_flag(TIF_32BIT);
  199. }
  200. #endif /* _ASM_COMPAT_H */