Xenomai API  2.6.5
mman.h
1 /*
2  * Copyright (C) 2006 Gilles Chanteperdrix <[email protected]>.
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 _XENO_POSIX_SYS_MMAN_H
20 #define _XENO_POSIX_SYS_MMAN_H
21 
22 #if defined(__KERNEL__) || defined(__XENO_SIM__)
23 
24 #include <nucleus/xenomai.h>
25 
26 #ifdef __KERNEL__
27 #include <asm/mman.h>
28 #endif /* __KERNEL__ */
29 
30 #ifdef __XENO_SIM__
31 #pragma GCC system_header
32 
33 #include_next <sys/mman.h>
34 #include <posix_overrides.h>
35 #endif /* __XENO_SIM__ */
36 
37 #define MAP_FAILED ((void *) -1)
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 int shm_open(const char *name, int oflag, mode_t mode);
44 
45 int shm_unlink(const char *name);
46 
47 void *mmap(void *addr, size_t len, int prot, int flags,
48  int fildes, off_t off);
49 
50 int munmap(void *addr, size_t len);
51 
52 #ifdef __cplusplus
53 }
54 #endif
55 
56 #else /* !(__KERNEL__ || __XENO_SIM__) */
57 
58 #pragma GCC system_header
59 
60 #include_next <sys/mman.h>
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
66 int __real_shm_open(const char *name, int oflag, mode_t mode);
67 
68 int __real_shm_unlink(const char *name);
69 
70 void *__real_mmap(void *addr,
71  size_t len,
72  int prot,
73  int flags,
74  int fildes,
75  long off);
76 
77 #if defined(_LARGEFILE64_SOURCE) \
78  || defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
79 void *__real_mmap64(void *addr,
80  size_t len,
81  int prot,
82  int flags,
83  int fildes,
84  long long off);
85 #endif
86 
87 #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
88 #define __real_mmap __real_mmap64
89 #endif
90 
91 int __real_munmap(void *addr, size_t len);
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif /* !(__KERNEL__ || __XENO_SIM__) */
98 
99 #endif /* _XENO_POSIX_SYS_MMAN_H */
int munmap(void *addr, size_t len)
Unmap pages of memory.
Definition: shm.c:793
int shm_unlink(const char *name)
Unlink a shared memory object.
Definition: shm.c:393
void * mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off)
Map pages of memory.
Definition: shm.c:641
int shm_open(const char *name, int oflag, mode_t mode)
Open a shared memory object.
Definition: shm.c:224