aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compat.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/compat.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/linux/compat.h')
-rw-r--r--include/linux/compat.h162
1 files changed, 162 insertions, 0 deletions
diff --git a/include/linux/compat.h b/include/linux/compat.h
new file mode 100644
index 000000000000..b58b7d6f2fdb
--- /dev/null
+++ b/include/linux/compat.h
@@ -0,0 +1,162 @@
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#include <linux/config.h>
8
9#ifdef CONFIG_COMPAT
10
11#include <linux/stat.h>
12#include <linux/param.h> /* for HZ */
13#include <linux/sem.h>
14
15#include <asm/compat.h>
16#include <asm/siginfo.h>
17
18#define compat_jiffies_to_clock_t(x) \
19 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
20
21struct rusage;
22
23struct compat_itimerspec {
24 struct compat_timespec it_interval;
25 struct compat_timespec it_value;
26};
27
28struct compat_utimbuf {
29 compat_time_t actime;
30 compat_time_t modtime;
31};
32
33struct compat_itimerval {
34 struct compat_timeval it_interval;
35 struct compat_timeval it_value;
36};
37
38struct compat_tms {
39 compat_clock_t tms_utime;
40 compat_clock_t tms_stime;
41 compat_clock_t tms_cutime;
42 compat_clock_t tms_cstime;
43};
44
45#define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
46
47typedef struct {
48 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
49} compat_sigset_t;
50
51extern int cp_compat_stat(struct kstat *, struct compat_stat __user *);
52extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *);
53extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *);
54
55struct compat_iovec {
56 compat_uptr_t iov_base;
57 compat_size_t iov_len;
58};
59
60struct compat_rlimit {
61 compat_ulong_t rlim_cur;
62 compat_ulong_t rlim_max;
63};
64
65struct 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;
82};
83
84extern int put_compat_rusage(const struct rusage *, struct compat_rusage __user *);
85
86struct compat_siginfo;
87
88extern asmlinkage long compat_sys_waitid(int, compat_pid_t,
89 struct compat_siginfo __user *, int,
90 struct compat_rusage __user *);
91
92struct compat_dirent {
93 u32 d_ino;
94 compat_off_t d_off;
95 u16 d_reclen;
96 char d_name[256];
97};
98
99typedef union compat_sigval {
100 compat_int_t sival_int;
101 compat_uptr_t sival_ptr;
102} compat_sigval_t;
103
104#define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
105
106typedef struct compat_sigevent {
107 compat_sigval_t sigev_value;
108 compat_int_t sigev_signo;
109 compat_int_t sigev_notify;
110 union {
111 compat_int_t _pad[COMPAT_SIGEV_PAD_SIZE];
112 compat_int_t _tid;
113
114 struct {
115 compat_uptr_t _function;
116 compat_uptr_t _attribute;
117 } _sigev_thread;
118 } _sigev_un;
119} compat_sigevent_t;
120
121
122long compat_sys_semctl(int first, int second, int third, void __user *uptr);
123long compat_sys_msgsnd(int first, int second, int third, void __user *uptr);
124long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
125 int version, void __user *uptr);
126long compat_sys_msgctl(int first, int second, void __user *uptr);
127long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
128 void __user *uptr);
129long compat_sys_shmctl(int first, int second, void __user *uptr);
130long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
131 unsigned nsems, const struct compat_timespec __user *timeout);
132asmlinkage long compat_sys_keyctl(u32 option,
133 u32 arg2, u32 arg3, u32 arg4, u32 arg5);
134
135asmlinkage ssize_t compat_sys_readv(unsigned long fd,
136 const struct compat_iovec __user *vec, unsigned long vlen);
137asmlinkage ssize_t compat_sys_writev(unsigned long fd,
138 const struct compat_iovec __user *vec, unsigned long vlen);
139
140int compat_do_execve(char * filename, compat_uptr_t __user *argv,
141 compat_uptr_t __user *envp, struct pt_regs * regs);
142
143asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
144 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
145 struct compat_timeval __user *tvp);
146
147#define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t))
148
149#define BITS_TO_COMPAT_LONGS(bits) \
150 (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG)
151
152long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask,
153 unsigned long bitmap_size);
154long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
155 unsigned long bitmap_size);
156int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from);
157int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from);
158int get_compat_sigevent(struct sigevent *event,
159 const struct compat_sigevent __user *u_event);
160
161#endif /* CONFIG_COMPAT */
162#endif /* _LINUX_COMPAT_H */