1 /* SPDX-License-Identifier: GPL-2.0 */ !! 1 #ifndef _ASM_COMPAT_H 2 #ifndef __ASM_GENERIC_COMPAT_H !! 2 #define _ASM_COMPAT_H 3 #define __ASM_GENERIC_COMPAT_H !! 3 /* 4 !! 4 * Architecture specific compatibility types 5 #ifndef COMPAT_USER_HZ !! 5 */ 6 #define COMPAT_USER_HZ 100 !! 6 #include <linux/types.h> 7 #endif !! 7 #include <asm/page.h> 8 !! 8 9 #ifndef COMPAT_RLIM_INFINITY !! 9 #define COMPAT_USER_HZ 100 10 #define COMPAT_RLIM_INFINITY 0xffffffff !! 10 11 #endif !! 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 >> 17 typedef s32 compat_pid_t; >> 18 typedef s32 compat_uid_t; >> 19 typedef s32 compat_gid_t; >> 20 typedef u32 compat_mode_t; >> 21 typedef u32 compat_ino_t; >> 22 typedef u32 compat_dev_t; >> 23 typedef s32 compat_off_t; >> 24 typedef s64 compat_loff_t; >> 25 typedef u32 compat_nlink_t; >> 26 typedef s32 compat_ipc_pid_t; >> 27 typedef s32 compat_daddr_t; >> 28 typedef s32 compat_caddr_t; >> 29 typedef struct { >> 30 s32 val[2]; >> 31 } compat_fsid_t; >> 32 >> 33 typedef s32 compat_int_t; >> 34 typedef s32 compat_long_t; >> 35 typedef u32 compat_uint_t; >> 36 typedef u32 compat_ulong_t; >> 37 >> 38 struct compat_timespec { >> 39 compat_time_t tv_sec; >> 40 s32 tv_nsec; >> 41 }; 12 42 13 #ifndef COMPAT_OFF_T_MAX !! 43 struct compat_timeval { 14 #define COMPAT_OFF_T_MAX 0x7fffffff !! 44 compat_time_t tv_sec; 15 #endif !! 45 s32 tv_usec; >> 46 }; >> 47 >> 48 struct compat_stat { >> 49 compat_dev_t st_dev; >> 50 s32 st_pad1[3]; >> 51 compat_ino_t st_ino; >> 52 compat_mode_t st_mode; >> 53 compat_nlink_t st_nlink; >> 54 compat_uid_t st_uid; >> 55 compat_gid_t st_gid; >> 56 compat_dev_t st_rdev; >> 57 s32 st_pad2[2]; >> 58 compat_off_t st_size; >> 59 s32 st_pad3; >> 60 compat_time_t st_atime; >> 61 s32 st_atime_nsec; >> 62 compat_time_t st_mtime; >> 63 s32 st_mtime_nsec; >> 64 compat_time_t st_ctime; >> 65 s32 st_ctime_nsec; >> 66 s32 st_blksize; >> 67 s32 st_blocks; >> 68 s32 st_pad4[14]; >> 69 }; >> 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 }; 16 81 17 #ifndef compat_arg_u64 !! 82 #define F_GETLK64 33 18 #ifndef CONFIG_CPU_BIG_ENDIAN !! 83 #define F_SETLK64 34 19 #define compat_arg_u64(name) u32 n !! 84 #define F_SETLKW64 35 20 #define compat_arg_u64_dual(name) u32, n !! 85 21 #else !! 86 struct compat_flock64 { 22 #define compat_arg_u64(name) u32 n !! 87 short l_type; 23 #define compat_arg_u64_dual(name) u32, n !! 88 short l_whence; 24 #endif !! 89 compat_loff_t l_start; 25 #define compat_arg_u64_glue(name) (((u64 !! 90 compat_loff_t l_len; 26 ((u64 !! 91 compat_pid_t l_pid; 27 #endif /* compat_arg_u64 */ !! 92 }; 28 << 29 /* These types are common across all compat AB << 30 typedef u32 compat_size_t; << 31 typedef s32 compat_ssize_t; << 32 typedef s32 compat_clock_t; << 33 typedef s32 compat_pid_t; << 34 typedef u32 compat_ino_t; << 35 typedef s32 compat_off_t; << 36 typedef s64 compat_loff_t; << 37 typedef s32 compat_daddr_t; << 38 typedef s32 compat_timer_t; << 39 typedef s32 compat_key_t; << 40 typedef s16 compat_short_t; << 41 typedef s32 compat_int_t; << 42 typedef s32 compat_long_t; << 43 typedef u16 compat_ushort_t; << 44 typedef u32 compat_uint_t; << 45 typedef u32 compat_ulong_t; << 46 typedef u32 compat_uptr_t; << 47 typedef u32 compat_caddr_t; << 48 typedef u32 compat_aio_context_t; << 49 typedef u32 compat_old_sigset_t; << 50 << 51 #ifndef __compat_uid_t << 52 typedef u32 __compat_uid_t; << 53 typedef u32 __compat_gid_t; << 54 #endif << 55 << 56 #ifndef __compat_uid32_t << 57 typedef u32 __compat_uid32_t; << 58 typedef u32 __compat_gid32_t; << 59 #endif << 60 << 61 #ifndef compat_mode_t << 62 typedef u32 compat_mode_t; << 63 #endif << 64 << 65 #ifdef CONFIG_COMPAT_FOR_U64_ALIGNMENT << 66 typedef s64 __attribute__((aligned(4))) compat << 67 typedef u64 __attribute__((aligned(4))) compat << 68 #else << 69 typedef s64 compat_s64; << 70 typedef u64 compat_u64; << 71 #endif << 72 << 73 #ifndef _COMPAT_NSIG << 74 typedef u32 compat_sigset_word; << 75 #define _COMPAT_NSIG _NSIG << 76 #define _COMPAT_NSIG_BPW 32 << 77 #endif << 78 << 79 #ifndef compat_dev_t << 80 typedef u32 compat_dev_t; << 81 #endif << 82 << 83 #ifndef compat_ipc_pid_t << 84 typedef s32 compat_ipc_pid_t; << 85 #endif << 86 << 87 #ifndef compat_fsid_t << 88 typedef __kernel_fsid_t compat_fsid_t; << 89 #endif << 90 93 91 #ifndef compat_statfs << 92 struct compat_statfs { 94 struct compat_statfs { 93 compat_int_t f_type; !! 95 int f_type; 94 compat_int_t f_bsize; !! 96 int f_bsize; 95 compat_int_t f_blocks; !! 97 int f_frsize; 96 compat_int_t f_bfree; !! 98 int f_blocks; 97 compat_int_t f_bavail; !! 99 int f_bfree; 98 compat_int_t f_files; !! 100 int f_files; 99 compat_int_t f_ffree; !! 101 int f_ffree; >> 102 int f_bavail; 100 compat_fsid_t f_fsid; 103 compat_fsid_t f_fsid; 101 compat_int_t f_namelen; !! 104 int f_namelen; 102 compat_int_t f_frsize; !! 105 int f_spare[6]; 103 compat_int_t f_flags; << 104 compat_int_t f_spare[4]; << 105 }; << 106 #endif << 107 << 108 #ifndef compat_ipc64_perm << 109 struct compat_ipc64_perm { << 110 compat_key_t key; << 111 __compat_uid32_t uid; << 112 __compat_gid32_t gid; << 113 __compat_uid32_t cuid; << 114 __compat_gid32_t cgid; << 115 compat_mode_t mode; << 116 unsigned char __pad1[4 - sizeof(comp << 117 compat_ushort_t seq; << 118 compat_ushort_t __pad2; << 119 compat_ulong_t unused1; << 120 compat_ulong_t unused2; << 121 }; << 122 << 123 struct compat_semid64_ds { << 124 struct compat_ipc64_perm sem_perm; << 125 compat_ulong_t sem_otime; << 126 compat_ulong_t sem_otime_high; << 127 compat_ulong_t sem_ctime; << 128 compat_ulong_t sem_ctime_high; << 129 compat_ulong_t sem_nsems; << 130 compat_ulong_t __unused3; << 131 compat_ulong_t __unused4; << 132 }; << 133 << 134 struct compat_msqid64_ds { << 135 struct compat_ipc64_perm msg_perm; << 136 compat_ulong_t msg_stime; << 137 compat_ulong_t msg_stime_high; << 138 compat_ulong_t msg_rtime; << 139 compat_ulong_t msg_rtime_high; << 140 compat_ulong_t msg_ctime; << 141 compat_ulong_t msg_ctime_high; << 142 compat_ulong_t msg_cbytes; << 143 compat_ulong_t msg_qnum; << 144 compat_ulong_t msg_qbytes; << 145 compat_pid_t msg_lspid; << 146 compat_pid_t msg_lrpid; << 147 compat_ulong_t __unused4; << 148 compat_ulong_t __unused5; << 149 }; << 150 << 151 struct compat_shmid64_ds { << 152 struct compat_ipc64_perm shm_perm; << 153 compat_size_t shm_segsz; << 154 compat_ulong_t shm_atime; << 155 compat_ulong_t shm_atime_high; << 156 compat_ulong_t shm_dtime; << 157 compat_ulong_t shm_dtime_high; << 158 compat_ulong_t shm_ctime; << 159 compat_ulong_t shm_ctime_high; << 160 compat_pid_t shm_cpid; << 161 compat_pid_t shm_lpid; << 162 compat_ulong_t shm_nattch; << 163 compat_ulong_t __unused4; << 164 compat_ulong_t __unused5; << 165 }; 106 }; 166 #endif << 167 107 168 #endif !! 108 #define COMPAT_RLIM_INFINITY 0x7fffffffUL >> 109 >> 110 typedef u32 compat_old_sigset_t; /* at least 32 bits */ >> 111 >> 112 #define _COMPAT_NSIG 128 /* Don't ask !$@#% ... */ >> 113 #define _COMPAT_NSIG_BPW 32 >> 114 >> 115 typedef u32 compat_sigset_word; >> 116 >> 117 #define COMPAT_OFF_T_MAX 0x7fffffff >> 118 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL >> 119 >> 120 /* >> 121 * A pointer passed in from user mode. This should not >> 122 * be used for syscall parameters, just declare them >> 123 * as pointers because the syscall entry code will have >> 124 * appropriately comverted them already. >> 125 */ >> 126 typedef u32 compat_uptr_t; >> 127 >> 128 static inline void *compat_ptr(compat_uptr_t uptr) >> 129 { >> 130 return (void *)(long)uptr; >> 131 } >> 132 >> 133 static inline void *compat_alloc_user_space(long len) >> 134 { >> 135 unsigned long sp = (unsigned long) current_thread_info() + >> 136 THREAD_SIZE - 32; >> 137 >> 138 return (void *) (sp - len); >> 139 } >> 140 >> 141 #endif /* _ASM_COMPAT_H */ 169 142
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.