Xenomai  3.0-rc7
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 op;
65  int nr_windows;
66  struct compat_sched_tp_window windows[0];
67 };
68 
69 union compat_sched_config {
70  struct __compat_sched_config_tp tp;
71  struct __sched_config_quota quota;
72 };
73 
74 #define compat_sched_tp_confsz(nr_win) \
75  (sizeof(struct __compat_sched_config_tp) + nr_win * sizeof(struct compat_sched_tp_window))
76 
77 typedef struct {
78  compat_ulong_t fds_bits[__FD_SETSIZE / (8 * sizeof(compat_long_t))];
79 } compat_fd_set;
80 
81 struct compat_rtdm_mmap_request {
82  u64 offset;
83  compat_size_t length;
84  int prot;
85  int flags;
86 };
87 
88 int sys32_get_timespec(struct timespec *ts,
89  const struct compat_timespec __user *cts);
90 
91 int sys32_put_timespec(struct compat_timespec __user *cts,
92  const struct timespec *ts);
93 
94 int sys32_get_itimerspec(struct itimerspec *its,
95  const struct compat_itimerspec __user *cits);
96 
97 int sys32_put_itimerspec(struct compat_itimerspec __user *cits,
98  const struct itimerspec *its);
99 
100 int sys32_get_timeval(struct timeval *tv,
101  const struct compat_timeval __user *ctv);
102 
103 int sys32_put_timeval(struct compat_timeval __user *ctv,
104  const struct timeval *tv);
105 
106 ssize_t sys32_get_fdset(fd_set *fds, const compat_fd_set __user *cfds,
107  size_t cfdsize);
108 
109 ssize_t sys32_put_fdset(compat_fd_set __user *cfds, const fd_set *fds,
110  size_t fdsize);
111 
112 int sys32_get_param_ex(int policy,
113  struct sched_param_ex *p,
114  const struct compat_sched_param_ex __user *u_cp);
115 
116 int sys32_put_param_ex(int policy,
117  struct compat_sched_param_ex __user *u_cp,
118  const struct sched_param_ex *p);
119 
120 int sys32_get_mqattr(struct mq_attr *ap,
121  const struct compat_mq_attr __user *u_cap);
122 
123 int sys32_put_mqattr(struct compat_mq_attr __user *u_cap,
124  const struct mq_attr *ap);
125 
126 int sys32_get_sigevent(struct sigevent *ev,
127  const struct compat_sigevent *__user u_cev);
128 
129 int sys32_get_sigset(sigset_t *set, const compat_sigset_t *u_cset);
130 
131 int sys32_put_sigset(compat_sigset_t *u_cset, const sigset_t *set);
132 
133 int sys32_get_sigval(union sigval *val, const union compat_sigval *u_cval);
134 
135 int sys32_put_siginfo(void __user *u_si, const struct siginfo *si,
136  int overrun);
137 
138 int sys32_get_msghdr(struct msghdr *msg,
139  const struct compat_msghdr __user *u_cmsg);
140 
141 int sys32_put_msghdr(struct compat_msghdr __user *u_cmsg,
142  const struct msghdr *msg);
143 
144 int sys32_get_iovec(struct iovec *iov,
145  const struct compat_iovec __user *ciov,
146  int ciovlen);
147 
148 int sys32_put_iovec(struct compat_iovec __user *u_ciov,
149  const struct iovec *iov,
150  int iovlen);
151 
152 #endif /* CONFIG_XENO_ARCH_SYS3264 */
153 
154 #endif /* !_COBALT_KERNEL_COMPAT_H */