OSDN Git Service

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