Xenomai 3.3.2
Loading...
Searching...
No Matches
mutex.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
19#ifndef _COBALT_POSIX_MUTEX_H
20#define _COBALT_POSIX_MUTEX_H
21
22#include "thread.h"
23#include <cobalt/uapi/mutex.h>
24#include <xenomai/posix/syscall.h>
25#include <xenomai/posix/process.h>
26
27struct cobalt_process;
28
29struct cobalt_mutex {
30 unsigned int magic;
31 struct xnsynch synchbase;
33 struct list_head conds;
34 struct cobalt_mutexattr attr;
35 struct cobalt_resnode resnode;
36};
37
38int __cobalt_mutex_timedlock_break(struct cobalt_mutex_shadow __user *u_mx,
39 const void __user *u_ts,
40 int (*fetch_timeout)(struct timespec64 *ts,
41 const void __user *u_ts));
42
43int __cobalt_mutex_acquire_unchecked(struct xnthread *cur,
44 struct cobalt_mutex *mutex,
45 const struct timespec64 *ts);
46
47COBALT_SYSCALL_DECL(mutex_check_init,
48 (struct cobalt_mutex_shadow __user *u_mx));
49
50COBALT_SYSCALL_DECL(mutex_init,
51 (struct cobalt_mutex_shadow __user *u_mx,
52 const struct cobalt_mutexattr __user *u_attr));
53
54COBALT_SYSCALL_DECL(mutex_destroy,
55 (struct cobalt_mutex_shadow __user *u_mx));
56
57COBALT_SYSCALL_DECL(mutex_trylock,
58 (struct cobalt_mutex_shadow __user *u_mx));
59
60COBALT_SYSCALL_DECL(mutex_lock,
61 (struct cobalt_mutex_shadow __user *u_mx));
62
63COBALT_SYSCALL_DECL(mutex_timedlock,
64 (struct cobalt_mutex_shadow __user *u_mx,
65 const struct __kernel_old_timespec __user *u_ts));
66
67COBALT_SYSCALL_DECL(mutex_timedlock64,
68 (struct cobalt_mutex_shadow __user *u_mx,
69 const struct __kernel_timespec __user *u_ts));
70
71COBALT_SYSCALL_DECL(mutex_unlock,
72 (struct cobalt_mutex_shadow __user *u_mx));
73
74int cobalt_mutex_release(struct xnthread *cur,
75 struct cobalt_mutex *mutex);
76
77void cobalt_mutex_reclaim(struct cobalt_resnode *node,
78 spl_t s);
79
80#endif /* !_COBALT_POSIX_MUTEX_H */