OSDN Git Service

(split) LDP: Update POT and ja.po to LDP v3.40.
[linuxjm/LDP_man-pages.git] / po4a / memory / po / memory.pot
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2012-05-01 04:38+0900\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: build/C/man2/alloc_hugepages.2:25
21 #, no-wrap
22 msgid "ALLOC_HUGEPAGES"
23 msgstr ""
24
25 #. type: TH
26 #: build/C/man2/alloc_hugepages.2:25
27 #, no-wrap
28 msgid "2007-05-31"
29 msgstr ""
30
31 #. type: TH
32 #: build/C/man2/alloc_hugepages.2:25 build/C/man2/cacheflush.2:24 build/C/man2/fallocate.2:8 build/C/man2/madvise.2:35 build/C/man3/mallopt.3:24 build/C/man2/mlock.2:27 build/C/man2/mmap.2:40 build/C/man2/mmap2.2:29 build/C/man2/mprotect.2:32 build/C/man2/mremap.2:31 build/C/man2/msync.2:25 build/C/man2/posix_fadvise.2:27 build/C/man2/readahead.2:28 build/C/man2/remap_file_pages.2:26 build/C/man3/shm_open.3:26 build/C/man7/shm_overview.7:27 build/C/man2/shmctl.2:43 build/C/man2/shmget.2:36 build/C/man2/shmop.2:39 build/C/man2/subpage_prot.2:28 build/C/man2/sync_file_range.2:30 build/C/man3/malloc_trim.3:24
33 #, no-wrap
34 msgid "Linux"
35 msgstr ""
36
37 #. type: TH
38 #: build/C/man2/alloc_hugepages.2:25 build/C/man3/alloca.3:41 build/C/man2/cacheflush.2:24 build/C/man2/fallocate.2:8 build/C/man2/madvise.2:35 build/C/man3/malloc_hook.3:6 build/C/man3/mallopt.3:24 build/C/man2/mlock.2:27 build/C/man2/mmap.2:40 build/C/man2/mmap2.2:29 build/C/man2/mprotect.2:32 build/C/man2/mremap.2:31 build/C/man2/msync.2:25 build/C/man3/mtrace.3:23 build/C/man2/posix_fadvise.2:27 build/C/man3/posix_fallocate.3:23 build/C/man3/posix_memalign.3:28 build/C/man2/readahead.2:28 build/C/man2/remap_file_pages.2:26 build/C/man3/shm_open.3:26 build/C/man7/shm_overview.7:27 build/C/man2/shmctl.2:43 build/C/man2/shmget.2:36 build/C/man2/shmop.2:39 build/C/man2/subpage_prot.2:28 build/C/man2/sync_file_range.2:30 build/C/man3/malloc_get_state.3:23 build/C/man3/malloc_trim.3:24 build/C/man3/malloc_usable_size.3:23 build/C/man3/mcheck.3:23
39 #, no-wrap
40 msgid "Linux Programmer's Manual"
41 msgstr ""
42
43 #. type: SH
44 #: build/C/man2/alloc_hugepages.2:26 build/C/man3/alloca.3:42 build/C/man2/cacheflush.2:25 build/C/man2/fallocate.2:9 build/C/man2/madvise.2:36 build/C/man3/malloc_hook.3:7 build/C/man3/mallopt.3:25 build/C/man2/mlock.2:28 build/C/man2/mmap.2:41 build/C/man2/mmap2.2:30 build/C/man2/mprotect.2:33 build/C/man2/mremap.2:32 build/C/man2/msync.2:26 build/C/man3/mtrace.3:24 build/C/man2/posix_fadvise.2:28 build/C/man3/posix_fallocate.3:24 build/C/man3/posix_memalign.3:29 build/C/man2/readahead.2:29 build/C/man2/remap_file_pages.2:27 build/C/man3/shm_open.3:27 build/C/man7/shm_overview.7:28 build/C/man2/shmctl.2:44 build/C/man2/shmget.2:37 build/C/man2/shmop.2:40 build/C/man2/subpage_prot.2:29 build/C/man2/sync_file_range.2:31 build/C/man3/malloc_get_state.3:24 build/C/man3/malloc_trim.3:25 build/C/man3/malloc_usable_size.3:24 build/C/man3/mcheck.3:24
45 #, no-wrap
46 msgid "NAME"
47 msgstr ""
48
49 #. type: Plain text
50 #: build/C/man2/alloc_hugepages.2:28
51 msgid "alloc_hugepages, free_hugepages - allocate or free huge pages"
52 msgstr ""
53
54 #. type: SH
55 #: build/C/man2/alloc_hugepages.2:28 build/C/man3/alloca.3:44 build/C/man2/cacheflush.2:27 build/C/man2/fallocate.2:11 build/C/man2/madvise.2:38 build/C/man3/malloc_hook.3:11 build/C/man3/mallopt.3:27 build/C/man2/mlock.2:30 build/C/man2/mmap.2:43 build/C/man2/mmap2.2:32 build/C/man2/mprotect.2:35 build/C/man2/mremap.2:34 build/C/man2/msync.2:28 build/C/man3/mtrace.3:26 build/C/man2/posix_fadvise.2:30 build/C/man3/posix_fallocate.3:26 build/C/man3/posix_memalign.3:31 build/C/man2/readahead.2:31 build/C/man2/remap_file_pages.2:29 build/C/man3/shm_open.3:29 build/C/man2/shmctl.2:46 build/C/man2/shmget.2:39 build/C/man2/shmop.2:42 build/C/man2/subpage_prot.2:31 build/C/man2/sync_file_range.2:33 build/C/man3/malloc_get_state.3:26 build/C/man3/malloc_trim.3:27 build/C/man3/malloc_usable_size.3:26 build/C/man3/mcheck.3:26
56 #, no-wrap
57 msgid "SYNOPSIS"
58 msgstr ""
59
60 #.  asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr,
61 #.  unsigned long len, int prot, int flag);
62 #. type: Plain text
63 #: build/C/man2/alloc_hugepages.2:34
64 #, no-wrap
65 msgid ""
66 "B<void *alloc_hugepages(int >I<key>B<, void *>I<addr>B<, size_t "
67 ">I<len>B<,>\n"
68 "B<                      int >I<prot>B<, int >I<flag>B<);>\n"
69 msgstr ""
70
71 #.  asmlinkage int sys_free_hugepages(unsigned long addr);
72 #. type: Plain text
73 #: build/C/man2/alloc_hugepages.2:37
74 #, no-wrap
75 msgid "B<int free_hugepages(void *>I<addr>B<);>\n"
76 msgstr ""
77
78 #. type: SH
79 #: build/C/man2/alloc_hugepages.2:38 build/C/man3/alloca.3:48 build/C/man2/cacheflush.2:33 build/C/man2/fallocate.2:19 build/C/man2/madvise.2:50 build/C/man3/malloc_hook.3:29 build/C/man3/mallopt.3:31 build/C/man2/mlock.2:40 build/C/man2/mmap.2:52 build/C/man2/mmap2.2:39 build/C/man2/mprotect.2:41 build/C/man2/mremap.2:43 build/C/man2/msync.2:32 build/C/man3/mtrace.3:32 build/C/man2/posix_fadvise.2:49 build/C/man3/posix_fallocate.3:44 build/C/man3/posix_memalign.3:83 build/C/man2/readahead.2:38 build/C/man2/remap_file_pages.2:37 build/C/man3/shm_open.3:41 build/C/man7/shm_overview.7:30 build/C/man2/shmctl.2:54 build/C/man2/shmget.2:47 build/C/man2/shmop.2:51 build/C/man2/subpage_prot.2:36 build/C/man2/sync_file_range.2:41 build/C/man3/malloc_get_state.3:34 build/C/man3/malloc_trim.3:31 build/C/man3/malloc_usable_size.3:30 build/C/man3/mcheck.3:39
80 #, no-wrap
81 msgid "DESCRIPTION"
82 msgstr ""
83
84 #. type: Plain text
85 #: build/C/man2/alloc_hugepages.2:49
86 msgid ""
87 "The system calls B<alloc_hugepages>()  and B<free_hugepages>()  were "
88 "introduced in Linux 2.5.36 and removed again in 2.5.54.  They existed only "
89 "on i386 and ia64 (when built with B<CONFIG_HUGETLB_PAGE>).  In Linux 2.4.20 "
90 "the syscall numbers exist, but the calls fail with the error B<ENOSYS>."
91 msgstr ""
92
93 #. type: Plain text
94 #: build/C/man2/alloc_hugepages.2:57
95 msgid ""
96 "On i386 the memory management hardware knows about ordinary pages (4 KiB)  "
97 "and huge pages (2 or 4 MiB).  Similarly ia64 knows about huge pages of "
98 "several sizes.  These system calls serve to map huge pages into the "
99 "process's memory or to free them again.  Huge pages are locked into memory, "
100 "and are not swapped."
101 msgstr ""
102
103 #. type: Plain text
104 #: build/C/man2/alloc_hugepages.2:66
105 msgid ""
106 "The I<key> argument is an identifier.  When zero the pages are private, and "
107 "not inherited by children.  When positive the pages are shared with other "
108 "applications using the same I<key>, and inherited by child processes."
109 msgstr ""
110
111 #. type: Plain text
112 #: build/C/man2/alloc_hugepages.2:81
113 msgid ""
114 "The I<addr> argument of B<free_hugepages>()  tells which page is being "
115 "freed: it was the return value of a call to B<alloc_hugepages>().  (The "
116 "memory is first actually freed when all users have released it.)  The "
117 "I<addr> argument of B<alloc_hugepages>()  is a hint, that the kernel may or "
118 "may not follow.  Addresses must be properly aligned."
119 msgstr ""
120
121 #. type: Plain text
122 #: build/C/man2/alloc_hugepages.2:86
123 msgid ""
124 "The I<len> argument is the length of the required segment.  It must be a "
125 "multiple of the huge page size."
126 msgstr ""
127
128 #. type: Plain text
129 #: build/C/man2/alloc_hugepages.2:94
130 msgid ""
131 "The I<prot> argument specifies the memory protection of the segment.  It is "
132 "one of B<PROT_READ>, B<PROT_WRITE>, B<PROT_EXEC>."
133 msgstr ""
134
135 #. type: Plain text
136 #: build/C/man2/alloc_hugepages.2:109
137 msgid ""
138 "The I<flag> argument is ignored, unless I<key> is positive.  In that case, "
139 "if I<flag> is B<IPC_CREAT>, then a new huge page segment is created when "
140 "none with the given key existed.  If this flag is not set, then B<ENOENT> is "
141 "returned when no segment with the given key exists."
142 msgstr ""
143
144 #. type: SH
145 #: build/C/man2/alloc_hugepages.2:109 build/C/man3/alloca.3:58 build/C/man2/cacheflush.2:52 build/C/man2/fallocate.2:109 build/C/man2/madvise.2:250 build/C/man3/mallopt.3:377 build/C/man2/mlock.2:117 build/C/man2/mmap.2:373 build/C/man2/mmap2.2:54 build/C/man2/mprotect.2:72 build/C/man2/mremap.2:128 build/C/man2/msync.2:68 build/C/man2/posix_fadvise.2:86 build/C/man3/posix_fallocate.3:64 build/C/man3/posix_memalign.3:141 build/C/man2/readahead.2:65 build/C/man2/remap_file_pages.2:122 build/C/man3/shm_open.3:169 build/C/man2/shmctl.2:272 build/C/man2/shmget.2:178 build/C/man2/shmop.2:169 build/C/man2/subpage_prot.2:61 build/C/man2/sync_file_range.2:141 build/C/man3/malloc_get_state.3:59 build/C/man3/malloc_trim.3:49 build/C/man3/malloc_usable_size.3:38 build/C/man3/mcheck.3:128
146 #, no-wrap
147 msgid "RETURN VALUE"
148 msgstr ""
149
150 #. type: Plain text
151 #: build/C/man2/alloc_hugepages.2:118
152 msgid ""
153 "On success, B<alloc_hugepages>()  returns the allocated virtual address, and "
154 "B<free_hugepages>()  returns zero.  On error, -1 is returned, and I<errno> "
155 "is set appropriately."
156 msgstr ""
157
158 #. type: SH
159 #: build/C/man2/alloc_hugepages.2:118 build/C/man2/cacheflush.2:58 build/C/man2/fallocate.2:112 build/C/man2/madvise.2:257 build/C/man3/mallopt.3:382 build/C/man2/mlock.2:123 build/C/man2/mmap.2:390 build/C/man2/mmap2.2:61 build/C/man2/mprotect.2:79 build/C/man2/mremap.2:136 build/C/man2/msync.2:73 build/C/man2/posix_fadvise.2:89 build/C/man3/posix_fallocate.3:70 build/C/man3/posix_memalign.3:155 build/C/man2/readahead.2:71 build/C/man2/remap_file_pages.2:129 build/C/man3/shm_open.3:178 build/C/man2/shmctl.2:294 build/C/man2/shmget.2:182 build/C/man2/shmop.2:183 build/C/man2/subpage_prot.2:66 build/C/man2/sync_file_range.2:147 build/C/man3/malloc_trim.3:54
160 #, no-wrap
161 msgid "ERRORS"
162 msgstr ""
163
164 #. type: TP
165 #: build/C/man2/alloc_hugepages.2:119 build/C/man2/fallocate.2:151
166 #, no-wrap
167 msgid "B<ENOSYS>"
168 msgstr ""
169
170 #. type: Plain text
171 #: build/C/man2/alloc_hugepages.2:122
172 msgid "The system call is not supported on this kernel."
173 msgstr ""
174
175 #. type: SH
176 #: build/C/man2/alloc_hugepages.2:122
177 #, no-wrap
178 msgid "FILES"
179 msgstr ""
180
181 #. type: Plain text
182 #: build/C/man2/alloc_hugepages.2:126
183 msgid ""
184 "I</proc/sys/vm/nr_hugepages> Number of configured hugetlb pages.  This can "
185 "be read and written."
186 msgstr ""
187
188 #. type: Plain text
189 #: build/C/man2/alloc_hugepages.2:130
190 msgid ""
191 "I</proc/meminfo> Gives info on the number of configured hugetlb pages and on "
192 "their size in the three variables HugePages_Total, HugePages_Free, "
193 "Hugepagesize."
194 msgstr ""
195
196 #. type: SH
197 #: build/C/man2/alloc_hugepages.2:130 build/C/man3/alloca.3:63 build/C/man2/cacheflush.2:74 build/C/man2/fallocate.2:188 build/C/man2/madvise.2:307 build/C/man3/malloc_hook.3:76 build/C/man3/mallopt.3:390 build/C/man2/mlock.2:187 build/C/man2/mmap.2:483 build/C/man2/mmap2.2:77 build/C/man2/mprotect.2:107 build/C/man2/mremap.2:186 build/C/man2/msync.2:96 build/C/man3/mtrace.3:76 build/C/man2/posix_fadvise.2:111 build/C/man3/posix_fallocate.3:101 build/C/man3/posix_memalign.3:180 build/C/man2/readahead.2:87 build/C/man2/remap_file_pages.2:151 build/C/man3/shm_open.3:249 build/C/man7/shm_overview.7:101 build/C/man2/shmctl.2:366 build/C/man2/shmget.2:229 build/C/man2/shmop.2:226 build/C/man2/subpage_prot.2:91 build/C/man2/sync_file_range.2:180 build/C/man3/malloc_get_state.3:84 build/C/man3/malloc_trim.3:58 build/C/man3/malloc_usable_size.3:46 build/C/man3/mcheck.3:144
198 #, no-wrap
199 msgid "CONFORMING TO"
200 msgstr ""
201
202 #. type: Plain text
203 #: build/C/man2/alloc_hugepages.2:133
204 msgid ""
205 "These calls are specific to Linux on Intel processors, and should not be "
206 "used in programs intended to be portable."
207 msgstr ""
208
209 #. type: SH
210 #: build/C/man2/alloc_hugepages.2:133 build/C/man3/alloca.3:71 build/C/man2/madvise.2:328 build/C/man3/malloc_hook.3:78 build/C/man2/mlock.2:214 build/C/man2/mmap.2:501 build/C/man2/mmap2.2:79 build/C/man2/mprotect.2:116 build/C/man2/mremap.2:192 build/C/man3/mtrace.3:78 build/C/man2/posix_fadvise.2:120 build/C/man3/posix_memalign.3:219 build/C/man3/shm_open.3:255 build/C/man7/shm_overview.7:103 build/C/man2/shmctl.2:371 build/C/man2/shmget.2:235 build/C/man2/shmop.2:245 build/C/man2/subpage_prot.2:93 build/C/man2/sync_file_range.2:183 build/C/man3/malloc_get_state.3:86 build/C/man3/malloc_trim.3:60 build/C/man3/malloc_trim.3:72 build/C/man3/malloc_usable_size.3:48 build/C/man3/mcheck.3:146
211 #, no-wrap
212 msgid "NOTES"
213 msgstr ""
214
215 #. type: Plain text
216 #: build/C/man2/alloc_hugepages.2:141
217 msgid ""
218 "These system calls are gone; they existed only in Linux 2.5.36 through to "
219 "2.5.54.  Now the hugetlbfs file system can be used instead.  Memory backed "
220 "by huge pages (if the CPU supports them) is obtained by using B<mmap>(2)  to "
221 "map files in this virtual file system."
222 msgstr ""
223
224 #. type: Plain text
225 #: build/C/man2/alloc_hugepages.2:145
226 msgid ""
227 "The maximal number of huge pages can be specified using the B<hugepages=> "
228 "boot parameter."
229 msgstr ""
230
231 #. type: SH
232 #: build/C/man2/alloc_hugepages.2:150 build/C/man3/alloca.3:153 build/C/man2/cacheflush.2:88 build/C/man2/fallocate.2:195 build/C/man2/madvise.2:360 build/C/man3/malloc_hook.3:138 build/C/man3/mallopt.3:580 build/C/man2/mlock.2:337 build/C/man2/mmap.2:671 build/C/man2/mmap2.2:98 build/C/man2/mprotect.2:223 build/C/man2/mremap.2:214 build/C/man2/msync.2:122 build/C/man3/mtrace.3:170 build/C/man2/posix_fadvise.2:188 build/C/man3/posix_fallocate.3:130 build/C/man3/posix_memalign.3:275 build/C/man2/readahead.2:98 build/C/man2/remap_file_pages.2:162 build/C/man3/shm_open.3:280 build/C/man7/shm_overview.7:127 build/C/man2/shmctl.2:410 build/C/man2/shmget.2:298 build/C/man2/shmop.2:290 build/C/man2/subpage_prot.2:126 build/C/man2/sync_file_range.2:222 build/C/man3/malloc_get_state.3:112 build/C/man3/malloc_trim.3:80 build/C/man3/malloc_usable_size.3:62 build/C/man3/mcheck.3:211
233 #, no-wrap
234 msgid "COLOPHON"
235 msgstr ""
236
237 #. type: Plain text
238 #: build/C/man2/alloc_hugepages.2:157 build/C/man3/alloca.3:160 build/C/man2/cacheflush.2:95 build/C/man2/fallocate.2:202 build/C/man2/madvise.2:367 build/C/man3/malloc_hook.3:145 build/C/man3/mallopt.3:587 build/C/man2/mlock.2:344 build/C/man2/mmap.2:678 build/C/man2/mmap2.2:105 build/C/man2/mprotect.2:230 build/C/man2/mremap.2:221 build/C/man2/msync.2:129 build/C/man3/mtrace.3:177 build/C/man2/posix_fadvise.2:195 build/C/man3/posix_fallocate.3:137 build/C/man3/posix_memalign.3:282 build/C/man2/readahead.2:105 build/C/man2/remap_file_pages.2:169 build/C/man3/shm_open.3:287 build/C/man7/shm_overview.7:134 build/C/man2/shmctl.2:417 build/C/man2/shmget.2:305 build/C/man2/shmop.2:297 build/C/man2/subpage_prot.2:133 build/C/man2/sync_file_range.2:229 build/C/man3/malloc_get_state.3:119 build/C/man3/malloc_trim.3:87 build/C/man3/malloc_usable_size.3:69 build/C/man3/mcheck.3:218
239 msgid ""
240 "This page is part of release 3.40 of the Linux I<man-pages> project.  A "
241 "description of the project, and information about reporting bugs, can be "
242 "found at http://www.kernel.org/doc/man-pages/."
243 msgstr ""
244
245 #. type: TH
246 #: build/C/man3/alloca.3:41
247 #, no-wrap
248 msgid "ALLOCA"
249 msgstr ""
250
251 #. type: TH
252 #: build/C/man3/alloca.3:41
253 #, no-wrap
254 msgid "2008-01-24"
255 msgstr ""
256
257 #. type: TH
258 #: build/C/man3/alloca.3:41 build/C/man3/malloc_hook.3:6 build/C/man3/mtrace.3:23 build/C/man3/posix_fallocate.3:23 build/C/man3/posix_memalign.3:28 build/C/man3/malloc_get_state.3:23 build/C/man3/malloc_usable_size.3:23 build/C/man3/mcheck.3:23
259 #, no-wrap
260 msgid "GNU"
261 msgstr ""
262
263 #. type: Plain text
264 #: build/C/man3/alloca.3:44
265 msgid "alloca - allocate memory that is automatically freed"
266 msgstr ""
267
268 #. type: Plain text
269 #: build/C/man3/alloca.3:46
270 msgid "B<#include E<lt>alloca.hE<gt>>"
271 msgstr ""
272
273 #. type: Plain text
274 #: build/C/man3/alloca.3:48
275 msgid "B<void *alloca(size_t >I<size>B<);>"
276 msgstr ""
277
278 #. type: Plain text
279 #: build/C/man3/alloca.3:58
280 msgid ""
281 "The B<alloca>()  function allocates I<size> bytes of space in the stack "
282 "frame of the caller.  This temporary space is automatically freed when the "
283 "function that called B<alloca>()  returns to its caller."
284 msgstr ""
285
286 #. type: Plain text
287 #: build/C/man3/alloca.3:63
288 msgid ""
289 "The B<alloca>()  function returns a pointer to the beginning of the "
290 "allocated space.  If the allocation causes stack overflow, program behavior "
291 "is undefined."
292 msgstr ""
293
294 #. type: Plain text
295 #: build/C/man3/alloca.3:65
296 msgid "This function is not in POSIX.1-2001."
297 msgstr ""
298
299 #. type: Plain text
300 #: build/C/man3/alloca.3:71
301 msgid ""
302 "There is evidence that the B<alloca>()  function appeared in 32V, PWB, "
303 "PWB.2, 3BSD, and 4BSD.  There is a man page for it in 4.3BSD.  Linux uses "
304 "the GNU version."
305 msgstr ""
306
307 #. type: Plain text
308 #: build/C/man3/alloca.3:86
309 msgid ""
310 "The B<alloca>()  function is machine- and compiler-dependent.  For certain "
311 "applications, its use can improve efficiency compared to the use of "
312 "B<malloc>(3)  plus B<free>(3).  In certain cases, it can also simplify "
313 "memory deallocation in applications that use B<longjmp>(3)  or "
314 "B<siglongjmp>(3).  Otherwise, its use is discouraged."
315 msgstr ""
316
317 #. type: Plain text
318 #: build/C/man3/alloca.3:95
319 msgid ""
320 "Because the space allocated by B<alloca>()  is allocated within the stack "
321 "frame, that space is automatically freed if the function return is jumped "
322 "over by a call to B<longjmp>(3)  or B<siglongjmp>(3)."
323 msgstr ""
324
325 #. type: Plain text
326 #: build/C/man3/alloca.3:100
327 msgid "Do not attempt to B<free>(3)  space allocated by B<alloca>()!"
328 msgstr ""
329
330 #. type: SS
331 #: build/C/man3/alloca.3:100
332 #, no-wrap
333 msgid "Notes on the GNU Version"
334 msgstr ""
335
336 #. type: Plain text
337 #: build/C/man3/alloca.3:122
338 msgid ""
339 "Normally, B<gcc>(1)  translates calls to B<alloca>()  with inlined code.  "
340 "This is not done when either the I<-ansi>, I<-std=c89>, I<-std=c99>, or the "
341 "I<-fno-builtin> option is given (and the header I<E<lt>alloca.hE<gt>> is not "
342 "included).  But beware! By default the glibc version of "
343 "I<E<lt>stdlib.hE<gt>> includes I<E<lt>alloca.hE<gt>> and that contains the "
344 "line:"
345 msgstr ""
346
347 #. type: Plain text
348 #: build/C/man3/alloca.3:125
349 #, no-wrap
350 msgid "    #define alloca(size)   __builtin_alloca (size)\n"
351 msgstr ""
352
353 #. type: Plain text
354 #: build/C/man3/alloca.3:128
355 msgid "with messy consequences if one has a private version of this function."
356 msgstr ""
357
358 #. type: Plain text
359 #: build/C/man3/alloca.3:132
360 msgid ""
361 "The fact that the code is inlined means that it is impossible to take the "
362 "address of this function, or to change its behavior by linking with a "
363 "different library."
364 msgstr ""
365
366 #. type: Plain text
367 #: build/C/man3/alloca.3:136
368 msgid ""
369 "The inlined code often consists of a single instruction adjusting the stack "
370 "pointer, and does not check for stack overflow.  Thus, there is no NULL "
371 "error return."
372 msgstr ""
373
374 #. type: SH
375 #: build/C/man3/alloca.3:136 build/C/man2/cacheflush.2:81 build/C/man3/mallopt.3:404 build/C/man2/mlock.2:305 build/C/man2/mmap.2:544 build/C/man3/mtrace.3:100 build/C/man2/posix_fadvise.2:177 build/C/man2/shmget.2:284
376 #, no-wrap
377 msgid "BUGS"
378 msgstr ""
379
380 #. type: Plain text
381 #: build/C/man3/alloca.3:141
382 msgid ""
383 "There is no error indication if the stack frame cannot be extended.  "
384 "(However, after a failed allocation, the program is likely to receive a "
385 "B<SIGSEGV> signal if it attempts to access the unallocated space.)"
386 msgstr ""
387
388 #. type: Plain text
389 #: build/C/man3/alloca.3:149
390 msgid ""
391 "On many systems B<alloca>()  cannot be used inside the list of arguments of "
392 "a function call, because the stack space reserved by B<alloca>()  would "
393 "appear on the stack in the middle of the space for the function arguments."
394 msgstr ""
395
396 #. type: SH
397 #: build/C/man3/alloca.3:149 build/C/man2/fallocate.2:191 build/C/man2/madvise.2:353 build/C/man3/malloc_hook.3:133 build/C/man3/mallopt.3:568 build/C/man2/mlock.2:330 build/C/man2/mmap.2:653 build/C/man2/mmap2.2:92 build/C/man2/mprotect.2:220 build/C/man2/mremap.2:200 build/C/man2/msync.2:118 build/C/man3/mtrace.3:165 build/C/man2/posix_fadvise.2:182 build/C/man3/posix_fallocate.3:126 build/C/man3/posix_memalign.3:270 build/C/man2/readahead.2:92 build/C/man2/remap_file_pages.2:155 build/C/man3/shm_open.3:269 build/C/man7/shm_overview.7:114 build/C/man2/shmctl.2:403 build/C/man2/shmget.2:290 build/C/man2/shmop.2:282 build/C/man2/subpage_prot.2:120 build/C/man2/sync_file_range.2:217 build/C/man3/malloc_get_state.3:109 build/C/man3/malloc_trim.3:76 build/C/man3/malloc_usable_size.3:60 build/C/man3/mcheck.3:204
398 #, no-wrap
399 msgid "SEE ALSO"
400 msgstr ""
401
402 #. type: Plain text
403 #: build/C/man3/alloca.3:153
404 msgid "B<brk>(2), B<longjmp>(3), B<malloc>(3)"
405 msgstr ""
406
407 #. type: TH
408 #: build/C/man2/cacheflush.2:24
409 #, no-wrap
410 msgid "CACHEFLUSH"
411 msgstr ""
412
413 #. type: TH
414 #: build/C/man2/cacheflush.2:24
415 #, no-wrap
416 msgid "2007-05-26"
417 msgstr ""
418
419 #. type: Plain text
420 #: build/C/man2/cacheflush.2:27
421 msgid "cacheflush - flush contents of instruction and/or data cache"
422 msgstr ""
423
424 #. type: Plain text
425 #: build/C/man2/cacheflush.2:30
426 #, no-wrap
427 msgid "B<#include E<lt>asm/cachectl.hE<gt>>\n"
428 msgstr ""
429
430 #. type: Plain text
431 #: build/C/man2/cacheflush.2:32
432 #, no-wrap
433 msgid "B<int cacheflush(char *>I<addr>B<, int >I<nbytes>B<, int >I<cache>B<);>\n"
434 msgstr ""
435
436 #. type: Plain text
437 #: build/C/man2/cacheflush.2:42
438 msgid ""
439 "B<cacheflush>()  flushes the contents of the indicated cache(s) for the user "
440 "addresses in the range I<addr> to I<(addr+nbytes-1)>.  I<cache> may be one "
441 "of:"
442 msgstr ""
443
444 #. type: TP
445 #: build/C/man2/cacheflush.2:42
446 #, no-wrap
447 msgid "B<ICACHE>"
448 msgstr ""
449
450 #. type: Plain text
451 #: build/C/man2/cacheflush.2:45
452 msgid "Flush the instruction cache."
453 msgstr ""
454
455 #. type: TP
456 #: build/C/man2/cacheflush.2:45
457 #, no-wrap
458 msgid "B<DCACHE>"
459 msgstr ""
460
461 #. type: Plain text
462 #: build/C/man2/cacheflush.2:48
463 msgid "Write back to memory and invalidate the affected valid cache lines."
464 msgstr ""
465
466 #. type: TP
467 #: build/C/man2/cacheflush.2:48
468 #, no-wrap
469 msgid "B<BCACHE>"
470 msgstr ""
471
472 #. type: Plain text
473 #: build/C/man2/cacheflush.2:52
474 msgid "Same as B<(ICACHE|DCACHE)>."
475 msgstr ""
476
477 #. type: Plain text
478 #: build/C/man2/cacheflush.2:58
479 msgid ""
480 "B<cacheflush>()  returns 0 on success or -1 on error.  If errors are "
481 "detected, I<errno> will indicate the error."
482 msgstr ""
483
484 #. type: TP
485 #: build/C/man2/cacheflush.2:59 build/C/man2/mmap2.2:62 build/C/man2/mremap.2:143 build/C/man2/shmctl.2:303 build/C/man2/subpage_prot.2:67
486 #, no-wrap
487 msgid "B<EFAULT>"
488 msgstr ""
489
490 #. type: Plain text
491 #: build/C/man2/cacheflush.2:66
492 msgid ""
493 "Some or all of the address range I<addr> to I<(addr+nbytes-1)> is not "
494 "accessible."
495 msgstr ""
496
497 #. type: TP
498 #: build/C/man2/cacheflush.2:66 build/C/man2/fallocate.2:124 build/C/man2/madvise.2:264 build/C/man2/mlock.2:158 build/C/man2/mlock.2:165 build/C/man2/mlock.2:177 build/C/man2/mmap.2:421 build/C/man2/mmap.2:429 build/C/man2/mmap.2:434 build/C/man2/mmap2.2:65 build/C/man2/mprotect.2:89 build/C/man2/mremap.2:152 build/C/man2/msync.2:80 build/C/man2/posix_fadvise.2:93 build/C/man3/posix_fallocate.3:79 build/C/man3/posix_memalign.3:156 build/C/man2/readahead.2:76 build/C/man2/remap_file_pages.2:130 build/C/man2/remap_file_pages.2:137 build/C/man3/shm_open.3:211 build/C/man2/shmctl.2:317 build/C/man2/shmget.2:196 build/C/man2/shmop.2:195 build/C/man2/shmop.2:218 build/C/man2/subpage_prot.2:72 build/C/man2/sync_file_range.2:152
499 #, no-wrap
500 msgid "B<EINVAL>"
501 msgstr ""
502
503 #. type: Plain text
504 #: build/C/man2/cacheflush.2:74
505 msgid "I<cache> is not one of B<ICACHE>, B<DCACHE>, or B<BCACHE>."
506 msgstr ""
507
508 #.  FIXME This system call was only on MIPS back in 1.2 days, but
509 #.  by now it is on a number of other architectures (but not i386).
510 #.  Investigate the details and update this page.
511 #.  Irix 6.5 appears to have a cacheflush() syscall -- mtk
512 #. type: Plain text
513 #: build/C/man2/cacheflush.2:81
514 msgid ""
515 "This Linux-specific system call is only available on MIPS-based systems.  It "
516 "should not be used in programs intended to be portable."
517 msgstr ""
518
519 #. type: Plain text
520 #: build/C/man2/cacheflush.2:88
521 msgid ""
522 "The current implementation ignores the I<addr> and I<nbytes> arguments.  "
523 "Therefore, the whole cache is always flushed."
524 msgstr ""
525
526 #. type: TH
527 #: build/C/man2/fallocate.2:8
528 #, no-wrap
529 msgid "FALLOCATE"
530 msgstr ""
531
532 #. type: TH
533 #: build/C/man2/fallocate.2:8
534 #, no-wrap
535 msgid "2012-04-23"
536 msgstr ""
537
538 #. type: Plain text
539 #: build/C/man2/fallocate.2:11
540 msgid "fallocate - manipulate file space"
541 msgstr ""
542
543 #. type: Plain text
544 #: build/C/man2/fallocate.2:15 build/C/man2/readahead.2:35
545 #, no-wrap
546 msgid ""
547 "B<#define _GNU_SOURCE>             /* See feature_test_macros(7) */\n"
548 "B<#include E<lt>fcntl.hE<gt>>\n"
549 msgstr ""
550
551 #. type: Plain text
552 #: build/C/man2/fallocate.2:18
553 #, no-wrap
554 msgid ""
555 "B<int fallocate(int >I<fd>B<, int >I<mode>B<, off_t >I<offset>B<, off_t "
556 ">I<len>B<);>\n"
557 msgstr ""
558
559 #. type: Plain text
560 #: build/C/man2/fallocate.2:24
561 msgid ""
562 "This is a nonportable, Linux-specific system call.  For the portable, "
563 "POSIX.1-specified method of ensuring that space is allocated for a file, see "
564 "B<posix_fallocate>(3)."
565 msgstr ""
566
567 #. type: Plain text
568 #: build/C/man2/fallocate.2:34
569 msgid ""
570 "B<fallocate>()  allows the caller to directly manipulate the allocated disk "
571 "space for the file referred to by I<fd> for the byte range starting at "
572 "I<offset> and continuing for I<len> bytes."
573 msgstr ""
574
575 #. type: Plain text
576 #: build/C/man2/fallocate.2:39
577 msgid ""
578 "The I<mode> argument determines the operation to be performed on the given "
579 "range.  Details of the supported operations are given in the subsections "
580 "below."
581 msgstr ""
582
583 #. type: SS
584 #: build/C/man2/fallocate.2:39
585 #, no-wrap
586 msgid "Allocating disk space"
587 msgstr ""
588
589 #. type: Plain text
590 #: build/C/man2/fallocate.2:58
591 msgid ""
592 "The default operation (i.e., I<mode> is zero) of B<fallocate>()  allocates "
593 "and initializes to zero the disk space within the range specified by "
594 "I<offset> and I<len>.  The file size (as reported by B<stat>(2))  will be "
595 "changed if I<offset>+I<len> is greater than the file size.  This default "
596 "behavior closely resembles the behavior of the B<posix_fallocate>(3)  "
597 "library function, and is intended as a method of optimally implementing that "
598 "function."
599 msgstr ""
600
601 #. type: Plain text
602 #: build/C/man2/fallocate.2:64
603 msgid ""
604 "After a successful call, subsequent writes into the range specified by "
605 "I<offset> and I<len> are guaranteed not to fail because of lack of disk "
606 "space."
607 msgstr ""
608
609 #. type: Plain text
610 #: build/C/man2/fallocate.2:75
611 msgid ""
612 "If the B<FALLOC_FL_KEEP_SIZE> flag is specified in I<mode>, the behavior of "
613 "the call is similar, but the file size will not be changed even if "
614 "I<offset>+I<len> is greater than the file size.  Preallocating zeroed blocks "
615 "beyond the end of the file in this manner is useful for optimizing append "
616 "workloads."
617 msgstr ""
618
619 #. type: Plain text
620 #: build/C/man2/fallocate.2:79
621 msgid ""
622 "Because allocation is done in block size chunks, B<fallocate>()  may "
623 "allocate a larger range of disk space than was specified."
624 msgstr ""
625
626 #. type: SS
627 #: build/C/man2/fallocate.2:79
628 #, no-wrap
629 msgid "Deallocating file space"
630 msgstr ""
631
632 #. type: Plain text
633 #: build/C/man2/fallocate.2:94
634 msgid ""
635 "Specifying the B<FALLOC_FL_PUNCH_HOLE> flag (available since Linux 2.6.38) "
636 "in I<mode> deallocates space (i.e., creates a hole)  in the byte range "
637 "starting at I<offset> and continuing for I<len> bytes.  Within the specified "
638 "range, partial file system blocks are zeroed, and whole file system blocks "
639 "are removed from the file.  After a successful call, subsequent reads from "
640 "this range will return zeroes."
641 msgstr ""
642
643 #. type: Plain text
644 #: build/C/man2/fallocate.2:105
645 msgid ""
646 "The B<FALLOC_FL_PUNCH_HOLE> flag must be ORed with B<FALLOC_FL_KEEP_SIZE> in "
647 "I<mode>; in other words, even when punching off the end of the file, the "
648 "file size (as reported by B<stat>(2))  does not change."
649 msgstr ""
650
651 #. type: Plain text
652 #: build/C/man2/fallocate.2:109
653 msgid ""
654 "Not all file systems support B<FALLOC_FL_PUNCH_HOLE>; if a file system "
655 "doesn't support the operation, an error is returned."
656 msgstr ""
657
658 #. type: Plain text
659 #: build/C/man2/fallocate.2:112
660 msgid "B<fallocate>()  returns zero on success, and -1 on failure."
661 msgstr ""
662
663 #. type: TP
664 #: build/C/man2/fallocate.2:113 build/C/man2/madvise.2:261 build/C/man2/mmap.2:415 build/C/man2/posix_fadvise.2:90 build/C/man3/posix_fallocate.3:71 build/C/man2/readahead.2:72 build/C/man2/sync_file_range.2:148
665 #, no-wrap
666 msgid "B<EBADF>"
667 msgstr ""
668
669 #. type: Plain text
670 #: build/C/man2/fallocate.2:117 build/C/man3/posix_fallocate.3:75
671 msgid "I<fd> is not a valid file descriptor, or is not opened for writing."
672 msgstr ""
673
674 #. type: TP
675 #: build/C/man2/fallocate.2:117 build/C/man3/posix_fallocate.3:75
676 #, no-wrap
677 msgid "B<EFBIG>"
678 msgstr ""
679
680 #. type: Plain text
681 #: build/C/man2/fallocate.2:121
682 msgid "I<offset>+I<len> exceeds the maximum file size."
683 msgstr ""
684
685 #. type: TP
686 #: build/C/man2/fallocate.2:121
687 #, no-wrap
688 msgid "B<EINTR>"
689 msgstr ""
690
691 #. type: Plain text
692 #: build/C/man2/fallocate.2:124
693 msgid "A signal was caught during execution."
694 msgstr ""
695
696 #. type: Plain text
697 #: build/C/man2/fallocate.2:136 build/C/man3/posix_fallocate.3:85
698 msgid "I<offset> was less than 0, or I<len> was less than or equal to 0."
699 msgstr ""
700
701 #. type: TP
702 #: build/C/man2/fallocate.2:136 build/C/man2/madvise.2:292 build/C/man2/sync_file_range.2:160
703 #, no-wrap
704 msgid "B<EIO>"
705 msgstr ""
706
707 #. type: Plain text
708 #: build/C/man2/fallocate.2:139
709 msgid "An I/O error occurred while reading from or writing to a file system."
710 msgstr ""
711
712 #. type: TP
713 #: build/C/man2/fallocate.2:139 build/C/man2/mmap.2:450 build/C/man3/posix_fallocate.3:85
714 #, no-wrap
715 msgid "B<ENODEV>"
716 msgstr ""
717
718 #. type: Plain text
719 #: build/C/man2/fallocate.2:146
720 msgid ""
721 "I<fd> does not refer to a regular file or a directory.  (If I<fd> is a pipe "
722 "or FIFO, a different error results.)"
723 msgstr ""
724
725 #. type: TP
726 #: build/C/man2/fallocate.2:146 build/C/man3/posix_fallocate.3:89 build/C/man2/shmget.2:214 build/C/man2/sync_file_range.2:166
727 #, no-wrap
728 msgid "B<ENOSPC>"
729 msgstr ""
730
731 #. type: Plain text
732 #: build/C/man2/fallocate.2:151 build/C/man3/posix_fallocate.3:94
733 msgid ""
734 "There is not enough space left on the device containing the file referred to "
735 "by I<fd>."
736 msgstr ""
737
738 #. type: Plain text
739 #: build/C/man2/fallocate.2:155
740 msgid "This kernel does not implement B<fallocate>()."
741 msgstr ""
742
743 #. type: TP
744 #: build/C/man2/fallocate.2:155
745 #, no-wrap
746 msgid "B<EOPNOTSUPP>"
747 msgstr ""
748
749 #. type: Plain text
750 #: build/C/man2/fallocate.2:164
751 msgid ""
752 "The file system containing the file referred to by I<fd> does not support "
753 "this operation; or the I<mode> is not supported by the file system "
754 "containing the file referred to by I<fd>."
755 msgstr ""
756
757 #. type: TP
758 #: build/C/man2/fallocate.2:164 build/C/man2/mlock.2:144 build/C/man2/mlock.2:183 build/C/man2/mmap.2:458 build/C/man2/shmctl.2:342 build/C/man2/shmget.2:222
759 #, no-wrap
760 msgid "B<EPERM>"
761 msgstr ""
762
763 #. type: Plain text
764 #: build/C/man2/fallocate.2:180
765 msgid ""
766 "The file referred to by I<fd> is marked immutable (see B<chattr>(1)).  Or: "
767 "I<mode> specifies B<FALLOC_FL_PUNCH_HOLE> and the file referred to by I<fd> "
768 "is marked append-only (see B<chattr>(1))."
769 msgstr ""
770
771 #. type: TP
772 #: build/C/man2/fallocate.2:180 build/C/man2/posix_fadvise.2:96 build/C/man3/posix_fallocate.3:94 build/C/man2/sync_file_range.2:169
773 #, no-wrap
774 msgid "B<ESPIPE>"
775 msgstr ""
776
777 #. type: Plain text
778 #: build/C/man2/fallocate.2:184
779 msgid "I<fd> refers to a pipe or FIFO."
780 msgstr ""
781
782 #. type: SH
783 #: build/C/man2/fallocate.2:184 build/C/man2/mmap2.2:74 build/C/man2/posix_fadvise.2:103 build/C/man3/posix_fallocate.3:98 build/C/man3/posix_memalign.3:165 build/C/man2/readahead.2:82 build/C/man2/remap_file_pages.2:146 build/C/man3/shm_open.3:247 build/C/man2/subpage_prot.2:85 build/C/man2/sync_file_range.2:177 build/C/man3/mcheck.3:133
784 #, no-wrap
785 msgid "VERSIONS"
786 msgstr ""
787
788 #. type: Plain text
789 #: build/C/man2/fallocate.2:188
790 msgid ""
791 "B<fallocate>()  is available on Linux since kernel 2.6.23.  Support is "
792 "provided by glibc since version 2.10."
793 msgstr ""
794
795 #. type: Plain text
796 #: build/C/man2/fallocate.2:191
797 msgid "B<fallocate>()  is Linux-specific."
798 msgstr ""
799
800 #. type: Plain text
801 #: build/C/man2/fallocate.2:195
802 msgid "B<ftruncate>(2), B<posix_fadvise>(3), B<posix_fallocate>(3)"
803 msgstr ""
804
805 #. type: TH
806 #: build/C/man2/madvise.2:35
807 #, no-wrap
808 msgid "MADVISE"
809 msgstr ""
810
811 #. type: TH
812 #: build/C/man2/madvise.2:35
813 #, no-wrap
814 msgid "2011-09-18"
815 msgstr ""
816
817 #. type: Plain text
818 #: build/C/man2/madvise.2:38
819 msgid "madvise - give advice about use of memory"
820 msgstr ""
821
822 #. type: Plain text
823 #: build/C/man2/madvise.2:40 build/C/man2/msync.2:30 build/C/man3/shm_open.3:31
824 msgid "B<#include E<lt>sys/mman.hE<gt>>"
825 msgstr ""
826
827 #. type: Plain text
828 #: build/C/man2/madvise.2:42
829 msgid "B<int madvise(void *>I<addr>B<, size_t >I<length>B<, int >I<advice>B<);>"
830 msgstr ""
831
832 #. type: Plain text
833 #: build/C/man2/madvise.2:46 build/C/man2/posix_fadvise.2:42 build/C/man3/posix_fallocate.3:37 build/C/man3/posix_memalign.3:48
834 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
835 msgstr ""
836
837 #. type: Plain text
838 #: build/C/man2/madvise.2:50
839 msgid "B<madvise>(): _BSD_SOURCE"
840 msgstr ""
841
842 #. type: Plain text
843 #: build/C/man2/madvise.2:68
844 msgid ""
845 "The B<madvise>()  system call advises the kernel about how to handle paging "
846 "input/output in the address range beginning at address I<addr> and with size "
847 "I<length> bytes.  It allows an application to tell the kernel how it expects "
848 "to use some mapped or shared memory areas, so that the kernel can choose "
849 "appropriate read-ahead and caching techniques.  This call does not influence "
850 "the semantics of the application (except in the case of B<MADV_DONTNEED>), "
851 "but may influence its performance.  The kernel is free to ignore the advice."
852 msgstr ""
853
854 #. type: Plain text
855 #: build/C/man2/madvise.2:72
856 msgid "The advice is indicated in the I<advice> argument which can be"
857 msgstr ""
858
859 #. type: TP
860 #: build/C/man2/madvise.2:72
861 #, no-wrap
862 msgid "B<MADV_NORMAL>"
863 msgstr ""
864
865 #. type: Plain text
866 #: build/C/man2/madvise.2:76
867 msgid "No special treatment.  This is the default."
868 msgstr ""
869
870 #. type: TP
871 #: build/C/man2/madvise.2:76
872 #, no-wrap
873 msgid "B<MADV_RANDOM>"
874 msgstr ""
875
876 #. type: Plain text
877 #: build/C/man2/madvise.2:80
878 msgid ""
879 "Expect page references in random order.  (Hence, read ahead may be less "
880 "useful than normally.)"
881 msgstr ""
882
883 #. type: TP
884 #: build/C/man2/madvise.2:80
885 #, no-wrap
886 msgid "B<MADV_SEQUENTIAL>"
887 msgstr ""
888
889 #. type: Plain text
890 #: build/C/man2/madvise.2:85
891 msgid ""
892 "Expect page references in sequential order.  (Hence, pages in the given "
893 "range can be aggressively read ahead, and may be freed soon after they are "
894 "accessed.)"
895 msgstr ""
896
897 #. type: TP
898 #: build/C/man2/madvise.2:85
899 #, no-wrap
900 msgid "B<MADV_WILLNEED>"
901 msgstr ""
902
903 #. type: Plain text
904 #: build/C/man2/madvise.2:89
905 msgid ""
906 "Expect access in the near future.  (Hence, it might be a good idea to read "
907 "some pages ahead.)"
908 msgstr ""
909
910 #. type: TP
911 #: build/C/man2/madvise.2:89
912 #, no-wrap
913 msgid "B<MADV_DONTNEED>"
914 msgstr ""
915
916 #. type: Plain text
917 #: build/C/man2/madvise.2:100
918 msgid ""
919 "Do not expect access in the near future.  (For the time being, the "
920 "application is finished with the given range, so the kernel can free "
921 "resources associated with it.)  Subsequent accesses of pages in this range "
922 "will succeed, but will result either in reloading of the memory contents "
923 "from the underlying mapped file (see B<mmap>(2))  or zero-fill-on-demand "
924 "pages for mappings without an underlying file."
925 msgstr ""
926
927 #. type: TP
928 #: build/C/man2/madvise.2:100
929 #, no-wrap
930 msgid "B<MADV_REMOVE> (Since Linux 2.6.16)"
931 msgstr ""
932
933 #.  2.6.18-rc5
934 #.  Databases want to use this feature to drop a section of their
935 #.  bufferpool (shared memory segments) - without writing back to
936 #.  disk/swap space.  This feature is also useful for supporting
937 #.  hot-plug memory on UML.
938 #. type: Plain text
939 #: build/C/man2/madvise.2:113
940 msgid ""
941 "Free up a given range of pages and its associated backing store.  Currently, "
942 "only shmfs/tmpfs supports this; other file systems return with the error "
943 "B<ENOSYS>."
944 msgstr ""
945
946 #. type: TP
947 #: build/C/man2/madvise.2:113
948 #, no-wrap
949 msgid "B<MADV_DONTFORK> (Since Linux 2.6.16)"
950 msgstr ""
951
952 #.  See http://lwn.net/Articles/171941/
953 #.  [PATCH] madvise MADV_DONTFORK/MADV_DOFORK
954 #.  Currently, copy-on-write may change the physical address of
955 #.  a page even if the user requested that the page is pinned in
956 #.  memory (either by mlock or by get_user_pages).  This happens
957 #.  if the process forks meanwhile, and the parent writes to that
958 #.  page.  As a result, the page is orphaned: in case of
959 #.  get_user_pages, the application will never see any data hardware
960 #.  DMA's into this page after the COW.  In case of mlock'd memory,
961 #.  the parent is not getting the realtime/security benefits of mlock.
962 #
963 #.  In particular, this affects the Infiniband modules which do DMA from
964 #.  and into user pages all the time.
965 #
966 #.  This patch adds madvise options to control whether memory range is
967 #.  inherited across fork. Useful e.g. for when hardware is doing DMA
968 #.  from/into these pages.  Could also be useful to an application
969 #.  wanting to speed up its forks by cutting large areas out of
970 #.  consideration.
971 #
972 #.  SEE ALSO: http://lwn.net/Articles/171941/
973 #.  "Tweaks to madvise() and posix_fadvise()", 14 Feb 2006
974 #. type: Plain text
975 #: build/C/man2/madvise.2:144
976 msgid ""
977 "Do not make the pages in this range available to the child after a "
978 "B<fork>(2).  This is useful to prevent copy-on-write semantics from changing "
979 "the physical location of a page(s) if the parent writes to it after a "
980 "B<fork>(2).  (Such page relocations cause problems for hardware that DMAs "
981 "into the page(s).)"
982 msgstr ""
983
984 #. type: TP
985 #: build/C/man2/madvise.2:144
986 #, no-wrap
987 msgid "B<MADV_DOFORK> (Since Linux 2.6.16)"
988 msgstr ""
989
990 #. type: Plain text
991 #: build/C/man2/madvise.2:150
992 msgid ""
993 "Undo the effect of B<MADV_DONTFORK>, restoring the default behavior, whereby "
994 "a mapping is inherited across B<fork>(2)."
995 msgstr ""
996
997 #. type: TP
998 #: build/C/man2/madvise.2:150
999 #, no-wrap
1000 msgid "B<MADV_HWPOISON> (Since Linux 2.6.32)"
1001 msgstr ""
1002
1003 #. type: Plain text
1004 #: build/C/man2/madvise.2:162
1005 msgid ""
1006 "Poison a page and handle it like a hardware memory corruption.  This "
1007 "operation is only available for privileged (B<CAP_SYS_ADMIN>)  processes.  "
1008 "This operation may result in the calling process receiving a B<SIGBUS> and "
1009 "the page being unmapped.  This feature is intended for testing of memory "
1010 "error-handling code; it is only available if the kernel was configured with "
1011 "B<CONFIG_MEMORY_FAILURE>."
1012 msgstr ""
1013
1014 #. type: TP
1015 #: build/C/man2/madvise.2:162
1016 #, no-wrap
1017 msgid "B<MADV_SOFT_OFFLINE> (Since Linux 2.6.33)"
1018 msgstr ""
1019
1020 #. type: Plain text
1021 #: build/C/man2/madvise.2:180
1022 msgid ""
1023 "Soft offline the pages in the range specified by I<addr> and I<length>.  The "
1024 "memory of each page in the specified range is preserved (i.e., when next "
1025 "accessed, the same content will be visible, but in a new physical page "
1026 "frame), and the original page is offlined (i.e., no longer used, and taken "
1027 "out of normal memory management).  The effect of the B<MADV_SOFT_OFFLINE> "
1028 "operation is invisible to (i.e., does not change the semantics of)  the "
1029 "calling process.  This feature is intended for testing of memory "
1030 "error-handling code; it is only available if the kernel was configured with "
1031 "B<CONFIG_MEMORY_FAILURE>."
1032 msgstr ""
1033
1034 #. type: TP
1035 #: build/C/man2/madvise.2:180
1036 #, no-wrap
1037 msgid "B<MADV_MERGEABLE> (since Linux 2.6.32)"
1038 msgstr ""
1039
1040 #. type: Plain text
1041 #: build/C/man2/madvise.2:205
1042 msgid ""
1043 "Enable Kernel Samepage Merging (KSM) for the pages in the range specified by "
1044 "I<addr> and I<length>.  The kernel regularly scans those areas of user "
1045 "memory that have been marked as mergeable, looking for pages with identical "
1046 "content.  These are replaced by a single write-protected page (which is "
1047 "automatically copied if a process later wants to update the content of the "
1048 "page).  KSM only merges private anonymous pages (see B<mmap>(2)).  The KSM "
1049 "feature is intended for applications that generate many instances of the "
1050 "same data (e.g., virtualization systems such as KVM).  It can consume a lot "
1051 "of processing power; use with care.  See the kernel source file "
1052 "I<Documentation/vm/ksm.txt> for more details.  The B<MADV_MERGEABLE> and "
1053 "B<MADV_UNMERGEABLE> operations are only available if the kernel was "
1054 "configured with B<CONFIG_KSM>."
1055 msgstr ""
1056
1057 #. type: TP
1058 #: build/C/man2/madvise.2:205
1059 #, no-wrap
1060 msgid "B<MADV_UNMERGEABLE> (since Linux 2.6.32)"
1061 msgstr ""
1062
1063 #. type: Plain text
1064 #: build/C/man2/madvise.2:214
1065 msgid ""
1066 "Undo the effect of an earlier B<MADV_MERGEABLE> operation on the specified "
1067 "address range; KSM unmerges whatever pages it had merged in the address "
1068 "range specified by I<addr> and I<length>."
1069 msgstr ""
1070
1071 #. type: TP
1072 #: build/C/man2/madvise.2:214
1073 #, no-wrap
1074 msgid "B<MADV_HUGEPAGE> (since Linux 2.6.38)"
1075 msgstr ""
1076
1077 #.  http://lwn.net/Articles/358904/
1078 #.  https://lwn.net/Articles/423584/
1079 #. type: Plain text
1080 #: build/C/man2/madvise.2:243
1081 msgid ""
1082 "Enables Transparent Huge Pages (THP) for pages in the range specified by "
1083 "I<addr> and I<length>.  Currently, Transparent Huge Pages only work with "
1084 "private anonymous pages (see B<mmap>(2)).  The kernel will regularly scan "
1085 "the areas marked as huge page candidates to replace them with huge pages.  "
1086 "The kernel will also allocate huge pages directly when the region is "
1087 "naturally aligned to the huge page size (see B<posix_memalign>(2)).  This "
1088 "feature is primarily aimed at applications that use large mappings of data "
1089 "and access large regions of that memory at a time (e.g. virtualization "
1090 "systems such as QEMU).  It can very easily waste memory (e.g. a 2MB mapping "
1091 "that only ever accesses 1 byte will result in 2MB of wired memory instead of "
1092 "one 4KB page).  See the kernel source file I<Documentation/vm/transhuge.txt> "
1093 "for more details.  The B<MADV_HUGEPAGE> and B<MADV_NOHUGEPAGE> operations "
1094 "are only available if the kernel was configured with "
1095 "B<CONFIG_TRANSPARENT_HUGEPAGE>."
1096 msgstr ""
1097
1098 #. type: TP
1099 #: build/C/man2/madvise.2:243
1100 #, no-wrap
1101 msgid "B<MADV_NOHUGEPAGE> (since Linux 2.6.38)"
1102 msgstr ""
1103
1104 #. type: Plain text
1105 #: build/C/man2/madvise.2:250
1106 msgid ""
1107 "Ensures that memory in the address range specified by I<addr> and I<length> "
1108 "will not be collapsed into huge pages."
1109 msgstr ""
1110
1111 #. type: Plain text
1112 #: build/C/man2/madvise.2:257
1113 msgid ""
1114 "On success B<madvise>()  returns zero.  On error, it returns -1 and I<errno> "
1115 "is set appropriately."
1116 msgstr ""
1117
1118 #. type: TP
1119 #: build/C/man2/madvise.2:258 build/C/man2/mlock.2:155 build/C/man2/mmap.2:411 build/C/man2/mremap.2:137
1120 #, no-wrap
1121 msgid "B<EAGAIN>"
1122 msgstr ""
1123
1124 #. type: Plain text
1125 #: build/C/man2/madvise.2:261
1126 msgid "A kernel resource was temporarily unavailable."
1127 msgstr ""
1128
1129 #. type: Plain text
1130 #: build/C/man2/madvise.2:264
1131 msgid "The map exists, but the area maps something that isn't a file."
1132 msgstr ""
1133
1134 #. type: Plain text
1135 #: build/C/man2/madvise.2:267
1136 msgid "This error can occur for the following reasons:"
1137 msgstr ""
1138
1139 #. type: IP
1140 #: build/C/man2/madvise.2:268 build/C/man2/madvise.2:274 build/C/man2/madvise.2:277 build/C/man2/madvise.2:280 build/C/man2/madvise.2:283 build/C/man3/mallopt.3:233 build/C/man3/mallopt.3:239
1141 #, no-wrap
1142 msgid "*"
1143 msgstr ""
1144
1145 #.  .I len
1146 #.  is zero,
1147 #. type: Plain text
1148 #: build/C/man2/madvise.2:274
1149 msgid "The value I<len> is negative."
1150 msgstr ""
1151
1152 #. type: Plain text
1153 #: build/C/man2/madvise.2:277
1154 msgid "I<addr> is not page-aligned."
1155 msgstr ""
1156
1157 #. type: Plain text
1158 #: build/C/man2/madvise.2:280
1159 msgid "I<advice> is not a valid value"
1160 msgstr ""
1161
1162 #. type: Plain text
1163 #: build/C/man2/madvise.2:283
1164 msgid ""
1165 "The application is attempting to release locked or shared pages (with "
1166 "B<MADV_DONTNEED>)."
1167 msgstr ""
1168
1169 #. type: Plain text
1170 #: build/C/man2/madvise.2:291
1171 msgid ""
1172 "B<MADV_MERGEABLE> or B<MADV_UNMERGEABLE> was specified in I<advice>, but the "
1173 "kernel was not configured with B<CONFIG_KSM>."
1174 msgstr ""
1175
1176 #. type: Plain text
1177 #: build/C/man2/madvise.2:298
1178 msgid ""
1179 "(for B<MADV_WILLNEED>)  Paging in this area would exceed the process's "
1180 "maximum resident set size."
1181 msgstr ""
1182
1183 #. type: TP
1184 #: build/C/man2/madvise.2:298 build/C/man2/madvise.2:303 build/C/man2/mlock.2:124 build/C/man2/mlock.2:132 build/C/man2/mlock.2:170 build/C/man2/mmap.2:454 build/C/man2/mprotect.2:94 build/C/man2/mprotect.2:97 build/C/man2/mremap.2:180 build/C/man2/msync.2:93 build/C/man3/posix_memalign.3:162 build/C/man2/shmctl.2:326 build/C/man2/shmget.2:211 build/C/man2/shmop.2:209 build/C/man2/subpage_prot.2:82 build/C/man2/sync_file_range.2:163
1185 #, no-wrap
1186 msgid "B<ENOMEM>"
1187 msgstr ""
1188
1189 #. type: Plain text
1190 #: build/C/man2/madvise.2:303
1191 msgid "(for B<MADV_WILLNEED>)  Not enough memory: paging in failed."
1192 msgstr ""
1193
1194 #. type: Plain text
1195 #: build/C/man2/madvise.2:307
1196 msgid ""
1197 "Addresses in the specified range are not currently mapped, or are outside "
1198 "the address space of the process."
1199 msgstr ""
1200
1201 #.  FIXME . Write a posix_fadvise(3) page.
1202 #. type: Plain text
1203 #: build/C/man2/madvise.2:319
1204 msgid ""
1205 "POSIX.1b.  POSIX.1-2001 describes B<posix_madvise>(3)  with constants "
1206 "B<POSIX_MADV_NORMAL>, etc., with a behavior close to that described here.  "
1207 "There is a similar B<posix_fadvise>(2)  for file access."
1208 msgstr ""
1209
1210 #. type: Plain text
1211 #: build/C/man2/madvise.2:328
1212 msgid ""
1213 "B<MADV_REMOVE>, B<MADV_DONTFORK>, B<MADV_DOFORK>, B<MADV_HWPOISON>, "
1214 "B<MADV_MERGEABLE>, and B<MADV_UNMERGEABLE> are Linux-specific."
1215 msgstr ""
1216
1217 #. type: SS
1218 #: build/C/man2/madvise.2:329 build/C/man2/mlock.2:268 build/C/man2/shmget.2:278
1219 #, no-wrap
1220 msgid "Linux Notes"
1221 msgstr ""
1222
1223 #. type: Plain text
1224 #: build/C/man2/madvise.2:337
1225 msgid ""
1226 "The current Linux implementation (2.4.0) views this system call more as a "
1227 "command than as advice and hence may return an error when it cannot do what "
1228 "it usually would do in response to this advice.  (See the ERRORS description "
1229 "above.)  This is nonstandard behavior."
1230 msgstr ""
1231
1232 #.  .SH HISTORY
1233 #.  The
1234 #.  .BR madvise ()
1235 #.  function first appeared in 4.4BSD.
1236 #. type: Plain text
1237 #: build/C/man2/madvise.2:353
1238 msgid ""
1239 "The Linux implementation requires that the address I<addr> be page-aligned, "
1240 "and allows I<length> to be zero.  If there are some parts of the specified "
1241 "address range that are not mapped, the Linux version of B<madvise>()  "
1242 "ignores them and applies the call to the rest (but returns B<ENOMEM> from "
1243 "the system call, as it should)."
1244 msgstr ""
1245
1246 #. type: Plain text
1247 #: build/C/man2/madvise.2:360
1248 msgid ""
1249 "B<getrlimit>(2), B<mincore>(2), B<mmap>(2), B<mprotect>(2), B<msync>(2), "
1250 "B<munmap>(2)"
1251 msgstr ""
1252
1253 #. type: TH
1254 #: build/C/man3/malloc_hook.3:6
1255 #, no-wrap
1256 msgid "MALLOC_HOOK"
1257 msgstr ""
1258
1259 #. type: TH
1260 #: build/C/man3/malloc_hook.3:6
1261 #, no-wrap
1262 msgid "2010-10-13"
1263 msgstr ""
1264
1265 #. type: Plain text
1266 #: build/C/man3/malloc_hook.3:11
1267 msgid ""
1268 "__malloc_hook, __malloc_initialize_hook, __memalign_hook, __free_hook, "
1269 "__realloc_hook, __after_morecore_hook - malloc debugging variables"
1270 msgstr ""
1271
1272 #. type: Plain text
1273 #: build/C/man3/malloc_hook.3:14 build/C/man3/posix_memalign.3:40
1274 #, no-wrap
1275 msgid "B<#include E<lt>malloc.hE<gt>>\n"
1276 msgstr ""
1277
1278 #. type: Plain text
1279 #: build/C/man3/malloc_hook.3:16
1280 #, no-wrap
1281 msgid "B<void *(*__malloc_hook)(size_t >I<size>B<, const void *>I<caller>B<);>\n"
1282 msgstr ""
1283
1284 #. type: Plain text
1285 #: build/C/man3/malloc_hook.3:19
1286 #, no-wrap
1287 msgid ""
1288 "B<void *(*__realloc_hook)(void *>I<ptr>B<, size_t >I<size>B<, const void "
1289 "*>I<caller>B<);>\n"
1290 msgstr ""
1291
1292 #. type: Plain text
1293 #: build/C/man3/malloc_hook.3:22
1294 #, no-wrap
1295 msgid ""
1296 "B<void *(*__memalign_hook)(size_t >I<alignment>B<, size_t >I<size>B<,>\n"
1297 "B<                         const void *>I<caller>B<);>\n"
1298 msgstr ""
1299
1300 #. type: Plain text
1301 #: build/C/man3/malloc_hook.3:24
1302 #, no-wrap
1303 msgid "B<void (*__free_hook)(void *>I<ptr>B<, const void *>I<caller>B<);>\n"
1304 msgstr ""
1305
1306 #. type: Plain text
1307 #: build/C/man3/malloc_hook.3:26
1308 #, no-wrap
1309 msgid "B<void (*__malloc_initialize_hook)(void);>\n"
1310 msgstr ""
1311
1312 #. type: Plain text
1313 #: build/C/man3/malloc_hook.3:28
1314 #, no-wrap
1315 msgid "B<void (*__after_morecore_hook)(void);>\n"
1316 msgstr ""
1317
1318 #. type: Plain text
1319 #: build/C/man3/malloc_hook.3:39
1320 msgid ""
1321 "The GNU C library lets you modify the behavior of B<malloc>(3), "
1322 "B<realloc>(3), and B<free>(3)  by specifying appropriate hook functions.  "
1323 "You can use these hooks to help you debug programs that use dynamic memory "
1324 "allocation, for example."
1325 msgstr ""
1326
1327 #. type: Plain text
1328 #: build/C/man3/malloc_hook.3:46
1329 msgid ""
1330 "The variable B<__malloc_initialize_hook> points at a function that is called "
1331 "once when the malloc implementation is initialized.  This is a weak "
1332 "variable, so it can be overridden in the application with a definition like "
1333 "the following:"
1334 msgstr ""
1335
1336 #. type: Plain text
1337 #: build/C/man3/malloc_hook.3:49
1338 #, no-wrap
1339 msgid "    void (*__malloc_initialize_hook)(void) = my_init_hook;\n"
1340 msgstr ""
1341
1342 #. type: Plain text
1343 #: build/C/man3/malloc_hook.3:54
1344 msgid "Now the function I<my_init_hook>()  can do the initialization of all hooks."
1345 msgstr ""
1346
1347 #. type: Plain text
1348 #: build/C/man3/malloc_hook.3:70
1349 msgid ""
1350 "The four functions pointed to by B<__malloc_hook>, B<__realloc_hook>, "
1351 "B<__memalign_hook>, B<__free_hook> have a prototype like the functions "
1352 "B<malloc>(3), B<realloc>(3), B<memalign>(3), B<free>(3), respectively, "
1353 "except that they have a final argument I<caller> that gives the address of "
1354 "the caller of B<malloc>(3), etc."
1355 msgstr ""
1356
1357 #. type: Plain text
1358 #: build/C/man3/malloc_hook.3:76
1359 msgid ""
1360 "The variable B<__after_morecore_hook> points at a function that is called "
1361 "each time after B<sbrk>(2)  was asked for more memory."
1362 msgstr ""
1363
1364 #. type: Plain text
1365 #: build/C/man3/malloc_hook.3:78 build/C/man3/mtrace.3:78 build/C/man3/malloc_get_state.3:86 build/C/man3/mcheck.3:146
1366 msgid "These functions are GNU extensions."
1367 msgstr ""
1368
1369 #.  https://bugzilla.redhat.com/show_bug.cgi?id=450187
1370 #.  http://sourceware.org/bugzilla/show_bug.cgi?id=9957
1371 #. type: Plain text
1372 #: build/C/man3/malloc_hook.3:85
1373 msgid ""
1374 "The use of these hook functions is not safe in multithreaded programs, and "
1375 "they are now deprecated.  Programmers should instead preempt calls to the "
1376 "relevant functions by defining and exporting functions such as \"malloc\" "
1377 "and \"free\"."
1378 msgstr ""
1379
1380 #. type: SH
1381 #: build/C/man3/malloc_hook.3:85 build/C/man3/mallopt.3:464 build/C/man2/mmap.2:571 build/C/man2/mprotect.2:142 build/C/man3/mtrace.3:106 build/C/man3/mcheck.3:159
1382 #, no-wrap
1383 msgid "EXAMPLE"
1384 msgstr ""
1385
1386 #. type: Plain text
1387 #: build/C/man3/malloc_hook.3:87
1388 msgid "Here is a short example of how to use these variables."
1389 msgstr ""
1390
1391 #. type: Plain text
1392 #: build/C/man3/malloc_hook.3:91
1393 #, no-wrap
1394 msgid ""
1395 "#include E<lt>stdio.hE<gt>\n"
1396 "#include E<lt>malloc.hE<gt>\n"
1397 msgstr ""
1398
1399 #. type: Plain text
1400 #: build/C/man3/malloc_hook.3:95
1401 #, no-wrap
1402 msgid ""
1403 "/* Prototypes for our hooks.  */\n"
1404 "static void my_init_hook(void);\n"
1405 "static void *my_malloc_hook(size_t, const void *);\n"
1406 msgstr ""
1407
1408 #. type: Plain text
1409 #: build/C/man3/malloc_hook.3:98
1410 #, no-wrap
1411 msgid ""
1412 "/* Variables to save original hooks. */\n"
1413 "static void *(*old_malloc_hook)(size_t, const void *);\n"
1414 msgstr ""
1415
1416 #. type: Plain text
1417 #: build/C/man3/malloc_hook.3:101
1418 #, no-wrap
1419 msgid ""
1420 "/* Override initializing hook from the C library. */\n"
1421 "void (*__malloc_initialize_hook) (void) = my_init_hook;\n"
1422 msgstr ""
1423
1424 #. type: Plain text
1425 #: build/C/man3/malloc_hook.3:108
1426 #, no-wrap
1427 msgid ""
1428 "static void\n"
1429 "my_init_hook(void)\n"
1430 "{\n"
1431 "    old_malloc_hook = __malloc_hook;\n"
1432 "    __malloc_hook = my_malloc_hook;\n"
1433 "}\n"
1434 msgstr ""
1435
1436 #. type: Plain text
1437 #: build/C/man3/malloc_hook.3:113
1438 #, no-wrap
1439 msgid ""
1440 "static void *\n"
1441 "my_malloc_hook(size_t size, const void *caller)\n"
1442 "{\n"
1443 "    void *result;\n"
1444 msgstr ""
1445
1446 #. type: Plain text
1447 #: build/C/man3/malloc_hook.3:116
1448 #, no-wrap
1449 msgid ""
1450 "    /* Restore all old hooks */\n"
1451 "    __malloc_hook = old_malloc_hook;\n"
1452 msgstr ""
1453
1454 #. type: Plain text
1455 #: build/C/man3/malloc_hook.3:119
1456 #, no-wrap
1457 msgid ""
1458 "    /* Call recursively */\n"
1459 "    result = malloc(size);\n"
1460 msgstr ""
1461
1462 #. type: Plain text
1463 #: build/C/man3/malloc_hook.3:122
1464 #, no-wrap
1465 msgid ""
1466 "    /* Save underlying hooks */\n"
1467 "    old_malloc_hook = __malloc_hook;\n"
1468 msgstr ""
1469
1470 #. type: Plain text
1471 #: build/C/man3/malloc_hook.3:126
1472 #, no-wrap
1473 msgid ""
1474 "    /* printf() might call malloc(), so protect it too. */\n"
1475 "    printf(\"malloc(%u) called from %p returns %p\\en\",\n"
1476 "            (unsigned int) size, caller, result);\n"
1477 msgstr ""
1478
1479 #. type: Plain text
1480 #: build/C/man3/malloc_hook.3:129
1481 #, no-wrap
1482 msgid ""
1483 "    /* Restore our own hooks */\n"
1484 "    __malloc_hook = my_malloc_hook;\n"
1485 msgstr ""
1486
1487 #. type: Plain text
1488 #: build/C/man3/malloc_hook.3:132
1489 #, no-wrap
1490 msgid ""
1491 "    return result;\n"
1492 "}\n"
1493 msgstr ""
1494
1495 #. type: Plain text
1496 #: build/C/man3/malloc_hook.3:138
1497 msgid "B<mallinfo>(3), B<malloc>(3), B<mcheck>(3), B<mtrace>(3)"
1498 msgstr ""
1499
1500 #. type: TH
1501 #: build/C/man3/mallopt.3:24
1502 #, no-wrap
1503 msgid "MALLOPT"
1504 msgstr ""
1505
1506 #. type: TH
1507 #: build/C/man3/mallopt.3:24 build/C/man3/mtrace.3:23 build/C/man3/mcheck.3:23
1508 #, no-wrap
1509 msgid "2012-04-18"
1510 msgstr ""
1511
1512 #. type: Plain text
1513 #: build/C/man3/mallopt.3:27
1514 msgid "mallopt - set memory allocation parameters"
1515 msgstr ""
1516
1517 #. type: Plain text
1518 #: build/C/man3/mallopt.3:29 build/C/man3/malloc_trim.3:29 build/C/man3/malloc_usable_size.3:28
1519 msgid "B<#include E<lt>malloc.hE<gt>>"
1520 msgstr ""
1521
1522 #. type: Plain text
1523 #: build/C/man3/mallopt.3:31
1524 msgid "B<int mallopt(int >I<param>B<, int >I<value>B<);>"
1525 msgstr ""
1526
1527 #. type: Plain text
1528 #: build/C/man3/mallopt.3:42
1529 msgid ""
1530 "The B<mallopt>()  function adjusts parameters that control the behavior of "
1531 "the memory-allocation functions (see B<malloc>(3)).  The I<param> argument "
1532 "specifies the parameter to be modified, and I<value> specifies the new value "
1533 "for that parameter."
1534 msgstr ""
1535
1536 #. type: Plain text
1537 #: build/C/man3/mallopt.3:45
1538 msgid "The following values can be specified for I<param>:"
1539 msgstr ""
1540
1541 #. type: TP
1542 #: build/C/man3/mallopt.3:45
1543 #, no-wrap
1544 msgid "B<M_CHECK_ACTION>"
1545 msgstr ""
1546
1547 #. type: Plain text
1548 #: build/C/man3/mallopt.3:51
1549 msgid ""
1550 "Setting this parameter controls how glibc responds when various kinds of "
1551 "programming errors are detected (e.g., freeing the same pointer twice).  The "
1552 "3 least significant bits (2, 1, and 0) of the value assigned to this "
1553 "parameter determine the glibc behavior, as follows:"
1554 msgstr ""
1555
1556 #. type: TP
1557 #: build/C/man3/mallopt.3:52
1558 #, no-wrap
1559 msgid "Bit 0"
1560 msgstr ""
1561
1562 #. type: Plain text
1563 #: build/C/man3/mallopt.3:62
1564 msgid ""
1565 "If this bit is set, then print a one-line message on I<stderr> that provides "
1566 "details about the error.  The message starts with the string \"***\\ glibc "
1567 "detected\\ ***\", followed by the program name, the name of the "
1568 "memory-allocation function in which the error was detected, a brief "
1569 "description of the error, and the memory address where the error was "
1570 "detected."
1571 msgstr ""
1572
1573 #. type: TP
1574 #: build/C/man3/mallopt.3:62
1575 #, no-wrap
1576 msgid "Bit 1"
1577 msgstr ""
1578
1579 #. type: Plain text
1580 #: build/C/man3/mallopt.3:77
1581 msgid ""
1582 "If this bit is set, then, after printing any error message specified by bit "
1583 "0, the program is terminated by calling B<abort>(3).  In glibc versions "
1584 "since 2.4, if bit 0 is also set, then, between printing the error message "
1585 "and aborting, the program also prints a stack trace in the manner of "
1586 "B<backtrace>(3), and prints the process's memory mapping in the style of "
1587 "I</proc/[pid]/maps> (see B<proc>(5))."
1588 msgstr ""
1589
1590 #. type: TP
1591 #: build/C/man3/mallopt.3:77
1592 #, no-wrap
1593 msgid "Bit 2 (since glibc 2.4)"
1594 msgstr ""
1595
1596 #. type: Plain text
1597 #: build/C/man3/mallopt.3:84
1598 msgid ""
1599 "This bit has an effect only if bit 0 is also set.  If this bit is set, then "
1600 "the one-line message describing the error is simplified to contain just the "
1601 "name of the function where the error was detected and the brief description "
1602 "of the error."
1603 msgstr ""
1604
1605 #. type: Plain text
1606 #: build/C/man3/mallopt.3:89
1607 msgid "The remaining bits in I<value> are ignored."
1608 msgstr ""
1609
1610 #. type: Plain text
1611 #: build/C/man3/mallopt.3:93
1612 msgid ""
1613 "Combining the above details, the following numeric values are meaningful for "
1614 "B<M_CHECK_ACTION>:"
1615 msgstr ""
1616
1617 #. type: IP
1618 #: build/C/man3/mallopt.3:94
1619 #, no-wrap
1620 msgid "0"
1621 msgstr ""
1622
1623 #. type: Plain text
1624 #: build/C/man3/mallopt.3:96
1625 msgid "Ignore error conditions; continue execution (with undefined results)."
1626 msgstr ""
1627
1628 #. type: IP
1629 #: build/C/man3/mallopt.3:96
1630 #, no-wrap
1631 msgid "1"
1632 msgstr ""
1633
1634 #. type: Plain text
1635 #: build/C/man3/mallopt.3:98
1636 msgid "Print a detailed error message and continue execution."
1637 msgstr ""
1638
1639 #. type: IP
1640 #: build/C/man3/mallopt.3:98
1641 #, no-wrap
1642 msgid "2"
1643 msgstr ""
1644
1645 #. type: Plain text
1646 #: build/C/man3/mallopt.3:100
1647 msgid "Abort the program."
1648 msgstr ""
1649
1650 #. type: IP
1651 #: build/C/man3/mallopt.3:100
1652 #, no-wrap
1653 msgid "3"
1654 msgstr ""
1655
1656 #. type: Plain text
1657 #: build/C/man3/mallopt.3:103
1658 msgid ""
1659 "Print detailed error message, stack trace, and memory mappings, and abort "
1660 "the program."
1661 msgstr ""
1662
1663 #. type: IP
1664 #: build/C/man3/mallopt.3:103
1665 #, no-wrap
1666 msgid "5"
1667 msgstr ""
1668
1669 #. type: Plain text
1670 #: build/C/man3/mallopt.3:105
1671 msgid "Print a simple error message and continue execution."
1672 msgstr ""
1673
1674 #. type: IP
1675 #: build/C/man3/mallopt.3:105
1676 #, no-wrap
1677 msgid "7"
1678 msgstr ""
1679
1680 #. type: Plain text
1681 #: build/C/man3/mallopt.3:108
1682 msgid ""
1683 "Print simple error message, stack trace, and memory mappings, and abort the "
1684 "program."
1685 msgstr ""
1686
1687 #. type: Plain text
1688 #: build/C/man3/mallopt.3:114
1689 msgid ""
1690 "Since glibc 2.3.4, the default value for the B<M_CHECK_ACTION> parameter is "
1691 "3.  In glibc version 2.3.3 and earlier, the default value is 1."
1692 msgstr ""
1693
1694 #. type: Plain text
1695 #: build/C/man3/mallopt.3:119
1696 msgid ""
1697 "Using a nonzero B<M_CHECK_ACTION> value can be useful because otherwise a "
1698 "crash may happen much later, and the true cause of the problem is then very "
1699 "hard to track down."
1700 msgstr ""
1701
1702 #. type: TP
1703 #: build/C/man3/mallopt.3:119
1704 #, no-wrap
1705 msgid "B<M_MMAP_MAX>"
1706 msgstr ""
1707
1708 #.  The following text adapted from comments in the glibc source:
1709 #. type: Plain text
1710 #: build/C/man3/mallopt.3:129
1711 msgid ""
1712 "This parameter specifies the maximum number of allocation requests that may "
1713 "be simultaneously serviced using B<mmap>(2).  This parameter exists because "
1714 "some systems have a limited number of internal tables for use by B<mmap>(2), "
1715 "and using more than a few of them may degrade performance."
1716 msgstr ""
1717
1718 #. type: Plain text
1719 #: build/C/man3/mallopt.3:136
1720 msgid ""
1721 "The default value is 65,536, a value which has no special significance and "
1722 "which servers only as a safeguard.  Setting this parameter to 0 disables the "
1723 "use of B<mmap>(2)  for servicing large allocation requests."
1724 msgstr ""
1725
1726 #. type: TP
1727 #: build/C/man3/mallopt.3:136
1728 #, no-wrap
1729 msgid "B<M_MMAP_THRESHOLD>"
1730 msgstr ""
1731
1732 #. type: Plain text
1733 #: build/C/man3/mallopt.3:145
1734 msgid ""
1735 "For allocations greater than or equal to the limit specified (in bytes) by "
1736 "B<M_MMAP_THRESHOLD> that can't be satisfied from the free list, the "
1737 "memory-allocation functions employ B<mmap>(2)  instead of increasing the "
1738 "program break using B<sbrk>(2)."
1739 msgstr ""
1740
1741 #. type: Plain text
1742 #: build/C/man3/mallopt.3:165
1743 msgid ""
1744 "Allocating memory using B<mmap>(2)  has the significant advantage that the "
1745 "allocated memory blocks can always be independently released back to the "
1746 "system.  (By contrast, the heap can be trimmed only if memory is freed at "
1747 "the top end.)  On the other hand, there are some disadvantages to the use of "
1748 "B<mmap>(2): deallocated space is not placed on the free list for reuse by "
1749 "later allocations; memory may be wasted because B<mmap>(2)  allocations must "
1750 "be page-aligned; and the kernel must perform the expensive task of zeroing "
1751 "out memory allocated via B<mmap>(2).  Balancing these factors leads to a "
1752 "default setting of 128*1024 for the B<M_MMAP_THRESHOLD> parameter."
1753 msgstr ""
1754
1755 #. type: Plain text
1756 #: build/C/man3/mallopt.3:172
1757 msgid ""
1758 "The lower limit for this parameter is 0.  The upper limit is "
1759 "B<DEFAULT_MMAP_THRESHOLD_MAX>: 512*1024 on 32-bit systems or "
1760 "I<4*1024*1024*sizeof(long)> on 64-bit systems."
1761 msgstr ""
1762
1763 #. type: Plain text
1764 #: build/C/man3/mallopt.3:190
1765 msgid ""
1766 "I<Note:> Nowadays, glibc uses a dynamic mmap threshold by default.  The "
1767 "initial value of the threshold is 128*1024, but when blocks larger than the "
1768 "current threshold and less than or equal to B<DEFAULT_MMAP_THRESHOLD_MAX> "
1769 "are freed, the threshold is adjusted upwards to the size of the freed "
1770 "block.  When dynamic mmap thresholding is in effect, the threshold for "
1771 "trimming the heap is also dynamically adjusted to be twice the dynamic mmap "
1772 "threshold.  Dynamic adjustment of the mmap threshold is disabled if any of "
1773 "the B<M_TRIM_THRESHOLD>, B<M_TOP_PAD>, B<M_MMAP_THRESHOLD>, or B<M_MMAP_MAX> "
1774 "parameters is set."
1775 msgstr ""
1776
1777 #. type: TP
1778 #: build/C/man3/mallopt.3:190
1779 #, no-wrap
1780 msgid "B<M_MXFAST> (since glibc 2.3)"
1781 msgstr ""
1782
1783 #.  The following text adapted from comments in the glibc sources:
1784 #. type: Plain text
1785 #: build/C/man3/mallopt.3:210
1786 msgid ""
1787 "Set the upper limit for memory allocation requests that are satisfied using "
1788 "\"fastbins\".  (The measurement unit for this parameter is bytes.)  Fastbins "
1789 "are storage areas that hold deallocated blocks of memory of the same size "
1790 "without merging adjacent free blocks.  Subsequent reallocation of blocks of "
1791 "the same size can be handled very quickly by allocating from the fastbin, "
1792 "although memory fragmentation and the overall memory footprint of the "
1793 "program can increase.  The default value for this parameter is "
1794 "I<64*sizeof(size_t)/4> (i.e., 64 on 32-bit architectures).  The range for "
1795 "this parameter is 0 to I<80*sizeof(size_t)/4>.  Setting B<M_MXFAST> to 0 "
1796 "disables the use of fastbins."
1797 msgstr ""
1798
1799 #. type: TP
1800 #: build/C/man3/mallopt.3:210
1801 #, no-wrap
1802 msgid "B<M_PERTURB> (since glibc 2.4)"
1803 msgstr ""
1804
1805 #. type: Plain text
1806 #: build/C/man3/mallopt.3:225
1807 msgid ""
1808 "If this parameter is set to a nonzero value, then bytes of allocated memory "
1809 "(other than allocations via B<calloc>(3))  are initialized to the complement "
1810 "of the value in the least significant byte of I<value>, and when allocated "
1811 "memory is released using B<free>(3), the freed bytes are set to the least "
1812 "significant byte of I<value>.  This can be useful for detecting errors where "
1813 "programs incorrectly rely on allocated memory being initialized to zero, or "
1814 "reuse values in memory that has already been freed."
1815 msgstr ""
1816
1817 #. type: TP
1818 #: build/C/man3/mallopt.3:225
1819 #, no-wrap
1820 msgid "B<M_TOP_PAD>"
1821 msgstr ""
1822
1823 #. type: Plain text
1824 #: build/C/man3/mallopt.3:232
1825 msgid ""
1826 "This parameter defines the amount of padding to employ when calling "
1827 "B<sbrk>(2)  to modify the program break.  (The measurement unit for this "
1828 "parameter is bytes.)  This parameter has an effect in the following "
1829 "circumstances:"
1830 msgstr ""
1831
1832 #. type: Plain text
1833 #: build/C/man3/mallopt.3:239
1834 msgid ""
1835 "When the program break is increased, then B<M_TOP_PAD> bytes are added to "
1836 "the B<sbrk>(2)  request."
1837 msgstr ""
1838
1839 #. type: Plain text
1840 #: build/C/man3/mallopt.3:245
1841 msgid ""
1842 "When the heap is trimmed as a consequence of calling B<free>(3)  (see the "
1843 "discussion of B<M_TRIM_THRESHOLD>)  this much free space is preserved at the "
1844 "top of the heap."
1845 msgstr ""
1846
1847 #. type: Plain text
1848 #: build/C/man3/mallopt.3:249
1849 msgid ""
1850 "In either case, the amount of padding is always rounded to a system page "
1851 "boundary."
1852 msgstr ""
1853
1854 #. type: Plain text
1855 #: build/C/man3/mallopt.3:256
1856 msgid ""
1857 "Modifying B<M_TOP_PAD> is a trade-off between increasing the number of "
1858 "system calls (when the parameter is set low)  and wasting unused memory at "
1859 "the top of the heap (when the parameter is set high)."
1860 msgstr ""
1861
1862 #.  DEFAULT_TOP_PAD in glibc source
1863 #. type: Plain text
1864 #: build/C/man3/mallopt.3:259
1865 msgid "The default value for this parameter is 128*1024."
1866 msgstr ""
1867
1868 #. type: TP
1869 #: build/C/man3/mallopt.3:259
1870 #, no-wrap
1871 msgid "B<M_TRIM_THRESHOLD>"
1872 msgstr ""
1873
1874 #. type: Plain text
1875 #: build/C/man3/mallopt.3:275
1876 msgid ""
1877 "When the amount of contiguous free memory at the top of the heap grows "
1878 "sufficiently large, B<free>(3)  employs B<sbrk>(2)  to release this memory "
1879 "back to the system.  (This can be useful in programs that continue to "
1880 "execute for a long period after freeing a significant amount of memory.)  "
1881 "The B<M_TRIM_THRESHOLD> parameter specifies the minimum size (in bytes) that "
1882 "this block of memory must reach before B<sbrk>(2)  is used to trim the heap."
1883 msgstr ""
1884
1885 #. type: Plain text
1886 #: build/C/man3/mallopt.3:280
1887 msgid ""
1888 "The default value for this parameter is 128*1024.  Setting "
1889 "B<M_TRIM_THRESHOLD> to -1 disables trimming completely."
1890 msgstr ""
1891
1892 #.  FIXME Do the arena parameters need to be documented?
1893 #.  .TP
1894 #.  .BR M_ARENA_TEST " (since glibc 2.10)"
1895 #.  .TP
1896 #.  .BR M_ARENA_MAX " (since glibc 2.10)"
1897 #
1898 #.  Environment variables
1899 #.      MALLOC_ARENA_MAX_
1900 #.      MALLOC_ARENA_TEST_
1901 #
1902 #.  http://udrepper.livejournal.com/20948.html describes some details
1903 #.      of the MALLOC_ARENA_* environment variables.
1904 #
1905 #.  These macros aren't enabled in production releases until 2.15?
1906 #.  (see glibc malloc/Makefile)
1907 #. type: Plain text
1908 #: build/C/man3/mallopt.3:303
1909 msgid ""
1910 "Modifying B<M_TRIM_THRESHOLD> is a trade-off between increasing the number "
1911 "of system calls (when the parameter is set low)  and wasting unused memory "
1912 "at the top of the heap (when the parameter is set high)."
1913 msgstr ""
1914
1915 #. type: SS
1916 #: build/C/man3/mallopt.3:303
1917 #, no-wrap
1918 msgid "Environment Variables"
1919 msgstr ""
1920
1921 #. type: Plain text
1922 #: build/C/man3/mallopt.3:318
1923 msgid ""
1924 "A number of environment variables can be defined to modify some of the same "
1925 "parameters as are controlled by B<mallopt>().  Using these variables has the "
1926 "advantage that the source code of the program need not be changed.  To be "
1927 "effective, these variables must be defined before the first call to a "
1928 "memory-allocation function.  (If the same parameters are adjusted via "
1929 "B<mallopt>()  then the B<mallopt>()  settings take precedence.)  For "
1930 "security reasons, these variables are ignored in set-user-ID and "
1931 "set-group-ID programs."
1932 msgstr ""
1933
1934 #. type: Plain text
1935 #: build/C/man3/mallopt.3:321
1936 msgid ""
1937 "The environment variables are as follows (note the trailing underscore at "
1938 "the end of the name of each variable):"
1939 msgstr ""
1940
1941 #. type: TP
1942 #: build/C/man3/mallopt.3:321
1943 #, no-wrap
1944 msgid "B<MALLOC_CHECK_>"
1945 msgstr ""
1946
1947 #.  On glibc 2.12/x86, a simple malloc()+free() loop is about 70% slower
1948 #.  when MALLOC_CHECK_ was set.
1949 #. type: Plain text
1950 #: build/C/man3/mallopt.3:338
1951 msgid ""
1952 "This environment variable controls the same parameter as B<mallopt>()  "
1953 "B<M_CHECK_ACTION>.  If this variable is set to a nonzero value, then a "
1954 "special implementation of the memory-allocation functions is used.  (This is "
1955 "accomplished using the B<malloc_hook>(3)  feature.)  This implementation "
1956 "performs additional error checking, but is slower than the standard set of "
1957 "memory-allocation functions.  (This implementation does not detect all "
1958 "possible errors; memory leaks can still occur.)"
1959 msgstr ""
1960
1961 #. type: Plain text
1962 #: build/C/man3/mallopt.3:343
1963 msgid ""
1964 "The value assigned to this environment variable should be a single digit, "
1965 "whose meaning is as described for B<M_CHECK_ACTION>.  Any characters beyond "
1966 "the initial digit are ignored."
1967 msgstr ""
1968
1969 #. type: Plain text
1970 #: build/C/man3/mallopt.3:352
1971 msgid ""
1972 "For security reasons, the effect of B<MALLOC_CHECK_> is disabled by default "
1973 "for set-user-ID and set-group-ID programs.  However, if the file "
1974 "I</etc/suid-debug> exists (the content of the file is irrelevant), then "
1975 "B<MALLOC_CHECK_> also has an effect for set-user-ID and set-group-ID "
1976 "programs."
1977 msgstr ""
1978
1979 #. type: TP
1980 #: build/C/man3/mallopt.3:352
1981 #, no-wrap
1982 msgid "B<MALLOC_MMAP_MAX_>"
1983 msgstr ""
1984
1985 #. type: Plain text
1986 #: build/C/man3/mallopt.3:357
1987 msgid "Controls the same parameter as B<mallopt>()  B<M_MMAP_MAX>."
1988 msgstr ""
1989
1990 #. type: TP
1991 #: build/C/man3/mallopt.3:357
1992 #, no-wrap
1993 msgid "B<MALLOC_MMAP_THRESHOLD_>"
1994 msgstr ""
1995
1996 #. type: Plain text
1997 #: build/C/man3/mallopt.3:362
1998 msgid "Controls the same parameter as B<mallopt>()  B<M_MMAP_THRESHOLD>."
1999 msgstr ""
2000
2001 #. type: TP
2002 #: build/C/man3/mallopt.3:362
2003 #, no-wrap
2004 msgid "B<MALLOC_PERTURB_>"
2005 msgstr ""
2006
2007 #. type: Plain text
2008 #: build/C/man3/mallopt.3:367
2009 msgid "Controls the same parameter as B<mallopt>()  B<M_PERTURB>."
2010 msgstr ""
2011
2012 #. type: TP
2013 #: build/C/man3/mallopt.3:367
2014 #, no-wrap
2015 msgid "B<MALLOC_TRIM_THRESHOLD_>"
2016 msgstr ""
2017
2018 #. type: Plain text
2019 #: build/C/man3/mallopt.3:372
2020 msgid "Controls the same parameter as B<mallopt>()  B<M_TRIM_THRESHOLD>."
2021 msgstr ""
2022
2023 #. type: TP
2024 #: build/C/man3/mallopt.3:372
2025 #, no-wrap
2026 msgid "B<MALLOC_TOP_PAD_>"
2027 msgstr ""
2028
2029 #. type: Plain text
2030 #: build/C/man3/mallopt.3:377
2031 msgid "Controls the same parameter as B<mallopt>()  B<M_TOP_PAD>."
2032 msgstr ""
2033
2034 #. type: Plain text
2035 #: build/C/man3/mallopt.3:382
2036 msgid "On success, B<mallopt>()  returns 1.  On error, it returns 0."
2037 msgstr ""
2038
2039 #.  .SH VERSIONS
2040 #.  Available already in glibc 2.0, possibly earlier
2041 #. type: Plain text
2042 #: build/C/man3/mallopt.3:390
2043 msgid "On error, I<errno> is I<not> set."
2044 msgstr ""
2045
2046 #.  .SH NOTES
2047 #. type: Plain text
2048 #: build/C/man3/mallopt.3:404
2049 msgid ""
2050 "This function is not specified by POSIX or the C standards.  A similar "
2051 "function exists on many System V derivatives, but the range of values for "
2052 "I<param> varies across systems.  The SVID defined options B<M_MXFAST>, "
2053 "B<M_NLBLKS>, B<M_GRAIN>, and B<M_KEEP>, but only the first of these is "
2054 "implemented in glibc."
2055 msgstr ""
2056
2057 #. type: Plain text
2058 #: build/C/man3/mallopt.3:408
2059 msgid "Specifying an invalid value for I<param> does not generate an error."
2060 msgstr ""
2061
2062 #.  FIXME This looks buggy:
2063 #.  setting the M_MXFAST limit rounds up:    (s + SIZE_SZ) & ~MALLOC_ALIGN_MASK)
2064 #.  malloc requests are rounded up:
2065 #.     (req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK
2066 #.  http://sources.redhat.com/bugzilla/show_bug.cgi?id=12129
2067 #. type: Plain text
2068 #: build/C/man3/mallopt.3:416
2069 msgid ""
2070 "A calculation error within the glibc implementation means that a call of the "
2071 "form:"
2072 msgstr ""
2073
2074 #. type: Plain text
2075 #: build/C/man3/mallopt.3:419
2076 #, no-wrap
2077 msgid "    mallopt(M_MXFAST, n)\n"
2078 msgstr ""
2079
2080 #.  Bins are multiples of 2 * sizeof(size_t) + sizeof(size_t)
2081 #. type: Plain text
2082 #: build/C/man3/mallopt.3:431
2083 msgid ""
2084 "does not result in fastbins being employed for all allocations of size up to "
2085 "I<n>.  To ensure desired results, I<n> should be rounded up to the next "
2086 "multiple greater than or equal to I<(2k+1)*sizeof(size_t)>, where I<k> is an "
2087 "integer."
2088 msgstr ""
2089
2090 #.  FIXME MALLOC_MMAP_THRESHOLD_ and MALLOC_MMAP_MAX_
2091 #.  do have an effect for set-user-ID programs (but not
2092 #.  set-group-ID programs).
2093 #.  http://sources.redhat.com/bugzilla/show_bug.cgi?id=12155
2094 #. type: Plain text
2095 #: build/C/man3/mallopt.3:443
2096 msgid ""
2097 "The B<MALLOC_MMAP_THRESHOLD_> and B<MALLOC_MMAP_MAX_> variables are I<not> "
2098 "ignored in set-group-ID programs."
2099 msgstr ""
2100
2101 #.  FIXME http://sources.redhat.com/bugzilla/show_bug.cgi?id=12140
2102 #. type: Plain text
2103 #: build/C/man3/mallopt.3:464
2104 msgid ""
2105 "If B<mallopt>()  is used to set B<M_PERTURB>, then, as expected, the bytes "
2106 "of allocated memory are initialized to the complement of the byte in "
2107 "I<value>, and when that memory is freed, the bytes of the region are "
2108 "initialized to the byte specified in I<value>.  However, there is an "
2109 "off-by-I<sizeof(size_t)> error in the implementation: instead of "
2110 "initializing precisely the block of memory being freed by the call "
2111 "I<free(p)>, the block starting at I<p+sizeof(size_t)> is initialized."
2112 msgstr ""
2113
2114 #. type: Plain text
2115 #: build/C/man3/mallopt.3:473
2116 msgid ""
2117 "The program below demonstrates the use of B<M_CHECK_ACTION>.  If the program "
2118 "is supplied with an (integer) command-line argument, then that argument is "
2119 "used to set the B<M_CHECK_ACTION> parameter.  The program then allocates a "
2120 "block of memory, and frees it twice (an error)."
2121 msgstr ""
2122
2123 #. type: Plain text
2124 #: build/C/man3/mallopt.3:477
2125 msgid ""
2126 "The following shell session shows what happens when we run this program "
2127 "under glibc, with the default value for B<M_CHECK_ACTION>:"
2128 msgstr ""
2129
2130 #. type: Plain text
2131 #: build/C/man3/mallopt.3:496
2132 #, no-wrap
2133 msgid ""
2134 "$ B<./a.out>\n"
2135 "*** glibc detected *** ./a.out: double free or corruption (top): 0x09d30008 "
2136 "***\n"
2137 "======= Backtrace: =========\n"
2138 "/lib/libc.so.6(+0x6c501)[0x523501]\n"
2139 "/lib/libc.so.6(+0x6dd70)[0x524d70]\n"
2140 "/lib/libc.so.6(cfree+0x6d)[0x527e5d]\n"
2141 "\\&./a.out[0x80485db]\n"
2142 "/lib/libc.so.6(__libc_start_main+0xe7)[0x4cdce7]\n"
2143 "\\&./a.out[0x8048471]\n"
2144 "======= Memory map: ========\n"
2145 "001e4000-001fe000 r-xp 00000000 08:06 1083555    /lib/libgcc_s.so.1\n"
2146 "001fe000-001ff000 r--p 00019000 08:06 1083555    /lib/libgcc_s.so.1\n"
2147 "[some lines omitted]\n"
2148 "b7814000-b7817000 rw-p 00000000 00:00 0\n"
2149 "bff53000-bff74000 rw-p 00000000 00:00 0          [stack]\n"
2150 "Aborted (core dumped)\n"
2151 msgstr ""
2152
2153 #. type: Plain text
2154 #: build/C/man3/mallopt.3:501
2155 msgid ""
2156 "The following runs show the results when employing other values for "
2157 "B<M_CHECK_ACTION>:"
2158 msgstr ""
2159
2160 #. type: Plain text
2161 #: build/C/man3/mallopt.3:514
2162 #, no-wrap
2163 msgid ""
2164 "$ B<./a.out 1>             # Diagnose error and continue\n"
2165 "main(): returned from first free() call\n"
2166 "*** glibc detected *** ./a.out: double free or corruption (top): 0x09cbe008 "
2167 "***\n"
2168 "main(): returned from second free() call\n"
2169 "$ B<./a.out 2>             # Abort without error message\n"
2170 "main(): returned from first free() call\n"
2171 "Aborted (core dumped)\n"
2172 "$ B<./a.out 0>             # Ignore error and continue\n"
2173 "main(): returned from first free() call\n"
2174 "main(): returned from second free() call\n"
2175 msgstr ""
2176
2177 #. type: Plain text
2178 #: build/C/man3/mallopt.3:520
2179 msgid ""
2180 "The next run shows how to set the same parameter using the B<MALLOC_CHECK_> "
2181 "environment variable:"
2182 msgstr ""
2183
2184 #. type: Plain text
2185 #: build/C/man3/mallopt.3:527
2186 #, no-wrap
2187 msgid ""
2188 "$ B<MALLOC_CHECK_=1 ./a.out>\n"
2189 "main(): returned from first free() call\n"
2190 "*** glibc detected *** ./a.out: free(): invalid pointer: 0x092c2008 ***\n"
2191 "main(): returned from second free() call\n"
2192 msgstr ""
2193
2194 #. type: SS
2195 #: build/C/man3/mallopt.3:529 build/C/man2/mprotect.2:159 build/C/man3/mcheck.3:176
2196 #, no-wrap
2197 msgid "Program source"
2198 msgstr ""
2199
2200 #. type: Plain text
2201 #: build/C/man3/mallopt.3:535
2202 #, no-wrap
2203 msgid ""
2204 "#include E<lt>malloc.hE<gt>\n"
2205 "#include E<lt>stdio.hE<gt>\n"
2206 "#include E<lt>stdlib.hE<gt>\n"
2207 msgstr ""
2208
2209 #. type: Plain text
2210 #: build/C/man3/mallopt.3:540 build/C/man3/mcheck.3:187
2211 #, no-wrap
2212 msgid ""
2213 "int\n"
2214 "main(int argc, char *argv[])\n"
2215 "{\n"
2216 "    char *p;\n"
2217 msgstr ""
2218
2219 #. type: Plain text
2220 #: build/C/man3/mallopt.3:547
2221 #, no-wrap
2222 msgid ""
2223 "    if (argc E<gt> 1) {\n"
2224 "        if (argc != 2) {\n"
2225 "            fprintf(stderr, \"%s E<lt>M_CHECK_ACTION-valueE<gt>\\en\", "
2226 "argv[0]);\n"
2227 "            exit(EXIT_FAILURE);\n"
2228 "        }\n"
2229 "    }\n"
2230 msgstr ""
2231
2232 #. type: Plain text
2233 #: build/C/man3/mallopt.3:552
2234 #, no-wrap
2235 msgid ""
2236 "    if (mallopt(M_CHECK_ACTION, atoi(argv[1])) != 1) {\n"
2237 "        fprintf(stderr, \"mallopt() failed\");\n"
2238 "        exit(EXIT_FAILURE);\n"
2239 "    }\n"
2240 msgstr ""
2241
2242 #. type: Plain text
2243 #: build/C/man3/mallopt.3:558
2244 #, no-wrap
2245 msgid ""
2246 "    p = malloc(1000);\n"
2247 "    if (p == NULL) {\n"
2248 "        fprintf(stderr, \"malloc() failed\");\n"
2249 "        exit(EXIT_FAILURE);\n"
2250 "    }\n"
2251 msgstr ""
2252
2253 #. type: Plain text
2254 #: build/C/man3/mallopt.3:561
2255 #, no-wrap
2256 msgid ""
2257 "    free(p);\n"
2258 "    printf(\"main(): returned from first free() call\\en\");\n"
2259 msgstr ""
2260
2261 #. type: Plain text
2262 #: build/C/man3/mallopt.3:564
2263 #, no-wrap
2264 msgid ""
2265 "    free(p);\n"
2266 "    printf(\"main(): returned from second free() call\\en\");\n"
2267 msgstr ""
2268
2269 #. type: Plain text
2270 #: build/C/man3/mallopt.3:567 build/C/man2/mmap.2:652 build/C/man3/mcheck.3:203
2271 #, no-wrap
2272 msgid ""
2273 "    exit(EXIT_SUCCESS);\n"
2274 "}\n"
2275 msgstr ""
2276
2277 #. type: Plain text
2278 #: build/C/man3/mallopt.3:580
2279 msgid ""
2280 "B<mmap>(2)  B<sbrk>(2), B<mallinfo>(3), B<malloc>(3), B<malloc_hook>(3), "
2281 "B<malloc_trim>(3), B<mcheck>(3), B<mtrace>(3), B<posix_memalign>(3)"
2282 msgstr ""
2283
2284 #. type: TH
2285 #: build/C/man2/mlock.2:27
2286 #, no-wrap
2287 msgid "MLOCK"
2288 msgstr ""
2289
2290 #. type: TH
2291 #: build/C/man2/mlock.2:27
2292 #, no-wrap
2293 msgid "2011-09-14"
2294 msgstr ""
2295
2296 #. type: Plain text
2297 #: build/C/man2/mlock.2:30
2298 msgid "mlock, munlock, mlockall, munlockall - lock and unlock memory"
2299 msgstr ""
2300
2301 #. type: Plain text
2302 #: build/C/man2/mlock.2:33 build/C/man2/mmap.2:46 build/C/man2/mmap2.2:35 build/C/man2/mprotect.2:38 build/C/man2/mremap.2:39
2303 #, no-wrap
2304 msgid "B<#include E<lt>sys/mman.hE<gt>>\n"
2305 msgstr ""
2306
2307 #. type: Plain text
2308 #: build/C/man2/mlock.2:36
2309 #, no-wrap
2310 msgid ""
2311 "B<int mlock(const void *>I<addr>B<, size_t >I<len>B<);>\n"
2312 "B<int munlock(const void *>I<addr>B<, size_t >I<len>B<);>\n"
2313 msgstr ""
2314
2315 #. type: Plain text
2316 #: build/C/man2/mlock.2:39
2317 #, no-wrap
2318 msgid ""
2319 "B<int mlockall(int >I<flags>B<);>\n"
2320 "B<int munlockall(void);>\n"
2321 msgstr ""
2322
2323 #. type: Plain text
2324 #: build/C/man2/mlock.2:55
2325 msgid ""
2326 "B<mlock>()  and B<mlockall>()  respectively lock part or all of the calling "
2327 "process's virtual address space into RAM, preventing that memory from being "
2328 "paged to the swap area.  B<munlock>()  and B<munlockall>()  perform the "
2329 "converse operation, respectively unlocking part or all of the calling "
2330 "process's virtual address space, so that pages in the specified virtual "
2331 "address range may once more to be swapped out if required by the kernel "
2332 "memory manager.  Memory locking and unlocking are performed in units of "
2333 "whole pages."
2334 msgstr ""
2335
2336 #. type: SS
2337 #: build/C/man2/mlock.2:55
2338 #, no-wrap
2339 msgid "mlock() and munlock()"
2340 msgstr ""
2341
2342 #. type: Plain text
2343 #: build/C/man2/mlock.2:65
2344 msgid ""
2345 "B<mlock>()  locks pages in the address range starting at I<addr> and "
2346 "continuing for I<len> bytes.  All pages that contain a part of the specified "
2347 "address range are guaranteed to be resident in RAM when the call returns "
2348 "successfully; the pages are guaranteed to stay in RAM until later unlocked."
2349 msgstr ""
2350
2351 #. type: Plain text
2352 #: build/C/man2/mlock.2:74
2353 msgid ""
2354 "B<munlock>()  unlocks pages in the address range starting at I<addr> and "
2355 "continuing for I<len> bytes.  After this call, all pages that contain a part "
2356 "of the specified memory range can be moved to external swap space again by "
2357 "the kernel."
2358 msgstr ""
2359
2360 #. type: SS
2361 #: build/C/man2/mlock.2:74
2362 #, no-wrap
2363 msgid "mlockall() and munlockall()"
2364 msgstr ""
2365
2366 #. type: Plain text
2367 #: build/C/man2/mlock.2:84
2368 msgid ""
2369 "B<mlockall>()  locks all pages mapped into the address space of the calling "
2370 "process.  This includes the pages of the code, data and stack segment, as "
2371 "well as shared libraries, user space kernel data, shared memory, and "
2372 "memory-mapped files.  All mapped pages are guaranteed to be resident in RAM "
2373 "when the call returns successfully; the pages are guaranteed to stay in RAM "
2374 "until later unlocked."
2375 msgstr ""
2376
2377 #. type: Plain text
2378 #: build/C/man2/mlock.2:89
2379 msgid ""
2380 "The I<flags> argument is constructed as the bitwise OR of one or more of the "
2381 "following constants:"
2382 msgstr ""
2383
2384 #. type: TP
2385 #: build/C/man2/mlock.2:89
2386 #, no-wrap
2387 msgid "B<MCL_CURRENT>"
2388 msgstr ""
2389
2390 #. type: Plain text
2391 #: build/C/man2/mlock.2:93
2392 msgid ""
2393 "Lock all pages which are currently mapped into the address space of the "
2394 "process."
2395 msgstr ""
2396
2397 #. type: TP
2398 #: build/C/man2/mlock.2:93
2399 #, no-wrap
2400 msgid "B<MCL_FUTURE>"
2401 msgstr ""
2402
2403 #. type: Plain text
2404 #: build/C/man2/mlock.2:100
2405 msgid ""
2406 "Lock all pages which will become mapped into the address space of the "
2407 "process in the future.  These could be for instance new pages required by a "
2408 "growing heap and stack as well as new memory mapped files or shared memory "
2409 "regions."
2410 msgstr ""
2411
2412 #. type: Plain text
2413 #: build/C/man2/mlock.2:113
2414 msgid ""
2415 "If B<MCL_FUTURE> has been specified, then a later system call (e.g., "
2416 "B<mmap>(2), B<sbrk>(2), B<malloc>(3)), may fail if it would cause the number "
2417 "of locked bytes to exceed the permitted maximum (see below).  In the same "
2418 "circumstances, stack growth may likewise fail: the kernel will deny stack "
2419 "expansion and deliver a B<SIGSEGV> signal to the process."
2420 msgstr ""
2421
2422 #. type: Plain text
2423 #: build/C/man2/mlock.2:117
2424 msgid ""
2425 "B<munlockall>()  unlocks all pages mapped into the address space of the "
2426 "calling process."
2427 msgstr ""
2428
2429 #. type: Plain text
2430 #: build/C/man2/mlock.2:123
2431 msgid ""
2432 "On success these system calls return 0.  On error, -1 is returned, I<errno> "
2433 "is set appropriately, and no changes are made to any locks in the address "
2434 "space of the process."
2435 msgstr ""
2436
2437 #. type: Plain text
2438 #: build/C/man2/mlock.2:132
2439 msgid ""
2440 "(Linux 2.6.9 and later) the caller had a nonzero B<RLIMIT_MEMLOCK> soft "
2441 "resource limit, but tried to lock more memory than the limit permitted.  "
2442 "This limit is not enforced if the process is privileged (B<CAP_IPC_LOCK>)."
2443 msgstr ""
2444
2445 #.  In the case of mlock(), this check is somewhat buggy: it doesn't
2446 #.  take into account whether the to-be-locked range overlaps with
2447 #.  already locked pages.  Thus, suppose we allocate
2448 #.  (num_physpages / 4 + 1) of memory, and lock those pages once using
2449 #.  mlock(), and then lock the *same* page range a second time.
2450 #.  In the case, the second mlock() call will fail, since the check
2451 #.  calculates that the process is trying to lock (num_physpages / 2 + 2)
2452 #.  pages, which of course is not true.  (MTK, Nov 04, kernel 2.4.28)
2453 #. type: Plain text
2454 #: build/C/man2/mlock.2:144
2455 msgid ""
2456 "(Linux 2.4 and earlier) the calling process tried to lock more than half of "
2457 "RAM."
2458 msgstr ""
2459
2460 #. SVr4 documents an additional EAGAIN error code.
2461 #. type: Plain text
2462 #: build/C/man2/mlock.2:150
2463 msgid ""
2464 "The caller is not privileged, but needs privilege (B<CAP_IPC_LOCK>)  to "
2465 "perform the requested operation."
2466 msgstr ""
2467
2468 #. type: Plain text
2469 #: build/C/man2/mlock.2:155
2470 msgid "For B<mlock>()  and B<munlock>():"
2471 msgstr ""
2472
2473 #. type: Plain text
2474 #: build/C/man2/mlock.2:158
2475 msgid "Some or all of the specified address range could not be locked."
2476 msgstr ""
2477
2478 #. type: Plain text
2479 #: build/C/man2/mlock.2:165
2480 msgid ""
2481 "The result of the addition I<start>+I<len> was less than I<start> (e.g., the "
2482 "addition may have resulted in an overflow)."
2483 msgstr ""
2484
2485 #. type: Plain text
2486 #: build/C/man2/mlock.2:170
2487 msgid "(Not on Linux)  I<addr> was not a multiple of the page size."
2488 msgstr ""
2489
2490 #. type: Plain text
2491 #: build/C/man2/mlock.2:174
2492 msgid ""
2493 "Some of the specified address range does not correspond to mapped pages in "
2494 "the address space of the process."
2495 msgstr ""
2496
2497 #. type: Plain text
2498 #: build/C/man2/mlock.2:177
2499 msgid "For B<mlockall>():"
2500 msgstr ""
2501
2502 #. type: Plain text
2503 #: build/C/man2/mlock.2:180
2504 msgid "Unknown I<flags> were specified."
2505 msgstr ""
2506
2507 #. type: Plain text
2508 #: build/C/man2/mlock.2:183
2509 msgid "For B<munlockall>():"
2510 msgstr ""
2511
2512 #. type: Plain text
2513 #: build/C/man2/mlock.2:187
2514 msgid "(Linux 2.6.8 and earlier) The caller was not privileged (B<CAP_IPC_LOCK>)."
2515 msgstr ""
2516
2517 #. type: Plain text
2518 #: build/C/man2/mlock.2:189
2519 msgid "POSIX.1-2001, SVr4."
2520 msgstr ""
2521
2522 #. type: SH
2523 #: build/C/man2/mlock.2:189 build/C/man2/mmap.2:487 build/C/man2/msync.2:105
2524 #, no-wrap
2525 msgid "AVAILABILITY"
2526 msgstr ""
2527
2528 #. type: Plain text
2529 #: build/C/man2/mlock.2:201
2530 msgid ""
2531 "On POSIX systems on which B<mlock>()  and B<munlock>()  are available, "
2532 "B<_POSIX_MEMLOCK_RANGE> is defined in I<E<lt>unistd.hE<gt>> and the number "
2533 "of bytes in a page can be determined from the constant B<PAGESIZE> (if "
2534 "defined) in I<E<lt>limits.hE<gt>> or by calling I<sysconf(_SC_PAGESIZE)>."
2535 msgstr ""
2536
2537 #.  POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
2538 #.  -1: unavailable, 0: ask using sysconf().
2539 #.  glibc defines it to 1.
2540 #. type: Plain text
2541 #: build/C/man2/mlock.2:214
2542 msgid ""
2543 "On POSIX systems on which B<mlockall>()  and B<munlockall>()  are available, "
2544 "B<_POSIX_MEMLOCK> is defined in I<E<lt>unistd.hE<gt>> to a value greater "
2545 "than 0.  (See also B<sysconf>(3).)"
2546 msgstr ""
2547
2548 #. type: Plain text
2549 #: build/C/man2/mlock.2:232
2550 msgid ""
2551 "Memory locking has two main applications: real-time algorithms and "
2552 "high-security data processing.  Real-time applications require deterministic "
2553 "timing, and, like scheduling, paging is one major cause of unexpected "
2554 "program execution delays.  Real-time applications will usually also switch "
2555 "to a real-time scheduler with B<sched_setscheduler>(2).  Cryptographic "
2556 "security software often handles critical bytes like passwords or secret keys "
2557 "as data structures.  As a result of paging, these secrets could be "
2558 "transferred onto a persistent swap store medium, where they might be "
2559 "accessible to the enemy long after the security software has erased the "
2560 "secrets in RAM and terminated.  (But be aware that the suspend mode on "
2561 "laptops and some desktop computers will save a copy of the system's RAM to "
2562 "disk, regardless of memory locks.)"
2563 msgstr ""
2564
2565 #. type: Plain text
2566 #: build/C/man2/mlock.2:245
2567 msgid ""
2568 "Real-time processes that are using B<mlockall>()  to prevent delays on page "
2569 "faults should reserve enough locked stack pages before entering the "
2570 "time-critical section, so that no page fault can be caused by function "
2571 "calls.  This can be achieved by calling a function that allocates a "
2572 "sufficiently large automatic variable (an array) and writes to the memory "
2573 "occupied by this array in order to touch these stack pages.  This way, "
2574 "enough pages will be mapped for the stack and can be locked into RAM.  The "
2575 "dummy writes ensure that not even copy-on-write page faults can occur in the "
2576 "critical section."
2577 msgstr ""
2578
2579 #. type: Plain text
2580 #: build/C/man2/mlock.2:251
2581 msgid ""
2582 "Memory locks are not inherited by a child created via B<fork>(2)  and are "
2583 "automatically removed (unlocked) during an B<execve>(2)  or when the process "
2584 "terminates."
2585 msgstr ""
2586
2587 #. type: Plain text
2588 #: build/C/man2/mlock.2:255
2589 msgid ""
2590 "The memory lock on an address range is automatically removed if the address "
2591 "range is unmapped via B<munmap>(2)."
2592 msgstr ""
2593
2594 #. type: Plain text
2595 #: build/C/man2/mlock.2:268
2596 msgid ""
2597 "Memory locks do not stack, that is, pages which have been locked several "
2598 "times by calls to B<mlock>()  or B<mlockall>()  will be unlocked by a single "
2599 "call to B<munlock>()  for the corresponding range or by B<munlockall>().  "
2600 "Pages which are mapped to several locations or by several processes stay "
2601 "locked into RAM as long as they are locked at least at one location or by at "
2602 "least one process."
2603 msgstr ""
2604
2605 #. type: Plain text
2606 #: build/C/man2/mlock.2:279
2607 msgid ""
2608 "Under Linux, B<mlock>()  and B<munlock>()  automatically round I<addr> down "
2609 "to the nearest page boundary.  However, POSIX.1-2001 allows an "
2610 "implementation to require that I<addr> is page aligned, so portable "
2611 "applications should ensure this."
2612 msgstr ""
2613
2614 #. type: Plain text
2615 #: build/C/man2/mlock.2:292
2616 msgid ""
2617 "The I<VmLck> field of the Linux-specific I</proc/PID/status> file shows how "
2618 "many kilobytes of memory the process with ID I<PID> has locked using "
2619 "B<mlock>(), B<mlockall>(), and B<mmap>(2)  B<MAP_LOCKED>."
2620 msgstr ""
2621
2622 #. type: SS
2623 #: build/C/man2/mlock.2:292
2624 #, no-wrap
2625 msgid "Limits and permissions"
2626 msgstr ""
2627
2628 #. type: Plain text
2629 #: build/C/man2/mlock.2:299
2630 msgid ""
2631 "In Linux 2.6.8 and earlier, a process must be privileged (B<CAP_IPC_LOCK>)  "
2632 "in order to lock memory and the B<RLIMIT_MEMLOCK> soft resource limit "
2633 "defines a limit on how much memory the process may lock."
2634 msgstr ""
2635
2636 #. type: Plain text
2637 #: build/C/man2/mlock.2:305
2638 msgid ""
2639 "Since Linux 2.6.9, no limits are placed on the amount of memory that a "
2640 "privileged process can lock and the B<RLIMIT_MEMLOCK> soft resource limit "
2641 "instead defines a limit on how much memory an unprivileged process may lock."
2642 msgstr ""
2643
2644 #. type: Plain text
2645 #: build/C/man2/mlock.2:313
2646 msgid ""
2647 "In the 2.4 series Linux kernels up to and including 2.4.17, a bug caused the "
2648 "B<mlockall>()  B<MCL_FUTURE> flag to be inherited across a B<fork>(2).  This "
2649 "was rectified in kernel 2.4.18."
2650 msgstr ""
2651
2652 #.  See the following LKML thread:
2653 #.  http://marc.theaimsgroup.com/?l=linux-kernel&m=113801392825023&w=2
2654 #.  "Rationale for RLIMIT_MEMLOCK"
2655 #.  23 Jan 2006
2656 #. type: Plain text
2657 #: build/C/man2/mlock.2:330
2658 msgid ""
2659 "Since kernel 2.6.9, if a privileged process calls I<mlockall(MCL_FUTURE)> "
2660 "and later drops privileges (loses the B<CAP_IPC_LOCK> capability by, for "
2661 "example, setting its effective UID to a nonzero value), then subsequent "
2662 "memory allocations (e.g., B<mmap>(2), B<brk>(2))  will fail if the "
2663 "B<RLIMIT_MEMLOCK> resource limit is encountered."
2664 msgstr ""
2665
2666 #. type: Plain text
2667 #: build/C/man2/mlock.2:337
2668 msgid ""
2669 "B<mmap>(2), B<setrlimit>(2), B<shmctl>(2), B<sysconf>(3), B<proc>(5), "
2670 "B<capabilities>(7)"
2671 msgstr ""
2672
2673 #. type: TH
2674 #: build/C/man2/mmap.2:40
2675 #, no-wrap
2676 msgid "MMAP"
2677 msgstr ""
2678
2679 #. type: TH
2680 #: build/C/man2/mmap.2:40 build/C/man2/mmap2.2:29
2681 #, no-wrap
2682 msgid "2012-04-16"
2683 msgstr ""
2684
2685 #. type: Plain text
2686 #: build/C/man2/mmap.2:43
2687 msgid "mmap, munmap - map or unmap files or devices into memory"
2688 msgstr ""
2689
2690 #. type: Plain text
2691 #: build/C/man2/mmap.2:51
2692 #, no-wrap
2693 msgid ""
2694 "B<void *mmap(void *>I<addr>B<, size_t >I<length>B<, int >I<prot>B<, int "
2695 ">I<flags>B<,>\n"
2696 "B<           int >I<fd>B<, off_t >I<offset>B<);>\n"
2697 "B<int munmap(void *>I<addr>B<, size_t >I<length>B<);>\n"
2698 msgstr ""
2699
2700 #. type: Plain text
2701 #: build/C/man2/mmap.2:61
2702 msgid ""
2703 "B<mmap>()  creates a new mapping in the virtual address space of the calling "
2704 "process.  The starting address for the new mapping is specified in I<addr>.  "
2705 "The I<length> argument specifies the length of the mapping."
2706 msgstr ""
2707
2708 #.  Before Linux 2.6.24, the address was rounded up to the next page
2709 #.  boundary; since 2.6.24, it is rounded down!
2710 #. type: Plain text
2711 #: build/C/man2/mmap.2:75
2712 msgid ""
2713 "If I<addr> is NULL, then the kernel chooses the address at which to create "
2714 "the mapping; this is the most portable method of creating a new mapping.  If "
2715 "I<addr> is not NULL, then the kernel takes it as a hint about where to place "
2716 "the mapping; on Linux, the mapping will be created at a nearby page "
2717 "boundary.  The address of the new mapping is returned as the result of the "
2718 "call."
2719 msgstr ""
2720
2721 #. type: Plain text
2722 #: build/C/man2/mmap.2:87
2723 msgid ""
2724 "The contents of a file mapping (as opposed to an anonymous mapping; see "
2725 "B<MAP_ANONYMOUS> below), are initialized using I<length> bytes starting at "
2726 "offset I<offset> in the file (or other object) referred to by the file "
2727 "descriptor I<fd>.  I<offset> must be a multiple of the page size as returned "
2728 "by I<sysconf(_SC_PAGE_SIZE)>."
2729 msgstr ""
2730
2731 #. type: Plain text
2732 #: build/C/man2/mmap.2:95
2733 msgid ""
2734 "The I<prot> argument describes the desired memory protection of the mapping "
2735 "(and must not conflict with the open mode of the file).  It is either "
2736 "B<PROT_NONE> or the bitwise OR of one or more of the following flags:"
2737 msgstr ""
2738
2739 #. type: TP
2740 #: build/C/man2/mmap.2:95 build/C/man2/mprotect.2:67
2741 #, no-wrap
2742 msgid "B<PROT_EXEC>"
2743 msgstr ""
2744
2745 #. type: Plain text
2746 #: build/C/man2/mmap.2:98
2747 msgid "Pages may be executed."
2748 msgstr ""
2749
2750 #. type: TP
2751 #: build/C/man2/mmap.2:98 build/C/man2/mprotect.2:61
2752 #, no-wrap
2753 msgid "B<PROT_READ>"
2754 msgstr ""
2755
2756 #. type: Plain text
2757 #: build/C/man2/mmap.2:101
2758 msgid "Pages may be read."
2759 msgstr ""
2760
2761 #. type: TP
2762 #: build/C/man2/mmap.2:101 build/C/man2/mprotect.2:64
2763 #, no-wrap
2764 msgid "B<PROT_WRITE>"
2765 msgstr ""
2766
2767 #. type: Plain text
2768 #: build/C/man2/mmap.2:104
2769 msgid "Pages may be written."
2770 msgstr ""
2771
2772 #. type: TP
2773 #: build/C/man2/mmap.2:104 build/C/man2/mprotect.2:58
2774 #, no-wrap
2775 msgid "B<PROT_NONE>"
2776 msgstr ""
2777
2778 #. type: Plain text
2779 #: build/C/man2/mmap.2:107
2780 msgid "Pages may not be accessed."
2781 msgstr ""
2782
2783 #. type: Plain text
2784 #: build/C/man2/mmap.2:116
2785 msgid ""
2786 "The I<flags> argument determines whether updates to the mapping are visible "
2787 "to other processes mapping the same region, and whether updates are carried "
2788 "through to the underlying file.  This behavior is determined by including "
2789 "exactly one of the following values in I<flags>:"
2790 msgstr ""
2791
2792 #. type: TP
2793 #: build/C/man2/mmap.2:116
2794 #, no-wrap
2795 msgid "B<MAP_SHARED>"
2796 msgstr ""
2797
2798 #. type: Plain text
2799 #: build/C/man2/mmap.2:126
2800 msgid ""
2801 "Share this mapping.  Updates to the mapping are visible to other processes "
2802 "that map this file, and are carried through to the underlying file.  The "
2803 "file may not actually be updated until B<msync>(2)  or B<munmap>()  is "
2804 "called."
2805 msgstr ""
2806
2807 #. type: TP
2808 #: build/C/man2/mmap.2:126
2809 #, no-wrap
2810 msgid "B<MAP_PRIVATE>"
2811 msgstr ""
2812
2813 #. type: Plain text
2814 #: build/C/man2/mmap.2:135
2815 msgid ""
2816 "Create a private copy-on-write mapping.  Updates to the mapping are not "
2817 "visible to other processes mapping the same file, and are not carried "
2818 "through to the underlying file.  It is unspecified whether changes made to "
2819 "the file after the B<mmap>()  call are visible in the mapped region."
2820 msgstr ""
2821
2822 #. type: Plain text
2823 #: build/C/man2/mmap.2:137
2824 msgid "Both of these flags are described in POSIX.1-2001."
2825 msgstr ""
2826
2827 #. type: Plain text
2828 #: build/C/man2/mmap.2:140
2829 msgid "In addition, zero or more of the following values can be ORed in I<flags>:"
2830 msgstr ""
2831
2832 #. type: TP
2833 #: build/C/man2/mmap.2:140
2834 #, no-wrap
2835 msgid "B<MAP_32BIT> (since Linux 2.4.20, 2.6)"
2836 msgstr ""
2837
2838 #.  See http://lwn.net/Articles/294642 "Tangled up in threads", 19 Aug 08
2839 #. type: Plain text
2840 #: build/C/man2/mmap.2:156
2841 msgid ""
2842 "Put the mapping into the first 2 Gigabytes of the process address space.  "
2843 "This flag is only supported on x86-64, for 64-bit programs.  It was added to "
2844 "allow thread stacks to be allocated somewhere in the first 2GB of memory, so "
2845 "as to improve context-switch performance on some early 64-bit processors.  "
2846 "Modern x86-64 processors no longer have this performance problem, so use of "
2847 "this flag is not required on those systems.  The B<MAP_32BIT> flag is "
2848 "ignored when B<MAP_FIXED> is set."
2849 msgstr ""
2850
2851 #. type: TP
2852 #: build/C/man2/mmap.2:156
2853 #, no-wrap
2854 msgid "B<MAP_ANON>"
2855 msgstr ""
2856
2857 #. type: Plain text
2858 #: build/C/man2/mmap.2:161
2859 msgid "Synonym for B<MAP_ANONYMOUS>.  Deprecated."
2860 msgstr ""
2861
2862 #. type: TP
2863 #: build/C/man2/mmap.2:161
2864 #, no-wrap
2865 msgid "B<MAP_ANONYMOUS>"
2866 msgstr ""
2867
2868 #. type: Plain text
2869 #: build/C/man2/mmap.2:183
2870 msgid ""
2871 "The mapping is not backed by any file; its contents are initialized to "
2872 "zero.  The I<fd> and I<offset> arguments are ignored; however, some "
2873 "implementations require I<fd> to be -1 if B<MAP_ANONYMOUS> (or B<MAP_ANON>)  "
2874 "is specified, and portable applications should ensure this.  The use of "
2875 "B<MAP_ANONYMOUS> in conjunction with B<MAP_SHARED> is only supported on "
2876 "Linux since kernel 2.4."
2877 msgstr ""
2878
2879 #. type: TP
2880 #: build/C/man2/mmap.2:183
2881 #, no-wrap
2882 msgid "B<MAP_DENYWRITE>"
2883 msgstr ""
2884
2885 #.  Introduced in 1.1.36, removed in 1.3.24.
2886 #. type: Plain text
2887 #: build/C/man2/mmap.2:191
2888 msgid ""
2889 "This flag is ignored.  (Long ago, it signaled that attempts to write to the "
2890 "underlying file should fail with B<ETXTBUSY>.  But this was a source of "
2891 "denial-of-service attacks.)"
2892 msgstr ""
2893
2894 #. type: TP
2895 #: build/C/man2/mmap.2:191
2896 #, no-wrap
2897 msgid "B<MAP_EXECUTABLE>"
2898 msgstr ""
2899
2900 #.  Introduced in 1.1.38, removed in 1.3.24. Flag tested in proc_follow_link.
2901 #.  (Long ago, it signaled that the underlying file is an executable.
2902 #.  However, that information was not really used anywhere.)
2903 #.  Linus talked about DOS related to MAP_EXECUTABLE, but he was thinking of
2904 #.  MAP_DENYWRITE?
2905 #. type: Plain text
2906 #: build/C/man2/mmap.2:199
2907 msgid "This flag is ignored."
2908 msgstr ""
2909
2910 #. type: TP
2911 #: build/C/man2/mmap.2:199
2912 #, no-wrap
2913 msgid "B<MAP_FILE>"
2914 msgstr ""
2915
2916 #.  On some systems, this was required as the opposite of
2917 #.  MAP_ANONYMOUS -- mtk, 1 May 2007
2918 #. type: Plain text
2919 #: build/C/man2/mmap.2:205
2920 msgid "Compatibility flag.  Ignored."
2921 msgstr ""
2922
2923 #. type: TP
2924 #: build/C/man2/mmap.2:205
2925 #, no-wrap
2926 msgid "B<MAP_FIXED>"
2927 msgstr ""
2928
2929 #. type: Plain text
2930 #: build/C/man2/mmap.2:223
2931 msgid ""
2932 "Don't interpret I<addr> as a hint: place the mapping at exactly that "
2933 "address.  I<addr> must be a multiple of the page size.  If the memory region "
2934 "specified by I<addr> and I<len> overlaps pages of any existing mapping(s), "
2935 "then the overlapped part of the existing mapping(s) will be discarded.  If "
2936 "the specified address cannot be used, B<mmap>()  will fail.  Because "
2937 "requiring a fixed address for a mapping is less portable, the use of this "
2938 "option is discouraged."
2939 msgstr ""
2940
2941 #. type: TP
2942 #: build/C/man2/mmap.2:223
2943 #, no-wrap
2944 msgid "B<MAP_GROWSDOWN>"
2945 msgstr ""
2946
2947 #. type: Plain text
2948 #: build/C/man2/mmap.2:228
2949 msgid ""
2950 "Used for stacks.  Indicates to the kernel virtual memory system that the "
2951 "mapping should extend downward in memory."
2952 msgstr ""
2953
2954 #. type: TP
2955 #: build/C/man2/mmap.2:228
2956 #, no-wrap
2957 msgid "B<MAP_HUGETLB> (since Linux 2.6.32)"
2958 msgstr ""
2959
2960 #. type: Plain text
2961 #: build/C/man2/mmap.2:234
2962 msgid ""
2963 "Allocate the mapping using \"huge pages.\" See the kernel source file "
2964 "I<Documentation/vm/hugetlbpage.txt> for further information."
2965 msgstr ""
2966
2967 #. type: TP
2968 #: build/C/man2/mmap.2:234
2969 #, no-wrap
2970 msgid "B<MAP_LOCKED> (since Linux 2.5.37)"
2971 msgstr ""
2972
2973 #.  If set, the mapped pages will not be swapped out.
2974 #. type: Plain text
2975 #: build/C/man2/mmap.2:240
2976 msgid ""
2977 "Lock the pages of the mapped region into memory in the manner of "
2978 "B<mlock>(2).  This flag is ignored in older kernels."
2979 msgstr ""
2980
2981 #. type: TP
2982 #: build/C/man2/mmap.2:240
2983 #, no-wrap
2984 msgid "B<MAP_NONBLOCK> (since Linux 2.5.46)"
2985 msgstr ""
2986
2987 #. type: Plain text
2988 #: build/C/man2/mmap.2:255
2989 msgid ""
2990 "Only meaningful in conjunction with B<MAP_POPULATE>.  Don't perform "
2991 "read-ahead: only create page tables entries for pages that are already "
2992 "present in RAM.  Since Linux 2.6.23, this flag causes B<MAP_POPULATE> to do "
2993 "nothing.  One day the combination of B<MAP_POPULATE> and B<MAP_NONBLOCK> may "
2994 "be reimplemented."
2995 msgstr ""
2996
2997 #. type: TP
2998 #: build/C/man2/mmap.2:255
2999 #, no-wrap
3000 msgid "B<MAP_NORESERVE>"
3001 msgstr ""
3002
3003 #. type: Plain text
3004 #: build/C/man2/mmap.2:270
3005 msgid ""
3006 "Do not reserve swap space for this mapping.  When swap space is reserved, "
3007 "one has the guarantee that it is possible to modify the mapping.  When swap "
3008 "space is not reserved one might get B<SIGSEGV> upon a write if no physical "
3009 "memory is available.  See also the discussion of the file "
3010 "I</proc/sys/vm/overcommit_memory> in B<proc>(5).  In kernels before 2.6, "
3011 "this flag only had effect for private writable mappings."
3012 msgstr ""
3013
3014 #. type: TP
3015 #: build/C/man2/mmap.2:270
3016 #, no-wrap
3017 msgid "B<MAP_POPULATE> (since Linux 2.5.46)"
3018 msgstr ""
3019
3020 #. type: Plain text
3021 #: build/C/man2/mmap.2:277
3022 msgid ""
3023 "Populate (prefault) page tables for a mapping.  For a file mapping, this "
3024 "causes read-ahead on the file.  Later accesses to the mapping will not be "
3025 "blocked by page faults.  B<MAP_POPULATE> is only supported for private "
3026 "mappings since Linux 2.6.23."
3027 msgstr ""
3028
3029 #. type: TP
3030 #: build/C/man2/mmap.2:277
3031 #, no-wrap
3032 msgid "B<MAP_STACK> (since Linux 2.6.27)"
3033 msgstr ""
3034
3035 #.  See http://lwn.net/Articles/294642 "Tangled up in threads", 19 Aug 08
3036 #.  commit cd98a04a59e2f94fa64d5bf1e26498d27427d5e7
3037 #.  http://thread.gmane.org/gmane.linux.kernel/720412
3038 #.  "pthread_create() slow for many threads; also time to revisit 64b
3039 #.   context switch optimization?"
3040 #. type: Plain text
3041 #: build/C/man2/mmap.2:290
3042 msgid ""
3043 "Allocate the mapping at an address suitable for a process or thread stack.  "
3044 "This flag is currently a no-op, but is used in the glibc threading "
3045 "implementation so that if some architectures require special treatment for "
3046 "stack allocations, support can later be transparently implemented for glibc."
3047 msgstr ""
3048
3049 #. type: TP
3050 #: build/C/man2/mmap.2:290
3051 #, no-wrap
3052 msgid "B<MAP_UNINITIALIZED> (since Linux 2.6.33)"
3053 msgstr ""
3054
3055 #. type: Plain text
3056 #: build/C/man2/mmap.2:300
3057 msgid ""
3058 "Don't clear anonymous pages.  This flag is intended to improve performance "
3059 "on embedded devices.  This flag is only honored if the kernel was configured "
3060 "with the B<CONFIG_MMAP_ALLOW_UNINITIALIZED> option.  Because of the security "
3061 "implications, that option is normally enabled only on embedded devices "
3062 "(i.e., devices where one has complete control of the contents of user "
3063 "memory)."
3064 msgstr ""
3065
3066 #. type: Plain text
3067 #: build/C/man2/mmap.2:308
3068 msgid ""
3069 "Of the above flags, only B<MAP_FIXED> is specified in POSIX.1-2001.  "
3070 "However, most systems also support B<MAP_ANONYMOUS> (or its synonym "
3071 "B<MAP_ANON>)."
3072 msgstr ""
3073
3074 #. type: Plain text
3075 #: build/C/man2/mmap.2:315
3076 msgid ""
3077 "Some systems document the additional flags B<MAP_AUTOGROW>, "
3078 "B<MAP_AUTORESRV>, B<MAP_COPY>, and B<MAP_LOCAL>."
3079 msgstr ""
3080
3081 #. type: Plain text
3082 #: build/C/man2/mmap.2:321
3083 msgid ""
3084 "Memory mapped by B<mmap>()  is preserved across B<fork>(2), with the same "
3085 "attributes."
3086 msgstr ""
3087
3088 #. type: Plain text
3089 #: build/C/man2/mmap.2:329
3090 msgid ""
3091 "A file is mapped in multiples of the page size.  For a file that is not a "
3092 "multiple of the page size, the remaining memory is zeroed when mapped, and "
3093 "writes to that region are not written out to the file.  The effect of "
3094 "changing the size of the underlying file of a mapping on the pages that "
3095 "correspond to added or removed regions of the file is unspecified."
3096 msgstr ""
3097
3098 #. type: SS
3099 #: build/C/man2/mmap.2:329
3100 #, no-wrap
3101 msgid "munmap()"
3102 msgstr ""
3103
3104 #. type: Plain text
3105 #: build/C/man2/mmap.2:339
3106 msgid ""
3107 "The B<munmap>()  system call deletes the mappings for the specified address "
3108 "range, and causes further references to addresses within the range to "
3109 "generate invalid memory references.  The region is also automatically "
3110 "unmapped when the process is terminated.  On the other hand, closing the "
3111 "file descriptor does not unmap the region."
3112 msgstr ""
3113
3114 #. type: Plain text
3115 #: build/C/man2/mmap.2:349
3116 msgid ""
3117 "The address I<addr> must be a multiple of the page size.  All pages "
3118 "containing a part of the indicated range are unmapped, and subsequent "
3119 "references to these pages will generate B<SIGSEGV>.  It is not an error if "
3120 "the indicated range does not contain any mapped pages."
3121 msgstr ""
3122
3123 #. type: SS
3124 #: build/C/man2/mmap.2:349
3125 #, no-wrap
3126 msgid "Timestamps changes for file-backed mappings"
3127 msgstr ""
3128
3129 #. type: Plain text
3130 #: build/C/man2/mmap.2:356
3131 msgid ""
3132 "For file-backed mappings, the I<st_atime> field for the mapped file may be "
3133 "updated at any time between the B<mmap>()  and the corresponding unmapping; "
3134 "the first reference to a mapped page will update the field if it has not "
3135 "been already."
3136 msgstr ""
3137
3138 #. type: Plain text
3139 #: build/C/man2/mmap.2:373
3140 msgid ""
3141 "The I<st_ctime> and I<st_mtime> field for a file mapped with B<PROT_WRITE> "
3142 "and B<MAP_SHARED> will be updated after a write to the mapped region, and "
3143 "before a subsequent B<msync>(2)  with the B<MS_SYNC> or B<MS_ASYNC> flag, if "
3144 "one occurs."
3145 msgstr ""
3146
3147 #. type: Plain text
3148 #: build/C/man2/mmap.2:390
3149 msgid ""
3150 "On success, B<mmap>()  returns a pointer to the mapped area.  On error, the "
3151 "value B<MAP_FAILED> (that is, I<(void\\ *)\\ -1>)  is returned, and I<errno> "
3152 "is set appropriately.  On success, B<munmap>()  returns 0, on failure -1, "
3153 "and I<errno> is set (probably to B<EINVAL>)."
3154 msgstr ""
3155
3156 #. type: TP
3157 #: build/C/man2/mmap.2:391 build/C/man2/mprotect.2:80 build/C/man3/shm_open.3:185 build/C/man3/shm_open.3:190 build/C/man2/shmctl.2:295 build/C/man2/shmget.2:186 build/C/man2/shmop.2:189
3158 #, no-wrap
3159 msgid "B<EACCES>"
3160 msgstr ""
3161
3162 #. type: Plain text
3163 #: build/C/man2/mmap.2:411
3164 msgid ""
3165 "A file descriptor refers to a non-regular file.  Or B<MAP_PRIVATE> was "
3166 "requested, but I<fd> is not open for reading.  Or B<MAP_SHARED> was "
3167 "requested and B<PROT_WRITE> is set, but I<fd> is not open in read/write "
3168 "(B<O_RDWR>)  mode.  Or B<PROT_WRITE> is set, but the file is append-only."
3169 msgstr ""
3170
3171 #. type: Plain text
3172 #: build/C/man2/mmap.2:415
3173 msgid ""
3174 "The file has been locked, or too much memory has been locked (see "
3175 "B<setrlimit>(2))."
3176 msgstr ""
3177
3178 #. type: Plain text
3179 #: build/C/man2/mmap.2:421
3180 msgid "I<fd> is not a valid file descriptor (and B<MAP_ANONYMOUS> was not set)."
3181 msgstr ""
3182
3183 #. type: Plain text
3184 #: build/C/man2/mmap.2:429
3185 msgid ""
3186 "We don't like I<addr>, I<length>, or I<offset> (e.g., they are too large, or "
3187 "not aligned on a page boundary)."
3188 msgstr ""
3189
3190 #. type: Plain text
3191 #: build/C/man2/mmap.2:434
3192 msgid "(since Linux 2.6.12)  I<length> was 0."
3193 msgstr ""
3194
3195 #. type: Plain text
3196 #: build/C/man2/mmap.2:442
3197 msgid ""
3198 "I<flags> contained neither B<MAP_PRIVATE> or B<MAP_SHARED>, or contained "
3199 "both of these values."
3200 msgstr ""
3201
3202 #. type: TP
3203 #: build/C/man2/mmap.2:442 build/C/man3/shm_open.3:227 build/C/man2/shmget.2:202
3204 #, no-wrap
3205 msgid "B<ENFILE>"
3206 msgstr ""
3207
3208 #.  [2.6.7] shmem_zero_setup()-->shmem_file_setup()-->get_empty_filp()
3209 #. type: Plain text
3210 #: build/C/man2/mmap.2:450 build/C/man2/shmget.2:206
3211 msgid "The system limit on the total number of open files has been reached."
3212 msgstr ""
3213
3214 #. type: Plain text
3215 #: build/C/man2/mmap.2:454
3216 msgid ""
3217 "The underlying file system of the specified file does not support memory "
3218 "mapping."
3219 msgstr ""
3220
3221 #. type: Plain text
3222 #: build/C/man2/mmap.2:458
3223 msgid ""
3224 "No memory is available, or the process's maximum number of mappings would "
3225 "have been exceeded."
3226 msgstr ""
3227
3228 #.  (Since 2.4.25 / 2.6.0.)
3229 #. type: Plain text
3230 #: build/C/man2/mmap.2:467
3231 msgid ""
3232 "The I<prot> argument asks for B<PROT_EXEC> but the mapped area belongs to a "
3233 "file on a file system that was mounted no-exec."
3234 msgstr ""
3235
3236 #. type: TP
3237 #: build/C/man2/mmap.2:467
3238 #, no-wrap
3239 msgid "B<ETXTBSY>"
3240 msgstr ""
3241
3242 #. type: Plain text
3243 #: build/C/man2/mmap.2:473
3244 msgid ""
3245 "B<MAP_DENYWRITE> was set but the object specified by I<fd> is open for "
3246 "writing."
3247 msgstr ""
3248
3249 #. type: Plain text
3250 #: build/C/man2/mmap.2:475
3251 msgid "Use of a mapped region can result in these signals:"
3252 msgstr ""
3253
3254 #. type: TP
3255 #: build/C/man2/mmap.2:475
3256 #, no-wrap
3257 msgid "B<SIGSEGV>"
3258 msgstr ""
3259
3260 #. type: Plain text
3261 #: build/C/man2/mmap.2:478
3262 msgid "Attempted write into a region mapped as read-only."
3263 msgstr ""
3264
3265 #. type: TP
3266 #: build/C/man2/mmap.2:478
3267 #, no-wrap
3268 msgid "B<SIGBUS>"
3269 msgstr ""
3270
3271 #. type: Plain text
3272 #: build/C/man2/mmap.2:483
3273 msgid ""
3274 "Attempted access to a portion of the buffer that does not correspond to the "
3275 "file (for example, beyond the end of the file, including the case where "
3276 "another process has truncated the file)."
3277 msgstr ""
3278
3279 #.  SVr4 documents additional error codes ENXIO and ENODEV.
3280 #.  SUSv2 documents additional error codes EMFILE and EOVERFLOW.
3281 #. type: Plain text
3282 #: build/C/man2/mmap.2:487
3283 msgid "SVr4, 4.4BSD, POSIX.1-2001."
3284 msgstr ""
3285
3286 #.  POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
3287 #.  -1: unavailable, 0: ask using sysconf().
3288 #.  glibc defines it to 1.
3289 #. type: Plain text
3290 #: build/C/man2/mmap.2:501
3291 msgid ""
3292 "On POSIX systems on which B<mmap>(), B<msync>(2)  and B<munmap>()  are "
3293 "available, B<_POSIX_MAPPED_FILES> is defined in I<E<lt>unistd.hE<gt>> to a "
3294 "value greater than 0.  (See also B<sysconf>(3).)"
3295 msgstr ""
3296
3297 #.  Since around glibc 2.1/2.2, depending on the platform.
3298 #. type: Plain text
3299 #: build/C/man2/mmap.2:516
3300 msgid ""
3301 "This page describes the interface provided by the glibc B<mmap>()  wrapper "
3302 "function.  Originally, this function invoked a system call of the same "
3303 "name.  Since kernel 2.4, that system call has been superseded by "
3304 "B<mmap2>(2), and nowadays the glibc B<mmap>()  wrapper function invokes "
3305 "B<mmap2>(2)  with a suitably adjusted value for I<offset>."
3306 msgstr ""
3307
3308 #. type: Plain text
3309 #: build/C/man2/mmap.2:529
3310 msgid ""
3311 "On some hardware architectures (e.g., i386), B<PROT_WRITE> implies "
3312 "B<PROT_READ>.  It is architecture dependent whether B<PROT_READ> implies "
3313 "B<PROT_EXEC> or not.  Portable programs should always set B<PROT_EXEC> if "
3314 "they intend to execute code in the new mapping."
3315 msgstr ""
3316
3317 #. type: Plain text
3318 #: build/C/man2/mmap.2:544
3319 msgid ""
3320 "The portable way to create a mapping is to specify I<addr> as 0 (NULL), and "
3321 "omit B<MAP_FIXED> from I<flags>.  In this case, the system chooses the "
3322 "address for the mapping; the address is chosen so as not to conflict with "
3323 "any existing mapping, and will not be 0.  If the B<MAP_FIXED> flag is "
3324 "specified, and I<addr> is 0 (NULL), then the mapped address will be 0 "
3325 "(NULL)."
3326 msgstr ""
3327
3328 #. type: Plain text
3329 #: build/C/man2/mmap.2:549
3330 msgid ""
3331 "On Linux there are no guarantees like those suggested above under "
3332 "B<MAP_NORESERVE>.  By default, any process can be killed at any moment when "
3333 "the system runs out of memory."
3334 msgstr ""
3335
3336 #. type: Plain text
3337 #: build/C/man2/mmap.2:556
3338 msgid ""
3339 "In kernels before 2.6.7, the B<MAP_POPULATE> flag only has effect if I<prot> "
3340 "is specified as B<PROT_NONE>."
3341 msgstr ""
3342
3343 #. type: Plain text
3344 #: build/C/man2/mmap.2:571
3345 msgid ""
3346 "SUSv3 specifies that B<mmap>()  should fail if I<length> is 0.  However, in "
3347 "kernels before 2.6.12, B<mmap>()  succeeded in this case: no mapping was "
3348 "created and the call returned I<addr>.  Since kernel 2.6.12, B<mmap>()  "
3349 "fails with the error B<EINVAL> for this case."
3350 msgstr ""
3351
3352 #. type: Plain text
3353 #: build/C/man2/mmap.2:583
3354 msgid ""
3355 "The following program prints part of the file specified in its first "
3356 "command-line argument to standard output.  The range of bytes to be printed "
3357 "is specified via offset and length values in the second and third "
3358 "command-line arguments.  The program creates a memory mapping of the "
3359 "required pages of the file and then uses B<write>(2)  to output the desired "
3360 "bytes."
3361 msgstr ""
3362
3363 #. type: Plain text
3364 #: build/C/man2/mmap.2:591
3365 #, no-wrap
3366 msgid ""
3367 "#include E<lt>sys/mman.hE<gt>\n"
3368 "#include E<lt>sys/stat.hE<gt>\n"
3369 "#include E<lt>fcntl.hE<gt>\n"
3370 "#include E<lt>stdio.hE<gt>\n"
3371 "#include E<lt>stdlib.hE<gt>\n"
3372 "#include E<lt>unistd.hE<gt>\n"
3373 msgstr ""
3374
3375 #. type: Plain text
3376 #: build/C/man2/mmap.2:594 build/C/man2/mprotect.2:172
3377 #, no-wrap
3378 msgid ""
3379 "#define handle_error(msg) \\e\n"
3380 "    do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
3381 msgstr ""
3382
3383 #. type: Plain text
3384 #: build/C/man2/mmap.2:604
3385 #, no-wrap
3386 msgid ""
3387 "int\n"
3388 "main(int argc, char *argv[])\n"
3389 "{\n"
3390 "    char *addr;\n"
3391 "    int fd;\n"
3392 "    struct stat sb;\n"
3393 "    off_t offset, pa_offset;\n"
3394 "    size_t length;\n"
3395 "    ssize_t s;\n"
3396 msgstr ""
3397
3398 #. type: Plain text
3399 #: build/C/man2/mmap.2:609
3400 #, no-wrap
3401 msgid ""
3402 "    if (argc E<lt> 3 || argc E<gt> 4) {\n"
3403 "        fprintf(stderr, \"%s file offset [length]\\en\", argv[0]);\n"
3404 "        exit(EXIT_FAILURE);\n"
3405 "    }\n"
3406 msgstr ""
3407
3408 #. type: Plain text
3409 #: build/C/man2/mmap.2:613
3410 #, no-wrap
3411 msgid ""
3412 "    fd = open(argv[1], O_RDONLY);\n"
3413 "    if (fd == -1)\n"
3414 "        handle_error(\"open\");\n"
3415 msgstr ""
3416
3417 #. type: Plain text
3418 #: build/C/man2/mmap.2:616
3419 #, no-wrap
3420 msgid ""
3421 "    if (fstat(fd, &sb) == -1)           /* To obtain file size */\n"
3422 "        handle_error(\"fstat\");\n"
3423 msgstr ""
3424
3425 #. type: Plain text
3426 #: build/C/man2/mmap.2:620
3427 #, no-wrap
3428 msgid ""
3429 "    offset = atoi(argv[2]);\n"
3430 "    pa_offset = offset & ~(sysconf(_SC_PAGE_SIZE) - 1);\n"
3431 "        /* offset for mmap() must be page aligned */\n"
3432 msgstr ""
3433
3434 #. type: Plain text
3435 #: build/C/man2/mmap.2:625
3436 #, no-wrap
3437 msgid ""
3438 "    if (offset E<gt>= sb.st_size) {\n"
3439 "        fprintf(stderr, \"offset is past end of file\\en\");\n"
3440 "        exit(EXIT_FAILURE);\n"
3441 "    }\n"
3442 msgstr ""
3443
3444 #. type: Plain text
3445 #: build/C/man2/mmap.2:631
3446 #, no-wrap
3447 msgid ""
3448 "    if (argc == 4) {\n"
3449 "        length = atoi(argv[3]);\n"
3450 "        if (offset + length E<gt> sb.st_size)\n"
3451 "            length = sb.st_size - offset;\n"
3452 "                /* Can\\(aqt display bytes past end of file */\n"
3453 msgstr ""
3454
3455 #. type: Plain text
3456 #: build/C/man2/mmap.2:635
3457 #, no-wrap
3458 msgid ""
3459 "    } else {    /* No length arg ==E<gt> display to end of file */\n"
3460 "        length = sb.st_size - offset;\n"
3461 "    }\n"
3462 msgstr ""
3463
3464 #. type: Plain text
3465 #: build/C/man2/mmap.2:640
3466 #, no-wrap
3467 msgid ""
3468 "    addr = mmap(NULL, length + offset - pa_offset, PROT_READ,\n"
3469 "                MAP_PRIVATE, fd, pa_offset);\n"
3470 "    if (addr == MAP_FAILED)\n"
3471 "        handle_error(\"mmap\");\n"
3472 msgstr ""
3473
3474 #. type: Plain text
3475 #: build/C/man2/mmap.2:645
3476 #, no-wrap
3477 msgid ""
3478 "    s = write(STDOUT_FILENO, addr + offset - pa_offset, length);\n"
3479 "    if (s != length) {\n"
3480 "        if (s == -1)\n"
3481 "            handle_error(\"write\");\n"
3482 msgstr ""
3483
3484 #. type: Plain text
3485 #: build/C/man2/mmap.2:649
3486 #, no-wrap
3487 msgid ""
3488 "        fprintf(stderr, \"partial write\");\n"
3489 "        exit(EXIT_FAILURE);\n"
3490 "    }\n"
3491 msgstr ""
3492
3493 #. type: Plain text
3494 #: build/C/man2/mmap.2:666
3495 msgid ""
3496 "B<getpagesize>(2), B<mincore>(2), B<mlock>(2), B<mmap2>(2), B<mprotect>(2), "
3497 "B<mremap>(2), B<msync>(2), B<remap_file_pages>(2), B<setrlimit>(2), "
3498 "B<shmat>(2), B<shm_open>(3), B<shm_overview>(7)"
3499 msgstr ""
3500
3501 #. type: Plain text
3502 #: build/C/man2/mmap.2:671 build/C/man2/msync.2:122
3503 msgid "B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391."
3504 msgstr ""
3505
3506 #. type: TH
3507 #: build/C/man2/mmap2.2:29
3508 #, no-wrap
3509 msgid "MMAP2"
3510 msgstr ""
3511
3512 #. type: Plain text
3513 #: build/C/man2/mmap2.2:32
3514 msgid "mmap2 - map files or devices into memory"
3515 msgstr ""
3516
3517 #. type: Plain text
3518 #: build/C/man2/mmap2.2:38
3519 #, no-wrap
3520 msgid ""
3521 "B<void *mmap2(void *>I<addr>B<, size_t >I<length>B<, int >I<prot>B<,>\n"
3522 "B<             int >I<flags>B<, int >I<fd>B<, off_t >I<pgoffset>B<);>\n"
3523 msgstr ""
3524
3525 #. type: Plain text
3526 #: build/C/man2/mmap2.2:43
3527 msgid ""
3528 "This is probably not the system call you are interested; instead, see "
3529 "B<mmap>(2), which describes the glibc wrapper function that invokes this "
3530 "system call."
3531 msgstr ""
3532
3533 #. type: Plain text
3534 #: build/C/man2/mmap2.2:54
3535 msgid ""
3536 "The B<mmap2>()  system call provides the same interface as B<mmap>(2), "
3537 "except that the final argument specifies the offset into the file in "
3538 "4096-byte units (instead of bytes, as is done by B<mmap>(2)).  This enables "
3539 "applications that use a 32-bit I<off_t> to map large files (up to 2^44 "
3540 "bytes)."
3541 msgstr ""
3542
3543 #. type: Plain text
3544 #: build/C/man2/mmap2.2:61
3545 msgid ""
3546 "On success, B<mmap2>()  returns a pointer to the mapped area.  On error -1 "
3547 "is returned and I<errno> is set appropriately."
3548 msgstr ""
3549
3550 #. type: Plain text
3551 #: build/C/man2/mmap2.2:65
3552 msgid "Problem with getting the data from userspace."
3553 msgstr ""
3554
3555 #. type: Plain text
3556 #: build/C/man2/mmap2.2:70
3557 msgid ""
3558 "(Various platforms where the page size is not 4096 bytes.)  I<offset * 4096> "
3559 "is not a multiple of the system page size."
3560 msgstr ""
3561
3562 #. type: Plain text
3563 #: build/C/man2/mmap2.2:74
3564 msgid "B<mmap2>()  can also return any of the errors described in B<mmap>(2)."
3565 msgstr ""
3566
3567 #. type: Plain text
3568 #: build/C/man2/mmap2.2:77
3569 msgid "B<mmap2>()  is available since Linux 2.3.31."
3570 msgstr ""
3571
3572 #. type: Plain text
3573 #: build/C/man2/mmap2.2:79 build/C/man2/subpage_prot.2:93
3574 msgid "This system call is Linux-specific."
3575 msgstr ""
3576
3577 #. type: Plain text
3578 #: build/C/man2/mmap2.2:85
3579 msgid ""
3580 "Nowadays, the glibc B<mmap>()  wrapper function invokes this system call "
3581 "rather than the B<mmap>(2)  system call."
3582 msgstr ""
3583
3584 #.  ia64 can have page sizes ranging from 4kB to 64kB.
3585 #.  On cris, it looks like the unit might also be the page size,
3586 #.  which is 8192 bytes. -- mtk, June 2007
3587 #. type: Plain text
3588 #: build/C/man2/mmap2.2:92
3589 msgid ""
3590 "On ia64, the unit for I<offset> is actually the system page size, rather "
3591 "than 4096 bytes."
3592 msgstr ""
3593
3594 #. type: Plain text
3595 #: build/C/man2/mmap2.2:98
3596 msgid "B<getpagesize>(2), B<mmap>(2), B<mremap>(2), B<msync>(2), B<shm_open>(3)"
3597 msgstr ""
3598
3599 #. type: TH
3600 #: build/C/man2/mprotect.2:32
3601 #, no-wrap
3602 msgid "MPROTECT"
3603 msgstr ""
3604
3605 #. type: TH
3606 #: build/C/man2/mprotect.2:32
3607 #, no-wrap
3608 msgid "2011-09-08"
3609 msgstr ""
3610
3611 #. type: Plain text
3612 #: build/C/man2/mprotect.2:35
3613 msgid "mprotect - set protection on a region of memory"
3614 msgstr ""
3615
3616 #. type: Plain text
3617 #: build/C/man2/mprotect.2:40
3618 #, no-wrap
3619 msgid "B<int mprotect(const void *>I<addr>B<, size_t >I<len>B<, int >I<prot>B<);>\n"
3620 msgstr ""
3621
3622 #. type: Plain text
3623 #: build/C/man2/mprotect.2:48
3624 msgid ""
3625 "B<mprotect>()  changes protection for the calling process's memory page(s)  "
3626 "containing any part of the address range in the interval [I<addr>,\\ "
3627 "I<addr>+I<len>-1].  I<addr> must be aligned to a page boundary."
3628 msgstr ""
3629
3630 #. type: Plain text
3631 #: build/C/man2/mprotect.2:53
3632 msgid ""
3633 "If the calling process tries to access memory in a manner that violates the "
3634 "protection, then the kernel generates a B<SIGSEGV> signal for the process."
3635 msgstr ""
3636
3637 #. type: Plain text
3638 #: build/C/man2/mprotect.2:58
3639 msgid ""
3640 "I<prot> is either B<PROT_NONE> or a bitwise-or of the other values in the "
3641 "following list:"
3642 msgstr ""
3643
3644 #. type: Plain text
3645 #: build/C/man2/mprotect.2:61
3646 msgid "The memory cannot be accessed at all."
3647 msgstr ""
3648
3649 #. type: Plain text
3650 #: build/C/man2/mprotect.2:64
3651 msgid "The memory can be read."
3652 msgstr ""
3653
3654 #. type: Plain text
3655 #: build/C/man2/mprotect.2:67
3656 msgid "The memory can be modified."
3657 msgstr ""
3658
3659 #.  FIXME
3660 #.  Document PROT_GROWSUP and PROT_GROWSDOWN
3661 #. type: Plain text
3662 #: build/C/man2/mprotect.2:72
3663 msgid "The memory can be executed."
3664 msgstr ""
3665
3666 #. type: Plain text
3667 #: build/C/man2/mprotect.2:79
3668 msgid ""
3669 "On success, B<mprotect>()  returns zero.  On error, -1 is returned, and "
3670 "I<errno> is set appropriately."
3671 msgstr ""
3672
3673 #. type: Plain text
3674 #: build/C/man2/mprotect.2:89
3675 msgid ""
3676 "The memory cannot be given the specified access.  This can happen, for "
3677 "example, if you B<mmap>(2)  a file to which you have read-only access, then "
3678 "ask B<mprotect>()  to mark it B<PROT_WRITE>."
3679 msgstr ""
3680
3681 #.  Or: both PROT_GROWSUP and PROT_GROWSDOWN were specified in 'prot'.
3682 #. type: Plain text
3683 #: build/C/man2/mprotect.2:94
3684 msgid "I<addr> is not a valid pointer, or not a multiple of the system page size."
3685 msgstr ""
3686
3687 #. type: Plain text
3688 #: build/C/man2/mprotect.2:97
3689 msgid "Internal kernel structures could not be allocated."
3690 msgstr ""
3691
3692 #. type: Plain text
3693 #: build/C/man2/mprotect.2:107
3694 msgid ""
3695 "Addresses in the range [I<addr>, I<addr>+I<len>-1] are invalid for the "
3696 "address space of the process, or specify one or more pages that are not "
3697 "mapped.  (Before kernel 2.4.19, the error B<EFAULT> was incorrectly produced "
3698 "for these cases.)"
3699 msgstr ""
3700
3701 #.  SVr4 defines an additional error
3702 #.  code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's.
3703 #. type: Plain text
3704 #: build/C/man2/mprotect.2:116
3705 msgid ""
3706 "SVr4, POSIX.1-2001.  POSIX says that the behavior of B<mprotect>()  is "
3707 "unspecified if it is applied to a region of memory that was not obtained via "
3708 "B<mmap>(2)."
3709 msgstr ""
3710
3711 #. type: Plain text
3712 #: build/C/man2/mprotect.2:123
3713 msgid ""
3714 "On Linux it is always permissible to call B<mprotect>()  on any address in a "
3715 "process's address space (except for the kernel vsyscall area).  In "
3716 "particular it can be used to change existing code mappings to be writable."
3717 msgstr ""
3718
3719 #. type: Plain text
3720 #: build/C/man2/mprotect.2:133
3721 msgid ""
3722 "Whether B<PROT_EXEC> has any effect different from B<PROT_READ> is "
3723 "architecture- and kernel version-dependent.  On some hardware architectures "
3724 "(e.g., i386), B<PROT_WRITE> implies B<PROT_READ>."
3725 msgstr ""
3726
3727 #. type: Plain text
3728 #: build/C/man2/mprotect.2:142
3729 msgid ""
3730 "POSIX.1-2001 says that an implementation may permit access other than that "
3731 "specified in I<prot>, but at a minimum can only allow write access if "
3732 "B<PROT_WRITE> has been set, and must not allow any access if B<PROT_NONE> "
3733 "has been set."
3734 msgstr ""
3735
3736 #. type: Plain text
3737 #: build/C/man2/mprotect.2:148
3738 msgid ""
3739 "The program below allocates four pages of memory, makes the third of these "
3740 "pages read-only, and then executes a loop that walks upward through the "
3741 "allocated region modifying bytes."
3742 msgstr ""
3743
3744 #. type: Plain text
3745 #: build/C/man2/mprotect.2:151
3746 msgid "An example of what we might see when running the program is the following:"
3747 msgstr ""
3748
3749 #. type: Plain text
3750 #: build/C/man2/mprotect.2:157
3751 #, no-wrap
3752 msgid ""
3753 "$B< ./a.out>\n"
3754 "Start of region:        0x804c000\n"
3755 "Got SIGSEGV at address: 0x804e000\n"
3756 msgstr ""
3757
3758 #. type: Plain text
3759 #: build/C/man2/mprotect.2:169
3760 #, no-wrap
3761 msgid ""
3762 "#include E<lt>unistd.hE<gt>\n"
3763 "#include E<lt>signal.hE<gt>\n"
3764 "#include E<lt>stdio.hE<gt>\n"
3765 "#include E<lt>malloc.hE<gt>\n"
3766 "#include E<lt>stdlib.hE<gt>\n"
3767 "#include E<lt>errno.hE<gt>\n"
3768 "#include E<lt>sys/mman.hE<gt>\n"
3769 msgstr ""
3770
3771 #. type: Plain text
3772 #: build/C/man2/mprotect.2:174
3773 #, no-wrap
3774 msgid "char *buffer;\n"
3775 msgstr ""
3776
3777 #. type: Plain text
3778 #: build/C/man2/mprotect.2:182
3779 #, no-wrap
3780 msgid ""
3781 "static void\n"
3782 "handler(int sig, siginfo_t *si, void *unused)\n"
3783 "{\n"
3784 "    printf(\"Got SIGSEGV at address: 0x%lx\\en\",\n"
3785 "            (long) si-E<gt>si_addr);\n"
3786 "    exit(EXIT_FAILURE);\n"
3787 "}\n"
3788 msgstr ""
3789
3790 #. type: Plain text
3791 #: build/C/man2/mprotect.2:189
3792 #, no-wrap
3793 msgid ""
3794 "int\n"
3795 "main(int argc, char *argv[])\n"
3796 "{\n"
3797 "    char *p;\n"
3798 "    int pagesize;\n"
3799 "    struct sigaction sa;\n"
3800 msgstr ""
3801
3802 #. type: Plain text
3803 #: build/C/man2/mprotect.2:195
3804 #, no-wrap
3805 msgid ""
3806 "    sa.sa_flags = SA_SIGINFO;\n"
3807 "    sigemptyset(&sa.sa_mask);\n"
3808 "    sa.sa_sigaction = handler;\n"
3809 "    if (sigaction(SIGSEGV, &sa, NULL) == -1)\n"
3810 "        handle_error(\"sigaction\");\n"
3811 msgstr ""
3812
3813 #. type: Plain text
3814 #: build/C/man2/mprotect.2:199
3815 #, no-wrap
3816 msgid ""
3817 "    pagesize = sysconf(_SC_PAGE_SIZE);\n"
3818 "    if (pagesize == -1)\n"
3819 "        handle_error(\"sysconf\");\n"
3820 msgstr ""
3821
3822 #. type: Plain text
3823 #: build/C/man2/mprotect.2:202
3824 #, no-wrap
3825 msgid ""
3826 "    /* Allocate a buffer aligned on a page boundary;\n"
3827 "       initial protection is PROT_READ | PROT_WRITE */\n"
3828 msgstr ""
3829
3830 #. type: Plain text
3831 #: build/C/man2/mprotect.2:206
3832 #, no-wrap
3833 msgid ""
3834 "    buffer = memalign(pagesize, 4 * pagesize);\n"
3835 "    if (buffer == NULL)\n"
3836 "        handle_error(\"memalign\");\n"
3837 msgstr ""
3838
3839 #. type: Plain text
3840 #: build/C/man2/mprotect.2:208
3841 #, no-wrap
3842 msgid "    printf(\"Start of region:        0x%lx\\en\", (long) buffer);\n"
3843 msgstr ""
3844
3845 #. type: Plain text
3846 #: build/C/man2/mprotect.2:212
3847 #, no-wrap
3848 msgid ""
3849 "    if (mprotect(buffer + pagesize * 2, pagesize,\n"
3850 "                PROT_READ) == -1)\n"
3851 "        handle_error(\"mprotect\");\n"
3852 msgstr ""
3853
3854 #. type: Plain text
3855 #: build/C/man2/mprotect.2:215
3856 #, no-wrap
3857 msgid ""
3858 "    for (p = buffer ; ; )\n"
3859 "        *(p++) = \\(aqa\\(aq;\n"
3860 msgstr ""
3861
3862 #. type: Plain text
3863 #: build/C/man2/mprotect.2:219
3864 #, no-wrap
3865 msgid ""
3866 "    printf(\"Loop completed\\en\");     /* Should never happen */\n"
3867 "    exit(EXIT_SUCCESS);\n"
3868 "}\n"
3869 msgstr ""
3870
3871 #. type: Plain text
3872 #: build/C/man2/mprotect.2:223
3873 msgid "B<mmap>(2), B<sysconf>(3)"
3874 msgstr ""
3875
3876 #. type: TH
3877 #: build/C/man2/mremap.2:31
3878 #, no-wrap
3879 msgid "MREMAP"
3880 msgstr ""
3881
3882 #. type: TH
3883 #: build/C/man2/mremap.2:31
3884 #, no-wrap
3885 msgid "2010-06-10"
3886 msgstr ""
3887
3888 #. type: Plain text
3889 #: build/C/man2/mremap.2:34
3890 msgid "mremap - remap a virtual memory address"
3891 msgstr ""
3892
3893 #. type: Plain text
3894 #: build/C/man2/mremap.2:37
3895 #, no-wrap
3896 msgid "B<#define _GNU_SOURCE>         /* See feature_test_macros(7) */\n"
3897 msgstr ""
3898
3899 #. type: Plain text
3900 #: build/C/man2/mremap.2:42
3901 #, no-wrap
3902 msgid ""
3903 "B<void *mremap(void *>I<old_address>B<, size_t >I<old_size>B<,>\n"
3904 "B<             size_t >I<new_size>B<, int >I<flags>B<, ... /* void "
3905 "*>I<new_address>B< */);>\n"
3906 msgstr ""
3907
3908 #. type: Plain text
3909 #: build/C/man2/mremap.2:48
3910 msgid ""
3911 "B<mremap>()  expands (or shrinks) an existing memory mapping, potentially "
3912 "moving it at the same time (controlled by the I<flags> argument and the "
3913 "available virtual address space)."
3914 msgstr ""
3915
3916 #. type: Plain text
3917 #: build/C/man2/mremap.2:62
3918 msgid ""
3919 "I<old_address> is the old address of the virtual memory block that you want "
3920 "to expand (or shrink).  Note that I<old_address> has to be page aligned.  "
3921 "I<old_size> is the old size of the virtual memory block.  I<new_size> is the "
3922 "requested size of the virtual memory block after the resize.  An optional "
3923 "fifth argument, I<new_address>, may be provided; see the description of "
3924 "B<MREMAP_FIXED> below."
3925 msgstr ""
3926
3927 #. type: Plain text
3928 #: build/C/man2/mremap.2:74
3929 msgid ""
3930 "In Linux the memory is divided into pages.  A user process has (one or)  "
3931 "several linear virtual memory segments.  Each virtual memory segment has one "
3932 "or more mappings to real memory pages (in the page table).  Each virtual "
3933 "memory segment has its own protection (access rights), which may cause a "
3934 "segmentation violation if the memory is accessed incorrectly (e.g., writing "
3935 "to a read-only segment).  Accessing virtual memory outside of the segments "
3936 "will also cause a segmentation violation."
3937 msgstr ""
3938
3939 #. type: Plain text
3940 #: build/C/man2/mremap.2:82
3941 msgid ""
3942 "B<mremap>()  uses the Linux page table scheme.  B<mremap>()  changes the "
3943 "mapping between virtual addresses and memory pages.  This can be used to "
3944 "implement a very efficient B<realloc>(3)."
3945 msgstr ""
3946
3947 #. type: Plain text
3948 #: build/C/man2/mremap.2:84
3949 msgid "The I<flags> bit-mask argument may be 0, or include the following flag:"
3950 msgstr ""
3951
3952 #. type: TP
3953 #: build/C/man2/mremap.2:84
3954 #, no-wrap
3955 msgid "B<MREMAP_MAYMOVE>"
3956 msgstr ""
3957
3958 #. type: Plain text
3959 #: build/C/man2/mremap.2:96
3960 msgid ""
3961 "By default, if there is not sufficient space to expand a mapping at its "
3962 "current location, then B<mremap>()  fails.  If this flag is specified, then "
3963 "the kernel is permitted to relocate the mapping to a new virtual address, if "
3964 "necessary.  If the mapping is relocated, then absolute pointers into the old "
3965 "mapping location become invalid (offsets relative to the starting address of "
3966 "the mapping should be employed)."
3967 msgstr ""
3968
3969 #. type: TP
3970 #: build/C/man2/mremap.2:96
3971 #, no-wrap
3972 msgid "B<MREMAP_FIXED> (since Linux 2.3.31)"
3973 msgstr ""
3974
3975 #. type: Plain text
3976 #: build/C/man2/mremap.2:118
3977 msgid ""
3978 "This flag serves a similar purpose to the B<MAP_FIXED> flag of B<mmap>(2).  "
3979 "If this flag is specified, then B<mremap>()  accepts a fifth argument, "
3980 "I<void *new_address>, which specifies a page-aligned address to which the "
3981 "mapping must be moved.  Any previous mapping at the address range specified "
3982 "by I<new_address> and I<new_size> is unmapped.  If B<MREMAP_FIXED> is "
3983 "specified, then B<MREMAP_MAYMOVE> must also be specified."
3984 msgstr ""
3985
3986 #. type: Plain text
3987 #: build/C/man2/mremap.2:128
3988 msgid ""
3989 "If the memory segment specified by I<old_address> and I<old_size> is locked "
3990 "(using B<mlock>(2)  or similar), then this lock is maintained when the "
3991 "segment is resized and/or relocated.  As a consequence, the amount of memory "
3992 "locked by the process may change."
3993 msgstr ""
3994
3995 #. type: Plain text
3996 #: build/C/man2/mremap.2:136
3997 msgid ""
3998 "On success B<mremap>()  returns a pointer to the new virtual memory area.  "
3999 "On error, the value B<MAP_FAILED> (that is, I<(void\\ *)\\ -1>) is returned, "
4000 "and I<errno> is set appropriately."
4001 msgstr ""
4002
4003 #. type: Plain text
4004 #: build/C/man2/mremap.2:143
4005 msgid ""
4006 "The caller tried to expand a memory segment that is locked, but this was not "
4007 "possible without exceeding the B<RLIMIT_MEMLOCK> resource limit."
4008 msgstr ""
4009
4010 #. type: Plain text
4011 #: build/C/man2/mremap.2:152
4012 msgid ""
4013 "\"Segmentation fault.\" Some address in the range I<old_address> to "
4014 "I<old_address>+I<old_size> is an invalid virtual memory address for this "
4015 "process.  You can also get B<EFAULT> even if there exist mappings that cover "
4016 "the whole address space requested, but those mappings are of different "
4017 "types."
4018 msgstr ""
4019
4020 #. type: Plain text
4021 #: build/C/man2/mremap.2:180
4022 msgid ""
4023 "An invalid argument was given.  Possible causes are: I<old_address> was not "
4024 "page aligned; a value other than B<MREMAP_MAYMOVE> or B<MREMAP_FIXED> was "
4025 "specified in I<flags>; I<new_size> was zero; I<new_size> or I<new_address> "
4026 "was invalid; or the new address range specified by I<new_address> and "
4027 "I<new_size> overlapped the old address range specified by I<old_address> and "
4028 "I<old_size>; or B<MREMAP_FIXED> was specified without also specifying "
4029 "B<MREMAP_MAYMOVE>."
4030 msgstr ""
4031
4032 #. type: Plain text
4033 #: build/C/man2/mremap.2:186
4034 msgid ""
4035 "The memory area cannot be expanded at the current virtual address, and the "
4036 "B<MREMAP_MAYMOVE> flag is not set in I<flags>.  Or, there is not enough "
4037 "(virtual) memory available."
4038 msgstr ""
4039
4040 #.  4.2BSD had a (never actually implemented)
4041 #.  .BR mremap (2)
4042 #.  call with completely different semantics.
4043 #. type: Plain text
4044 #: build/C/man2/mremap.2:192
4045 msgid ""
4046 "This call is Linux-specific, and should not be used in programs intended to "
4047 "be portable."
4048 msgstr ""
4049
4050 #. type: Plain text
4051 #: build/C/man2/mremap.2:200
4052 msgid ""
4053 "Prior to version 2.4, glibc did not expose the definition of "
4054 "B<MREMAP_FIXED>, and the prototype for B<mremap>()  did not allow for the "
4055 "I<new_address> argument."
4056 msgstr ""
4057
4058 #. type: Plain text
4059 #: build/C/man2/mremap.2:209
4060 msgid ""
4061 "B<brk>(2), B<getpagesize>(2), B<getrlimit>(2), B<mlock>(2), B<mmap>(2), "
4062 "B<sbrk>(2), B<malloc>(3), B<realloc>(3)"
4063 msgstr ""
4064
4065 #. type: Plain text
4066 #: build/C/man2/mremap.2:214
4067 msgid ""
4068 "Your favorite OS text book for more information on paged memory.  (I<Modern "
4069 "Operating Systems> by Andrew S. Tanenbaum, I<Inside Linux> by Randolf "
4070 "Bentson, I<The Design of the UNIX Operating System> by Maurice J. Bach.)"
4071 msgstr ""
4072
4073 #. type: TH
4074 #: build/C/man2/msync.2:25
4075 #, no-wrap
4076 msgid "MSYNC"
4077 msgstr ""
4078
4079 #. type: TH
4080 #: build/C/man2/msync.2:25 build/C/man2/remap_file_pages.2:26
4081 #, no-wrap
4082 msgid "2008-04-22"
4083 msgstr ""
4084
4085 #. type: Plain text
4086 #: build/C/man2/msync.2:28
4087 msgid "msync - synchronize a file with a memory map"
4088 msgstr ""
4089
4090 #. type: Plain text
4091 #: build/C/man2/msync.2:32
4092 msgid "B<int msync(void *>I<addr>B<, size_t >I<length>B<, int >I<flags>B<);>"
4093 msgstr ""
4094
4095 #. type: Plain text
4096 #: build/C/man2/msync.2:48
4097 msgid ""
4098 "B<msync>()  flushes changes made to the in-core copy of a file that was "
4099 "mapped into memory using B<mmap>(2)  back to disk.  Without use of this call "
4100 "there is no guarantee that changes are written back before B<munmap>(2)  is "
4101 "called.  To be more precise, the part of the file that corresponds to the "
4102 "memory area starting at I<addr> and having length I<length> is updated."
4103 msgstr ""
4104
4105 #. type: Plain text
4106 #: build/C/man2/msync.2:68
4107 msgid ""
4108 "The I<flags> argument may have the bits B<MS_ASYNC>, B<MS_SYNC>, and "
4109 "B<MS_INVALIDATE> set, but not both B<MS_ASYNC> and B<MS_SYNC>.  B<MS_ASYNC> "
4110 "specifies that an update be scheduled, but the call returns immediately.  "
4111 "B<MS_SYNC> asks for an update and waits for it to complete.  "
4112 "B<MS_INVALIDATE> asks to invalidate other mappings of the same file (so that "
4113 "they can be updated with the fresh values just written)."
4114 msgstr ""
4115
4116 #. type: Plain text
4117 #: build/C/man2/msync.2:73
4118 msgid ""
4119 "On success, zero is returned.  On error, -1 is returned, and I<errno> is set "
4120 "appropriately."
4121 msgstr ""
4122
4123 #. type: TP
4124 #: build/C/man2/msync.2:74
4125 #, no-wrap
4126 msgid "B<EBUSY>"
4127 msgstr ""
4128
4129 #. type: Plain text
4130 #: build/C/man2/msync.2:80
4131 msgid ""
4132 "B<MS_INVALIDATE> was specified in I<flags>, and a memory lock exists for the "
4133 "specified address range."
4134 msgstr ""
4135
4136 #. type: Plain text
4137 #: build/C/man2/msync.2:93
4138 msgid ""
4139 "I<addr> is not a multiple of PAGESIZE; or any bit other than B<MS_ASYNC> | "
4140 "B<MS_INVALIDATE> | B<MS_SYNC> is set in I<flags>; or both B<MS_SYNC> and "
4141 "B<MS_ASYNC> are set in I<flags>."
4142 msgstr ""
4143
4144 #. type: Plain text
4145 #: build/C/man2/msync.2:96
4146 msgid "The indicated memory (or part of it) was not mapped."
4147 msgstr ""
4148
4149 #. type: Plain text
4150 #: build/C/man2/msync.2:98 build/C/man3/posix_fallocate.3:103 build/C/man3/shm_open.3:251 build/C/man7/shm_overview.7:103
4151 msgid "POSIX.1-2001."
4152 msgstr ""
4153
4154 #. type: Plain text
4155 #: build/C/man2/msync.2:105
4156 msgid ""
4157 "This call was introduced in Linux 1.3.21, and then used B<EFAULT> instead of "
4158 "B<ENOMEM>.  In Linux 2.4.19 this was changed to the POSIX value B<ENOMEM>."
4159 msgstr ""
4160
4161 #.  POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
4162 #.  -1: unavailable, 0: ask using sysconf().
4163 #.  glibc defines them to 1.
4164 #. type: Plain text
4165 #: build/C/man2/msync.2:118
4166 msgid ""
4167 "On POSIX systems on which B<msync>()  is available, both "
4168 "B<_POSIX_MAPPED_FILES> and B<_POSIX_SYNCHRONIZED_IO> are defined in "
4169 "I<E<lt>unistd.hE<gt>> to a value greater than 0.  (See also B<sysconf>(3).)"
4170 msgstr ""
4171
4172 #. type: TP
4173 #: build/C/man2/msync.2:120 build/C/man7/shm_overview.7:46
4174 #, no-wrap
4175 msgid "B<mmap>(2)"
4176 msgstr ""
4177
4178 #. type: TH
4179 #: build/C/man3/mtrace.3:23
4180 #, no-wrap
4181 msgid "MTRACE"
4182 msgstr ""
4183
4184 #. type: Plain text
4185 #: build/C/man3/mtrace.3:26
4186 msgid "mtrace, muntrace - malloc tracing"
4187 msgstr ""
4188
4189 #. type: Plain text
4190 #: build/C/man3/mtrace.3:28
4191 msgid "B<#include E<lt>mcheck.hE<gt>>"
4192 msgstr ""
4193
4194 #. type: Plain text
4195 #: build/C/man3/mtrace.3:30
4196 msgid "B<void mtrace(void);>"
4197 msgstr ""
4198
4199 #. type: Plain text
4200 #: build/C/man3/mtrace.3:32
4201 msgid "B<void muntrace(void);>"
4202 msgstr ""
4203
4204 #. type: Plain text
4205 #: build/C/man3/mtrace.3:44
4206 msgid ""
4207 "The B<mtrace>()  function installs hook functions for the memory-allocation "
4208 "functions (B<malloc>(3), B<realloc>(3)  B<memalign>(3), B<free>(3)).  These "
4209 "hook functions record tracing information about memory allocation and "
4210 "deallocation.  The tracing information can be used to discover memory leaks "
4211 "and attempts to free nonallocated memory in a program."
4212 msgstr ""
4213
4214 #. type: Plain text
4215 #: build/C/man3/mtrace.3:55
4216 msgid ""
4217 "The B<muntrace>()  function disables the hook functions installed by "
4218 "B<mtrace>(), so that tracing information is no longer recorded for the "
4219 "memory-allocation functions.  If no hook functions were successfully "
4220 "installed by B<mtrace>(), B<muntrace>()  does nothing."
4221 msgstr ""
4222
4223 #. type: Plain text
4224 #: build/C/man3/mtrace.3:63
4225 msgid ""
4226 "When B<mtrace>(3)  is called, it checks the value of the environment "
4227 "variable B<MALLOC_TRACE>, which should contain the pathname of a file in "
4228 "which the tracing information is to be recorded.  If the pathname is "
4229 "successfully opened, it is truncated to zero length."
4230 msgstr ""
4231
4232 #. type: Plain text
4233 #: build/C/man3/mtrace.3:76
4234 msgid ""
4235 "If B<MALLOC_TRACE> is not set, or the pathname it specifies is invalid or "
4236 "not writable, then no hook functions are installed, and B<mtrace>()  has no "
4237 "effect.  In set-user-ID and set-group-ID programs, B<MALLOC_TRACE> is "
4238 "ignored, and B<mtrace>()  has no effect."
4239 msgstr ""
4240
4241 #. type: Plain text
4242 #: build/C/man3/mtrace.3:84
4243 msgid ""
4244 "In normal usage, B<mtrace>()  is called once at the start of execution of a "
4245 "program, and B<muntrace>()  is never called."
4246 msgstr ""
4247
4248 #. type: Plain text
4249 #: build/C/man3/mtrace.3:94
4250 msgid ""
4251 "The tracing output produced after a call to B<mtrace>()  is textual, but not "
4252 "designed to be human readable.  The GNU C library provides a Perl script, "
4253 "B<mtrace>(1), that interprets the trace log and produces human-readable "
4254 "output.  For best results, the traced program should be compiled with "
4255 "debugging enabled, so that line-number information is recorded in the "
4256 "executable."
4257 msgstr ""
4258
4259 #. type: Plain text
4260 #: build/C/man3/mtrace.3:100
4261 msgid ""
4262 "The tracing performed by B<mtrace>()  incurs a performance penalty (if "
4263 "B<MALLOC_TRACE> points to a valid, writable pathname)."
4264 msgstr ""
4265
4266 #. type: Plain text
4267 #: build/C/man3/mtrace.3:106
4268 msgid ""
4269 "The line-number information produced by B<mtrace>(1)  is not always precise: "
4270 "the line number references may refer to the previous or following "
4271 "(non-blank)  line of the source code."
4272 msgstr ""
4273
4274 #. type: Plain text
4275 #: build/C/man3/mtrace.3:113
4276 msgid ""
4277 "The shell session below demonstrates the use of the B<mtrace>()  function "
4278 "and the B<mtrace>(1)  command in a program that has memory leaks at two "
4279 "different locations.  The demonstration uses the following program:"
4280 msgstr ""
4281
4282 #. type: Plain text
4283 #: build/C/man3/mtrace.3:120
4284 #, no-wrap
4285 msgid ""
4286 "$ B<cat t_mtrace.c>\n"
4287 "#include E<lt>mcheck.hE<gt>\n"
4288 "#include E<lt>stdlib.hE<gt>\n"
4289 "#include E<lt>stdio.hE<gt>\n"
4290 msgstr ""
4291
4292 #. type: Plain text
4293 #: build/C/man3/mtrace.3:125
4294 #, no-wrap
4295 msgid ""
4296 "int\n"
4297 "main(int argc, char *argv[])\n"
4298 "{\n"
4299 "    int j;\n"
4300 msgstr ""
4301
4302 #. type: Plain text
4303 #: build/C/man3/mtrace.3:127
4304 #, no-wrap
4305 msgid "    mtrace();\n"
4306 msgstr ""
4307
4308 #. type: Plain text
4309 #: build/C/man3/mtrace.3:130
4310 #, no-wrap
4311 msgid ""
4312 "    for (j = 0; j E<lt> 2; j++)\n"
4313 "        malloc(100);            /* Never freed--a memory leak */\n"
4314 msgstr ""
4315
4316 #. type: Plain text
4317 #: build/C/man3/mtrace.3:134
4318 #, no-wrap
4319 msgid ""
4320 "    calloc(16, 16);             /* Never freed--a memory leak */\n"
4321 "    exit(EXIT_SUCCESS);\n"
4322 "}\n"
4323 msgstr ""
4324
4325 #. type: Plain text
4326 #: build/C/man3/mtrace.3:140
4327 msgid ""
4328 "When we run the program as follows, we see that B<mtrace>()  diagnosed "
4329 "memory leaks at two different locations in the program:"
4330 msgstr ""
4331
4332 #. type: Plain text
4333 #: build/C/man3/mtrace.3:153
4334 #, no-wrap
4335 msgid ""
4336 "$ B<cc -g t_mtrace.c -o t_mtrace>\n"
4337 "$ B<export MALLOC_TRACE=/tmp/t>\n"
4338 "$ B<./t_mtrace>\n"
4339 "$ B<mtrace ./t_mtrace $MALLOC_TRACE>\n"
4340 "Memory not freed:\n"
4341 "-----------------\n"
4342 "   Address     Size     Caller\n"
4343 "0x084c9378     0x64  at /home/cecilia/t_mtrace.c:12\n"
4344 "0x084c93e0     0x64  at /home/cecilia/t_mtrace.c:12\n"
4345 "0x084c9448    0x100  at /home/cecilia/t_mtrace.c:16\n"
4346 msgstr ""
4347
4348 #. type: Plain text
4349 #: build/C/man3/mtrace.3:165
4350 msgid ""
4351 "The first two messages about unfreed memory correspond to the two "
4352 "B<malloc>(3)  calls inside the I<for> loop.  The final message corresponds "
4353 "to the call to B<calloc>(3)  (which in turn calls B<malloc>(3))."
4354 msgstr ""
4355
4356 #. type: Plain text
4357 #: build/C/man3/mtrace.3:170
4358 msgid "B<mtrace>(1), B<malloc>(3), B<malloc_hook>(3), B<mcheck>(3)"
4359 msgstr ""
4360
4361 #. type: TH
4362 #: build/C/man2/posix_fadvise.2:27
4363 #, no-wrap
4364 msgid "POSIX_FADVISE"
4365 msgstr ""
4366
4367 #. type: TH
4368 #: build/C/man2/posix_fadvise.2:27 build/C/man2/sync_file_range.2:30
4369 #, no-wrap
4370 msgid "2010-10-09"
4371 msgstr ""
4372
4373 #. type: Plain text
4374 #: build/C/man2/posix_fadvise.2:30
4375 msgid "posix_fadvise - predeclare an access pattern for file data"
4376 msgstr ""
4377
4378 #. type: Plain text
4379 #: build/C/man2/posix_fadvise.2:33 build/C/man3/posix_fallocate.3:29
4380 #, no-wrap
4381 msgid "B<#include E<lt>fcntl.hE<gt>>\n"
4382 msgstr ""
4383
4384 #. type: Plain text
4385 #: build/C/man2/posix_fadvise.2:36
4386 #, no-wrap
4387 msgid ""
4388 "B<int posix_fadvise(int >I<fd>B<, off_t >I<offset>B<, off_t >I<len>B<, int "
4389 ">I<advice>B<);>\n"
4390 msgstr ""
4391
4392 #. type: Plain text
4393 #: build/C/man2/posix_fadvise.2:45
4394 msgid "B<posix_fadvise>():"
4395 msgstr ""
4396
4397 #. type: Plain text
4398 #: build/C/man2/posix_fadvise.2:47 build/C/man3/posix_fallocate.3:42
4399 msgid "_XOPEN_SOURCE\\ E<gt>=\\ 600 || _POSIX_C_SOURCE\\ E<gt>=\\ 200112L"
4400 msgstr ""
4401
4402 #. type: Plain text
4403 #: build/C/man2/posix_fadvise.2:55
4404 msgid ""
4405 "Programs can use B<posix_fadvise>()  to announce an intention to access file "
4406 "data in a specific pattern in the future, thus allowing the kernel to "
4407 "perform appropriate optimizations."
4408 msgstr ""
4409
4410 #. type: Plain text
4411 #: build/C/man2/posix_fadvise.2:62
4412 msgid ""
4413 "The I<advice> applies to a (not necessarily existent) region starting at "
4414 "I<offset> and extending for I<len> bytes (or until the end of the file if "
4415 "I<len> is 0) within the file referred to by I<fd>.  The I<advice> is not "
4416 "binding; it merely constitutes an expectation on behalf of the application."
4417 msgstr ""
4418
4419 #. type: Plain text
4420 #: build/C/man2/posix_fadvise.2:64
4421 msgid "Permissible values for I<advice> include:"
4422 msgstr ""
4423
4424 #. type: TP
4425 #: build/C/man2/posix_fadvise.2:64
4426 #, no-wrap
4427 msgid "B<POSIX_FADV_NORMAL>"
4428 msgstr ""
4429
4430 #. type: Plain text
4431 #: build/C/man2/posix_fadvise.2:70
4432 msgid ""
4433 "Indicates that the application has no advice to give about its access "
4434 "pattern for the specified data.  If no advice is given for an open file, "
4435 "this is the default assumption."
4436 msgstr ""
4437
4438 #. type: TP
4439 #: build/C/man2/posix_fadvise.2:70
4440 #, no-wrap
4441 msgid "B<POSIX_FADV_SEQUENTIAL>"
4442 msgstr ""
4443
4444 #. type: Plain text
4445 #: build/C/man2/posix_fadvise.2:74
4446 msgid ""
4447 "The application expects to access the specified data sequentially (with "
4448 "lower offsets read before higher ones)."
4449 msgstr ""
4450
4451 #. type: TP
4452 #: build/C/man2/posix_fadvise.2:74
4453 #, no-wrap
4454 msgid "B<POSIX_FADV_RANDOM>"
4455 msgstr ""
4456
4457 #. type: Plain text
4458 #: build/C/man2/posix_fadvise.2:77
4459 msgid "The specified data will be accessed in random order."
4460 msgstr ""
4461
4462 #. type: TP
4463 #: build/C/man2/posix_fadvise.2:77
4464 #, no-wrap
4465 msgid "B<POSIX_FADV_NOREUSE>"
4466 msgstr ""
4467
4468 #. type: Plain text
4469 #: build/C/man2/posix_fadvise.2:80
4470 msgid "The specified data will be accessed only once."
4471 msgstr ""
4472
4473 #. type: TP
4474 #: build/C/man2/posix_fadvise.2:80
4475 #, no-wrap
4476 msgid "B<POSIX_FADV_WILLNEED>"
4477 msgstr ""
4478
4479 #. type: Plain text
4480 #: build/C/man2/posix_fadvise.2:83
4481 msgid "The specified data will be accessed in the near future."
4482 msgstr ""
4483
4484 #. type: TP
4485 #: build/C/man2/posix_fadvise.2:83
4486 #, no-wrap
4487 msgid "B<POSIX_FADV_DONTNEED>"
4488 msgstr ""
4489
4490 #. type: Plain text
4491 #: build/C/man2/posix_fadvise.2:86
4492 msgid "The specified data will not be accessed in the near future."
4493 msgstr ""
4494
4495 #. type: Plain text
4496 #: build/C/man2/posix_fadvise.2:89
4497 msgid "On success, zero is returned.  On error, an error number is returned."
4498 msgstr ""
4499
4500 #. type: Plain text
4501 #: build/C/man2/posix_fadvise.2:93
4502 msgid "The I<fd> argument was not a valid file descriptor."
4503 msgstr ""
4504
4505 #. type: Plain text
4506 #: build/C/man2/posix_fadvise.2:96
4507 msgid "An invalid value was specified for I<advice>."
4508 msgstr ""
4509
4510 #. type: Plain text
4511 #: build/C/man2/posix_fadvise.2:103
4512 msgid ""
4513 "The specified file descriptor refers to a pipe or FIFO.  (Linux actually "
4514 "returns B<EINVAL> in this case.)"
4515 msgstr ""
4516
4517 #.  of fadvise64_64()
4518 #. type: Plain text
4519 #: build/C/man2/posix_fadvise.2:111
4520 msgid ""
4521 "Kernel support first appeared in Linux 2.5.60; the underlying system call is "
4522 "called B<fadvise64>().  Library support has been provided since glibc "
4523 "version 2.2, via the wrapper function B<posix_fadvise>()."
4524 msgstr ""
4525
4526 #. type: Plain text
4527 #: build/C/man2/posix_fadvise.2:120
4528 msgid ""
4529 "POSIX.1-2001.  Note that the type of the I<len> argument was changed from "
4530 "I<size_t> to I<off_t> in POSIX.1-2003 TC1."
4531 msgstr ""
4532
4533 #. type: Plain text
4534 #: build/C/man2/posix_fadvise.2:126
4535 msgid ""
4536 "Under Linux, B<POSIX_FADV_NORMAL> sets the readahead window to the default "
4537 "size for the backing device; B<POSIX_FADV_SEQUENTIAL> doubles this size, and "
4538 "B<POSIX_FADV_RANDOM> disables file readahead entirely.  These changes affect "
4539 "the entire file, not just the specified region (but other open file handles "
4540 "to the same file are unaffected)."
4541 msgstr ""
4542
4543 #. type: Plain text
4544 #: build/C/man2/posix_fadvise.2:133
4545 msgid ""
4546 "B<POSIX_FADV_WILLNEED> initiates a nonblocking read of the specified region "
4547 "into the page cache.  The amount of data read may be decreased by the kernel "
4548 "depending on virtual memory load.  (A few megabytes will usually be fully "
4549 "satisfied, and more is rarely useful.)"
4550 msgstr ""
4551
4552 #. type: Plain text
4553 #: build/C/man2/posix_fadvise.2:137
4554 msgid ""
4555 "In kernels before 2.6.18, B<POSIX_FADV_NOREUSE> had the same semantics as "
4556 "B<POSIX_FADV_WILLNEED>.  This was probably a bug; since kernel 2.6.18, this "
4557 "flag is a no-op."
4558 msgstr ""
4559
4560 #. type: Plain text
4561 #: build/C/man2/posix_fadvise.2:145
4562 msgid ""
4563 "B<POSIX_FADV_DONTNEED> attempts to free cached pages associated with the "
4564 "specified region.  This is useful, for example, while streaming large "
4565 "files.  A program may periodically request the kernel to free cached data "
4566 "that has already been used, so that more useful cached pages are not "
4567 "discarded instead."
4568 msgstr ""
4569
4570 #. type: Plain text
4571 #: build/C/man2/posix_fadvise.2:153
4572 msgid ""
4573 "Pages that have not yet been written out will be unaffected, so if the "
4574 "application wishes to guarantee that pages will be released, it should call "
4575 "B<fsync>(2)  or B<fdatasync>(2)  first."
4576 msgstr ""
4577
4578 #. type: SS
4579 #: build/C/man2/posix_fadvise.2:153
4580 #, no-wrap
4581 msgid "arm_fadvise()"
4582 msgstr ""
4583
4584 #. type: Plain text
4585 #: build/C/man2/posix_fadvise.2:165
4586 msgid ""
4587 "The ARM architecture needs 64-bit arguments to be aligned in a suitable pair "
4588 "of registers.  On this architecture, the call signature of "
4589 "B<posix_fadvise>()  is flawed, since it forces a register to be wasted as "
4590 "padding between the I<fd> and I<len> arguments.  Therefore, since Linux "
4591 "2.6.14, ARM defines a different system call that orders the arguments "
4592 "suitably:"
4593 msgstr ""
4594
4595 #. type: Plain text
4596 #: build/C/man2/posix_fadvise.2:170
4597 #, no-wrap
4598 msgid ""
4599 "B<long arm_fadvise64_64(int >I<fd>B<, int >I<advice>B<,>\n"
4600 "B<                      loff_t >I<offset>B<, loff_t >I<len>B<);>\n"
4601 msgstr ""
4602
4603 #.  No ARM support in glibc.
4604 #. type: Plain text
4605 #: build/C/man2/posix_fadvise.2:177
4606 msgid ""
4607 "The behavior of this system call is otherwise exactly the same as "
4608 "B<posix_fadvise>().  No library support is provided for this system call in "
4609 "glibc."
4610 msgstr ""
4611
4612 #. type: Plain text
4613 #: build/C/man2/posix_fadvise.2:182
4614 msgid ""
4615 "In kernels before 2.6.6, if I<len> was specified as 0, then this was "
4616 "interpreted literally as \"zero bytes\", rather than as meaning \"all bytes "
4617 "through to the end of the file\"."
4618 msgstr ""
4619
4620 #.  FIXME . Write a posix_fadvise(3) page.
4621 #. type: Plain text
4622 #: build/C/man2/posix_fadvise.2:188
4623 msgid ""
4624 "B<readahead>(2), B<sync_file_range>(2), B<posix_fallocate>(3), "
4625 "B<posix_madvise>(3)"
4626 msgstr ""
4627
4628 #. type: TH
4629 #: build/C/man3/posix_fallocate.3:23
4630 #, no-wrap
4631 msgid "POSIX_FALLOCATE"
4632 msgstr ""
4633
4634 #. type: TH
4635 #: build/C/man3/posix_fallocate.3:23
4636 #, no-wrap
4637 msgid "2010-09-20"
4638 msgstr ""
4639
4640 #. type: Plain text
4641 #: build/C/man3/posix_fallocate.3:26
4642 msgid "posix_fallocate - allocate file space"
4643 msgstr ""
4644
4645 #. type: Plain text
4646 #: build/C/man3/posix_fallocate.3:31
4647 #, no-wrap
4648 msgid "B<int posix_fallocate(int >I<fd>B<, off_t >I<offset>B<, off_t >I<len>B<);>\n"
4649 msgstr ""
4650
4651 #. type: Plain text
4652 #: build/C/man3/posix_fallocate.3:40
4653 msgid "B<posix_fallocate>():"
4654 msgstr ""
4655
4656 #. type: Plain text
4657 #: build/C/man3/posix_fallocate.3:59
4658 msgid ""
4659 "The function B<posix_fallocate>()  ensures that disk space is allocated for "
4660 "the file referred to by the descriptor I<fd> for the bytes in the range "
4661 "starting at I<offset> and continuing for I<len> bytes.  After a successful "
4662 "call to B<posix_fallocate>(), subsequent writes to bytes in the specified "
4663 "range are guaranteed not to fail because of lack of disk space."
4664 msgstr ""
4665
4666 #. type: Plain text
4667 #: build/C/man3/posix_fallocate.3:64
4668 msgid ""
4669 "If the size of the file is less than I<offset>+I<len>, then the file is "
4670 "increased to this size; otherwise the file size is left unchanged."
4671 msgstr ""
4672
4673 #. type: Plain text
4674 #: build/C/man3/posix_fallocate.3:70
4675 msgid ""
4676 "B<posix_fallocate>()  returns zero on success, or an error number on "
4677 "failure.  Note that I<errno> is not set."
4678 msgstr ""
4679
4680 #. type: Plain text
4681 #: build/C/man3/posix_fallocate.3:79
4682 msgid "I<offset+len> exceeds the maximum file size."
4683 msgstr ""
4684
4685 #. type: Plain text
4686 #: build/C/man3/posix_fallocate.3:89
4687 msgid "I<fd> does not refer to a regular file."
4688 msgstr ""
4689
4690 #. type: Plain text
4691 #: build/C/man3/posix_fallocate.3:98
4692 msgid "I<fd> refers to a pipe."
4693 msgstr ""
4694
4695 #. type: Plain text
4696 #: build/C/man3/posix_fallocate.3:101
4697 msgid "B<posix_fallocate>()  is available since glibc 2.1.94."
4698 msgstr ""
4699
4700 #. type: Plain text
4701 #: build/C/man3/posix_fallocate.3:126
4702 msgid ""
4703 "POSIX.1-2008 says that an implementation I<shall> give the B<EINVAL> error "
4704 "if I<len> was 0, or I<offset> was less than 0.  POSIX.1-2001 says that an "
4705 "implementation I<shall> give the B<EINVAL> error if I<len> is less than 0, "
4706 "or I<offset> was less than 0, and I<may> give the error if I<len> equals "
4707 "zero."
4708 msgstr ""
4709
4710 #. type: Plain text
4711 #: build/C/man3/posix_fallocate.3:130
4712 msgid "B<fallocate>(2), B<lseek>(2), B<posix_fadvise>(2)"
4713 msgstr ""
4714
4715 #. type: TH
4716 #: build/C/man3/posix_memalign.3:28
4717 #, no-wrap
4718 msgid "POSIX_MEMALIGN"
4719 msgstr ""
4720
4721 #. type: TH
4722 #: build/C/man3/posix_memalign.3:28
4723 #, no-wrap
4724 msgid "2012-03-23"
4725 msgstr ""
4726
4727 #. type: Plain text
4728 #: build/C/man3/posix_memalign.3:31
4729 msgid ""
4730 "posix_memalign, aligned_alloc, memalign, valloc, pvalloc - Allocate aligned "
4731 "memory"
4732 msgstr ""
4733
4734 #. type: Plain text
4735 #: build/C/man3/posix_memalign.3:34 build/C/man3/malloc_get_state.3:29
4736 #, no-wrap
4737 msgid "B<#include E<lt>stdlib.hE<gt>>\n"
4738 msgstr ""
4739
4740 #. type: Plain text
4741 #: build/C/man3/posix_memalign.3:38
4742 #, no-wrap
4743 msgid ""
4744 "B<int posix_memalign(void **>I<memptr>B<, size_t >I<alignment>B<, size_t "
4745 ">I<size>B<);>\n"
4746 "B<void *aligned_alloc(size_t >I<alignment>B<, size_t >I<size>B<);>\n"
4747 "B<void *valloc(size_t >I<size>B<);>\n"
4748 msgstr ""
4749
4750 #. type: Plain text
4751 #: build/C/man3/posix_memalign.3:43
4752 #, no-wrap
4753 msgid ""
4754 "B<void *memalign(size_t >I<alignment>B<, size_t >I<size>B<);>\n"
4755 "B<void *pvalloc(size_t >I<size>B<);>\n"
4756 msgstr ""
4757
4758 #. type: Plain text
4759 #: build/C/man3/posix_memalign.3:53
4760 msgid ""
4761 "B<posix_memalign>(): _POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ "
4762 "E<gt>=\\ 600"
4763 msgstr ""
4764
4765 #. type: Plain text
4766 #: build/C/man3/posix_memalign.3:56
4767 msgid "B<aligned_alloc>(): _ISOC11_SOURCE"
4768 msgstr ""
4769
4770 #. type: Plain text
4771 #: build/C/man3/posix_memalign.3:58
4772 msgid "B<valloc>():"
4773 msgstr ""
4774
4775 #. type: TP
4776 #: build/C/man3/posix_memalign.3:61
4777 #, no-wrap
4778 msgid "Since glibc 2.12:"
4779 msgstr ""
4780
4781 #. type: Plain text
4782 #: build/C/man3/posix_memalign.3:68
4783 #, no-wrap
4784 msgid ""
4785 "_BSD_SOURCE ||\n"
4786 "    (_XOPEN_SOURCE\\ E<gt>=\\ 500 ||\n"
4787 "        _XOPEN_SOURCE\\ &&\\ _XOPEN_SOURCE_EXTENDED) &&\n"
4788 "    !(_POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ E<gt>=\\ 600)\n"
4789 msgstr ""
4790
4791 #. type: TP
4792 #: build/C/man3/posix_memalign.3:70
4793 #, no-wrap
4794 msgid "Before glibc 2.12:"
4795 msgstr ""
4796
4797 #. type: Plain text
4798 #: build/C/man3/posix_memalign.3:74
4799 msgid ""
4800 "_BSD_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500 || _XOPEN_SOURCE\\ &&\\ "
4801 "_XOPEN_SOURCE_EXTENDED"
4802 msgstr ""
4803
4804 #. type: Plain text
4805 #: build/C/man3/posix_memalign.3:81
4806 msgid ""
4807 "(The (nonstandard) header file I<E<lt>malloc.hE<gt>> also exposes the "
4808 "declaration of B<valloc>(); no feature test macros are required.)"
4809 msgstr ""
4810
4811 #.  glibc does this:
4812 #. type: Plain text
4813 #: build/C/man3/posix_memalign.3:102
4814 msgid ""
4815 "The function B<posix_memalign>()  allocates I<size> bytes and places the "
4816 "address of the allocated memory in I<*memptr>.  The address of the allocated "
4817 "memory will be a multiple of I<alignment>, which must be a power of two and "
4818 "a multiple of I<sizeof(void *)>.  If I<size> is 0, then B<posix_memalign>()  "
4819 "returns either NULL, or a unique pointer value that can later be "
4820 "successfully passed to B<free>(3)."
4821 msgstr ""
4822
4823 #.  The behavior of memalign() for size==0 is as for posix_memalign()
4824 #.  but no standards govern this.
4825 #. type: Plain text
4826 #: build/C/man3/posix_memalign.3:113
4827 msgid ""
4828 "The obsolete function B<memalign>()  allocates I<size> bytes and returns a "
4829 "pointer to the allocated memory.  The memory address will be a multiple of "
4830 "I<alignment>, which must be a power of two."
4831 msgstr ""
4832
4833 #. type: Plain text
4834 #: build/C/man3/posix_memalign.3:122
4835 msgid ""
4836 "The function B<aligned_alloc>()  is the same as B<memalign>(), except for "
4837 "the added restriction that I<size> should be a multiple of I<alignment>."
4838 msgstr ""
4839
4840 #. type: Plain text
4841 #: build/C/man3/posix_memalign.3:132
4842 msgid ""
4843 "The obsolete function B<valloc>()  allocates I<size> bytes and returns a "
4844 "pointer to the allocated memory.  The memory address will be a multiple of "
4845 "the page size.  It is equivalent to I<memalign(sysconf(_SC_PAGESIZE),size)>."
4846 msgstr ""
4847
4848 #. type: Plain text
4849 #: build/C/man3/posix_memalign.3:139
4850 msgid ""
4851 "The obsolete function B<pvalloc>()  is similar to B<valloc>(), but rounds "
4852 "the size of the allocation up to the next multiple of the system page size."
4853 msgstr ""
4854
4855 #. type: Plain text
4856 #: build/C/man3/posix_memalign.3:141
4857 msgid "For all of these functions, the memory is not zeroed."
4858 msgstr ""
4859
4860 #. type: Plain text
4861 #: build/C/man3/posix_memalign.3:148
4862 msgid ""
4863 "B<aligned_alloc>(), B<memalign>(), B<valloc>(), and B<pvalloc>()  return a "
4864 "pointer to the allocated memory, or NULL if the request fails."
4865 msgstr ""
4866
4867 #. type: Plain text
4868 #: build/C/man3/posix_memalign.3:155
4869 msgid ""
4870 "B<posix_memalign>()  returns zero on success, or one of the error values "
4871 "listed in the next section on failure.  Note that I<errno> is not set."
4872 msgstr ""
4873
4874 #. type: Plain text
4875 #: build/C/man3/posix_memalign.3:162
4876 msgid ""
4877 "The I<alignment> argument was not a power of two, or was not a multiple of "
4878 "I<sizeof(void *)>."
4879 msgstr ""
4880
4881 #. type: Plain text
4882 #: build/C/man3/posix_memalign.3:165
4883 msgid "There was insufficient memory to fulfill the allocation request."
4884 msgstr ""
4885
4886 #. type: Plain text
4887 #: build/C/man3/posix_memalign.3:172
4888 msgid ""
4889 "The functions B<memalign>(), B<valloc>(), and B<pvalloc>()  have been "
4890 "available in all Linux libc libraries."
4891 msgstr ""
4892
4893 #. type: Plain text
4894 #: build/C/man3/posix_memalign.3:176
4895 msgid "The function B<aligned_alloc>()  was added to glibc in version 2.16."
4896 msgstr ""
4897
4898 #. type: Plain text
4899 #: build/C/man3/posix_memalign.3:180
4900 msgid "The function B<posix_memalign>()  is available since glibc 2.1.91."
4901 msgstr ""
4902
4903 #. type: Plain text
4904 #: build/C/man3/posix_memalign.3:187
4905 msgid ""
4906 "The function B<valloc>()  appeared in 3.0BSD.  It is documented as being "
4907 "obsolete in 4.3BSD, and as legacy in SUSv2.  It does not appear in "
4908 "POSIX.1-2001."
4909 msgstr ""
4910
4911 #. type: Plain text
4912 #: build/C/man3/posix_memalign.3:191
4913 msgid "The function B<pvalloc>()  is a GNU extension."
4914 msgstr ""
4915
4916 #. type: Plain text
4917 #: build/C/man3/posix_memalign.3:195
4918 msgid "The function B<memalign>()  appears in SunOS 4.1.3 but not in 4.4BSD."
4919 msgstr ""
4920
4921 #. type: Plain text
4922 #: build/C/man3/posix_memalign.3:199
4923 msgid "The function B<posix_memalign>()  comes from POSIX.1d."
4924 msgstr ""
4925
4926 #. type: Plain text
4927 #: build/C/man3/posix_memalign.3:204
4928 msgid "The function B<aligned_alloc>()  is specified in the C11 standard."
4929 msgstr ""
4930
4931 #. type: SS
4932 #: build/C/man3/posix_memalign.3:204
4933 #, no-wrap
4934 msgid "Headers"
4935 msgstr ""
4936
4937 #. type: Plain text
4938 #: build/C/man3/posix_memalign.3:208
4939 msgid ""
4940 "Everybody agrees that B<posix_memalign>()  is declared in "
4941 "I<E<lt>stdlib.hE<gt>>."
4942 msgstr ""
4943
4944 #. type: Plain text
4945 #: build/C/man3/posix_memalign.3:212
4946 msgid ""
4947 "On some systems B<memalign>()  is declared in I<E<lt>stdlib.hE<gt>> instead "
4948 "of I<E<lt>malloc.hE<gt>>."
4949 msgstr ""
4950
4951 #. type: Plain text
4952 #: build/C/man3/posix_memalign.3:219
4953 msgid ""
4954 "According to SUSv2, B<valloc>()  is declared in I<E<lt>stdlib.hE<gt>>.  "
4955 "Libc4,5 and glibc declare it in I<E<lt>malloc.hE<gt>>, and also in "
4956 "I<E<lt>stdlib.hE<gt>> if suitable feature test macros are defined (see "
4957 "above)."
4958 msgstr ""
4959
4960 #. type: Plain text
4961 #: build/C/man3/posix_memalign.3:228
4962 msgid ""
4963 "On many systems there are alignment restrictions, for example, on buffers "
4964 "used for direct block device I/O.  POSIX specifies the "
4965 "I<pathconf(path,_PC_REC_XFER_ALIGN)> call that tells what alignment is "
4966 "needed.  Now one can use B<posix_memalign>()  to satisfy this requirement."
4967 msgstr ""
4968
4969 #. type: Plain text
4970 #: build/C/man3/posix_memalign.3:237
4971 msgid ""
4972 "B<posix_memalign>()  verifies that I<alignment> matches the requirements "
4973 "detailed above.  B<memalign>()  may not check that the I<alignment> argument "
4974 "is correct."
4975 msgstr ""
4976
4977 #.  Other systems allow passing the result of
4978 #.  .IR valloc ()
4979 #.  to
4980 #.  .IR free (3),
4981 #.  but not to
4982 #.  .IR realloc (3).
4983 #. type: Plain text
4984 #: build/C/man3/posix_memalign.3:265
4985 msgid ""
4986 "POSIX requires that memory obtained from B<posix_memalign>()  can be freed "
4987 "using B<free>(3).  Some systems provide no way to reclaim memory allocated "
4988 "with B<memalign>()  or B<valloc>()  (because one can only pass to B<free>(3)  "
4989 "a pointer gotten from B<malloc>(3), while, for example, B<memalign>()  would "
4990 "call B<malloc>(3)  and then align the obtained value).  The glibc "
4991 "implementation allows memory obtained from any of these these functions to "
4992 "be reclaimed with B<free>(3)."
4993 msgstr ""
4994
4995 #. type: Plain text
4996 #: build/C/man3/posix_memalign.3:270
4997 msgid ""
4998 "The glibc B<malloc>(3)  always returns 8-byte aligned memory addresses, so "
4999 "these functions are only needed if you require larger alignment values."
5000 msgstr ""
5001
5002 #. type: Plain text
5003 #: build/C/man3/posix_memalign.3:275
5004 msgid "B<brk>(2), B<getpagesize>(2), B<free>(3), B<malloc>(3)"
5005 msgstr ""
5006
5007 #. type: TH
5008 #: build/C/man2/readahead.2:28
5009 #, no-wrap
5010 msgid "READAHEAD"
5011 msgstr ""
5012
5013 #. type: TH
5014 #: build/C/man2/readahead.2:28 build/C/man7/shm_overview.7:27
5015 #, no-wrap
5016 msgid "2010-09-10"
5017 msgstr ""
5018
5019 #. type: Plain text
5020 #: build/C/man2/readahead.2:31
5021 msgid "readahead - perform file readahead into page cache"
5022 msgstr ""
5023
5024 #. type: Plain text
5025 #: build/C/man2/readahead.2:37
5026 #, no-wrap
5027 msgid ""
5028 "B<ssize_t readahead(int >I<fd>B<, off64_t >I<offset>B<, size_t "
5029 ">I<count>B<);>\n"
5030 msgstr ""
5031
5032 #. type: Plain text
5033 #: build/C/man2/readahead.2:65
5034 msgid ""
5035 "B<readahead>()  populates the page cache with data from a file so that "
5036 "subsequent reads from that file will not block on disk I/O.  The I<fd> "
5037 "argument is a file descriptor identifying the file which is to be read.  The "
5038 "I<offset> argument specifies the starting point from which data is to be "
5039 "read and I<count> specifies the number of bytes to be read.  I/O is "
5040 "performed in whole pages, so that I<offset> is effectively rounded down to a "
5041 "page boundary and bytes are read up to the next page boundary greater than "
5042 "or equal to I<(offset+count)>.  B<readahead>()  does not read beyond the end "
5043 "of the file.  B<readahead>()  blocks until the specified data has been "
5044 "read.  The current file offset of the open file referred to by I<fd> is left "
5045 "unchanged."
5046 msgstr ""
5047
5048 #. type: Plain text
5049 #: build/C/man2/readahead.2:71
5050 msgid ""
5051 "On success, B<readahead>()  returns 0; on failure, -1 is returned, with "
5052 "I<errno> set to indicate the cause of the error."
5053 msgstr ""
5054
5055 #. type: Plain text
5056 #: build/C/man2/readahead.2:76
5057 msgid "I<fd> is not a valid file descriptor or is not open for reading."
5058 msgstr ""
5059
5060 #. type: Plain text
5061 #: build/C/man2/readahead.2:82
5062 msgid "I<fd> does not refer to a file type to which B<readahead>()  can be applied."
5063 msgstr ""
5064
5065 #. type: Plain text
5066 #: build/C/man2/readahead.2:87
5067 msgid ""
5068 "The B<readahead>()  system call appeared in Linux 2.4.13; glibc support has "
5069 "been provided since version 2.3."
5070 msgstr ""
5071
5072 #. type: Plain text
5073 #: build/C/man2/readahead.2:92
5074 msgid ""
5075 "The B<readahead>()  system call is Linux-specific, and its use should be "
5076 "avoided in portable applications."
5077 msgstr ""
5078
5079 #. type: Plain text
5080 #: build/C/man2/readahead.2:98
5081 msgid "B<lseek>(2), B<madvise>(2), B<mmap>(2), B<posix_fadvise>(2), B<read>(2)"
5082 msgstr ""
5083
5084 #. type: TH
5085 #: build/C/man2/remap_file_pages.2:26
5086 #, no-wrap
5087 msgid "REMAP_FILE_PAGES"
5088 msgstr ""
5089
5090 #. type: Plain text
5091 #: build/C/man2/remap_file_pages.2:29
5092 msgid "remap_file_pages - create a nonlinear file mapping"
5093 msgstr ""
5094
5095 #. type: Plain text
5096 #: build/C/man2/remap_file_pages.2:33
5097 #, no-wrap
5098 msgid ""
5099 "B<#define _GNU_SOURCE>         /* See feature_test_macros(7) */\n"
5100 "B<#include E<lt>sys/mman.hE<gt>>\n"
5101 msgstr ""
5102
5103 #. type: Plain text
5104 #: build/C/man2/remap_file_pages.2:36
5105 #, no-wrap
5106 msgid ""
5107 "B<int remap_file_pages(void *>I<addr>B<, size_t >I<size>B<, int "
5108 ">I<prot>B<,>\n"
5109 "B<                     ssize_t >I<pgoff>B<, int >I<flags>B<);>\n"
5110 msgstr ""
5111
5112 #. type: Plain text
5113 #: build/C/man2/remap_file_pages.2:49
5114 msgid ""
5115 "The B<remap_file_pages>()  system call is used to create a nonlinear "
5116 "mapping, that is, a mapping in which the pages of the file are mapped into a "
5117 "nonsequential order in memory.  The advantage of using B<remap_file_pages>()  "
5118 "over using repeated calls to B<mmap>(2)  is that the former approach does "
5119 "not require the kernel to create additional VMA (Virtual Memory Area) data "
5120 "structures."
5121 msgstr ""
5122
5123 #. type: Plain text
5124 #: build/C/man2/remap_file_pages.2:51
5125 msgid "To create a nonlinear mapping we perform the following steps:"
5126 msgstr ""
5127
5128 #. type: TP
5129 #: build/C/man2/remap_file_pages.2:51
5130 #, no-wrap
5131 msgid "1."
5132 msgstr ""
5133
5134 #. type: Plain text
5135 #: build/C/man2/remap_file_pages.2:59
5136 msgid ""
5137 "Use B<mmap>(2)  to create a mapping (which is initially linear).  This "
5138 "mapping must be created with the B<MAP_SHARED> flag."
5139 msgstr ""
5140
5141 #. type: TP
5142 #: build/C/man2/remap_file_pages.2:59
5143 #, no-wrap
5144 msgid "2."
5145 msgstr ""
5146
5147 #. type: Plain text
5148 #: build/C/man2/remap_file_pages.2:67
5149 msgid ""
5150 "Use one or more calls to B<remap_file_pages>()  to rearrange the "
5151 "correspondence between the pages of the mapping and the pages of the file.  "
5152 "It is possible to map the same page of a file into multiple locations within "
5153 "the mapped region."
5154 msgstr ""
5155
5156 #. type: Plain text
5157 #: build/C/man2/remap_file_pages.2:78
5158 msgid ""
5159 "The I<pgoff> and I<size> arguments specify the region of the file that is to "
5160 "be relocated within the mapping: I<pgoff> is a file offset in units of the "
5161 "system page size; I<size> is the length of the region in bytes."
5162 msgstr ""
5163
5164 #. type: Plain text
5165 #: build/C/man2/remap_file_pages.2:96
5166 msgid ""
5167 "The I<addr> argument serves two purposes.  First, it identifies the mapping "
5168 "whose pages we want to rearrange.  Thus, I<addr> must be an address that "
5169 "falls within a region previously mapped by a call to B<mmap>(2).  Second, "
5170 "I<addr> specifies the address at which the file pages identified by I<pgoff> "
5171 "and I<size> will be placed."
5172 msgstr ""
5173
5174 #.  This rounding is weird, and not consistent with the treatment of
5175 #.  the analogous arguments for munmap()/mprotect() and for mlock().
5176 #.  MTK, 14 Sep 2005
5177 #. type: Plain text
5178 #: build/C/man2/remap_file_pages.2:110
5179 msgid ""
5180 "The values specified in I<addr> and I<size> should be multiples of the "
5181 "system page size.  If they are not, then the kernel rounds I<both> values "
5182 "I<down> to the nearest multiple of the page size."
5183 msgstr ""
5184
5185 #. type: Plain text
5186 #: build/C/man2/remap_file_pages.2:114
5187 msgid "The I<prot> argument must be specified as 0."
5188 msgstr ""
5189
5190 #. type: Plain text
5191 #: build/C/man2/remap_file_pages.2:122
5192 msgid ""
5193 "The I<flags> argument has the same meaning as for B<mmap>(2), but all flags "
5194 "other than B<MAP_NONBLOCK> are ignored."
5195 msgstr ""
5196
5197 #. type: Plain text
5198 #: build/C/man2/remap_file_pages.2:129
5199 msgid ""
5200 "On success, B<remap_file_pages>()  returns 0.  On error, -1 is returned, and "
5201 "I<errno> is set appropriately."
5202 msgstr ""
5203
5204 #. type: Plain text
5205 #: build/C/man2/remap_file_pages.2:137
5206 msgid ""
5207 "I<addr> does not refer to a valid mapping created with the B<MAP_SHARED> "
5208 "flag."
5209 msgstr ""
5210
5211 #.  And possibly others from vma->vm_ops->populate()
5212 #. type: Plain text
5213 #: build/C/man2/remap_file_pages.2:146
5214 msgid "I<addr>, I<size>, I<prot>, or I<pgoff> is invalid."
5215 msgstr ""
5216
5217 #. type: Plain text
5218 #: build/C/man2/remap_file_pages.2:151
5219 msgid ""
5220 "The B<remap_file_pages>()  system call appeared in Linux 2.5.46; glibc "
5221 "support was added in version 2.3.3."
5222 msgstr ""
5223
5224 #. type: Plain text
5225 #: build/C/man2/remap_file_pages.2:155
5226 msgid "The B<remap_file_pages>()  system call is Linux-specific."
5227 msgstr ""
5228
5229 #. type: Plain text
5230 #: build/C/man2/remap_file_pages.2:162
5231 msgid ""
5232 "B<getpagesize>(2), B<mmap>(2), B<mmap2>(2), B<mprotect>(2), B<mremap>(2), "
5233 "B<msync>(2)"
5234 msgstr ""
5235
5236 #. type: TH
5237 #: build/C/man3/shm_open.3:26
5238 #, no-wrap
5239 msgid "SHM_OPEN"
5240 msgstr ""
5241
5242 #. type: TH
5243 #: build/C/man3/shm_open.3:26
5244 #, no-wrap
5245 msgid "2009-02-25"
5246 msgstr ""
5247
5248 #. type: Plain text
5249 #: build/C/man3/shm_open.3:29
5250 msgid "shm_open, shm_unlink - Create/open or unlink POSIX shared memory objects"
5251 msgstr ""
5252
5253 #. type: Plain text
5254 #: build/C/man3/shm_open.3:33
5255 msgid "B<#include E<lt>sys/stat.hE<gt>> /* For mode constants */"
5256 msgstr ""
5257
5258 #. type: Plain text
5259 #: build/C/man3/shm_open.3:35
5260 msgid "B<#include E<lt>fcntl.hE<gt>> /* For O_* constants */"
5261 msgstr ""
5262
5263 #. type: Plain text
5264 #: build/C/man3/shm_open.3:37
5265 msgid "B<int shm_open(const char *>I<name>B<, int >I<oflag>B<, mode_t >I<mode>B<);>"
5266 msgstr ""
5267
5268 #. type: Plain text
5269 #: build/C/man3/shm_open.3:39
5270 msgid "B<int shm_unlink(const char *>I<name>B<);>"
5271 msgstr ""
5272
5273 #. type: Plain text
5274 #: build/C/man3/shm_open.3:41
5275 msgid "Link with I<-lrt>."
5276 msgstr ""
5277
5278 #. type: Plain text
5279 #: build/C/man3/shm_open.3:53
5280 msgid ""
5281 "B<shm_open>()  creates and opens a new, or opens an existing, POSIX shared "
5282 "memory object.  A POSIX shared memory object is in effect a handle which can "
5283 "be used by unrelated processes to B<mmap>(2)  the same region of shared "
5284 "memory.  The B<shm_unlink>()  function performs the converse operation, "
5285 "removing an object previously created by B<shm_open>()."
5286 msgstr ""
5287
5288 #.  glibc allows the initial slash to be omitted, and makes
5289 #.  multiple initial slashes equivalent to a single slash.
5290 #.  This differs from the implementation of POSIX message queues.
5291 #.  glibc allows subdirectory components in the name, in which
5292 #.  case the subdirectory must exist under /dev/shm, and allow the
5293 #.  required permissions if a user wants to create a shared memory
5294 #.  object in that subdirectory.
5295 #. type: Plain text
5296 #: build/C/man3/shm_open.3:74
5297 msgid ""
5298 "The operation of B<shm_open>()  is analogous to that of B<open>(2).  I<name> "
5299 "specifies the shared memory object to be created or opened.  For portable "
5300 "use, a shared memory object should be identified by a name of the form "
5301 "I</somename>; that is, a null-terminated string of up to B<NAME_MAX> (i.e., "
5302 "255) characters consisting of an initial slash, followed by one or more "
5303 "characters, none of which are slashes."
5304 msgstr ""
5305
5306 #. type: Plain text
5307 #: build/C/man3/shm_open.3:81
5308 msgid ""
5309 "I<oflag> is a bit mask created by ORing together exactly one of B<O_RDONLY> "
5310 "or B<O_RDWR> and any of the other flags listed here:"
5311 msgstr ""
5312
5313 #. type: TP
5314 #: build/C/man3/shm_open.3:81
5315 #, no-wrap
5316 msgid "B<O_RDONLY>"
5317 msgstr ""
5318
5319 #. type: Plain text
5320 #: build/C/man3/shm_open.3:87
5321 msgid ""
5322 "Open the object for read access.  A shared memory object opened in this way "
5323 "can only be B<mmap>(2)ed for read (B<PROT_READ>) access."
5324 msgstr ""
5325
5326 #. type: TP
5327 #: build/C/man3/shm_open.3:87
5328 #, no-wrap
5329 msgid "B<O_RDWR>"
5330 msgstr ""
5331
5332 #. type: Plain text
5333 #: build/C/man3/shm_open.3:90
5334 msgid "Open the object for read-write access."
5335 msgstr ""
5336
5337 #. type: TP
5338 #: build/C/man3/shm_open.3:90
5339 #, no-wrap
5340 msgid "B<O_CREAT>"
5341 msgstr ""
5342
5343 #.  In truth it is actually the file system IDs on Linux, but these
5344 #.  are nearly always the same as the effective IDs.  (MTK, Jul 05)
5345 #. type: Plain text
5346 #: build/C/man3/shm_open.3:110
5347 msgid ""
5348 "Create the shared memory object if it does not exist.  The user and group "
5349 "ownership of the object are taken from the corresponding effective IDs of "
5350 "the calling process, and the object's permission bits are set according to "
5351 "the low-order 9 bits of I<mode>, except that those bits set in the process "
5352 "file mode creation mask (see B<umask>(2))  are cleared for the new object.  "
5353 "A set of macro constants which can be used to define I<mode> is listed in "
5354 "B<open>(2).  (Symbolic definitions of these constants can be obtained by "
5355 "including I<E<lt>sys/stat.hE<gt>>.)"
5356 msgstr ""
5357
5358 #. type: Plain text
5359 #: build/C/man3/shm_open.3:116
5360 msgid ""
5361 "A new shared memory object initially has zero length\\(emthe size of the "
5362 "object can be set using B<ftruncate>(2).  The newly allocated bytes of a "
5363 "shared memory object are automatically initialized to 0."
5364 msgstr ""
5365
5366 #. type: TP
5367 #: build/C/man3/shm_open.3:116
5368 #, no-wrap
5369 msgid "B<O_EXCL>"
5370 msgstr ""
5371
5372 #. type: Plain text
5373 #: build/C/man3/shm_open.3:125
5374 msgid ""
5375 "If B<O_CREAT> was also specified, and a shared memory object with the given "
5376 "I<name> already exists, return an error.  The check for the existence of the "
5377 "object, and its creation if it does not exist, are performed atomically."
5378 msgstr ""
5379
5380 #. type: TP
5381 #: build/C/man3/shm_open.3:125
5382 #, no-wrap
5383 msgid "B<O_TRUNC>"
5384 msgstr ""
5385
5386 #. type: Plain text
5387 #: build/C/man3/shm_open.3:128
5388 msgid "If the shared memory object already exists, truncate it to zero bytes."
5389 msgstr ""
5390
5391 #. type: Plain text
5392 #: build/C/man3/shm_open.3:131
5393 msgid ""
5394 "Definitions of these flag values can be obtained by including "
5395 "I<E<lt>fcntl.hE<gt>>."
5396 msgstr ""
5397
5398 #. type: Plain text
5399 #: build/C/man3/shm_open.3:142
5400 msgid ""
5401 "On successful completion B<shm_open>()  returns a new file descriptor "
5402 "referring to the shared memory object.  This file descriptor is guaranteed "
5403 "to be the lowest-numbered file descriptor not previously opened within the "
5404 "process.  The B<FD_CLOEXEC> flag (see B<fcntl>(2))  is set for the file "
5405 "descriptor."
5406 msgstr ""
5407
5408 #. type: Plain text
5409 #: build/C/man3/shm_open.3:151
5410 msgid ""
5411 "The file descriptor is normally used in subsequent calls to B<ftruncate>(2)  "
5412 "(for a newly created object) and B<mmap>(2).  After a call to B<mmap>(2)  "
5413 "the file descriptor may be closed without affecting the memory mapping."
5414 msgstr ""
5415
5416 #. type: Plain text
5417 #: build/C/man3/shm_open.3:169
5418 msgid ""
5419 "The operation of B<shm_unlink>()  is analogous to B<unlink>(2): it removes a "
5420 "shared memory object name, and, once all processes have unmapped the object, "
5421 "de-allocates and destroys the contents of the associated memory region.  "
5422 "After a successful B<shm_unlink>(), attempts to B<shm_open>()  an object "
5423 "with the same I<name> will fail (unless B<O_CREAT> was specified, in which "
5424 "case a new, distinct object is created)."
5425 msgstr ""
5426
5427 #. type: Plain text
5428 #: build/C/man3/shm_open.3:178
5429 msgid ""
5430 "On success, B<shm_open>()  returns a nonnegative file descriptor.  On "
5431 "failure, B<shm_open>()  returns -1.  B<shm_unlink>()  returns 0 on success, "
5432 "or -1 on error."
5433 msgstr ""
5434
5435 #. type: Plain text
5436 #: build/C/man3/shm_open.3:185
5437 msgid ""
5438 "On failure, I<errno> is set to indicate the cause of the error.  Values "
5439 "which may appear in I<errno> include the following:"
5440 msgstr ""
5441
5442 #. type: Plain text
5443 #: build/C/man3/shm_open.3:190
5444 msgid "Permission to B<shm_unlink>()  the shared memory object was denied."
5445 msgstr ""
5446
5447 #. type: Plain text
5448 #: build/C/man3/shm_open.3:200
5449 msgid ""
5450 "Permission was denied to B<shm_open>()  I<name> in the specified I<mode>, or "
5451 "B<O_TRUNC> was specified and the caller does not have write permission on "
5452 "the object."
5453 msgstr ""
5454
5455 #. type: TP
5456 #: build/C/man3/shm_open.3:200 build/C/man2/shmget.2:192
5457 #, no-wrap
5458 msgid "B<EEXIST>"
5459 msgstr ""
5460
5461 #. type: Plain text
5462 #: build/C/man3/shm_open.3:211
5463 msgid ""
5464 "Both B<O_CREAT> and B<O_EXCL> were specified to B<shm_open>()  and the "
5465 "shared memory object specified by I<name> already exists."
5466 msgstr ""
5467
5468 #. type: Plain text
5469 #: build/C/man3/shm_open.3:218
5470 msgid "The I<name> argument to B<shm_open>()  was invalid."
5471 msgstr ""
5472
5473 #. type: TP
5474 #: build/C/man3/shm_open.3:218
5475 #, no-wrap
5476 msgid "B<EMFILE>"
5477 msgstr ""
5478
5479 #. type: Plain text
5480 #: build/C/man3/shm_open.3:221
5481 msgid "The process already has the maximum number of files open."
5482 msgstr ""
5483
5484 #. type: TP
5485 #: build/C/man3/shm_open.3:221
5486 #, no-wrap
5487 msgid "B<ENAMETOOLONG>"
5488 msgstr ""
5489
5490 #. type: Plain text
5491 #: build/C/man3/shm_open.3:227
5492 msgid "The length of I<name> exceeds B<PATH_MAX>."
5493 msgstr ""
5494
5495 #. type: Plain text
5496 #: build/C/man3/shm_open.3:231
5497 msgid "The limit on the total number of files open on the system has been reached."
5498 msgstr ""
5499
5500 #. type: TP
5501 #: build/C/man3/shm_open.3:231 build/C/man3/shm_open.3:240 build/C/man2/shmget.2:206
5502 #, no-wrap
5503 msgid "B<ENOENT>"
5504 msgstr ""
5505
5506 #. type: Plain text
5507 #: build/C/man3/shm_open.3:240
5508 msgid ""
5509 "An attempt was made to B<shm_open>()  a I<name> that did not exist, and "
5510 "B<O_CREAT> was not specified."
5511 msgstr ""
5512
5513 #. type: Plain text
5514 #: build/C/man3/shm_open.3:247
5515 msgid "An attempt was to made to B<shm_unlink>()  a I<name> that does not exist."
5516 msgstr ""
5517
5518 #. type: Plain text
5519 #: build/C/man3/shm_open.3:249
5520 msgid "These functions are provided in glibc 2.2 and later."
5521 msgstr ""
5522
5523 #. type: Plain text
5524 #: build/C/man3/shm_open.3:255
5525 msgid ""
5526 "POSIX.1-2001 says that the group ownership of a newly created shared memory "
5527 "object is set to either the calling process's effective group ID or \"a "
5528 "system default group ID\"."
5529 msgstr ""
5530
5531 #. type: Plain text
5532 #: build/C/man3/shm_open.3:264
5533 msgid ""
5534 "POSIX leaves the behavior of the combination of B<O_RDONLY> and B<O_TRUNC> "
5535 "unspecified.  On Linux, this will successfully truncate an existing shared "
5536 "memory object\\(emthis may not be so on other UNIX systems."
5537 msgstr ""
5538
5539 #. type: Plain text
5540 #: build/C/man3/shm_open.3:269
5541 msgid ""
5542 "The POSIX shared memory object implementation on Linux 2.4 makes use of a "
5543 "dedicated file system, which is normally mounted under I</dev/shm>."
5544 msgstr ""
5545
5546 #. type: Plain text
5547 #: build/C/man3/shm_open.3:280
5548 msgid ""
5549 "B<close>(2), B<fchmod>(2), B<fchown>(2), B<fcntl>(2), B<fstat>(2), "
5550 "B<ftruncate>(2), B<mmap>(2), B<open>(2), B<umask>(2), B<shm_overview>(7)"
5551 msgstr ""
5552
5553 #. type: TH
5554 #: build/C/man7/shm_overview.7:27
5555 #, no-wrap
5556 msgid "SHM_OVERVIEW"
5557 msgstr ""
5558
5559 #. type: Plain text
5560 #: build/C/man7/shm_overview.7:30
5561 msgid "shm_overview - Overview of POSIX shared memory"
5562 msgstr ""
5563
5564 #. type: Plain text
5565 #: build/C/man7/shm_overview.7:33
5566 msgid ""
5567 "The POSIX shared memory API allows processes to communicate information by "
5568 "sharing a region of memory."
5569 msgstr ""
5570
5571 #. type: Plain text
5572 #: build/C/man7/shm_overview.7:35
5573 msgid "The interfaces employed in the API are:"
5574 msgstr ""
5575
5576 #. type: TP
5577 #: build/C/man7/shm_overview.7:35
5578 #, no-wrap
5579 msgid "B<shm_open>(3)"
5580 msgstr ""
5581
5582 #. type: Plain text
5583 #: build/C/man7/shm_overview.7:42
5584 msgid ""
5585 "Create and open a new object, or open an existing object.  This is analogous "
5586 "to B<open>(2).  The call returns a file descriptor for use by the other "
5587 "interfaces listed below."
5588 msgstr ""
5589
5590 #. type: TP
5591 #: build/C/man7/shm_overview.7:42
5592 #, no-wrap
5593 msgid "B<ftruncate>(2)"
5594 msgstr ""
5595
5596 #. type: Plain text
5597 #: build/C/man7/shm_overview.7:46
5598 msgid ""
5599 "Set the size of the shared memory object.  (A newly created shared memory "
5600 "object has a length of zero.)"
5601 msgstr ""
5602
5603 #. type: Plain text
5604 #: build/C/man7/shm_overview.7:50
5605 msgid ""
5606 "Map the shared memory object into the virtual address space of the calling "
5607 "process."
5608 msgstr ""
5609
5610 #. type: TP
5611 #: build/C/man7/shm_overview.7:50
5612 #, no-wrap
5613 msgid "B<munmap>(2)"
5614 msgstr ""
5615
5616 #. type: Plain text
5617 #: build/C/man7/shm_overview.7:54
5618 msgid ""
5619 "Unmap the shared memory object from the virtual address space of the calling "
5620 "process."
5621 msgstr ""
5622
5623 #. type: TP
5624 #: build/C/man7/shm_overview.7:54
5625 #, no-wrap
5626 msgid "B<shm_unlink>(3)"
5627 msgstr ""
5628
5629 #. type: Plain text
5630 #: build/C/man7/shm_overview.7:57
5631 msgid "Remove a shared memory object name."
5632 msgstr ""
5633
5634 #. type: TP
5635 #: build/C/man7/shm_overview.7:57
5636 #, no-wrap
5637 msgid "B<close>(2)"
5638 msgstr ""
5639
5640 #. type: Plain text
5641 #: build/C/man7/shm_overview.7:62
5642 msgid ""
5643 "Close the file descriptor allocated by B<shm_open>(3)  when it is no longer "
5644 "needed."
5645 msgstr ""
5646
5647 #. type: TP
5648 #: build/C/man7/shm_overview.7:62
5649 #, no-wrap
5650 msgid "B<fstat>(2)"
5651 msgstr ""
5652
5653 #. type: Plain text
5654 #: build/C/man7/shm_overview.7:76
5655 msgid ""
5656 "Obtain a I<stat> structure that describes the shared memory object.  Among "
5657 "the information returned by this call are the object's size (I<st_size>), "
5658 "permissions (I<st_mode>), owner (I<st_uid>), and group (I<st_gid>)."
5659 msgstr ""
5660
5661 #. type: TP
5662 #: build/C/man7/shm_overview.7:76
5663 #, no-wrap
5664 msgid "B<fchown>(2)"
5665 msgstr ""
5666
5667 #. type: Plain text
5668 #: build/C/man7/shm_overview.7:79
5669 msgid "To change the ownership of a shared memory object."
5670 msgstr ""
5671
5672 #. type: TP
5673 #: build/C/man7/shm_overview.7:79
5674 #, no-wrap
5675 msgid "B<fchmod>(2)"
5676 msgstr ""
5677
5678 #. type: Plain text
5679 #: build/C/man7/shm_overview.7:82
5680 msgid "To change the permissions of a shared memory object."
5681 msgstr ""
5682
5683 #. type: SS
5684 #: build/C/man7/shm_overview.7:82
5685 #, no-wrap
5686 msgid "Versions"
5687 msgstr ""
5688
5689 #. type: Plain text
5690 #: build/C/man7/shm_overview.7:84
5691 msgid "POSIX shared memory is supported since Linux 2.4 and glibc 2.2."
5692 msgstr ""
5693
5694 #. type: SS
5695 #: build/C/man7/shm_overview.7:84
5696 #, no-wrap
5697 msgid "Persistence"
5698 msgstr ""
5699
5700 #. type: Plain text
5701 #: build/C/man7/shm_overview.7:89
5702 msgid ""
5703 "POSIX shared memory objects have kernel persistence: a shared memory object "
5704 "will exist until the system is shut down, or until all processes have "
5705 "unmapped the object and it has been deleted with B<shm_unlink>(3)"
5706 msgstr ""
5707
5708 #. type: SS
5709 #: build/C/man7/shm_overview.7:89
5710 #, no-wrap
5711 msgid "Linking"
5712 msgstr ""
5713
5714 #. type: Plain text
5715 #: build/C/man7/shm_overview.7:94
5716 msgid ""
5717 "Programs using the POSIX shared memory API must be compiled with I<cc -lrt> "
5718 "to link against the real-time library, I<librt>."
5719 msgstr ""
5720
5721 #. type: SS
5722 #: build/C/man7/shm_overview.7:94
5723 #, no-wrap
5724 msgid "Accessing shared memory objects via the file system"
5725 msgstr ""
5726
5727 #. type: Plain text
5728 #: build/C/man7/shm_overview.7:101
5729 msgid ""
5730 "On Linux, shared memory objects are created in a (I<tmpfs>)  virtual file "
5731 "system, normally mounted under I</dev/shm>.  Since kernel 2.6.19, Linux "
5732 "supports the use of access control lists (ACLs)  to control the permissions "
5733 "of objects in the virtual file system."
5734 msgstr ""
5735
5736 #. type: Plain text
5737 #: build/C/man7/shm_overview.7:106
5738 msgid ""
5739 "Typically, processes must synchronize their access to a shared memory "
5740 "object, using, for example, POSIX semaphores."
5741 msgstr ""
5742
5743 #. type: Plain text
5744 #: build/C/man7/shm_overview.7:114
5745 msgid ""
5746 "System V shared memory (B<shmget>(2), B<shmop>(2), etc.) is an older shared "
5747 "memory API.  POSIX shared memory provides a simpler, and better designed "
5748 "interface; on the other hand POSIX shared memory is somewhat less widely "
5749 "available (especially on older systems) than System V shared memory."
5750 msgstr ""
5751
5752 #. type: Plain text
5753 #: build/C/man7/shm_overview.7:127
5754 msgid ""
5755 "B<fchmod>(2), B<fchown>(2), B<fstat>(2), B<ftruncate>(2), B<mmap>(2), "
5756 "B<mprotect>(2), B<munmap>(2), B<shmget>(2), B<shmop>(2), B<shm_open>(3), "
5757 "B<shm_unlink>(3), B<sem_overview>(7)"
5758 msgstr ""
5759
5760 #. type: TH
5761 #: build/C/man2/shmctl.2:43
5762 #, no-wrap
5763 msgid "SHMCTL"
5764 msgstr ""
5765
5766 #. type: TH
5767 #: build/C/man2/shmctl.2:43
5768 #, no-wrap
5769 msgid "2008-08-07"
5770 msgstr ""
5771
5772 #. type: Plain text
5773 #: build/C/man2/shmctl.2:46
5774 msgid "shmctl - shared memory control"
5775 msgstr ""
5776
5777 #. type: Plain text
5778 #: build/C/man2/shmctl.2:49 build/C/man2/shmget.2:42
5779 msgid "B<#include E<lt>sys/ipc.hE<gt>>"
5780 msgstr ""
5781
5782 #. type: Plain text
5783 #: build/C/man2/shmctl.2:51 build/C/man2/shmget.2:44
5784 msgid "B<#include E<lt>sys/shm.hE<gt>>"
5785 msgstr ""
5786
5787 #. type: Plain text
5788 #: build/C/man2/shmctl.2:53
5789 msgid "B<int shmctl(int >I<shmid>B<, int >I<cmd>B<, struct shmid_ds *>I<buf>B<);>"
5790 msgstr ""
5791
5792 #. type: Plain text
5793 #: build/C/man2/shmctl.2:60
5794 msgid ""
5795 "B<shmctl>()  performs the control operation specified by I<cmd> on the "
5796 "shared memory segment whose identifier is given in I<shmid>."
5797 msgstr ""
5798
5799 #. type: Plain text
5800 #: build/C/man2/shmctl.2:65
5801 msgid ""
5802 "The I<buf> argument is a pointer to a I<shmid_ds> structure, defined in "
5803 "I<E<lt>sys/shm.hE<gt>> as follows:"
5804 msgstr ""
5805
5806 #. type: Plain text
5807 #: build/C/man2/shmctl.2:79
5808 #, no-wrap
5809 msgid ""
5810 "struct shmid_ds {\n"
5811 "    struct ipc_perm shm_perm;    /* Ownership and permissions */\n"
5812 "    size_t          shm_segsz;   /* Size of segment (bytes) */\n"
5813 "    time_t          shm_atime;   /* Last attach time */\n"
5814 "    time_t          shm_dtime;   /* Last detach time */\n"
5815 "    time_t          shm_ctime;   /* Last change time */\n"
5816 "    pid_t           shm_cpid;    /* PID of creator */\n"
5817 "    pid_t           shm_lpid;    /* PID of last shmat(2)/shmdt(2) */\n"
5818 "    shmatt_t        shm_nattch;  /* No. of current attaches */\n"
5819 "    ...\n"
5820 "};\n"
5821 msgstr ""
5822
5823 #. type: Plain text
5824 #: build/C/man2/shmctl.2:87
5825 msgid ""
5826 "The I<ipc_perm> structure is defined in I<E<lt>sys/ipc.hE<gt>> as follows "
5827 "(the highlighted fields are settable using B<IPC_SET>):"
5828 msgstr ""
5829
5830 #. type: Plain text
5831 #: build/C/man2/shmctl.2:100
5832 #, no-wrap
5833 msgid ""
5834 "struct ipc_perm {\n"
5835 "    key_t          __key;    /* Key supplied to shmget(2) */\n"
5836 "    uid_t          B<uid>;      /* Effective UID of owner */\n"
5837 "    gid_t          B<gid>;      /* Effective GID of owner */\n"
5838 "    uid_t          cuid;     /* Effective UID of creator */\n"
5839 "    gid_t          cgid;     /* Effective GID of creator */\n"
5840 "    unsigned short B<mode>;     /* B<Permissions> + SHM_DEST and\n"
5841 "                                SHM_LOCKED flags */\n"
5842 "    unsigned short __seq;    /* Sequence number */\n"
5843 "};\n"
5844 msgstr ""
5845
5846 #. type: Plain text
5847 #: build/C/man2/shmctl.2:106
5848 msgid "Valid values for I<cmd> are:"
5849 msgstr ""
5850
5851 #. type: TP
5852 #: build/C/man2/shmctl.2:107
5853 #, no-wrap
5854 msgid "B<IPC_STAT>"
5855 msgstr ""
5856
5857 #. type: Plain text
5858 #: build/C/man2/shmctl.2:116
5859 msgid ""
5860 "Copy information from the kernel data structure associated with I<shmid> "
5861 "into the I<shmid_ds> structure pointed to by I<buf>.  The caller must have "
5862 "read permission on the shared memory segment."
5863 msgstr ""
5864
5865 #. type: TP
5866 #: build/C/man2/shmctl.2:116
5867 #, no-wrap
5868 msgid "B<IPC_SET>"
5869 msgstr ""
5870
5871 #. type: Plain text
5872 #: build/C/man2/shmctl.2:134
5873 msgid ""
5874 "Write the values of some members of the I<shmid_ds> structure pointed to by "
5875 "I<buf> to the kernel data structure associated with this shared memory "
5876 "segment, updating also its I<shm_ctime> member.  The following fields can be "
5877 "changed: I<shm_perm.uid>, I<shm_perm.gid>, and (the least significant 9 bits "
5878 "of) I<shm_perm.mode>.  The effective UID of the calling process must match "
5879 "the owner (I<shm_perm.uid>)  or creator (I<shm_perm.cuid>)  of the shared "
5880 "memory segment, or the caller must be privileged."
5881 msgstr ""
5882
5883 #. type: TP
5884 #: build/C/man2/shmctl.2:134
5885 #, no-wrap
5886 msgid "B<IPC_RMID>"
5887 msgstr ""
5888
5889 #. type: Plain text
5890 #: build/C/man2/shmctl.2:151
5891 msgid ""
5892 "Mark the segment to be destroyed.  The segment will only actually be "
5893 "destroyed after the last process detaches it (i.e., when the I<shm_nattch> "
5894 "member of the associated structure I<shmid_ds> is zero).  The caller must be "
5895 "the owner or creator, or be privileged.  If a segment has been marked for "
5896 "destruction, then the (nonstandard)  B<SHM_DEST> flag of the "
5897 "I<shm_perm.mode> field in the associated data structure retrieved by "
5898 "B<IPC_STAT> will be set."
5899 msgstr ""
5900
5901 #. type: Plain text
5902 #: build/C/man2/shmctl.2:154
5903 msgid ""
5904 "The caller I<must> ensure that a segment is eventually destroyed; otherwise "
5905 "its pages that were faulted in will remain in memory or swap."
5906 msgstr ""
5907
5908 #. type: TP
5909 #: build/C/man2/shmctl.2:154
5910 #, no-wrap
5911 msgid "B<IPC_INFO> (Linux-specific)"
5912 msgstr ""
5913
5914 #. type: Plain text
5915 #: build/C/man2/shmctl.2:167
5916 msgid ""
5917 "Returns information about system-wide shared memory limits and parameters in "
5918 "the structure pointed to by I<buf>.  This structure is of type I<shminfo> "
5919 "(thus, a cast is required), defined in I<E<lt>sys/shm.hE<gt>> if the "
5920 "B<_GNU_SOURCE> feature test macro is defined:"
5921 msgstr ""
5922
5923 #. type: Plain text
5924 #: build/C/man2/shmctl.2:181
5925 #, no-wrap
5926 msgid ""
5927 "struct  shminfo {\n"
5928 "    unsigned long shmmax; /* Maximum segment size */\n"
5929 "    unsigned long shmmin; /* Minimum segment size;\n"
5930 "                             always 1 */\n"
5931 "    unsigned long shmmni; /* Maximum number of segments */\n"
5932 "    unsigned long shmseg; /* Maximum number of segments\n"
5933 "                             that a process can attach;\n"
5934 "                             unused within kernel */\n"
5935 "    unsigned long shmall; /* Maximum number of pages of\n"
5936 "                             shared memory, system-wide */\n"
5937 "};\n"
5938 msgstr ""
5939
5940 #. type: Plain text
5941 #: build/C/man2/shmctl.2:194
5942 msgid ""
5943 "The I<shmmni>, I<shmmax>, and I<shmall> settings can be changed via I</proc> "
5944 "files of the same name; see B<proc>(5)  for details."
5945 msgstr ""
5946
5947 #. type: TP
5948 #: build/C/man2/shmctl.2:194
5949 #, no-wrap
5950 msgid "B<SHM_INFO> (Linux-specific)"
5951 msgstr ""
5952
5953 #. type: Plain text
5954 #: build/C/man2/shmctl.2:205
5955 msgid ""
5956 "Returns a I<shm_info> structure whose fields contain information about "
5957 "system resources consumed by shared memory.  This structure is defined in "
5958 "I<E<lt>sys/shm.hE<gt>> if the B<_GNU_SOURCE> feature test macro is defined:"
5959 msgstr ""
5960
5961 #. type: Plain text
5962 #: build/C/man2/shmctl.2:222
5963 #, no-wrap
5964 msgid ""
5965 "struct shm_info {\n"
5966 "    int           used_ids; /* # of currently existing\n"
5967 "                               segments */\n"
5968 "    unsigned long shm_tot;  /* Total number of shared\n"
5969 "                               memory pages */\n"
5970 "    unsigned long shm_rss;  /* # of resident shared\n"
5971 "                               memory pages */\n"
5972 "    unsigned long shm_swp;  /* # of swapped shared\n"
5973 "                               memory pages */\n"
5974 "    unsigned long swap_attempts;\n"
5975 "                            /* Unused since Linux 2.4 */\n"
5976 "    unsigned long swap_successes;\n"
5977 "                            /* Unused since Linux 2.4 */\n"
5978 "};\n"
5979 msgstr ""
5980
5981 #. type: TP
5982 #: build/C/man2/shmctl.2:224
5983 #, no-wrap
5984 msgid "B<SHM_STAT> (Linux-specific)"
5985 msgstr ""
5986
5987 #. type: Plain text
5988 #: build/C/man2/shmctl.2:235
5989 msgid ""
5990 "Returns a I<shmid_ds> structure as for B<IPC_STAT>.  However, the I<shmid> "
5991 "argument is not a segment identifier, but instead an index into the kernel's "
5992 "internal array that maintains information about all shared memory segments "
5993 "on the system."
5994 msgstr ""
5995
5996 #. type: Plain text
5997 #: build/C/man2/shmctl.2:238
5998 msgid ""
5999 "The caller can prevent or allow swapping of a shared memory segment with the "
6000 "following I<cmd> values:"
6001 msgstr ""
6002
6003 #. type: TP
6004 #: build/C/man2/shmctl.2:239
6005 #, no-wrap
6006 msgid "B<SHM_LOCK> (Linux-specific)"
6007 msgstr ""
6008
6009 #. type: Plain text
6010 #: build/C/man2/shmctl.2:251
6011 msgid ""
6012 "Prevent swapping of the shared memory segment.  The caller must fault in any "
6013 "pages that are required to be present after locking is enabled.  If a "
6014 "segment has been locked, then the (nonstandard)  B<SHM_LOCKED> flag of the "
6015 "I<shm_perm.mode> field in the associated data structure retrieved by "
6016 "B<IPC_STAT> will be set."
6017 msgstr ""
6018
6019 #. type: TP
6020 #: build/C/man2/shmctl.2:251
6021 #, no-wrap
6022 msgid "B<SHM_UNLOCK> (Linux-specific)"
6023 msgstr ""
6024
6025 #. type: Plain text
6026 #: build/C/man2/shmctl.2:254
6027 msgid "Unlock the segment, allowing it to be swapped out."
6028 msgstr ""
6029
6030 #.  There was some weirdness in 2.6.9: SHM_LOCK and SHM_UNLOCK could
6031 #.  be applied to a segment, regardless of ownership of the segment.
6032 #.  This was a botch-up in the move to RLIMIT_MEMLOCK, and was fixed
6033 #.  in 2.6.10.  MTK, May 2005
6034 #. type: Plain text
6035 #: build/C/man2/shmctl.2:272
6036 msgid ""
6037 "In kernels before 2.6.10, only a privileged process could employ B<SHM_LOCK> "
6038 "and B<SHM_UNLOCK>.  Since kernel 2.6.10, an unprivileged process can employ "
6039 "these operations if its effective UID matches the owner or creator UID of "
6040 "the segment, and (for B<SHM_LOCK>)  the amount of memory to be locked falls "
6041 "within the B<RLIMIT_MEMLOCK> resource limit (see B<setrlimit>(2))."
6042 msgstr ""
6043
6044 #. type: Plain text
6045 #: build/C/man2/shmctl.2:290
6046 msgid ""
6047 "A successful B<IPC_INFO> or B<SHM_INFO> operation returns the index of the "
6048 "highest used entry in the kernel's internal array recording information "
6049 "about all shared memory segments.  (This information can be used with "
6050 "repeated B<SHM_STAT> operations to obtain information about all shared "
6051 "memory segments on the system.)  A successful B<SHM_STAT> operation returns "
6052 "the identifier of the shared memory segment whose index was given in "
6053 "I<shmid>.  Other operations return 0 on success."
6054 msgstr ""
6055
6056 #. type: Plain text
6057 #: build/C/man2/shmctl.2:294
6058 msgid "On error, -1 is returned, and I<errno> is set appropriately."
6059 msgstr ""
6060
6061 #. type: Plain text
6062 #: build/C/man2/shmctl.2:303
6063 msgid ""
6064 "B<IPC_STAT> or B<SHM_STAT> is requested and I<shm_perm.mode> does not allow "
6065 "read access for I<shmid>, and the calling process does not have the "
6066 "B<CAP_IPC_OWNER> capability."
6067 msgstr ""
6068
6069 #. type: Plain text
6070 #: build/C/man2/shmctl.2:314
6071 msgid ""
6072 "The argument I<cmd> has value B<IPC_SET> or B<IPC_STAT> but the address "
6073 "pointed to by I<buf> isn't accessible."
6074 msgstr ""
6075
6076 #. type: TP
6077 #: build/C/man2/shmctl.2:314
6078 #, no-wrap
6079 msgid "B<EIDRM>"
6080 msgstr ""
6081
6082 #. type: Plain text
6083 #: build/C/man2/shmctl.2:317
6084 msgid "I<shmid> points to a removed identifier."
6085 msgstr ""
6086
6087 #. type: Plain text
6088 #: build/C/man2/shmctl.2:326
6089 msgid ""
6090 "I<shmid> is not a valid identifier, or I<cmd> is not a valid command.  Or: "
6091 "for a B<SHM_STAT> operation, the index value specified in I<shmid> referred "
6092 "to an array slot that is currently unused."
6093 msgstr ""
6094
6095 #. type: Plain text
6096 #: build/C/man2/shmctl.2:337
6097 msgid ""
6098 "(In kernels since 2.6.9), B<SHM_LOCK> was specified and the size of the "
6099 "to-be-locked segment would mean that the total bytes in locked shared memory "
6100 "segments would exceed the limit for the real user ID of the calling "
6101 "process.  This limit is defined by the B<RLIMIT_MEMLOCK> soft resource limit "
6102 "(see B<setrlimit>(2))."
6103 msgstr ""
6104
6105 #. type: TP
6106 #: build/C/man2/shmctl.2:337
6107 #, no-wrap
6108 msgid "B<EOVERFLOW>"
6109 msgstr ""
6110
6111 #. type: Plain text
6112 #: build/C/man2/shmctl.2:342
6113 msgid ""
6114 "B<IPC_STAT> is attempted, and the GID or UID value is too large to be stored "
6115 "in the structure pointed to by I<buf>."
6116 msgstr ""
6117
6118 #. type: Plain text
6119 #: build/C/man2/shmctl.2:354
6120 msgid ""
6121 "B<IPC_SET> or B<IPC_RMID> is attempted, and the effective user ID of the "
6122 "calling process is not that of the creator (found in I<shm_perm.cuid>), or "
6123 "the owner (found in I<shm_perm.uid>), and the process was not privileged "
6124 "(Linux: did not have the B<CAP_SYS_ADMIN> capability)."
6125 msgstr ""
6126
6127 #. type: Plain text
6128 #: build/C/man2/shmctl.2:366
6129 msgid ""
6130 "Or (in kernels before 2.6.9), B<SHM_LOCK> or B<SHM_UNLOCK> was specified, "
6131 "but the process was not privileged (Linux: did not have the B<CAP_IPC_LOCK> "
6132 "capability).  (Since Linux 2.6.9, this error can also occur if the "
6133 "B<RLIMIT_MEMLOCK> is 0 and the caller is not privileged.)"
6134 msgstr ""
6135
6136 #.  SVr4 documents an additional error condition EMFILE.
6137 #. type: Plain text
6138 #: build/C/man2/shmctl.2:371 build/C/man2/shmget.2:232 build/C/man2/shmop.2:229
6139 msgid "SVr4, POSIX.1-2001."
6140 msgstr ""
6141
6142 #. type: Plain text
6143 #: build/C/man2/shmctl.2:382
6144 msgid ""
6145 "The B<IPC_INFO>, B<SHM_STAT> and B<SHM_INFO> operations are used by the "
6146 "B<ipcs>(1)  program to provide information on allocated resources.  In the "
6147 "future these may modified or moved to a /proc file system interface."
6148 msgstr ""
6149
6150 #. type: Plain text
6151 #: build/C/man2/shmctl.2:390
6152 msgid ""
6153 "Linux permits a process to attach (B<shmat>(2))  a shared memory segment "
6154 "that has already been marked for deletion using I<shmctl(IPC_RMID)>.  This "
6155 "feature is not available on other UNIX implementations; portable "
6156 "applications should avoid relying on it."
6157 msgstr ""
6158
6159 #. type: Plain text
6160 #: build/C/man2/shmctl.2:403
6161 msgid ""
6162 "Various fields in a I<struct shmid_ds> were typed as I<short> under Linux "
6163 "2.2 and have become I<long> under Linux 2.4.  To take advantage of this, a "
6164 "recompilation under glibc-2.1.91 or later should suffice.  (The kernel "
6165 "distinguishes old and new calls by an B<IPC_64> flag in I<cmd>.)"
6166 msgstr ""
6167
6168 #. type: Plain text
6169 #: build/C/man2/shmctl.2:410
6170 msgid ""
6171 "B<mlock>(2), B<setrlimit>(2), B<shmget>(2), B<shmop>(2), B<capabilities>(7), "
6172 "B<svipc>(7)"
6173 msgstr ""
6174
6175 #. type: TH
6176 #: build/C/man2/shmget.2:36
6177 #, no-wrap
6178 msgid "SHMGET"
6179 msgstr ""
6180
6181 #. type: TH
6182 #: build/C/man2/shmget.2:36
6183 #, no-wrap
6184 msgid "2006-05-02"
6185 msgstr ""
6186
6187 #. type: Plain text
6188 #: build/C/man2/shmget.2:39
6189 msgid "shmget - allocates a shared memory segment"
6190 msgstr ""
6191
6192 #. type: Plain text
6193 #: build/C/man2/shmget.2:46
6194 msgid "B<int shmget(key_t >I<key>B<, size_t >I<size>B<, int >I<shmflg>B<);>"
6195 msgstr ""
6196
6197 #. type: Plain text
6198 #: build/C/man2/shmget.2:70
6199 msgid ""
6200 "B<shmget>()  returns the identifier of the shared memory segment associated "
6201 "with the value of the argument I<key>.  A new shared memory segment, with "
6202 "size equal to the value of I<size> rounded up to a multiple of B<PAGE_SIZE>, "
6203 "is created if I<key> has the value B<IPC_PRIVATE> or I<key> isn't "
6204 "B<IPC_PRIVATE>, no shared memory segment corresponding to I<key> exists, and "
6205 "B<IPC_CREAT> is specified in I<shmflg>."
6206 msgstr ""
6207
6208 #. type: Plain text
6209 #: build/C/man2/shmget.2:89
6210 msgid ""
6211 "If I<shmflg> specifies both B<IPC_CREAT> and B<IPC_EXCL> and a shared memory "
6212 "segment already exists for I<key>, then B<shmget>()  fails with I<errno> set "
6213 "to B<EEXIST>.  (This is analogous to the effect of the combination B<O_CREAT "
6214 "| O_EXCL> for B<open>(2).)"
6215 msgstr ""
6216
6217 #. type: Plain text
6218 #: build/C/man2/shmget.2:93
6219 msgid "The value I<shmflg> is composed of:"
6220 msgstr ""
6221
6222 #. type: TP
6223 #: build/C/man2/shmget.2:93
6224 #, no-wrap
6225 msgid "B<IPC_CREAT>"
6226 msgstr ""
6227
6228 #. type: Plain text
6229 #: build/C/man2/shmget.2:100
6230 msgid ""
6231 "to create a new segment.  If this flag is not used, then B<shmget>()  will "
6232 "find the segment associated with I<key> and check to see if the user has "
6233 "permission to access the segment."
6234 msgstr ""
6235
6236 #. type: TP
6237 #: build/C/man2/shmget.2:100
6238 #, no-wrap
6239 msgid "B<IPC_EXCL>"
6240 msgstr ""
6241
6242 #. type: Plain text
6243 #: build/C/man2/shmget.2:103
6244 msgid "used with B<IPC_CREAT> to ensure failure if the segment already exists."
6245 msgstr ""
6246
6247 #. type: TP
6248 #: build/C/man2/shmget.2:103
6249 #, no-wrap
6250 msgid "I<mode_flags>"
6251 msgstr ""
6252
6253 #. type: Plain text
6254 #: build/C/man2/shmget.2:113
6255 msgid ""
6256 "(least significant 9 bits)  specifying the permissions granted to the owner, "
6257 "group, and world.  These bits have the same format, and the same meaning, as "
6258 "the I<mode> argument of B<open>(2).  Presently, the execute permissions are "
6259 "not used by the system."
6260 msgstr ""
6261
6262 #. type: TP
6263 #: build/C/man2/shmget.2:113
6264 #, no-wrap
6265 msgid "B<SHM_HUGETLB> (since Linux 2.6)"
6266 msgstr ""
6267
6268 #. type: Plain text
6269 #: build/C/man2/shmget.2:119
6270 msgid ""
6271 "Allocate the segment using \"huge pages.\" See the kernel source file "
6272 "I<Documentation/vm/hugetlbpage.txt> for further information."
6273 msgstr ""
6274
6275 #. type: TP
6276 #: build/C/man2/shmget.2:119
6277 #, no-wrap
6278 msgid "B<SHM_NORESERVE> (since Linux 2.6.15)"
6279 msgstr ""
6280
6281 #.  As at 2.6.17-rc2, this flag has no effect if SHM_HUGETLB was also
6282 #.  specified.
6283 #. type: Plain text
6284 #: build/C/man2/shmget.2:138
6285 msgid ""
6286 "This flag serves the same purpose as the B<mmap>(2)  B<MAP_NORESERVE> flag.  "
6287 "Do not reserve swap space for this segment.  When swap space is reserved, "
6288 "one has the guarantee that it is possible to modify the segment.  When swap "
6289 "space is not reserved one might get B<SIGSEGV> upon a write if no physical "
6290 "memory is available.  See also the discussion of the file "
6291 "I</proc/sys/vm/overcommit_memory> in B<proc>(5)."
6292 msgstr ""
6293
6294 #. type: Plain text
6295 #: build/C/man2/shmget.2:146
6296 msgid ""
6297 "When a new shared memory segment is created, its contents are initialized to "
6298 "zero values, and its associated data structure, I<shmid_ds> (see "
6299 "B<shmctl>(2)), is initialized as follows:"
6300 msgstr ""
6301
6302 #. type: Plain text
6303 #: build/C/man2/shmget.2:151
6304 msgid ""
6305 "I<shm_perm.cuid> and I<shm_perm.uid> are set to the effective user ID of the "
6306 "calling process."
6307 msgstr ""
6308
6309 #. type: Plain text
6310 #: build/C/man2/shmget.2:156
6311 msgid ""
6312 "I<shm_perm.cgid> and I<shm_perm.gid> are set to the effective group ID of "
6313 "the calling process."
6314 msgstr ""
6315
6316 #. type: Plain text
6317 #: build/C/man2/shmget.2:161
6318 msgid ""
6319 "The least significant 9 bits of I<shm_perm.mode> are set to the least "
6320 "significant 9 bit of I<shmflg>."
6321 msgstr ""
6322
6323 #. type: Plain text
6324 #: build/C/man2/shmget.2:165
6325 msgid "I<shm_segsz> is set to the value of I<size>."
6326 msgstr ""
6327
6328 #. type: Plain text
6329 #: build/C/man2/shmget.2:172
6330 msgid "I<shm_lpid>, I<shm_nattch>, I<shm_atime> and I<shm_dtime> are set to 0."
6331 msgstr ""
6332
6333 #. type: Plain text
6334 #: build/C/man2/shmget.2:175
6335 msgid "I<shm_ctime> is set to the current time."
6336 msgstr ""
6337
6338 #. type: Plain text
6339 #: build/C/man2/shmget.2:178
6340 msgid ""
6341 "If the shared memory segment already exists, the permissions are verified, "
6342 "and a check is made to see if it is marked for destruction."
6343 msgstr ""
6344
6345 #. type: Plain text
6346 #: build/C/man2/shmget.2:182
6347 msgid "A valid segment identifier, I<shmid>, is returned on success, -1 on error."
6348 msgstr ""
6349
6350 #. type: Plain text
6351 #: build/C/man2/shmget.2:186
6352 msgid "On failure, I<errno> is set to one of the following:"
6353 msgstr ""
6354
6355 #. type: Plain text
6356 #: build/C/man2/shmget.2:192
6357 msgid ""
6358 "The user does not have permission to access the shared memory segment, and "
6359 "does not have the B<CAP_IPC_OWNER> capability."
6360 msgstr ""
6361
6362 #. type: Plain text
6363 #: build/C/man2/shmget.2:196
6364 msgid "B<IPC_CREAT | IPC_EXCL> was specified and the segment exists."
6365 msgstr ""
6366
6367 #. type: Plain text
6368 #: build/C/man2/shmget.2:202
6369 msgid ""
6370 "A new segment was to be created and I<size> E<lt> B<SHMMIN> or I<size> E<gt> "
6371 "B<SHMMAX>, or no new segment was to be created, a segment with given key "
6372 "existed, but I<size> is greater than the size of that segment."
6373 msgstr ""
6374
6375 #. type: Plain text
6376 #: build/C/man2/shmget.2:211
6377 msgid "No segment exists for the given I<key>, and B<IPC_CREAT> was not specified."
6378 msgstr ""
6379
6380 #. type: Plain text
6381 #: build/C/man2/shmget.2:214
6382 msgid "No memory could be allocated for segment overhead."
6383 msgstr ""
6384
6385 #. type: Plain text
6386 #: build/C/man2/shmget.2:222
6387 msgid ""
6388 "All possible shared memory IDs have been taken (B<SHMMNI>), or allocating a "
6389 "segment of the requested I<size> would cause the system to exceed the "
6390 "system-wide limit on shared memory (B<SHMALL>)."
6391 msgstr ""
6392
6393 #. type: Plain text
6394 #: build/C/man2/shmget.2:229
6395 msgid ""
6396 "The B<SHM_HUGETLB> flag was specified, but the caller was not privileged "
6397 "(did not have the B<CAP_IPC_LOCK> capability)."
6398 msgstr ""
6399
6400 #. type: Plain text
6401 #: build/C/man2/shmget.2:235
6402 msgid "B<SHM_HUGETLB> is a nonportable Linux extension."
6403 msgstr ""
6404
6405 #. type: Plain text
6406 #: build/C/man2/shmget.2:245
6407 msgid ""
6408 "B<IPC_PRIVATE> isn't a flag field but a I<key_t> type.  If this special "
6409 "value is used for I<key>, the system call ignores everything but the least "
6410 "significant 9 bits of I<shmflg> and creates a new shared memory segment (on "
6411 "success)."
6412 msgstr ""
6413
6414 #. type: Plain text
6415 #: build/C/man2/shmget.2:249
6416 msgid ""
6417 "The following limits on shared memory segment resources affect the "
6418 "B<shmget>()  call:"
6419 msgstr ""
6420
6421 #. type: TP
6422 #: build/C/man2/shmget.2:249
6423 #, no-wrap
6424 msgid "B<SHMALL>"
6425 msgstr ""
6426
6427 #. type: Plain text
6428 #: build/C/man2/shmget.2:254
6429 msgid ""
6430 "System wide maximum of shared memory pages (on Linux, this limit can be read "
6431 "and modified via I</proc/sys/kernel/shmall>)."
6432 msgstr ""
6433
6434 #. type: TP
6435 #: build/C/man2/shmget.2:254
6436 #, no-wrap
6437 msgid "B<SHMMAX>"
6438 msgstr ""
6439
6440 #. type: Plain text
6441 #: build/C/man2/shmget.2:259
6442 msgid ""
6443 "Maximum size in bytes for a shared memory segment: policy dependent (on "
6444 "Linux, this limit can be read and modified via I</proc/sys/kernel/shmmax>)."
6445 msgstr ""
6446
6447 #. type: TP
6448 #: build/C/man2/shmget.2:259
6449 #, no-wrap
6450 msgid "B<SHMMIN>"
6451 msgstr ""
6452
6453 #. type: Plain text
6454 #: build/C/man2/shmget.2:265
6455 msgid ""
6456 "Minimum size in bytes for a shared memory segment: implementation dependent "
6457 "(currently 1 byte, though B<PAGE_SIZE> is the effective minimum size)."
6458 msgstr ""
6459
6460 #. type: TP
6461 #: build/C/man2/shmget.2:265
6462 #, no-wrap
6463 msgid "B<SHMMNI>"
6464 msgstr ""
6465
6466 #.  Kernels between 2.4.x and 2.6.8 had an off-by-one error that meant
6467 #.  that we could create one more segment than SHMMNI -- MTK
6468 #.  This /proc file is not available in Linux 2.2 and earlier -- MTK
6469 #. type: Plain text
6470 #: build/C/man2/shmget.2:274
6471 msgid ""
6472 "System wide maximum number of shared memory segments: implementation "
6473 "dependent (currently 4096, was 128 before Linux 2.3.99; on Linux, this limit "
6474 "can be read and modified via I</proc/sys/kernel/shmmni>)."
6475 msgstr ""
6476
6477 #. type: Plain text
6478 #: build/C/man2/shmget.2:278
6479 msgid ""
6480 "The implementation has no specific limits for the per-process maximum number "
6481 "of shared memory segments (B<SHMSEG>)."
6482 msgstr ""
6483
6484 #. type: Plain text
6485 #: build/C/man2/shmget.2:284
6486 msgid ""
6487 "Until version 2.3.30 Linux would return B<EIDRM> for a B<shmget>()  on a "
6488 "shared memory segment scheduled for deletion."
6489 msgstr ""
6490
6491 #. type: Plain text
6492 #: build/C/man2/shmget.2:290
6493 msgid ""
6494 "The name choice B<IPC_PRIVATE> was perhaps unfortunate, B<IPC_NEW> would "
6495 "more clearly show its function."
6496 msgstr ""
6497
6498 #. type: Plain text
6499 #: build/C/man2/shmget.2:298
6500 msgid ""
6501 "B<shmat>(2), B<shmctl>(2), B<shmdt>(2), B<ftok>(3), B<capabilities>(7), "
6502 "B<shm_overview>(7), B<svipc>(7)"
6503 msgstr ""
6504
6505 #. type: TH
6506 #: build/C/man2/shmop.2:39
6507 #, no-wrap
6508 msgid "SHMOP"
6509 msgstr ""
6510
6511 #. type: TH
6512 #: build/C/man2/shmop.2:39
6513 #, no-wrap
6514 msgid "2008-06-03"
6515 msgstr ""
6516
6517 #. type: Plain text
6518 #: build/C/man2/shmop.2:42
6519 msgid "shmat, shmdt - shared memory operations"
6520 msgstr ""
6521
6522 #. type: Plain text
6523 #: build/C/man2/shmop.2:46
6524 #, no-wrap
6525 msgid ""
6526 "B<#include E<lt>sys/types.hE<gt>>\n"
6527 "B<#include E<lt>sys/shm.hE<gt>>\n"
6528 msgstr ""
6529
6530 #. type: Plain text
6531 #: build/C/man2/shmop.2:48
6532 #, no-wrap
6533 msgid ""
6534 "B<void *shmat(int >I<shmid>B<, const void *>I<shmaddr>B<, int "
6535 ">I<shmflg>B<);>\n"
6536 msgstr ""
6537
6538 #. type: Plain text
6539 #: build/C/man2/shmop.2:50
6540 #, no-wrap
6541 msgid "B<int shmdt(const void *>I<shmaddr>B<);>\n"
6542 msgstr ""
6543
6544 #. type: Plain text
6545 #: build/C/man2/shmop.2:59
6546 msgid ""
6547 "B<shmat>()  attaches the shared memory segment identified by I<shmid> to the "
6548 "address space of the calling process.  The attaching address is specified by "
6549 "I<shmaddr> with one of the following criteria:"
6550 msgstr ""
6551
6552 #. type: Plain text
6553 #: build/C/man2/shmop.2:65
6554 msgid ""
6555 "If I<shmaddr> is NULL, the system chooses a suitable (unused) address at "
6556 "which to attach the segment."
6557 msgstr ""
6558
6559 #. type: Plain text
6560 #: build/C/man2/shmop.2:80
6561 msgid ""
6562 "If I<shmaddr> isn't NULL and B<SHM_RND> is specified in I<shmflg>, the "
6563 "attach occurs at the address equal to I<shmaddr> rounded down to the nearest "
6564 "multiple of B<SHMLBA>.  Otherwise I<shmaddr> must be a page-aligned address "
6565 "at which the attach occurs."
6566 msgstr ""
6567
6568 #. type: Plain text
6569 #: build/C/man2/shmop.2:90
6570 msgid ""
6571 "If B<SHM_RDONLY> is specified in I<shmflg>, the segment is attached for "
6572 "reading and the process must have read permission for the segment.  "
6573 "Otherwise the segment is attached for read and write and the process must "
6574 "have read and write permission for the segment.  There is no notion of a "
6575 "write-only shared memory segment."
6576 msgstr ""
6577
6578 #. type: Plain text
6579 #: build/C/man2/shmop.2:105
6580 msgid ""
6581 "The (Linux-specific)  B<SHM_REMAP> flag may be specified in I<shmflg> to "
6582 "indicate that the mapping of the segment should replace any existing mapping "
6583 "in the range starting at I<shmaddr> and continuing for the size of the "
6584 "segment.  (Normally an B<EINVAL> error would result if a mapping already "
6585 "exists in this address range.)  In this case, I<shmaddr> must not be NULL."
6586 msgstr ""
6587
6588 #. type: Plain text
6589 #: build/C/man2/shmop.2:112
6590 msgid ""
6591 "The B<brk>(2)  value of the calling process is not altered by the attach.  "
6592 "The segment will automatically be detached at process exit.  The same "
6593 "segment may be attached as a read and as a read-write one, and more than "
6594 "once, in the process's address space."
6595 msgstr ""
6596
6597 #. type: Plain text
6598 #: build/C/man2/shmop.2:120
6599 msgid ""
6600 "A successful B<shmat>()  call updates the members of the I<shmid_ds> "
6601 "structure (see B<shmctl>(2))  associated with the shared memory segment as "
6602 "follows:"
6603 msgstr ""
6604
6605 #. type: Plain text
6606 #: build/C/man2/shmop.2:123
6607 msgid "I<shm_atime> is set to the current time."
6608 msgstr ""
6609
6610 #. type: Plain text
6611 #: build/C/man2/shmop.2:126 build/C/man2/shmop.2:152
6612 msgid "I<shm_lpid> is set to the process-ID of the calling process."
6613 msgstr ""
6614
6615 #. type: Plain text
6616 #: build/C/man2/shmop.2:129
6617 msgid "I<shm_nattch> is incremented by one."
6618 msgstr ""
6619
6620 #. type: Plain text
6621 #: build/C/man2/shmop.2:140
6622 msgid ""
6623 "B<shmdt>()  detaches the shared memory segment located at the address "
6624 "specified by I<shmaddr> from the address space of the calling process.  The "
6625 "to-be-detached segment must be currently attached with I<shmaddr> equal to "
6626 "the value returned by the attaching B<shmat>()  call."
6627 msgstr ""
6628
6629 #. type: Plain text
6630 #: build/C/man2/shmop.2:146
6631 msgid ""
6632 "On a successful B<shmdt>()  call the system updates the members of the "
6633 "I<shmid_ds> structure associated with the shared memory segment as follows:"
6634 msgstr ""
6635
6636 #. type: Plain text
6637 #: build/C/man2/shmop.2:149
6638 msgid "I<shm_dtime> is set to the current time."
6639 msgstr ""
6640
6641 #. type: Plain text
6642 #: build/C/man2/shmop.2:157
6643 msgid ""
6644 "I<shm_nattch> is decremented by one.  If it becomes 0 and the segment is "
6645 "marked for deletion, the segment is deleted."
6646 msgstr ""
6647
6648 #. type: Plain text
6649 #: build/C/man2/shmop.2:161
6650 msgid "After a B<fork>(2)  the child inherits the attached shared memory segments."
6651 msgstr ""
6652
6653 #. type: Plain text
6654 #: build/C/man2/shmop.2:165
6655 msgid ""
6656 "After an B<execve>(2)  all attached shared memory segments are detached from "
6657 "the process."
6658 msgstr ""
6659
6660 #. type: Plain text
6661 #: build/C/man2/shmop.2:169
6662 msgid ""
6663 "Upon B<_exit>(2)  all attached shared memory segments are detached from the "
6664 "process."
6665 msgstr ""
6666
6667 #. type: Plain text
6668 #: build/C/man2/shmop.2:177
6669 msgid ""
6670 "On success B<shmat>()  returns the address of the attached shared memory "
6671 "segment; on error I<(void\\ *)\\ -1> is returned, and I<errno> is set to "
6672 "indicate the cause of the error."
6673 msgstr ""
6674
6675 #. type: Plain text
6676 #: build/C/man2/shmop.2:183
6677 msgid ""
6678 "On success B<shmdt>()  returns 0; on error -1 is returned, and I<errno> is "
6679 "set to indicate the cause of the error."
6680 msgstr ""
6681
6682 #. type: Plain text
6683 #: build/C/man2/shmop.2:189
6684 msgid "When B<shmat>()  fails, I<errno> is set to one of the following:"
6685 msgstr ""
6686
6687 #. type: Plain text
6688 #: build/C/man2/shmop.2:195
6689 msgid ""
6690 "The calling process does not have the required permissions for the requested "
6691 "attach type, and does not have the B<CAP_IPC_OWNER> capability."
6692 msgstr ""
6693
6694 #. type: Plain text
6695 #: build/C/man2/shmop.2:209
6696 msgid ""
6697 "Invalid I<shmid> value, unaligned (i.e., not page-aligned and B<SHM_RND> was "
6698 "not specified) or invalid I<shmaddr> value, or can't attach segment at "
6699 "I<shmaddr>, or B<SHM_REMAP> was specified and I<shmaddr> was NULL."
6700 msgstr ""
6701
6702 #. type: Plain text
6703 #: build/C/man2/shmop.2:212
6704 msgid "Could not allocate memory for the descriptor or for the page tables."
6705 msgstr ""
6706
6707 #. type: Plain text
6708 #: build/C/man2/shmop.2:218
6709 msgid "When B<shmdt>()  fails, I<errno> is set as follows:"
6710 msgstr ""
6711
6712 #.  The following since 2.6.17-rc1:
6713 #. type: Plain text
6714 #: build/C/man2/shmop.2:226
6715 msgid ""
6716 "There is no shared memory segment attached at I<shmaddr>; or, I<shmaddr> is "
6717 "not aligned on a page boundary."
6718 msgstr ""
6719
6720 #. type: Plain text
6721 #: build/C/man2/shmop.2:245
6722 msgid ""
6723 "In SVID 3 (or perhaps earlier)  the type of the I<shmaddr> argument was "
6724 "changed from I<char *> into I<const void *>, and the returned type of "
6725 "B<shmat>()  from I<char *> into I<void *>.  (Linux libc4 and libc5 have the "
6726 "I<char *> prototypes; glibc2 has I<void *>.)"
6727 msgstr ""
6728
6729 #. type: Plain text
6730 #: build/C/man2/shmop.2:257
6731 msgid ""
6732 "Using B<shmat>()  with I<shmaddr> equal to NULL is the preferred, portable "
6733 "way of attaching a shared memory segment.  Be aware that the shared memory "
6734 "segment attached in this way may be attached at different addresses in "
6735 "different processes.  Therefore, any pointers maintained within the shared "
6736 "memory must be made relative (typically to the starting address of the "
6737 "segment), rather than absolute."
6738 msgstr ""
6739
6740 #. type: Plain text
6741 #: build/C/man2/shmop.2:262
6742 msgid ""
6743 "On Linux, it is possible to attach a shared memory segment even if it is "
6744 "already marked to be deleted.  However, POSIX.1-2001 does not specify this "
6745 "behavior and many other implementations do not support it."
6746 msgstr ""
6747
6748 #. type: Plain text
6749 #: build/C/man2/shmop.2:265
6750 msgid "The following system parameter affects B<shmat>():"
6751 msgstr ""
6752
6753 #.  FIXME A good explanation of the rationale for the existence
6754 #.  of SHMLBA would be useful here
6755 #. type: TP
6756 #: build/C/man2/shmop.2:265
6757 #, no-wrap
6758 msgid "B<SHMLBA>"
6759 msgstr ""
6760
6761 #.  FIXME That last sentence isn't true for all Linux
6762 #.  architectures (i.e., SHMLBA != PAGE_SIZE for some architectures)
6763 #.  -- MTK, Nov 04
6764 #. type: Plain text
6765 #: build/C/man2/shmop.2:278
6766 msgid ""
6767 "Segment low boundary address multiple.  Must be page aligned.  For the "
6768 "current implementation the B<SHMLBA> value is B<PAGE_SIZE>."
6769 msgstr ""
6770
6771 #. type: Plain text
6772 #: build/C/man2/shmop.2:282
6773 msgid ""
6774 "The implementation places no intrinsic limit on the per-process maximum "
6775 "number of shared memory segments (B<SHMSEG>)."
6776 msgstr ""
6777
6778 #. type: Plain text
6779 #: build/C/man2/shmop.2:290
6780 msgid ""
6781 "B<brk>(2), B<mmap>(2), B<shmctl>(2), B<shmget>(2), B<capabilities>(7), "
6782 "B<shm_overview>(7), B<svipc>(7)"
6783 msgstr ""
6784
6785 #. type: TH
6786 #: build/C/man2/subpage_prot.2:28
6787 #, no-wrap
6788 msgid "SUBPAGE_PROT"
6789 msgstr ""
6790
6791 #. type: TH
6792 #: build/C/man2/subpage_prot.2:28
6793 #, no-wrap
6794 msgid "2010-10-30"
6795 msgstr ""
6796
6797 #. type: Plain text
6798 #: build/C/man2/subpage_prot.2:31
6799 msgid "subpage_prot - define a subpage protection for an address range"
6800 msgstr ""
6801
6802 #. type: Plain text
6803 #: build/C/man2/subpage_prot.2:35
6804 #, no-wrap
6805 msgid ""
6806 "B<long subpage_prot(unsigned long >I<addr>B<, unsigned long >I<len>B<,>\n"
6807 "B<                  uint32_t *>I<map>B<);>\n"
6808 msgstr ""
6809
6810 #. type: Plain text
6811 #: build/C/man2/subpage_prot.2:42
6812 msgid ""
6813 "The PowerPC-specific B<subpage_prot>()  system call provides the facility to "
6814 "control the access permissions on individual 4kB subpages on systems "
6815 "configured with a page size of 64kB."
6816 msgstr ""
6817
6818 #. type: Plain text
6819 #: build/C/man2/subpage_prot.2:49
6820 msgid ""
6821 "The protection map is applied to the memory pages in the region starting at "
6822 "I<addr> and continuing for I<len> bytes.  Both of these arguments must be "
6823 "aligned to a 64-kB boundary."
6824 msgstr ""
6825
6826 #. type: Plain text
6827 #: build/C/man2/subpage_prot.2:61
6828 msgid ""
6829 "The protection map is specified in the buffer pointed to by I<map>.  The map "
6830 "has 2 bits per 4kB subpage; thus each 32-bit word specifies the protections "
6831 "of 16 4kB subpages inside a 64kB page (so, the number of 32-bit words "
6832 "pointed to by I<map> should equate to the number of 64-kB pages specified by "
6833 "I<len>).  Each 2-bit field in the protection map is either 0 to allow any "
6834 "access, 1 to prevent writes, or 2 or 3 to prevent all accesses."
6835 msgstr ""
6836
6837 #. type: Plain text
6838 #: build/C/man2/subpage_prot.2:66
6839 msgid ""
6840 "On success, B<subpage_prot>()  returns 0.  Otherwise, one of the error codes "
6841 "specified below is returned."
6842 msgstr ""
6843
6844 #. type: Plain text
6845 #: build/C/man2/subpage_prot.2:72
6846 msgid "The buffer referred to by I<map> is not accessible."
6847 msgstr ""
6848
6849 #. type: Plain text
6850 #: build/C/man2/subpage_prot.2:82
6851 msgid ""
6852 "The I<addr> or I<len> arguments are incorrect.  Both of these arguments must "
6853 "be aligned to a multiple of the system page size, and they must not refer to "
6854 "a region outside of the address space of the process or to a region that "
6855 "consists of huge pages."
6856 msgstr ""
6857
6858 #. type: Plain text
6859 #: build/C/man2/subpage_prot.2:85 build/C/man2/sync_file_range.2:166
6860 msgid "Out of memory."
6861 msgstr ""
6862
6863 #. type: Plain text
6864 #: build/C/man2/subpage_prot.2:91
6865 msgid ""
6866 "This system call is provided on the PowerPC architecture since Linux "
6867 "2.6.25.  The system call is provided only if the kernel is configured with "
6868 "B<CONFIG_PPC_64K_PAGES>.  No library support is provided."
6869 msgstr ""
6870
6871 #. type: Plain text
6872 #: build/C/man2/subpage_prot.2:98
6873 msgid ""
6874 "Normal page protections (at the 64-kB page level) also apply; the subpage "
6875 "protection mechanism is an additional constraint, so putting 0 in a 2-bit "
6876 "field won't allow writes to a page that is otherwise write-protected."
6877 msgstr ""
6878
6879 #. type: SS
6880 #: build/C/man2/subpage_prot.2:98
6881 #, no-wrap
6882 msgid "Rationale"
6883 msgstr ""
6884
6885 #.  In the initial implementation, it was the case that:
6886 #.      In fact the whole process is switched to use 4k hardware pages when the
6887 #.      subpage_prot system call is used, but this could be improved in future
6888 #.      to switch only the affected segments.
6889 #.  But Paul Mackerass says (Oct 2010): I'm pretty sure we now only switch
6890 #.  the affected segment, not the whole process.
6891 #. type: Plain text
6892 #: build/C/man2/subpage_prot.2:120
6893 msgid ""
6894 "This system call is provided to assist writing emulators that operate using "
6895 "64-kB pages on PowerPC systems.  When emulating systems such as x86, which "
6896 "uses a smaller page size, the emulator can no longer use the "
6897 "memory-management unit (MMU)  and normal system calls for controlling page "
6898 "protections.  (The emulator could emulate the MMU by checking and possibly "
6899 "remapping the address for each memory access in software, but that is slow.)  "
6900 "The idea is that the emulator supplies an array of protection masks to apply "
6901 "to a specified range of virtual addresses.  These masks are applied at the "
6902 "level where hardware page-table entries (PTEs)  are inserted into the "
6903 "hardware page table based on the Linux PTEs, so the Linux PTEs are not "
6904 "affected.  Implicit in this is that the regions of the address space that "
6905 "are protected are switched to use 4-kB hardware pages rather than 64-kB "
6906 "hardware pages (on machines with hardware 64-kB page support)."
6907 msgstr ""
6908
6909 #. type: Plain text
6910 #: build/C/man2/subpage_prot.2:123
6911 msgid "B<mprotect>(2), B<syscall>(2);"
6912 msgstr ""
6913
6914 #. type: Plain text
6915 #: build/C/man2/subpage_prot.2:126
6916 msgid "the kernel source file I<Documentation/vm/hugetlbpage.txt>."
6917 msgstr ""
6918
6919 #. type: TH
6920 #: build/C/man2/sync_file_range.2:30
6921 #, no-wrap
6922 msgid "SYNC_FILE_RANGE"
6923 msgstr ""
6924
6925 #. type: Plain text
6926 #: build/C/man2/sync_file_range.2:33
6927 msgid "sync_file_range - sync a file segment with disk"
6928 msgstr ""
6929
6930 #. type: Plain text
6931 #: build/C/man2/sync_file_range.2:37
6932 #, no-wrap
6933 msgid ""
6934 "B<#define _GNU_SOURCE>         /* See feature_test_macros(7) */\n"
6935 "B<#include E<lt>fcntl.hE<gt>>\n"
6936 msgstr ""
6937
6938 #. type: Plain text
6939 #: build/C/man2/sync_file_range.2:40
6940 #, no-wrap
6941 msgid ""
6942 "B<int sync_file_range(int >I<fd>B<, off64_t >I<offset>B<, off64_t "
6943 ">I<nbytes>B<,>\n"
6944 "B<                    unsigned int >I<flags>B<);>\n"
6945 msgstr ""
6946
6947 #. type: Plain text
6948 #: build/C/man2/sync_file_range.2:47
6949 msgid ""
6950 "B<sync_file_range>()  permits fine control when synchronizing the open file "
6951 "referred to by the file descriptor I<fd> with disk."
6952 msgstr ""
6953
6954 #. type: Plain text
6955 #: build/C/man2/sync_file_range.2:61
6956 msgid ""
6957 "I<offset> is the starting byte of the file range to be synchronized.  "
6958 "I<nbytes> specifies the length of the range to be synchronized, in bytes; if "
6959 "I<nbytes> is zero, then all bytes from I<offset> through to the end of file "
6960 "are synchronized.  Synchronization is in units of the system page size: "
6961 "I<offset> is rounded down to a page boundary; I<(offset+nbytes-1)> is "
6962 "rounded up to a page boundary."
6963 msgstr ""
6964
6965 #. type: Plain text
6966 #: build/C/man2/sync_file_range.2:65
6967 msgid "The I<flags> bit-mask argument can include any of the following values:"
6968 msgstr ""
6969
6970 #. type: TP
6971 #: build/C/man2/sync_file_range.2:65
6972 #, no-wrap
6973 msgid "B<SYNC_FILE_RANGE_WAIT_BEFORE>"
6974 msgstr ""
6975
6976 #. type: Plain text
6977 #: build/C/man2/sync_file_range.2:70
6978 msgid ""
6979 "Wait upon write-out of all pages in the specified range that have already "
6980 "been submitted to the device driver for write-out before performing any "
6981 "write."
6982 msgstr ""
6983
6984 #. type: TP
6985 #: build/C/man2/sync_file_range.2:70 build/C/man2/sync_file_range.2:120
6986 #, no-wrap
6987 msgid "B<SYNC_FILE_RANGE_WRITE>"
6988 msgstr ""
6989
6990 #. type: Plain text
6991 #: build/C/man2/sync_file_range.2:76
6992 msgid ""
6993 "Initiate write-out of all dirty pages in the specified range which are not "
6994 "presently submitted write-out.  Note that even this may block if you attempt "
6995 "to write more than request queue size."
6996 msgstr ""
6997
6998 #. type: TP
6999 #: build/C/man2/sync_file_range.2:76
7000 #, no-wrap
7001 msgid "B<SYNC_FILE_RANGE_WAIT_AFTER>"
7002 msgstr ""
7003
7004 #. type: Plain text
7005 #: build/C/man2/sync_file_range.2:80
7006 msgid "Wait upon write-out of all pages in the range after performing any write."
7007 msgstr ""
7008
7009 #. type: Plain text
7010 #: build/C/man2/sync_file_range.2:84
7011 msgid "Specifying I<flags> as 0 is permitted, as a no-op."
7012 msgstr ""
7013
7014 #. type: SS
7015 #: build/C/man2/sync_file_range.2:84
7016 #, no-wrap
7017 msgid "Warning"
7018 msgstr ""
7019
7020 #. type: Plain text
7021 #: build/C/man2/sync_file_range.2:100
7022 msgid ""
7023 "This system call is extremely dangerous and should not be used in portable "
7024 "programs.  None of these operations writes out the file's metadata.  "
7025 "Therefore, unless the application is strictly performing overwrites of "
7026 "already-instantiated disk blocks, there are no guarantees that the data will "
7027 "be available after a crash.  There is no user interface to know if a write "
7028 "is purely an overwrite.  On file systems using copy-on-write semantics "
7029 "(e.g., I<btrfs>)  an overwrite of existing allocated blocks is impossible.  "
7030 "When writing into preallocated space, many file systems also require calls "
7031 "into the block allocator, which this system call does not sync out to disk.  "
7032 "This system call does not flush disk write caches and thus does not provide "
7033 "any data integrity on systems with volatile disk write caches."
7034 msgstr ""
7035
7036 #. type: SS
7037 #: build/C/man2/sync_file_range.2:100
7038 #, no-wrap
7039 msgid "Some details"
7040 msgstr ""
7041
7042 #. type: Plain text
7043 #: build/C/man2/sync_file_range.2:108
7044 msgid ""
7045 "B<SYNC_FILE_RANGE_WAIT_BEFORE> and B<SYNC_FILE_RANGE_WAIT_AFTER> will detect "
7046 "any I/O errors or B<ENOSPC> conditions and will return these to the caller."
7047 msgstr ""
7048
7049 #. type: Plain text
7050 #: build/C/man2/sync_file_range.2:112
7051 msgid "Useful combinations of the I<flags> bits are:"
7052 msgstr ""
7053
7054 #. type: TP
7055 #: build/C/man2/sync_file_range.2:112
7056 #, no-wrap
7057 msgid "B<SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE>"
7058 msgstr ""
7059
7060 #. type: Plain text
7061 #: build/C/man2/sync_file_range.2:120
7062 msgid ""
7063 "Ensures that all pages in the specified range which were dirty when "
7064 "B<sync_file_range>()  was called are placed under write-out.  This is a "
7065 "start-write-for-data-integrity operation."
7066 msgstr ""
7067
7068 #. type: Plain text
7069 #: build/C/man2/sync_file_range.2:127
7070 msgid ""
7071 "Start write-out of all dirty pages in the specified range which are not "
7072 "presently under write-out.  This is an asynchronous flush-to-disk "
7073 "operation.  This is not suitable for data integrity operations."
7074 msgstr ""
7075
7076 #. type: TP
7077 #: build/C/man2/sync_file_range.2:127
7078 #, no-wrap
7079 msgid "B<SYNC_FILE_RANGE_WAIT_BEFORE> (or B<SYNC_FILE_RANGE_WAIT_AFTER>)"
7080 msgstr ""
7081
7082 #. type: Plain text
7083 #: build/C/man2/sync_file_range.2:134
7084 msgid ""
7085 "Wait for completion of write-out of all pages in the specified range.  This "
7086 "can be used after an earlier B<SYNC_FILE_RANGE_WAIT_BEFORE | "
7087 "SYNC_FILE_RANGE_WRITE> operation to wait for completion of that operation, "
7088 "and obtain its result."
7089 msgstr ""
7090
7091 #. type: TP
7092 #: build/C/man2/sync_file_range.2:134
7093 #, no-wrap
7094 msgid ""
7095 "B<SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | "
7096 "SYNC_FILE_RANGE_WAIT_AFTER>"
7097 msgstr ""
7098
7099 #. type: Plain text
7100 #: build/C/man2/sync_file_range.2:141
7101 msgid ""
7102 "This is a write-for-data-integrity operation that will ensure that all pages "
7103 "in the specified range which were dirty when B<sync_file_range>()  was "
7104 "called are committed to disk."
7105 msgstr ""
7106
7107 #. type: Plain text
7108 #: build/C/man2/sync_file_range.2:147
7109 msgid ""
7110 "On success, B<sync_file_range>()  returns 0; on failure -1 is returned and "
7111 "I<errno> is set to indicate the error."
7112 msgstr ""
7113
7114 #. type: Plain text
7115 #: build/C/man2/sync_file_range.2:152
7116 msgid "I<fd> is not a valid file descriptor."
7117 msgstr ""
7118
7119 #. type: Plain text
7120 #: build/C/man2/sync_file_range.2:160
7121 msgid "I<flags> specifies an invalid bit; or I<offset> or I<nbytes> is invalid."
7122 msgstr ""
7123
7124 #. type: Plain text
7125 #: build/C/man2/sync_file_range.2:163
7126 msgid "I/O error."
7127 msgstr ""
7128
7129 #. type: Plain text
7130 #: build/C/man2/sync_file_range.2:169
7131 msgid "Out of disk space."
7132 msgstr ""
7133
7134 #.  FIXME . (bug?) Actually, how can 'fd' refer to a symbolic link (S_ISLNK)?
7135 #.  (In userspace at least) it isn't possible to obtain a file descriptor
7136 #.  for a symbolic link.
7137 #. type: Plain text
7138 #: build/C/man2/sync_file_range.2:177
7139 msgid ""
7140 "I<fd> refers to something other than a regular file, a block device, a "
7141 "directory, or a symbolic link."
7142 msgstr ""
7143
7144 #. type: Plain text
7145 #: build/C/man2/sync_file_range.2:180
7146 msgid "B<sync_file_range>()  appeared on Linux in kernel 2.6.17."
7147 msgstr ""
7148
7149 #. type: Plain text
7150 #: build/C/man2/sync_file_range.2:183
7151 msgid ""
7152 "This system call is Linux-specific, and should be avoided in portable "
7153 "programs."
7154 msgstr ""
7155
7156 #.  See kernel commit edd5cd4a9424f22b0fa08bef5e299d41befd5622
7157 #. type: Plain text
7158 #: build/C/man2/sync_file_range.2:196
7159 msgid ""
7160 "Some architectures (e.g., PowerPC, ARM)  need 64-bit arguments to be aligned "
7161 "in a suitable pair of registers.  On such architectures, the call signature "
7162 "of B<sync_file_range>()  is flawed, since it forces a register to be wasted "
7163 "as padding between the I<fd> and I<offset> arguments.  Therefore, these "
7164 "architectures define a different system call that orders the arguments "
7165 "suitably:"
7166 msgstr ""
7167
7168 #. type: Plain text
7169 #: build/C/man2/sync_file_range.2:201
7170 #, no-wrap
7171 msgid ""
7172 "B<int sync_file_range2(int >I<fd>B<, unsigned int >I<flags>B<,>\n"
7173 "B<                     off64_t >I<offset>B<, off64_t >I<nbytes>B<);>\n"
7174 msgstr ""
7175
7176 #. type: Plain text
7177 #: build/C/man2/sync_file_range.2:206
7178 msgid ""
7179 "The behavior of this system call is otherwise exactly the same as "
7180 "B<sync_file_range>()."
7181 msgstr ""
7182
7183 #. type: Plain text
7184 #: build/C/man2/sync_file_range.2:217
7185 msgid ""
7186 "A system call with this signature first appeared on the ARM architecture in "
7187 "Linux 2.6.20, with the name B<arm_sync_file_range>().  It was renamed in "
7188 "Linux 2.6.22, when the analogous system call was added for PowerPC.  On "
7189 "architectures where glibc support is provided, glibc transparently wraps "
7190 "B<sync_file_range2>()  under the name B<sync_file_range>()."
7191 msgstr ""
7192
7193 #. type: Plain text
7194 #: build/C/man2/sync_file_range.2:222
7195 msgid "B<fdatasync>(2), B<fsync>(2), B<msync>(2), B<sync>(2)"
7196 msgstr ""
7197
7198 #. type: TH
7199 #: build/C/man3/malloc_get_state.3:23
7200 #, no-wrap
7201 msgid "MALLOC_GET_STATE"
7202 msgstr ""
7203
7204 #. type: TH
7205 #: build/C/man3/malloc_get_state.3:23
7206 #, no-wrap
7207 msgid "2012-03-26"
7208 msgstr ""
7209
7210 #. type: Plain text
7211 #: build/C/man3/malloc_get_state.3:26
7212 msgid ""
7213 "get_malloc_state, set_malloc_state - record and restore state of malloc "
7214 "implementation"
7215 msgstr ""
7216
7217 #. type: Plain text
7218 #: build/C/man3/malloc_get_state.3:31
7219 #, no-wrap
7220 msgid "B<void* malloc_get_state(void);>\n"
7221 msgstr ""
7222
7223 #. type: Plain text
7224 #: build/C/man3/malloc_get_state.3:33
7225 #, no-wrap
7226 msgid "B<int malloc_set_state(void *>I<state>B<);>\n"
7227 msgstr ""
7228
7229 #. type: Plain text
7230 #: build/C/man3/malloc_get_state.3:51
7231 msgid ""
7232 "The B<malloc_get_state>()  function records the current state of all "
7233 "B<malloc>(3)  internal bookkeeping variables (but not the actual contents of "
7234 "the heap or the state of B<malloc_hook>(3)  functions pointers).  The state "
7235 "is recorded in a system-dependent opaque data structure dynamically "
7236 "allocated via B<malloc>(3), and a pointer to that data structure is returned "
7237 "as the function result.  (It is the caller's responsibility to B<free>(3)  "
7238 "this memory.)"
7239 msgstr ""
7240
7241 #. type: Plain text
7242 #: build/C/man3/malloc_get_state.3:59
7243 msgid ""
7244 "The B<malloc_set_state>()  function restores the state of all B<malloc>(3)  "
7245 "internal bookkeeping variables to the values recorded in the opaque data "
7246 "structure pointed to by I<state>."
7247 msgstr ""
7248
7249 #. type: Plain text
7250 #: build/C/man3/malloc_get_state.3:66
7251 msgid ""
7252 "On success, B<malloc_get_state>()  returns a pointer to a newly allocated "
7253 "opaque data structure.  On error (for example, memory could not be allocated "
7254 "for the data structure), B<malloc_get_state>()  returns NULL."
7255 msgstr ""
7256
7257 #.  if(ms->magic != MALLOC_STATE_MAGIC) return -1;
7258 #.  /* Must fail if the major version is too high. */
7259 #.  if((ms->version & ~0xffl) > (MALLOC_STATE_VERSION & ~0xffl)) return -2;
7260 #. type: Plain text
7261 #: build/C/man3/malloc_get_state.3:84
7262 msgid ""
7263 "On success, B<malloc_set_state>()  returns 0.  If the implementation detects "
7264 "that I<state> does not point to a correctly formed data structure, "
7265 "B<malloc_set_state>()  returns -1.  If the implementation detects that the "
7266 "version of the data structure referred to by I<state> is a more recent "
7267 "version than this implementation knows about, B<malloc_set_state>()  returns "
7268 "-2."
7269 msgstr ""
7270
7271 #. type: Plain text
7272 #: build/C/man3/malloc_get_state.3:92
7273 msgid ""
7274 "These functions are especially useful when using this B<malloc>(3)  "
7275 "implementation as part of a shared library, and the heap contents are "
7276 "saved/restored via some other method.  This technique is used by the GNU "
7277 "Emacs to implement its \"dumping\" function."
7278 msgstr ""
7279
7280 #.  i.e., calls __malloc_check_init()
7281 #.  i.e., malloc checking is not already in use
7282 #.  and the caller requested malloc checking
7283 #. type: Plain text
7284 #: build/C/man3/malloc_get_state.3:109
7285 msgid ""
7286 "Hook function pointers are never saved or restored by these functions, with "
7287 "two exceptions: if malloc checking (see B<mallopt>(3))  was in use when "
7288 "B<malloc_get_state>()  was called, then B<malloc_set_state>()  resets malloc "
7289 "checking hooks if possible; if malloc checking was not in use in the "
7290 "recorded state, but the caller has requested malloc checking, then the hooks "
7291 "are reset to 0."
7292 msgstr ""
7293
7294 #. type: Plain text
7295 #: build/C/man3/malloc_get_state.3:112
7296 msgid "B<malloc>(3), B<mallopt>(3)"
7297 msgstr ""
7298
7299 #. type: TH
7300 #: build/C/man3/malloc_trim.3:24
7301 #, no-wrap
7302 msgid "MALLOC_TRIM"
7303 msgstr ""
7304
7305 #. type: TH
7306 #: build/C/man3/malloc_trim.3:24 build/C/man3/malloc_usable_size.3:23
7307 #, no-wrap
7308 msgid "2012-03-29"
7309 msgstr ""
7310
7311 #. type: Plain text
7312 #: build/C/man3/malloc_trim.3:27
7313 msgid "malloc_trim - release free memory from the top of the heap"
7314 msgstr ""
7315
7316 #. type: Plain text
7317 #: build/C/man3/malloc_trim.3:31
7318 msgid "B<void malloc_trim(size_t >I<pad>B<);>"
7319 msgstr ""
7320
7321 #. type: Plain text
7322 #: build/C/man3/malloc_trim.3:38
7323 msgid ""
7324 "The B<malloc_trim>()  function attempts to release free memory at the top of "
7325 "the heap (by calling B<sbrk>(2)  with a suitable argument)."
7326 msgstr ""
7327
7328 #. type: Plain text
7329 #: build/C/man3/malloc_trim.3:49
7330 msgid ""
7331 "The I<pad> argument specifies the amount of free space to leave untrimmed at "
7332 "the top of the heap.  If this argument is 0, only the minimum amount of "
7333 "memory is maintained at the top of the heap (i.e., one page or less).  A "
7334 "nonzero argument can be used to maintain some trailing space at the top of "
7335 "the heap in order to allow future allocations to be made without having to "
7336 "extend the heap with B<sbrk>(2)."
7337 msgstr ""
7338
7339 #. type: Plain text
7340 #: build/C/man3/malloc_trim.3:54
7341 msgid ""
7342 "The B<malloc_trim>()  function returns 1 if memory was actually released "
7343 "back to the system, or 0 if it was not possible to release any memory."
7344 msgstr ""
7345
7346 #.  .SH VERSIONS
7347 #.  Available already in glibc 2.0, possibly earlier
7348 #. type: Plain text
7349 #: build/C/man3/malloc_trim.3:58
7350 msgid "No errors are defined."
7351 msgstr ""
7352
7353 #. type: Plain text
7354 #: build/C/man3/malloc_trim.3:60 build/C/man3/malloc_usable_size.3:48
7355 msgid "This function is a GNU extension."
7356 msgstr ""
7357
7358 #. type: Plain text
7359 #: build/C/man3/malloc_trim.3:69
7360 msgid ""
7361 "This function is automatically called by B<free>(3)  in certain "
7362 "circumstances; see the discussion of B<M_TOP_PAD> and B<M_TRIM_THRESHOLD> in "
7363 "B<mallopt>(3)."
7364 msgstr ""
7365
7366 #. type: Plain text
7367 #: build/C/man3/malloc_trim.3:72
7368 msgid ""
7369 "This function cannot release free memory located at places other than the "
7370 "top of the heap."
7371 msgstr ""
7372
7373 #.  malloc/malloc.c::mTRIm():
7374 #.      return result | (av == &main_arena ? sYSTRIm (pad, av) : 0);
7375 #. type: Plain text
7376 #: build/C/man3/malloc_trim.3:76
7377 msgid "This function only releases memory in the main arena."
7378 msgstr ""
7379
7380 #. type: Plain text
7381 #: build/C/man3/malloc_trim.3:80
7382 msgid "B<sbrk>(2), B<malloc>(3), B<mallopt>(3)"
7383 msgstr ""
7384
7385 #. type: TH
7386 #: build/C/man3/malloc_usable_size.3:23
7387 #, no-wrap
7388 msgid "MALLOC_USABLE_SIZE"
7389 msgstr ""
7390
7391 #. type: Plain text
7392 #: build/C/man3/malloc_usable_size.3:26
7393 msgid "malloc_usable_size - obtain size of block of memory allocated from heap"
7394 msgstr ""
7395
7396 #. type: Plain text
7397 #: build/C/man3/malloc_usable_size.3:30
7398 msgid "B<size_t malloc_usable_size (void *>I<ptr>B<);>"
7399 msgstr ""
7400
7401 #. type: Plain text
7402 #: build/C/man3/malloc_usable_size.3:38
7403 msgid ""
7404 "The B<malloc_usable_size>()  function returns the number of usable bytes in "
7405 "the block pointed to by I<ptr>, a pointer to a block of memory allocated by "
7406 "B<malloc>(3)  or a related function."
7407 msgstr ""
7408
7409 #. type: Plain text
7410 #: build/C/man3/malloc_usable_size.3:46
7411 msgid ""
7412 "B<malloc_usable_size>()  returns the number of usable bytes in the block of "
7413 "allocated memory pointed to by I<ptr>.  If I<ptr> is NULL, 0 is returned."
7414 msgstr ""
7415
7416 #. type: Plain text
7417 #: build/C/man3/malloc_usable_size.3:58
7418 msgid ""
7419 "The value returned by B<malloc_usable_size>()  may be greater than the "
7420 "requested size of the allocation because of alignment and minimum size "
7421 "constraints.  Although the excess bytes can be overwritten by the "
7422 "application without ill effects, this is not good programming practice: the "
7423 "number of excess bytes in an allocation depends on the underlying "
7424 "implementation."
7425 msgstr ""
7426
7427 #. type: Plain text
7428 #: build/C/man3/malloc_usable_size.3:60
7429 msgid "The main use of this function is for debugging and introspection."
7430 msgstr ""
7431
7432 #. type: Plain text
7433 #: build/C/man3/malloc_usable_size.3:62
7434 msgid "B<malloc>(3)"
7435 msgstr ""
7436
7437 #. type: TH
7438 #: build/C/man3/mcheck.3:23
7439 #, no-wrap
7440 msgid "MCHECK"
7441 msgstr ""
7442
7443 #. type: Plain text
7444 #: build/C/man3/mcheck.3:26
7445 msgid ""
7446 "mcheck, mcheck_check_all, mcheck_pedantic, mprobe - heap consistency "
7447 "checking"
7448 msgstr ""
7449
7450 #. type: Plain text
7451 #: build/C/man3/mcheck.3:29
7452 #, no-wrap
7453 msgid "B<#include E<lt>mcheck.hE<gt>>\n"
7454 msgstr ""
7455
7456 #. type: Plain text
7457 #: build/C/man3/mcheck.3:31
7458 #, no-wrap
7459 msgid "B<int mcheck(void (*>I<abortfunc>B<)(enum mcheck_status >I<mstatus>B<));>\n"
7460 msgstr ""
7461
7462 #. type: Plain text
7463 #: build/C/man3/mcheck.3:33
7464 #, no-wrap
7465 msgid ""
7466 "B<int mcheck_pedantic(void (*>I<abortfunc>B<)(enum mcheck_status "
7467 ">I<mstatus>B<));>\n"
7468 msgstr ""
7469
7470 #. type: Plain text
7471 #: build/C/man3/mcheck.3:35
7472 #, no-wrap
7473 msgid "B<void mcheck_check_all(void);>\n"
7474 msgstr ""
7475
7476 #. type: Plain text
7477 #: build/C/man3/mcheck.3:37
7478 #, no-wrap
7479 msgid "B<enum mcheck_status mprobe(void *>I<ptr>B<);>\n"
7480 msgstr ""
7481
7482 #. type: Plain text
7483 #: build/C/man3/mcheck.3:50
7484 msgid ""
7485 "The B<mcheck>()  function installs a set of debugging hooks for the "
7486 "B<malloc>(3)  family of memory-allocation functions.  These hooks cause "
7487 "certain consistency checks to be performed on the state of the heap.  The "
7488 "checks can detect application errors such as freeing a block of memory more "
7489 "than once or corrupting the bookkeeping data structures that immediately "
7490 "precede a block of allocated memory."
7491 msgstr ""
7492
7493 #. type: Plain text
7494 #: build/C/man3/mcheck.3:62
7495 msgid ""
7496 "To be effective, the B<mcheck>()  function must be called before the first "
7497 "call to B<malloc>(3)  or a related function.  In cases where this is "
7498 "difficult to ensure, linking the program with I<-mcheck> inserts an implicit "
7499 "call to B<mcheck>()  (with a NULL argument)  before the first call to a "
7500 "memory-allocation function."
7501 msgstr ""
7502
7503 #. type: Plain text
7504 #: build/C/man3/mcheck.3:70
7505 msgid ""
7506 "The B<mcheck_pedantic>()  function is similar to B<mcheck>(), but performs "
7507 "checks on all allocated blocks whenever one of the memory-allocation "
7508 "functions is called.  This can be very slow!"
7509 msgstr ""
7510
7511 #. type: Plain text
7512 #: build/C/man3/mcheck.3:77
7513 msgid ""
7514 "The B<mcheck_check_all>()  function causes an immediate check on all "
7515 "allocated blocks.  This call is only effective if B<mcheck>()  is called "
7516 "beforehand."
7517 msgstr ""
7518
7519 #. type: Plain text
7520 #: build/C/man3/mcheck.3:90
7521 msgid ""
7522 "If the system detects an inconsistency in the heap, the caller-supplied "
7523 "function pointed to by I<abortfunc> is invoked with a single argument "
7524 "argument, I<mstatus>, that indicates what type of inconsistency was "
7525 "detected.  If I<abortfunc> is NULL, a default function prints an error "
7526 "message on I<stderr> and calls B<abort>(3)."
7527 msgstr ""
7528
7529 #. type: Plain text
7530 #: build/C/man3/mcheck.3:102
7531 msgid ""
7532 "The B<mprobe>()  function performs a consistency check on the block of "
7533 "allocated memory pointed to by I<ptr>.  The B<mcheck>()  function should be "
7534 "called beforehand (otherwise B<mprobe>()  returns B<MCHECK_DISABLED>)."
7535 msgstr ""
7536
7537 #. type: Plain text
7538 #: build/C/man3/mcheck.3:110
7539 msgid ""
7540 "The following list describes the values returned by B<mprobe>()  or passed "
7541 "as the I<mstatus> argument when I<abortfunc> is invoked:"
7542 msgstr ""
7543
7544 #. type: TP
7545 #: build/C/man3/mcheck.3:110
7546 #, no-wrap
7547 msgid "B<MCHECK_DISABLED> (B<mprobe>() only)"
7548 msgstr ""
7549
7550 #. type: Plain text
7551 #: build/C/man3/mcheck.3:115
7552 msgid ""
7553 "B<mcheck>()  was not called before the first memory allocation function was "
7554 "called.  Consistency checking is not possible."
7555 msgstr ""
7556
7557 #. type: TP
7558 #: build/C/man3/mcheck.3:115
7559 #, no-wrap
7560 msgid "B<MCHECK_OK> (B<mprobe>() only)"
7561 msgstr ""
7562
7563 #. type: Plain text
7564 #: build/C/man3/mcheck.3:118
7565 msgid "No inconsistency detected."
7566 msgstr ""
7567
7568 #. type: TP
7569 #: build/C/man3/mcheck.3:118
7570 #, no-wrap
7571 msgid "B<MCHECK_HEAD>"
7572 msgstr ""
7573
7574 #. type: Plain text
7575 #: build/C/man3/mcheck.3:121
7576 msgid "Memory preceding an allocated block was clobbered."
7577 msgstr ""
7578
7579 #. type: TP
7580 #: build/C/man3/mcheck.3:121
7581 #, no-wrap
7582 msgid "B<MCHECK_TAIL>"
7583 msgstr ""
7584
7585 #. type: Plain text
7586 #: build/C/man3/mcheck.3:124
7587 msgid "Memory following an allocated block was clobbered."
7588 msgstr ""
7589
7590 #. type: TP
7591 #: build/C/man3/mcheck.3:124
7592 #, no-wrap
7593 msgid "B<MCHECK_FREE>"
7594 msgstr ""
7595
7596 #. type: Plain text
7597 #: build/C/man3/mcheck.3:128
7598 msgid "A block of memory was freed twice."
7599 msgstr ""
7600
7601 #. type: Plain text
7602 #: build/C/man3/mcheck.3:133
7603 msgid "B<mcheck>()  and B<mcheck_pedantic>()  return 0 on success, or -1 on error."
7604 msgstr ""
7605
7606 #. type: Plain text
7607 #: build/C/man3/mcheck.3:144
7608 msgid ""
7609 "The B<mcheck_pedantic>()  and B<mcheck_check_all>()  functions are available "
7610 "since glibc 2.2.  The B<mcheck()> and B<mprobe()> functions are present "
7611 "since at least glibc 2.0"
7612 msgstr ""
7613
7614 #.  But is MALLOC_CHECK_ slower?
7615 #. type: Plain text
7616 #: build/C/man3/mcheck.3:158
7617 msgid ""
7618 "Linking a program with I<-lmcheck> and using the B<MALLOC_CHECK_> "
7619 "environment variable (described in B<mallopt>(3))  cause the same kinds of "
7620 "errors to be detected.  But, using B<MALLOC_CHECK_> does not require the "
7621 "application to be relinked."
7622 msgstr ""
7623
7624 #. type: Plain text
7625 #: build/C/man3/mcheck.3:165
7626 msgid ""
7627 "The program below calls B<mcheck>()  with a NULL argument and then frees the "
7628 "same block of memory twice.  The following shell session demonstrates what "
7629 "happens when running the program:"
7630 msgstr ""
7631
7632 #. type: Plain text
7633 #: build/C/man3/mcheck.3:170
7634 #, no-wrap
7635 msgid ""
7636 "$B< ./a.out>\n"
7637 "About to free\n"
7638 msgstr ""
7639
7640 #. type: Plain text
7641 #: build/C/man3/mcheck.3:174
7642 #, no-wrap
7643 msgid ""
7644 "About to free a second time\n"
7645 "block freed twice\n"
7646 "Aborted (core dumped)\n"
7647 msgstr ""
7648
7649 #. type: Plain text
7650 #: build/C/man3/mcheck.3:182
7651 #, no-wrap
7652 msgid ""
7653 "#include E<lt>stdlib.hE<gt>\n"
7654 "#include E<lt>stdio.hE<gt>\n"
7655 "#include E<lt>mcheck.hE<gt>\n"
7656 msgstr ""
7657
7658 #. type: Plain text
7659 #: build/C/man3/mcheck.3:190
7660 #, no-wrap
7661 msgid ""
7662 "    if (mcheck(NULL) != 0) {\n"
7663 "        fprintf(stderr, \"mcheck() failed\\en\");\n"
7664 msgstr ""
7665
7666 #. type: Plain text
7667 #: build/C/man3/mcheck.3:193
7668 #, no-wrap
7669 msgid ""
7670 "        exit(EXIT_FAILURE);\n"
7671 "    }\n"
7672 msgstr ""
7673
7674 #. type: Plain text
7675 #: build/C/man3/mcheck.3:195
7676 #, no-wrap
7677 msgid "    p = malloc(1000);\n"
7678 msgstr ""
7679
7680 #. type: Plain text
7681 #: build/C/man3/mcheck.3:200
7682 #, no-wrap
7683 msgid ""
7684 "    fprintf(stderr, \"About to free\\en\");\n"
7685 "    free(p);\n"
7686 "    fprintf(stderr, \"\\enAbout to free a second time\\en\");\n"
7687 "    free(p);\n"
7688 msgstr ""
7689
7690 #.  FIXME add SEE ALSO pointer from malloc(3) to here
7691 #.  FIXME add SEE ALSO pointer from mallopt(3) to here
7692 #.  FIXME add SEE ALSO pointer from mtrace(3) to here
7693 #. type: Plain text
7694 #: build/C/man3/mcheck.3:211
7695 msgid "B<malloc>(3), B<mallopt>(3), B<mtrace>(3)"
7696 msgstr ""