Xenomai  3.1
cond.h
1 /*
2  * Written by Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU 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_POSIX_COND_H
19 #define _COBALT_POSIX_COND_H
20 
21 #include <linux/types.h>
22 #include <linux/time.h>
23 #include <linux/list.h>
24 #include <cobalt/kernel/synch.h>
25 #include <cobalt/uapi/thread.h>
26 #include <cobalt/uapi/cond.h>
27 #include <xenomai/posix/syscall.h>
28 #include <xenomai/posix/process.h>
29 
30 struct cobalt_mutex;
31 
32 struct cobalt_cond {
33  unsigned int magic;
34  struct xnsynch synchbase;
35  struct list_head mutex_link;
36  struct cobalt_cond_state *state;
37  struct cobalt_condattr attr;
38  struct cobalt_mutex *mutex;
39  struct cobalt_resnode resnode;
40 };
41 
42 int __cobalt_cond_wait_prologue(struct cobalt_cond_shadow __user *u_cnd,
43  struct cobalt_mutex_shadow __user *u_mx,
44  int *u_err,
45  void __user *u_ts,
46  int (*fetch_timeout)(struct timespec *ts,
47  const void __user *u_ts));
48 COBALT_SYSCALL_DECL(cond_init,
49  (struct cobalt_cond_shadow __user *u_cnd,
50  const struct cobalt_condattr __user *u_attr));
51 
52 COBALT_SYSCALL_DECL(cond_destroy,
53  (struct cobalt_cond_shadow __user *u_cnd));
54 
55 COBALT_SYSCALL_DECL(cond_wait_prologue,
56  (struct cobalt_cond_shadow __user *u_cnd,
57  struct cobalt_mutex_shadow __user *u_mx,
58  int *u_err,
59  unsigned int timed,
60  struct timespec __user *u_ts));
61 
62 COBALT_SYSCALL_DECL(cond_wait_epilogue,
63  (struct cobalt_cond_shadow __user *u_cnd,
64  struct cobalt_mutex_shadow __user *u_mx));
65 
66 int cobalt_cond_deferred_signals(struct cobalt_cond *cond);
67 
68 void cobalt_cond_reclaim(struct cobalt_resnode *node,
69  spl_t s);
70 
71 #endif /* !_COBALT_POSIX_COND_H */