OSDN Git Service

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