compat.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_COMPAT_H
  3. #define _ASM_COMPAT_H
  4. /*
  5. * Architecture specific compatibility types
  6. */
  7. #include <linux/thread_info.h>
  8. #include <linux/types.h>
  9. #include <asm/page.h>
  10. #include <asm/ptrace.h>
  11. #define __compat_uid_t __compat_uid_t
  12. typedef s32 __compat_uid_t;
  13. typedef s32 __compat_gid_t;
  14. typedef __compat_uid_t __compat_uid32_t;
  15. typedef __compat_gid_t __compat_gid32_t;
  16. #define __compat_uid32_t __compat_uid32_t
  17. #define compat_statfs compat_statfs
  18. #define compat_ipc64_perm compat_ipc64_perm
  19. #define _COMPAT_NSIG 128 /* Don't ask !$@#% ... */
  20. #define _COMPAT_NSIG_BPW 32
  21. typedef u32 compat_sigset_word;
  22. #define COMPAT_RLIM_INFINITY 0x7fffffffUL
  23. #include <asm-generic/compat.h>
  24. #define COMPAT_UTS_MACHINE "mips\0\0\0"
  25. typedef u32 compat_nlink_t;
  26. struct compat_stat {
  27. compat_dev_t st_dev;
  28. s32 st_pad1[3];
  29. compat_ino_t st_ino;
  30. compat_mode_t st_mode;
  31. compat_nlink_t st_nlink;
  32. __compat_uid_t st_uid;
  33. __compat_gid_t st_gid;
  34. compat_dev_t st_rdev;
  35. s32 st_pad2[2];
  36. compat_off_t st_size;
  37. s32 st_pad3;
  38. old_time32_t st_atime;
  39. s32 st_atime_nsec;
  40. old_time32_t st_mtime;
  41. s32 st_mtime_nsec;
  42. old_time32_t st_ctime;
  43. s32 st_ctime_nsec;
  44. s32 st_blksize;
  45. s32 st_blocks;
  46. s32 st_pad4[14];
  47. };
  48. #define __ARCH_COMPAT_FLOCK_EXTRA_SYSID s32 l_sysid;
  49. #define __ARCH_COMPAT_FLOCK_PAD s32 pad[4];
  50. struct compat_statfs {
  51. int f_type;
  52. int f_bsize;
  53. int f_frsize;
  54. int f_blocks;
  55. int f_bfree;
  56. int f_files;
  57. int f_ffree;
  58. int f_bavail;
  59. compat_fsid_t f_fsid;
  60. int f_namelen;
  61. int f_flags;
  62. int f_spare[5];
  63. };
  64. struct compat_ipc64_perm {
  65. compat_key_t key;
  66. __compat_uid32_t uid;
  67. __compat_gid32_t gid;
  68. __compat_uid32_t cuid;
  69. __compat_gid32_t cgid;
  70. compat_mode_t mode;
  71. unsigned short seq;
  72. unsigned short __pad2;
  73. compat_ulong_t __unused1;
  74. compat_ulong_t __unused2;
  75. };
  76. struct compat_semid64_ds {
  77. struct compat_ipc64_perm sem_perm;
  78. compat_ulong_t sem_otime;
  79. compat_ulong_t sem_ctime;
  80. compat_ulong_t sem_nsems;
  81. compat_ulong_t sem_otime_high;
  82. compat_ulong_t sem_ctime_high;
  83. };
  84. struct compat_msqid64_ds {
  85. struct compat_ipc64_perm msg_perm;
  86. #ifndef CONFIG_CPU_LITTLE_ENDIAN
  87. compat_ulong_t msg_stime_high;
  88. #endif
  89. compat_ulong_t msg_stime;
  90. #ifdef CONFIG_CPU_LITTLE_ENDIAN
  91. compat_ulong_t msg_stime_high;
  92. #endif
  93. #ifndef CONFIG_CPU_LITTLE_ENDIAN
  94. compat_ulong_t msg_rtime_high;
  95. #endif
  96. compat_ulong_t msg_rtime;
  97. #ifdef CONFIG_CPU_LITTLE_ENDIAN
  98. compat_ulong_t msg_rtime_high;
  99. #endif
  100. #ifndef CONFIG_CPU_LITTLE_ENDIAN
  101. compat_ulong_t msg_ctime_high;
  102. #endif
  103. compat_ulong_t msg_ctime;
  104. #ifdef CONFIG_CPU_LITTLE_ENDIAN
  105. compat_ulong_t msg_ctime_high;
  106. #endif
  107. compat_ulong_t msg_cbytes;
  108. compat_ulong_t msg_qnum;
  109. compat_ulong_t msg_qbytes;
  110. compat_pid_t msg_lspid;
  111. compat_pid_t msg_lrpid;
  112. compat_ulong_t __unused4;
  113. compat_ulong_t __unused5;
  114. };
  115. struct compat_shmid64_ds {
  116. struct compat_ipc64_perm shm_perm;
  117. compat_size_t shm_segsz;
  118. compat_ulong_t shm_atime;
  119. compat_ulong_t shm_dtime;
  120. compat_ulong_t shm_ctime;
  121. compat_pid_t shm_cpid;
  122. compat_pid_t shm_lpid;
  123. compat_ulong_t shm_nattch;
  124. compat_ushort_t shm_atime_high;
  125. compat_ushort_t shm_dtime_high;
  126. compat_ushort_t shm_ctime_high;
  127. compat_ushort_t __unused2;
  128. };
  129. /* MIPS has unusual order of fields in stack_t */
  130. typedef struct compat_sigaltstack {
  131. compat_uptr_t ss_sp;
  132. compat_size_t ss_size;
  133. int ss_flags;
  134. } compat_stack_t;
  135. #define compat_sigaltstack compat_sigaltstack
  136. static inline int is_compat_task(void)
  137. {
  138. return test_thread_flag(TIF_32BIT_ADDR);
  139. }
  140. #endif /* _ASM_COMPAT_H */