OSDN Git Service

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