| 1 | #ifndef _LINUX_COMPAT_H |
|---|
| 2 | #define _LINUX_COMPAT_H |
|---|
| 3 | /* |
|---|
| 4 | * These are the type definitions for the architecture specific |
|---|
| 5 | * syscall compatibility layer. |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | #ifdef CONFIG_COMPAT |
|---|
| 9 | |
|---|
| 10 | #include <linux/param.h> /* for HZ */ |
|---|
| 11 | #include <linux/sem.h> |
|---|
| 12 | |
|---|
| 13 | #include <asm/compat.h> |
|---|
| 14 | #include <asm/siginfo.h> |
|---|
| 15 | |
|---|
| 16 | #define compat_jiffies_to_clock_t(x) \ |
|---|
| 17 | (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) |
|---|
| 18 | |
|---|
| 19 | struct rusage; |
|---|
| 20 | |
|---|
| 21 | struct compat_itimerspec { |
|---|
| 22 | struct compat_timespec it_interval; |
|---|
| 23 | struct compat_timespec it_value; |
|---|
| 24 | }; |
|---|
| 25 | |
|---|
| 26 | struct compat_utimbuf { |
|---|
| 27 | compat_time_t actime; |
|---|
| 28 | compat_time_t modtime; |
|---|
| 29 | }; |
|---|
| 30 | |
|---|
| 31 | struct compat_itimerval { |
|---|
| 32 | struct compat_timeval it_interval; |
|---|
| 33 | struct compat_timeval it_value; |
|---|
| 34 | }; |
|---|
| 35 | |
|---|
| 36 | struct compat_tms { |
|---|
| 37 | compat_clock_t tms_utime; |
|---|
| 38 | compat_clock_t tms_stime; |
|---|
| 39 | compat_clock_t tms_cutime; |
|---|
| 40 | compat_clock_t tms_cstime; |
|---|
| 41 | }; |
|---|
| 42 | |
|---|
| 43 | #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) |
|---|
| 44 | |
|---|
| 45 | typedef struct { |
|---|
| 46 | compat_sigset_word sig[_COMPAT_NSIG_WORDS]; |
|---|
| 47 | } compat_sigset_t; |
|---|
| 48 | |
|---|
| 49 | extern int cp_compat_stat(struct kstat *, struct compat_stat *); |
|---|
| 50 | extern int get_compat_timespec(struct timespec *, const struct compat_timespec *); |
|---|
| 51 | extern int put_compat_timespec(const struct timespec *, struct compat_timespec *); |
|---|
| 52 | |
|---|
| 53 | struct compat_iovec { |
|---|
| 54 | compat_uptr_t iov_base; |
|---|
| 55 | compat_size_t iov_len; |
|---|
| 56 | }; |
|---|
| 57 | |
|---|
| 58 | struct compat_rlimit { |
|---|
| 59 | compat_ulong_t rlim_cur; |
|---|
| 60 | compat_ulong_t rlim_max; |
|---|
| 61 | }; |
|---|
| 62 | |
|---|
| 63 | struct compat_rusage { |
|---|
| 64 | struct compat_timeval ru_utime; |
|---|
| 65 | struct compat_timeval ru_stime; |
|---|
| 66 | compat_long_t ru_maxrss; |
|---|
| 67 | compat_long_t ru_ixrss; |
|---|
| 68 | compat_long_t ru_idrss; |
|---|
| 69 | compat_long_t ru_isrss; |
|---|
| 70 | compat_long_t ru_minflt; |
|---|
| 71 | compat_long_t ru_majflt; |
|---|
| 72 | compat_long_t ru_nswap; |
|---|
| 73 | compat_long_t ru_inblock; |
|---|
| 74 | compat_long_t ru_oublock; |
|---|
| 75 | compat_long_t ru_msgsnd; |
|---|
| 76 | compat_long_t ru_msgrcv; |
|---|
| 77 | compat_long_t ru_nsignals; |
|---|
| 78 | compat_long_t ru_nvcsw; |
|---|
| 79 | compat_long_t ru_nivcsw; |
|---|
| 80 | }; |
|---|
| 81 | |
|---|
| 82 | struct compat_siginfo; |
|---|
| 83 | |
|---|
| 84 | extern asmlinkage long compat_sys_waitid(int, compat_pid_t, |
|---|
| 85 | struct compat_siginfo *, int, |
|---|
| 86 | struct compat_rusage *); |
|---|
| 87 | |
|---|
| 88 | struct compat_dirent { |
|---|
| 89 | __u32 d_ino; |
|---|
| 90 | compat_off_t d_off; |
|---|
| 91 | __u16 d_reclen; |
|---|
| 92 | char d_name[256]; |
|---|
| 93 | }; |
|---|
| 94 | |
|---|
| 95 | typedef union compat_sigval { |
|---|
| 96 | compat_int_t sival_int; |
|---|
| 97 | compat_uptr_t sival_ptr; |
|---|
| 98 | } compat_sigval_t; |
|---|
| 99 | |
|---|
| 100 | #define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3) |
|---|
| 101 | |
|---|
| 102 | typedef struct compat_sigevent { |
|---|
| 103 | compat_sigval_t sigev_value; |
|---|
| 104 | compat_int_t sigev_signo; |
|---|
| 105 | compat_int_t sigev_notify; |
|---|
| 106 | union { |
|---|
| 107 | compat_int_t _pad[COMPAT_SIGEV_PAD_SIZE]; |
|---|
| 108 | compat_int_t _tid; |
|---|
| 109 | |
|---|
| 110 | struct { |
|---|
| 111 | compat_uptr_t _function; |
|---|
| 112 | compat_uptr_t _attribute; |
|---|
| 113 | } _sigev_thread; |
|---|
| 114 | } _sigev_un; |
|---|
| 115 | } compat_sigevent_t; |
|---|
| 116 | |
|---|
| 117 | |
|---|
| 118 | long compat_sys_semctl(int first, int second, int third, void *uptr); |
|---|
| 119 | long compat_sys_msgsnd(int first, int second, int third, void *uptr); |
|---|
| 120 | long compat_sys_msgrcv(int first, int second, int msgtyp, int third, |
|---|
| 121 | int version, void *uptr); |
|---|
| 122 | long compat_sys_msgctl(int first, int second, void *uptr); |
|---|
| 123 | long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, |
|---|
| 124 | void *uptr); |
|---|
| 125 | long compat_sys_shmctl(int first, int second, void *uptr); |
|---|
| 126 | long compat_sys_semtimedop(int semid, struct sembuf *tsems, |
|---|
| 127 | unsigned nsems, const struct compat_timespec *timeout); |
|---|
| 128 | #endif /* CONFIG_COMPAT */ |
|---|
| 129 | #endif /* _LINUX_COMPAT_H */ |
|---|