OSDN Git Service

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