OSDN Git Service

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