Xenomai  3.0-rc3
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 
29 struct cobalt_kqueues;
30 struct cobalt_mutex;
31 
32 struct cobalt_cond {
33  unsigned int magic;
34  struct xnsynch synchbase;
36  struct list_head link;
37  struct list_head mutex_link;
38  struct cobalt_cond_state *state;
39  struct cobalt_condattr attr;
40  struct cobalt_mutex *mutex;
41  struct cobalt_kqueues *owningq;
42  xnhandle_t handle;
43 };
44 
45 int __cobalt_cond_wait_prologue(struct cobalt_cond_shadow __user *u_cnd,
46  struct cobalt_mutex_shadow __user *u_mx,
47  int *u_err,
48  void __user *u_ts,
49  int (*fetch_timeout)(struct timespec *ts,
50  const void __user *u_ts));
51 COBALT_SYSCALL_DECL(cond_init,
52  (struct cobalt_cond_shadow __user *u_cnd,
53  const struct cobalt_condattr __user *u_attr));
54 
55 COBALT_SYSCALL_DECL(cond_destroy,
56  (struct cobalt_cond_shadow __user *u_cnd));
57 
58 COBALT_SYSCALL_DECL(cond_wait_prologue,
59  (struct cobalt_cond_shadow __user *u_cnd,
60  struct cobalt_mutex_shadow __user *u_mx,
61  int *u_err,
62  unsigned int timed,
63  struct timespec __user *u_ts));
64 
65 COBALT_SYSCALL_DECL(cond_wait_epilogue,
66  (struct cobalt_cond_shadow __user *u_cnd,
67  struct cobalt_mutex_shadow __user *u_mx));
68 
69 int cobalt_cond_deferred_signals(struct cobalt_cond *cond);
70 
71 void cobalt_condq_cleanup(struct cobalt_kqueues *q);
72 
73 void cobalt_cond_pkg_init(void);
74 
75 void cobalt_cond_pkg_cleanup(void);
76 
77 #endif /* !_COBALT_POSIX_COND_H */