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)
21 struct compat_itimerspec
{
22 struct compat_timespec it_interval
;
23 struct compat_timespec it_value
;
26 struct compat_utimbuf
{
28 compat_time_t modtime
;
31 struct compat_itimerval
{
32 struct compat_timeval it_interval
;
33 struct compat_timeval it_value
;
37 compat_clock_t tms_utime
;
38 compat_clock_t tms_stime
;
39 compat_clock_t tms_cutime
;
40 compat_clock_t tms_cstime
;
43 #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
46 compat_sigset_word sig
[_COMPAT_NSIG_WORDS
];
49 extern int cp_compat_stat(struct kstat
*, struct compat_stat __user
*);
50 extern int get_compat_timespec(struct timespec
*, const struct compat_timespec __user
*);
51 extern int put_compat_timespec(const struct timespec
*, struct compat_timespec __user
*);
54 compat_uptr_t iov_base
;
55 compat_size_t iov_len
;
58 struct compat_rlimit
{
59 compat_ulong_t rlim_cur
;
60 compat_ulong_t rlim_max
;
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
;
82 extern int put_compat_rusage(const struct rusage
*, struct compat_rusage __user
*);
84 struct compat_dirent
{
91 typedef union compat_sigval
{
92 compat_int_t sival_int
;
93 compat_uptr_t sival_ptr
;
96 typedef struct compat_sigevent
{
97 compat_sigval_t sigev_value
;
98 compat_int_t sigev_signo
;
99 compat_int_t sigev_notify
;
101 compat_int_t _pad
[SIGEV_PAD_SIZE
];
105 compat_uptr_t _function
;
106 compat_uptr_t _attribute
;
112 long compat_sys_semctl(int first
, int second
, int third
, void __user
*uptr
);
113 long compat_sys_msgsnd(int first
, int second
, int third
, void __user
*uptr
);
114 long compat_sys_msgrcv(int first
, int second
, int msgtyp
, int third
,
115 int version
, void __user
*uptr
);
116 long compat_sys_msgctl(int first
, int second
, void __user
*uptr
);
117 long compat_sys_shmat(int first
, int second
, compat_uptr_t third
, int version
,
119 long compat_sys_shmctl(int first
, int second
, void __user
*uptr
);
120 long compat_sys_semtimedop(int semid
, struct sembuf __user
*tsems
,
121 unsigned nsems
, const struct compat_timespec __user
*timeout
);
123 asmlinkage ssize_t
compat_sys_readv(unsigned long fd
,
124 const struct compat_iovec __user
*vec
, unsigned long vlen
);
125 asmlinkage ssize_t
compat_sys_writev(unsigned long fd
,
126 const struct compat_iovec __user
*vec
, unsigned long vlen
);
128 int compat_do_execve(char * filename
, compat_uptr_t __user
*argv
,
129 compat_uptr_t __user
*envp
, struct pt_regs
* regs
);
131 asmlinkage
long compat_sys_select(int n
, compat_ulong_t __user
*inp
,
132 compat_ulong_t __user
*outp
, compat_ulong_t __user
*exp
,
133 struct compat_timeval __user
*tvp
);
135 #define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t))
137 #define BITS_TO_COMPAT_LONGS(bits) \
138 (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG)
140 long compat_get_bitmap(unsigned long *mask
, compat_ulong_t __user
*umask
,
141 unsigned long bitmap_size
);
142 long compat_put_bitmap(compat_ulong_t __user
*umask
, unsigned long *mask
,
143 unsigned long bitmap_size
);
145 #endif /* CONFIG_COMPAT */
146 #endif /* _LINUX_COMPAT_H */