1 #ifndef _LINUX_COMPAT_H
2 #define _LINUX_COMPAT_H
4 * These are the type definitions for the architecture specific
5 * syscall compatibility layer.
7 #include <linux/config.h>
11 #include <linux/stat.h>
12 #include <linux/param.h> /* for HZ */
13 #include <linux/sem.h>
15 #include <asm/compat.h>
16 #include <asm/siginfo.h>
18 #define compat_jiffies_to_clock_t(x) \
19 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
23 struct compat_itimerspec {
24 struct compat_timespec it_interval;
25 struct compat_timespec it_value;
28 struct compat_utimbuf {
30 compat_time_t modtime;
33 struct compat_itimerval {
34 struct compat_timeval it_interval;
35 struct compat_timeval it_value;
39 compat_clock_t tms_utime;
40 compat_clock_t tms_stime;
41 compat_clock_t tms_cutime;
42 compat_clock_t tms_cstime;
45 #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
48 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
51 extern int cp_compat_stat(struct kstat *, struct compat_stat __user *);
52 extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *);
53 extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *);
56 compat_uptr_t iov_base;
57 compat_size_t iov_len;
60 struct compat_rlimit {
61 compat_ulong_t rlim_cur;
62 compat_ulong_t rlim_max;
65 struct compat_rusage {
66 struct compat_timeval ru_utime;
67 struct compat_timeval ru_stime;
68 compat_long_t ru_maxrss;
69 compat_long_t ru_ixrss;
70 compat_long_t ru_idrss;
71 compat_long_t ru_isrss;
72 compat_long_t ru_minflt;
73 compat_long_t ru_majflt;
74 compat_long_t ru_nswap;
75 compat_long_t ru_inblock;
76 compat_long_t ru_oublock;
77 compat_long_t ru_msgsnd;
78 compat_long_t ru_msgrcv;
79 compat_long_t ru_nsignals;
80 compat_long_t ru_nvcsw;
81 compat_long_t ru_nivcsw;
84 extern int put_compat_rusage(const struct rusage *, struct compat_rusage __user *);
86 struct compat_dirent {
93 typedef union compat_sigval {
94 compat_int_t sival_int;
95 compat_uptr_t sival_ptr;
98 typedef struct compat_sigevent {
99 compat_sigval_t sigev_value;
100 compat_int_t sigev_signo;
101 compat_int_t sigev_notify;
103 compat_int_t _pad[SIGEV_PAD_SIZE];
107 compat_uptr_t _function;
108 compat_uptr_t _attribute;
114 long compat_sys_semctl(int first, int second, int third, void __user *uptr);
115 long compat_sys_msgsnd(int first, int second, int third, void __user *uptr);
116 long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
117 int version, void __user *uptr);
118 long compat_sys_msgctl(int first, int second, void __user *uptr);
119 long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
121 long compat_sys_shmctl(int first, int second, void __user *uptr);
122 long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
123 unsigned nsems, const struct compat_timespec __user *timeout);
124 asmlinkage long compat_sys_keyctl(u32 option,
125 u32 arg2, u32 arg3, u32 arg4, u32 arg5);
127 asmlinkage ssize_t compat_sys_readv(unsigned long fd,
128 const struct compat_iovec __user *vec, unsigned long vlen);
129 asmlinkage ssize_t compat_sys_writev(unsigned long fd,
130 const struct compat_iovec __user *vec, unsigned long vlen);
132 int compat_do_execve(char * filename, compat_uptr_t __user *argv,
133 compat_uptr_t __user *envp, struct pt_regs * regs);
135 asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
136 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
137 struct compat_timeval __user *tvp);
139 #define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t))
141 #define BITS_TO_COMPAT_LONGS(bits) \
142 (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG)
144 long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask,
145 unsigned long bitmap_size);
146 long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
147 unsigned long bitmap_size);
148 struct compat_siginfo;
149 int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from);
150 int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from);
151 #endif /* CONFIG_COMPAT */
152 #endif /* _LINUX_COMPAT_H */