Xenomai  3.0-rc3
compat.h
1 /*
2  * Copyright (C) 2014 Philippe Gerum <rpm@xenomai.org>
3  *
4  * Xenomai is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * Xenomai is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18 #ifndef _COBALT_KERNEL_COMPAT_H
19 #define _COBALT_KERNEL_COMPAT_H
20 
21 #ifdef CONFIG_XENO_ARCH_SYS3264
22 
23 #include <linux/compat.h>
24 #include <net/compat.h>
25 #include <cobalt/uapi/sched.h>
26 
27 struct mq_attr;
28 
29 struct __compat_sched_ss_param {
30  int __sched_low_priority;
31  struct compat_timespec __sched_repl_period;
32  struct compat_timespec __sched_init_budget;
33  int __sched_max_repl;
34 };
35 
36 struct __compat_sched_rr_param {
37  struct compat_timespec __sched_rr_quantum;
38 };
39 
40 struct compat_sched_param_ex {
41  int sched_priority;
42  union {
43  struct __compat_sched_ss_param ss;
44  struct __compat_sched_rr_param rr;
45  struct __sched_tp_param tp;
46  struct __sched_quota_param quota;
47  } sched_u;
48 };
49 
50 struct compat_mq_attr {
51  compat_long_t mq_flags;
52  compat_long_t mq_maxmsg;
53  compat_long_t mq_msgsize;
54  compat_long_t mq_curmsgs;
55 };
56 
57 struct compat_sched_tp_window {
58  struct compat_timespec offset;
59  struct compat_timespec duration;
60  int ptid;
61 };
62 
63 struct __compat_sched_config_tp {
64  int nr_windows;
65  struct compat_sched_tp_window windows[0];
66 };
67 
68 union compat_sched_config {
69  struct __compat_sched_config_tp tp;
70  struct __sched_config_quota quota;
71 };
72 
73 #define compat_sched_tp_confsz(nr_win) \
74  (sizeof(struct __compat_sched_config_tp) + nr_win * sizeof(struct compat_sched_tp_window))
75 
76 typedef struct {
77  compat_ulong_t fds_bits[__FD_SETSIZE / (8 * sizeof(compat_long_t))];
78 } compat_fd_set;
79 
80 struct compat_rtdm_mmap_request {
81  compat_size_t length;
82  compat_off_t offset;
83  int prot;
84  int flags;
85 };
86 
87 int sys32_get_timespec(struct timespec *ts,
88  const struct compat_timespec __user *cts);
89 
90 int sys32_put_timespec(struct compat_timespec __user *cts,
91  const struct timespec *ts);
92 
93 int sys32_get_itimerspec(struct itimerspec *its,
94  const struct compat_itimerspec __user *cits);
95 
96 int sys32_put_itimerspec(struct compat_itimerspec __user *cits,
97  const struct itimerspec *its);
98 
99 int sys32_get_timeval(struct timeval *tv,
100  const struct compat_timeval __user *ctv);
101 
102 int sys32_put_timeval(struct compat_timeval __user *ctv,
103  const struct timeval *tv);
104 
105 ssize_t sys32_get_fdset(fd_set *fds, const compat_fd_set __user *cfds,
106  size_t cfdsize);
107 
108 ssize_t sys32_put_fdset(compat_fd_set __user *cfds, const fd_set *fds,
109  size_t fdsize);
110 
111 int sys32_get_param_ex(int policy,
112  struct sched_param_ex *p,
113  const struct compat_sched_param_ex __user *u_cp);
114 
115 int sys32_put_param_ex(int policy,
116  struct compat_sched_param_ex __user *u_cp,
117  const struct sched_param_ex *p);
118 
119 int sys32_get_mqattr(struct mq_attr *ap,
120  const struct compat_mq_attr __user *u_cap);
121 
122 int sys32_put_mqattr(struct compat_mq_attr __user *u_cap,
123  const struct mq_attr *ap);
124 
125 int sys32_get_sigevent(struct sigevent *ev,
126  const struct compat_sigevent *__user u_cev);
127 
128 int sys32_get_sigset(sigset_t *set, const compat_sigset_t *u_cset);
129 
130 int sys32_put_sigset(compat_sigset_t *u_cset, const sigset_t *set);
131 
132 int sys32_get_sigval(union sigval *val, const union compat_sigval *u_cval);
133 
134 int sys32_put_siginfo(void __user *u_si, const struct siginfo *si,
135  int overrun);
136 
137 int sys32_get_msghdr(struct msghdr *msg,
138  const struct compat_msghdr __user *u_cmsg);
139 
140 int sys32_put_msghdr(struct compat_msghdr __user *u_cmsg,
141  const struct msghdr *msg);
142 
143 int sys32_get_iovec(struct iovec *iov,
144  const struct compat_iovec __user *ciov,
145  int ciovlen);
146 
147 int sys32_put_iovec(struct compat_iovec __user *u_ciov,
148  const struct iovec *iov,
149  int iovlen);
150 
151 #endif /* CONFIG_XENO_ARCH_SYS3264 */
152 
153 #endif /* !_COBALT_KERNEL_COMPAT_H */