OSDN Git Service

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