Xenomai  3.1
internal.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_INTERNAL_H
19 #define _COBALT_POSIX_INTERNAL_H
20 
21 #include <cobalt/kernel/sched.h>
22 #include <cobalt/kernel/heap.h>
23 #include <cobalt/kernel/ppd.h>
24 #include <cobalt/kernel/assert.h>
25 #include <cobalt/kernel/list.h>
26 #include <cobalt/kernel/arith.h>
27 #include <asm/xenomai/syscall.h>
28 #include "process.h"
29 #include "extension.h"
30 #include "syscall.h"
31 #include "memory.h"
32 
33 #define COBALT_MAXNAME 64
34 #define COBALT_PERMS_MASK (O_RDONLY | O_WRONLY | O_RDWR)
35 
36 #define COBALT_MAGIC(n) (0x8686##n##n)
37 #define COBALT_ANY_MAGIC COBALT_MAGIC(00)
38 #define COBALT_THREAD_MAGIC COBALT_MAGIC(01)
39 #define COBALT_MQ_MAGIC COBALT_MAGIC(0A)
40 #define COBALT_MQD_MAGIC COBALT_MAGIC(0B)
41 #define COBALT_EVENT_MAGIC COBALT_MAGIC(0F)
42 #define COBALT_MONITOR_MAGIC COBALT_MAGIC(10)
43 #define COBALT_TIMERFD_MAGIC COBALT_MAGIC(11)
44 
45 #define cobalt_obj_active(h,m,t) \
46  ((h) && ((t *)(h))->magic == (m))
47 
48 #define cobalt_mark_deleted(t) ((t)->magic = ~(t)->magic)
49 
50 static inline xnhandle_t cobalt_get_handle_from_user(xnhandle_t *u_h)
51 {
52  xnhandle_t handle;
53  return __xn_get_user(handle, u_h) ? 0 : handle;
54 }
55 
56 int cobalt_init(void);
57 
58 long cobalt_restart_syscall_placeholder(struct restart_block *param);
59 
60 #endif /* !_COBALT_POSIX_INTERNAL_H */