Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_COMPAT_H
0003 #define _ASM_COMPAT_H
0004 /*
0005  * Architecture specific compatibility types
0006  */
0007 #include <linux/thread_info.h>
0008 #include <linux/types.h>
0009 #include <asm/page.h>
0010 #include <asm/ptrace.h>
0011 
0012 #define __compat_uid_t  __compat_uid_t
0013 typedef s32     __compat_uid_t;
0014 typedef s32     __compat_gid_t;
0015 
0016 typedef __compat_uid_t  __compat_uid32_t;
0017 typedef __compat_gid_t  __compat_gid32_t;
0018 #define __compat_uid32_t __compat_uid32_t
0019 
0020 #define compat_statfs       compat_statfs
0021 #define compat_ipc64_perm   compat_ipc64_perm
0022 
0023 #define _COMPAT_NSIG        128     /* Don't ask !$@#% ...  */
0024 #define _COMPAT_NSIG_BPW    32
0025 typedef u32     compat_sigset_word;
0026 
0027 #define COMPAT_RLIM_INFINITY    0x7fffffffUL
0028 
0029 #include <asm-generic/compat.h>
0030 
0031 #define COMPAT_UTS_MACHINE  "mips\0\0\0"
0032 
0033 typedef u32     compat_nlink_t;
0034 
0035 struct compat_stat {
0036     compat_dev_t    st_dev;
0037     s32     st_pad1[3];
0038     compat_ino_t    st_ino;
0039     compat_mode_t   st_mode;
0040     compat_nlink_t  st_nlink;
0041     __compat_uid_t  st_uid;
0042     __compat_gid_t  st_gid;
0043     compat_dev_t    st_rdev;
0044     s32     st_pad2[2];
0045     compat_off_t    st_size;
0046     s32     st_pad3;
0047     old_time32_t    st_atime;
0048     s32     st_atime_nsec;
0049     old_time32_t    st_mtime;
0050     s32     st_mtime_nsec;
0051     old_time32_t    st_ctime;
0052     s32     st_ctime_nsec;
0053     s32     st_blksize;
0054     s32     st_blocks;
0055     s32     st_pad4[14];
0056 };
0057 
0058 #define __ARCH_COMPAT_FLOCK_EXTRA_SYSID     s32 l_sysid;
0059 #define __ARCH_COMPAT_FLOCK_PAD         s32 pad[4];
0060 
0061 struct compat_statfs {
0062     int     f_type;
0063     int     f_bsize;
0064     int     f_frsize;
0065     int     f_blocks;
0066     int     f_bfree;
0067     int     f_files;
0068     int     f_ffree;
0069     int     f_bavail;
0070     compat_fsid_t   f_fsid;
0071     int     f_namelen;
0072     int     f_flags;
0073     int     f_spare[5];
0074 };
0075 
0076 struct compat_ipc64_perm {
0077     compat_key_t key;
0078     __compat_uid32_t uid;
0079     __compat_gid32_t gid;
0080     __compat_uid32_t cuid;
0081     __compat_gid32_t cgid;
0082     compat_mode_t mode;
0083     unsigned short seq;
0084     unsigned short __pad2;
0085     compat_ulong_t __unused1;
0086     compat_ulong_t __unused2;
0087 };
0088 
0089 struct compat_semid64_ds {
0090     struct compat_ipc64_perm sem_perm;
0091     compat_ulong_t  sem_otime;
0092     compat_ulong_t  sem_ctime;
0093     compat_ulong_t  sem_nsems;
0094     compat_ulong_t  sem_otime_high;
0095     compat_ulong_t  sem_ctime_high;
0096 };
0097 
0098 struct compat_msqid64_ds {
0099     struct compat_ipc64_perm msg_perm;
0100 #ifndef CONFIG_CPU_LITTLE_ENDIAN
0101     compat_ulong_t  msg_stime_high;
0102 #endif
0103     compat_ulong_t  msg_stime;
0104 #ifdef CONFIG_CPU_LITTLE_ENDIAN
0105     compat_ulong_t  msg_stime_high;
0106 #endif
0107 #ifndef CONFIG_CPU_LITTLE_ENDIAN
0108     compat_ulong_t  msg_rtime_high;
0109 #endif
0110     compat_ulong_t  msg_rtime;
0111 #ifdef CONFIG_CPU_LITTLE_ENDIAN
0112     compat_ulong_t  msg_rtime_high;
0113 #endif
0114 #ifndef CONFIG_CPU_LITTLE_ENDIAN
0115     compat_ulong_t  msg_ctime_high;
0116 #endif
0117     compat_ulong_t  msg_ctime;
0118 #ifdef CONFIG_CPU_LITTLE_ENDIAN
0119     compat_ulong_t  msg_ctime_high;
0120 #endif
0121     compat_ulong_t  msg_cbytes;
0122     compat_ulong_t  msg_qnum;
0123     compat_ulong_t  msg_qbytes;
0124     compat_pid_t    msg_lspid;
0125     compat_pid_t    msg_lrpid;
0126     compat_ulong_t  __unused4;
0127     compat_ulong_t  __unused5;
0128 };
0129 
0130 struct compat_shmid64_ds {
0131     struct compat_ipc64_perm shm_perm;
0132     compat_size_t   shm_segsz;
0133     compat_ulong_t  shm_atime;
0134     compat_ulong_t  shm_dtime;
0135     compat_ulong_t  shm_ctime;
0136     compat_pid_t    shm_cpid;
0137     compat_pid_t    shm_lpid;
0138     compat_ulong_t  shm_nattch;
0139     compat_ushort_t shm_atime_high;
0140     compat_ushort_t shm_dtime_high;
0141     compat_ushort_t shm_ctime_high;
0142     compat_ushort_t __unused2;
0143 };
0144 
0145 /* MIPS has unusual order of fields in stack_t */
0146 typedef struct compat_sigaltstack {
0147     compat_uptr_t           ss_sp;
0148     compat_size_t           ss_size;
0149     int             ss_flags;
0150 } compat_stack_t;
0151 #define compat_sigaltstack compat_sigaltstack
0152 
0153 static inline int is_compat_task(void)
0154 {
0155     return test_thread_flag(TIF_32BIT_ADDR);
0156 }
0157 
0158 #endif /* _ASM_COMPAT_H */