source: branches/libc-0.6/src/emx/include/sys/mman.h

Last change on this file was 1603, checked in by bird, 21 years ago
  • mprotect().
  • Fixing timebomb issues.
  • removed b_fsChRoot since that's not used.
  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.5 KB
Line 
1/** @file
2 * FreeBSD 5.2
3 * @changed bird: disabled most of the stuff we don't implement yet.
4 */
5/*-
6 * Copyright (c) 1982, 1986, 1993
7 * The Regents of the University of California. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)mman.h 8.2 (Berkeley) 1/9/95
34 * $FreeBSD: src/sys/sys/mman.h,v 1.39 2004/04/27 13:13:20 mux Exp $
35 */
36
37#ifndef _SYS_MMAN_H_
38#define _SYS_MMAN_H_
39
40#include <sys/cdefs.h>
41#include <sys/_types.h>
42
43#if 0 /* bird */
44#if __BSD_VISIBLE
45/*
46 * Inheritance for minherit()
47 */
48#define INHERIT_SHARE 0
49#define INHERIT_COPY 1
50#define INHERIT_NONE 2
51#endif
52#endif /* bird */
53
54/*
55 * Protections are chosen from these bits, or-ed together
56 */
57#define PROT_NONE 0x00 /* no permissions */
58#define PROT_READ 0x01 /* pages can be read */
59#define PROT_WRITE 0x02 /* pages can be written */
60#define PROT_EXEC 0x04 /* pages can be executed */
61
62#if 0 /* bird */
63/*
64 * Flags contain sharing type and options.
65 * Sharing types; choose one.
66 */
67#define MAP_SHARED 0x0001 /* share changes */
68#define MAP_PRIVATE 0x0002 /* changes are private */
69#define MAP_COPY MAP_PRIVATE /* Obsolete */
70
71#if __BSD_VISIBLE
72/*
73 * Other flags
74 */
75#define MAP_FIXED 0x0010 /* map addr must be exactly as requested */
76#define MAP_RENAME 0x0020 /* Sun: rename private pages to file */
77#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */
78#define MAP_RESERVED0080 0x0080 /* previously misimplemented MAP_INHERIT */
79#define MAP_RESERVED0100 0x0100 /* previously unimplemented MAP_NOEXTEND */
80#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
81#define MAP_STACK 0x0400 /* region grows down, like a stack */
82#define MAP_NOSYNC 0x0800 /* page to but do not sync underlying file */
83
84/*
85 * Mapping type
86 */
87#define MAP_FILE 0x0000 /* map from file (default) */
88#define MAP_ANON 0x1000 /* allocated from memory, swap space */
89
90/*
91 * Extended flags
92 */
93#define MAP_NOCORE 0x00020000 /* dont include these pages in a coredump */
94#endif /* __BSD_VISIBLE */
95
96#if __POSIX_VISIBLE >= 199309
97/*
98 * Process memory locking
99 */
100#define MCL_CURRENT 0x0001 /* Lock only current memory */
101#define MCL_FUTURE 0x0002 /* Lock all future memory as well */
102#endif
103
104/*
105 * Error return from mmap()
106 */
107#define MAP_FAILED ((void *)-1)
108
109/*
110 * msync() flags
111 */
112#define MS_SYNC 0x0000 /* msync synchronously */
113#define MS_ASYNC 0x0001 /* return immediately */
114#define MS_INVALIDATE 0x0002 /* invalidate all cached data */
115
116#if __BSD_VISIBLE
117/*
118 * Advice to madvise
119 */
120#define MADV_NORMAL 0 /* no further special treatment */
121#define MADV_RANDOM 1 /* expect random page references */
122#define MADV_SEQUENTIAL 2 /* expect sequential page references */
123#define MADV_WILLNEED 3 /* will need these pages */
124#define MADV_DONTNEED 4 /* dont need these pages */
125#define MADV_FREE 5 /* dont need these pages, and junk contents */
126#define MADV_NOSYNC 6 /* try to avoid flushes to physical media */
127#define MADV_AUTOSYNC 7 /* revert to default flushing strategy */
128#define MADV_NOCORE 8 /* do not include these pages in a core file */
129#define MADV_CORE 9 /* revert to including pages in a core file */
130#define MADV_PROTECT 10 /* protect process from pageout kill */
131
132/*
133 * Return bits from mincore
134 */
135#define MINCORE_INCORE 0x1 /* Page is incore */
136#define MINCORE_REFERENCED 0x2 /* Page has been referenced by us */
137#define MINCORE_MODIFIED 0x4 /* Page has been modified by us */
138#define MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */
139#define MINCORE_MODIFIED_OTHER 0x10 /* Page has been modified */
140#endif /* __BSD_VISIBLE */
141
142/*
143 * XXX missing POSIX_TYPED_MEM_* macros and
144 * posix_typed_mem_info structure.
145 */
146#if __POSIX_VISIBLE >= 200112
147#define POSIX_MADV_NORMAL MADV_NORMAL
148#define POSIX_MADV_RANDOM MADV_RANDOM
149#define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
150#define POSIX_MADV_WILLNEED MADV_WILLNEED
151#define POSIX_MADV_DONTNEED MADV_DONTNEED
152#endif
153#endif /* bird */
154
155#ifndef _MODE_T_DECLARED
156typedef __mode_t mode_t;
157#define _MODE_T_DECLARED
158#endif
159
160#ifndef _OFF_T_DECLARED
161typedef __off_t off_t;
162#define _OFF_T_DECLARED
163#endif
164
165#ifndef _SIZE_T_DECLARED
166typedef __size_t size_t;
167#define _SIZE_T_DECLARED
168#endif
169
170#ifndef _KERNEL
171
172__BEGIN_DECLS
173/*
174 * XXX not yet implemented: posix_mem_offset(), posix_typed_mem_get_info(),
175 * posix_typed_mem_open().
176 */
177#if __BSD_VISIBLE
178/** @todo int madvise(void *, size_t, int); */
179/** @todo int mincore(const void *, size_t, char *); */
180/** @todo int minherit(void *, size_t, int); */
181#endif
182/** @todo int mlock(const void *, size_t); */
183#ifndef _MMAP_DECLARED
184#define _MMAP_DECLARED
185/** @todo void * mmap(void *, size_t, int, int, int, off_t); */
186#endif
187int mprotect(const void *, size_t, int);
188/** @todo int msync(void *, size_t, int); */
189/** @todo int munlock(const void *, size_t); */
190/** @todo int munmap(void *, size_t); */
191#if __POSIX_VISIBLE >= 200112
192/** @todo int posix_madvise(void *, size_t, int); */
193#endif
194#if __POSIX_VISIBLE >= 199309
195/** @todo int mlockall(int); */
196/** @todo int munlockall(void); */
197/** @todo int shm_open(const char *, int, mode_t); */
198/** @todo int shm_unlink(const char *); */
199#endif
200__END_DECLS
201
202#endif /* !_KERNEL */
203
204#endif /* !_SYS_MMAN_H_ */
Note: See TracBrowser for help on using the repository browser.