Xenomai  3.1
monitor.h
1 /*
2  * Copyright (C) 2011 Philippe Gerum <rpm@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 
19 #ifndef _COBALT_POSIX_MONITOR_H
20 #define _COBALT_POSIX_MONITOR_H
21 
22 #include <cobalt/kernel/synch.h>
23 #include <cobalt/uapi/monitor.h>
24 #include <xenomai/posix/syscall.h>
25 #include <xenomai/posix/process.h>
26 
27 struct cobalt_resources;
28 struct cobalt_process;
29 
30 struct cobalt_monitor {
31  unsigned int magic;
32  struct xnsynch gate;
33  struct xnsynch drain;
34  struct cobalt_monitor_state *state;
35  struct list_head waiters;
36  int flags;
37  xntmode_t tmode;
38  struct cobalt_resnode resnode;
39 };
40 
41 int __cobalt_monitor_wait(struct cobalt_monitor_shadow __user *u_mon,
42  int event, const struct timespec *ts,
43  int __user *u_ret);
44 
45 COBALT_SYSCALL_DECL(monitor_init,
46  (struct cobalt_monitor_shadow __user *u_monsh,
47  clockid_t clk_id,
48  int flags));
49 
50 COBALT_SYSCALL_DECL(monitor_enter,
51  (struct cobalt_monitor_shadow __user *u_monsh));
52 
53 COBALT_SYSCALL_DECL(monitor_sync,
54  (struct cobalt_monitor_shadow __user *u_monsh));
55 
56 COBALT_SYSCALL_DECL(monitor_exit,
57  (struct cobalt_monitor_shadow __user *u_monsh));
58 
59 COBALT_SYSCALL_DECL(monitor_wait,
60  (struct cobalt_monitor_shadow __user *u_monsh,
61  int event, const struct timespec __user *u_ts,
62  int __user *u_ret));
63 
64 COBALT_SYSCALL_DECL(monitor_destroy,
65  (struct cobalt_monitor_shadow __user *u_monsh));
66 
67 void cobalt_monitor_reclaim(struct cobalt_resnode *node,
68  spl_t s);
69 
70 #endif /* !_COBALT_POSIX_MONITOR_H */