OSDN Git Service

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