compat.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_GENERIC_COMPAT_H
  3. #define __ASM_GENERIC_COMPAT_H
  4. #ifndef COMPAT_USER_HZ
  5. #define COMPAT_USER_HZ 100
  6. #endif
  7. #ifndef COMPAT_RLIM_INFINITY
  8. #define COMPAT_RLIM_INFINITY 0xffffffff
  9. #endif
  10. #ifndef COMPAT_OFF_T_MAX
  11. #define COMPAT_OFF_T_MAX 0x7fffffff
  12. #endif
  13. #ifndef compat_arg_u64
  14. #ifndef CONFIG_CPU_BIG_ENDIAN
  15. #define compat_arg_u64(name) u32 name##_lo, u32 name##_hi
  16. #define compat_arg_u64_dual(name) u32, name##_lo, u32, name##_hi
  17. #else
  18. #define compat_arg_u64(name) u32 name##_hi, u32 name##_lo
  19. #define compat_arg_u64_dual(name) u32, name##_hi, u32, name##_lo
  20. #endif
  21. #define compat_arg_u64_glue(name) (((u64)name##_lo & 0xffffffffUL) | \
  22. ((u64)name##_hi << 32))
  23. #endif /* compat_arg_u64 */
  24. /* These types are common across all compat ABIs */
  25. typedef u32 compat_size_t;
  26. typedef s32 compat_ssize_t;
  27. typedef s32 compat_clock_t;
  28. typedef s32 compat_pid_t;
  29. typedef u32 compat_ino_t;
  30. typedef s32 compat_off_t;
  31. typedef s64 compat_loff_t;
  32. typedef s32 compat_daddr_t;
  33. typedef s32 compat_timer_t;
  34. typedef s32 compat_key_t;
  35. typedef s16 compat_short_t;
  36. typedef s32 compat_int_t;
  37. typedef s32 compat_long_t;
  38. typedef u16 compat_ushort_t;
  39. typedef u32 compat_uint_t;
  40. typedef u32 compat_ulong_t;
  41. typedef u32 compat_uptr_t;
  42. typedef u32 compat_caddr_t;
  43. typedef u32 compat_aio_context_t;
  44. typedef u32 compat_old_sigset_t;
  45. #ifndef __compat_uid_t
  46. typedef u32 __compat_uid_t;
  47. typedef u32 __compat_gid_t;
  48. #endif
  49. #ifndef __compat_uid32_t
  50. typedef u32 __compat_uid32_t;
  51. typedef u32 __compat_gid32_t;
  52. #endif
  53. #ifndef compat_mode_t
  54. typedef u32 compat_mode_t;
  55. #endif
  56. #ifdef CONFIG_COMPAT_FOR_U64_ALIGNMENT
  57. typedef s64 __attribute__((aligned(4))) compat_s64;
  58. typedef u64 __attribute__((aligned(4))) compat_u64;
  59. #else
  60. typedef s64 compat_s64;
  61. typedef u64 compat_u64;
  62. #endif
  63. #ifndef _COMPAT_NSIG
  64. typedef u32 compat_sigset_word;
  65. #define _COMPAT_NSIG _NSIG
  66. #define _COMPAT_NSIG_BPW 32
  67. #endif
  68. #ifndef compat_dev_t
  69. typedef u32 compat_dev_t;
  70. #endif
  71. #ifndef compat_ipc_pid_t
  72. typedef s32 compat_ipc_pid_t;
  73. #endif
  74. #ifndef compat_fsid_t
  75. typedef __kernel_fsid_t compat_fsid_t;
  76. #endif
  77. #ifndef compat_statfs
  78. struct compat_statfs {
  79. compat_int_t f_type;
  80. compat_int_t f_bsize;
  81. compat_int_t f_blocks;
  82. compat_int_t f_bfree;
  83. compat_int_t f_bavail;
  84. compat_int_t f_files;
  85. compat_int_t f_ffree;
  86. compat_fsid_t f_fsid;
  87. compat_int_t f_namelen;
  88. compat_int_t f_frsize;
  89. compat_int_t f_flags;
  90. compat_int_t f_spare[4];
  91. };
  92. #endif
  93. #ifndef compat_ipc64_perm
  94. struct compat_ipc64_perm {
  95. compat_key_t key;
  96. __compat_uid32_t uid;
  97. __compat_gid32_t gid;
  98. __compat_uid32_t cuid;
  99. __compat_gid32_t cgid;
  100. compat_mode_t mode;
  101. unsigned char __pad1[4 - sizeof(compat_mode_t)];
  102. compat_ushort_t seq;
  103. compat_ushort_t __pad2;
  104. compat_ulong_t unused1;
  105. compat_ulong_t unused2;
  106. };
  107. struct compat_semid64_ds {
  108. struct compat_ipc64_perm sem_perm;
  109. compat_ulong_t sem_otime;
  110. compat_ulong_t sem_otime_high;
  111. compat_ulong_t sem_ctime;
  112. compat_ulong_t sem_ctime_high;
  113. compat_ulong_t sem_nsems;
  114. compat_ulong_t __unused3;
  115. compat_ulong_t __unused4;
  116. };
  117. struct compat_msqid64_ds {
  118. struct compat_ipc64_perm msg_perm;
  119. compat_ulong_t msg_stime;
  120. compat_ulong_t msg_stime_high;
  121. compat_ulong_t msg_rtime;
  122. compat_ulong_t msg_rtime_high;
  123. compat_ulong_t msg_ctime;
  124. compat_ulong_t msg_ctime_high;
  125. compat_ulong_t msg_cbytes;
  126. compat_ulong_t msg_qnum;
  127. compat_ulong_t msg_qbytes;
  128. compat_pid_t msg_lspid;
  129. compat_pid_t msg_lrpid;
  130. compat_ulong_t __unused4;
  131. compat_ulong_t __unused5;
  132. };
  133. struct compat_shmid64_ds {
  134. struct compat_ipc64_perm shm_perm;
  135. compat_size_t shm_segsz;
  136. compat_ulong_t shm_atime;
  137. compat_ulong_t shm_atime_high;
  138. compat_ulong_t shm_dtime;
  139. compat_ulong_t shm_dtime_high;
  140. compat_ulong_t shm_ctime;
  141. compat_ulong_t shm_ctime_high;
  142. compat_pid_t shm_cpid;
  143. compat_pid_t shm_lpid;
  144. compat_ulong_t shm_nattch;
  145. compat_ulong_t __unused4;
  146. compat_ulong_t __unused5;
  147. };
  148. #endif
  149. #endif