1
/* Definitions for POSIX memory map interface. FreeBSD version.
2
Copyright (C) 1994-1998, 2000-2002 Free Software Foundation, Inc.
3
This file is part of the GNU C Library.
5
The GNU C Library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
8
version 2.1 of the License, or (at your option) any later version.
10
The GNU C Library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Lesser General Public License for more details.
15
You should have received a copy of the GNU Lesser General Public
16
License along with the GNU C Library; if not, write to the Free
17
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21
# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
27
/* Protections are chosen from these bits, OR'd together. The
28
implementation does not necessarily support PROT_EXEC or PROT_WRITE
29
without PROT_READ. The only guarantees are that no writing will be
30
allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
32
#define PROT_NONE 0x00 /* No access. */
33
#define PROT_READ 0x01 /* Pages can be read. */
34
#define PROT_WRITE 0x02 /* Pages can be written. */
35
#define PROT_EXEC 0x04 /* Pages can be executed. */
37
/* Flags contain mapping type, sharing type and options. */
39
/* Mapping type (must choose one and only one of these). */
41
# define MAP_FILE 0x0000 /* Mapped from a file or device. */
42
# define MAP_ANON 0x1000 /* Allocated from anonymous virtual memory. */
43
# define MAP_TYPE 0x1000 /* Mask for type field. */
45
# define MAP_ANONYMOUS MAP_ANON /* Linux name. */
49
/* Sharing types (must choose one and only one of these). */
50
#define MAP_SHARED 0x0001 /* Share changes. */
51
#define MAP_PRIVATE 0x0002 /* Changes private; copy pages on write. */
53
# define MAP_COPY MAP_PRIVATE /* Virtual copy of region at mapping time. */
57
#define MAP_FIXED 0x0010 /* Map address must be exactly as requested. */
59
#define MAP_RENAME 0x0020 /* Sun: rename private pages to file */
60
#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */
61
#define MAP_RESERVED0080 0x0080 /* previously misimplemented MAP_INHERIT */
62
#define MAP_RESERVED0100 0x0100 /* previously unimplemented MAP_NOEXTEND */
63
# define MAP_HASSEMPHORE 0x0200 /* Region may contain semaphores. */
64
# define MAP_STACK 0x0400 /* Region grows down, like a stack. */
65
# define MAP_NOSYNC 0x0800 /* Try to avoid flushing to the disk. */
66
# define MAP_NOCORE 0x20000 /* Don't include these pages in a core dump. */
69
/* Advice to `madvise'. */
71
# define MADV_NORMAL 0 /* No further special treatment. */
72
# define MADV_RANDOM 1 /* Expect random page references. */
73
# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
74
# define MADV_WILLNEED 3 /* Will need these pages. */
75
# define MADV_DONTNEED 4 /* Don't need these pages. */
76
# define MADV_FREE 5 /* Don't need these pages, they contain junk. */
77
# define MADV_NOSYNC 6 /* Try to avoid flushing to the disk. */
78
# define MADV_AUTOSYNC 7 /* Use the default flushing strategy. */
79
# define MADV_NOCORE 8 /* Don't include these pages in a core dump. */
80
# define MADV_CORE 9 /* Include pages in a core dump (default). */
81
# define MADV_PROTECT 10 /* protect process from pageout kill */
84
/* The POSIX people had to invent similar names for the same things. */
86
# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
87
# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
88
# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
89
# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
90
# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
93
/* Flags to `msync'. */
94
#define MS_ASYNC 1 /* Sync memory asynchronously. */
95
#define MS_SYNC 0 /* Synchronous memory sync. */
96
#define MS_INVALIDATE 2 /* Invalidate the caches. */
98
/* Flags for `mlockall' (can be OR'd together). */
99
#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
100
#define MCL_FUTURE 2 /* Lock all additions to address
103
/* Flags for 'minherit'. */
105
# define INHERIT_SHARE 0
106
# define INHERIT_COPY 1
107
# define INHERIT_NONE 2
112
* Return bits from mincore
115
#define MINCORE_INCORE 0x1 /* Page is incore */
116
#define MINCORE_REFERENCED 0x2 /* Page has been referenced by us */
117
#define MINCORE_MODIFIED 0x4 /* Page has been modified by us */
118
#define MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */
119
#define MINCORE_MODIFIED_OTHER 0x10 /* Page has been modified */
120
#endif /* Use MISC */
126
extern int minherit (void *__addr, size_t __len, int __inherit);