X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=po4a%2Fmemory%2Fpo%2Fmemory.pot;h=1682649126be47b5d15ab346b18d552bb3b50fde;hb=5618418a05886b550745e2bb4d21910858d500eb;hp=1b8f833bd1342b4b466fe62b43c0b764f7ebb962;hpb=68e3d1cf58ed53145d40880db51e693f0a72354b;p=linuxjm%2FLDP_man-pages.git diff --git a/po4a/memory/po/memory.pot b/po4a/memory/po/memory.pot index 1b8f833b..16826491 100644 --- a/po4a/memory/po/memory.pot +++ b/po4a/memory/po/memory.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2012-05-10 20:03+0900\n" +"POT-Creation-Date: 2015-02-04 23:32+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -29,19 +29,19 @@ msgid "2007-05-31" msgstr "" #. type: TH -#: build/C/man2/alloc_hugepages.2:25 build/C/man2/cacheflush.2:24 build/C/man2/fallocate.2:8 build/C/man2/madvise.2:35 build/C/man3/malloc_trim.3:24 build/C/man3/mallopt.3:24 build/C/man2/mlock.2:27 build/C/man2/mmap.2:40 build/C/man2/mmap2.2:29 build/C/man2/mprotect.2:32 build/C/man2/mremap.2:31 build/C/man2/msync.2:25 build/C/man2/posix_fadvise.2:27 build/C/man2/readahead.2:28 build/C/man2/remap_file_pages.2:26 build/C/man3/shm_open.3:26 build/C/man7/shm_overview.7:27 build/C/man2/shmctl.2:43 build/C/man2/shmget.2:36 build/C/man2/shmop.2:39 build/C/man2/subpage_prot.2:28 build/C/man2/sync_file_range.2:30 +#: 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 #, no-wrap msgid "Linux" msgstr "" #. type: TH -#: build/C/man2/alloc_hugepages.2:25 build/C/man3/alloca.3:41 build/C/man2/cacheflush.2:24 build/C/man2/fallocate.2:8 build/C/man2/madvise.2:35 build/C/man3/malloc_get_state.3:23 build/C/man3/malloc_hook.3:6 build/C/man3/malloc_trim.3:24 build/C/man3/malloc_usable_size.3:23 build/C/man3/mallopt.3:24 build/C/man3/mcheck.3:23 build/C/man2/mlock.2:27 build/C/man2/mmap.2:40 build/C/man2/mmap2.2:29 build/C/man2/mprotect.2:32 build/C/man2/mremap.2:31 build/C/man2/msync.2:25 build/C/man3/mtrace.3:23 build/C/man2/posix_fadvise.2:27 build/C/man3/posix_fallocate.3:23 build/C/man3/posix_memalign.3:28 build/C/man2/readahead.2:28 build/C/man2/remap_file_pages.2:26 build/C/man3/shm_open.3:26 build/C/man7/shm_overview.7:27 build/C/man2/shmctl.2:43 build/C/man2/shmget.2:36 build/C/man2/shmop.2:39 build/C/man2/subpage_prot.2:28 build/C/man2/sync_file_range.2:30 +#: 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 #, no-wrap msgid "Linux Programmer's Manual" msgstr "" #. type: SH -#: build/C/man2/alloc_hugepages.2:26 build/C/man3/alloca.3:42 build/C/man2/cacheflush.2:25 build/C/man2/fallocate.2:9 build/C/man2/madvise.2:36 build/C/man3/malloc_get_state.3:24 build/C/man3/malloc_hook.3:7 build/C/man3/malloc_trim.3:25 build/C/man3/malloc_usable_size.3:24 build/C/man3/mallopt.3:25 build/C/man3/mcheck.3:24 build/C/man2/mlock.2:28 build/C/man2/mmap.2:41 build/C/man2/mmap2.2:30 build/C/man2/mprotect.2:33 build/C/man2/mremap.2:32 build/C/man2/msync.2:26 build/C/man3/mtrace.3:24 build/C/man2/posix_fadvise.2:28 build/C/man3/posix_fallocate.3:24 build/C/man3/posix_memalign.3:29 build/C/man2/readahead.2:29 build/C/man2/remap_file_pages.2:27 build/C/man3/shm_open.3:27 build/C/man7/shm_overview.7:28 build/C/man2/shmctl.2:44 build/C/man2/shmget.2:37 build/C/man2/shmop.2:40 build/C/man2/subpage_prot.2:29 build/C/man2/sync_file_range.2:31 +#: 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 #, no-wrap msgid "NAME" msgstr "" @@ -52,7 +52,7 @@ msgid "alloc_hugepages, free_hugepages - allocate or free huge pages" msgstr "" #. type: SH -#: build/C/man2/alloc_hugepages.2:28 build/C/man3/alloca.3:44 build/C/man2/cacheflush.2:27 build/C/man2/fallocate.2:11 build/C/man2/madvise.2:38 build/C/man3/malloc_get_state.3:26 build/C/man3/malloc_hook.3:11 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:30 build/C/man2/mmap.2:43 build/C/man2/mmap2.2:32 build/C/man2/mprotect.2:35 build/C/man2/mremap.2:34 build/C/man2/msync.2:28 build/C/man3/mtrace.3:26 build/C/man2/posix_fadvise.2:30 build/C/man3/posix_fallocate.3:26 build/C/man3/posix_memalign.3:31 build/C/man2/readahead.2:31 build/C/man2/remap_file_pages.2:29 build/C/man3/shm_open.3:29 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:33 +#: 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 #, no-wrap msgid "SYNOPSIS" msgstr "" @@ -76,7 +76,7 @@ msgid "BIB<);>\n" msgstr "" #. type: SH -#: build/C/man2/alloc_hugepages.2:38 build/C/man3/alloca.3:48 build/C/man2/cacheflush.2:33 build/C/man2/fallocate.2:19 build/C/man2/madvise.2:50 build/C/man3/malloc_get_state.3:34 build/C/man3/malloc_hook.3:29 build/C/man3/malloc_trim.3:31 build/C/man3/malloc_usable_size.3:30 build/C/man3/mallopt.3:31 build/C/man3/mcheck.3:39 build/C/man2/mlock.2:40 build/C/man2/mmap.2:52 build/C/man2/mmap2.2:39 build/C/man2/mprotect.2:41 build/C/man2/mremap.2:43 build/C/man2/msync.2:32 build/C/man3/mtrace.3:32 build/C/man2/posix_fadvise.2:49 build/C/man3/posix_fallocate.3:44 build/C/man3/posix_memalign.3:83 build/C/man2/readahead.2:38 build/C/man2/remap_file_pages.2:37 build/C/man3/shm_open.3:41 build/C/man7/shm_overview.7:30 build/C/man2/shmctl.2:54 build/C/man2/shmget.2:47 build/C/man2/shmop.2:51 build/C/man2/subpage_prot.2:36 build/C/man2/sync_file_range.2:41 +#: 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 #, no-wrap msgid "DESCRIPTION" msgstr "" @@ -86,7 +86,7 @@ msgstr "" msgid "" "The system calls B() and B() were " "introduced in Linux 2.5.36 and removed again in 2.5.54. They existed only " -"on i386 and ia64 (when built with B). In Linux 2.4.20 " +"on i386 and ia64 (when built with B). In Linux 2.4.20, " "the syscall numbers exist, but the calls fail with the error B." msgstr "" @@ -142,7 +142,7 @@ msgid "" msgstr "" #. type: SH -#: build/C/man2/alloc_hugepages.2:109 build/C/man3/alloca.3:58 build/C/man2/cacheflush.2:52 build/C/man2/fallocate.2:109 build/C/man2/madvise.2:250 build/C/man3/malloc_get_state.3:59 build/C/man3/malloc_trim.3:49 build/C/man3/malloc_usable_size.3:38 build/C/man3/mallopt.3:377 build/C/man3/mcheck.3:128 build/C/man2/mlock.2:117 build/C/man2/mmap.2:373 build/C/man2/mmap2.2:54 build/C/man2/mprotect.2:72 build/C/man2/mremap.2:128 build/C/man2/msync.2:68 build/C/man2/posix_fadvise.2:86 build/C/man3/posix_fallocate.3:64 build/C/man3/posix_memalign.3:141 build/C/man2/readahead.2:65 build/C/man2/remap_file_pages.2:122 build/C/man3/shm_open.3:169 build/C/man2/shmctl.2:272 build/C/man2/shmget.2:178 build/C/man2/shmop.2:169 build/C/man2/subpage_prot.2:61 build/C/man2/sync_file_range.2:141 +#: 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 #, no-wrap msgid "RETURN VALUE" msgstr "" @@ -156,13 +156,13 @@ msgid "" msgstr "" #. type: SH -#: build/C/man2/alloc_hugepages.2:118 build/C/man2/cacheflush.2:58 build/C/man2/fallocate.2:112 build/C/man2/madvise.2:257 build/C/man3/malloc_trim.3:54 build/C/man3/mallopt.3:382 build/C/man2/mlock.2:123 build/C/man2/mmap.2:390 build/C/man2/mmap2.2:61 build/C/man2/mprotect.2:79 build/C/man2/mremap.2:136 build/C/man2/msync.2:73 build/C/man2/posix_fadvise.2:89 build/C/man3/posix_fallocate.3:70 build/C/man3/posix_memalign.3:155 build/C/man2/readahead.2:71 build/C/man2/remap_file_pages.2:129 build/C/man3/shm_open.3:178 build/C/man2/shmctl.2:294 build/C/man2/shmget.2:182 build/C/man2/shmop.2:183 build/C/man2/subpage_prot.2:66 build/C/man2/sync_file_range.2:147 +#: 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 #, no-wrap msgid "ERRORS" msgstr "" #. type: TP -#: build/C/man2/alloc_hugepages.2:119 build/C/man2/fallocate.2:151 +#: build/C/man2/alloc_hugepages.2:119 build/C/man2/fallocate.2:319 #, no-wrap msgid "B" msgstr "" @@ -194,7 +194,7 @@ msgid "" msgstr "" #. type: SH -#: build/C/man2/alloc_hugepages.2:130 build/C/man3/alloca.3:63 build/C/man2/cacheflush.2:74 build/C/man2/fallocate.2:188 build/C/man2/madvise.2:307 build/C/man3/malloc_get_state.3:84 build/C/man3/malloc_hook.3:76 build/C/man3/malloc_trim.3:58 build/C/man3/malloc_usable_size.3:46 build/C/man3/mallopt.3:390 build/C/man3/mcheck.3:144 build/C/man2/mlock.2:187 build/C/man2/mmap.2:483 build/C/man2/mmap2.2:77 build/C/man2/mprotect.2:107 build/C/man2/mremap.2:186 build/C/man2/msync.2:96 build/C/man3/mtrace.3:76 build/C/man2/posix_fadvise.2:111 build/C/man3/posix_fallocate.3:101 build/C/man3/posix_memalign.3:180 build/C/man2/readahead.2:87 build/C/man2/remap_file_pages.2:151 build/C/man3/shm_open.3:249 build/C/man7/shm_overview.7:101 build/C/man2/shmctl.2:366 build/C/man2/shmget.2:229 build/C/man2/shmop.2:226 build/C/man2/subpage_prot.2:91 build/C/man2/sync_file_range.2:180 +#: 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 #, no-wrap msgid "CONFORMING TO" msgstr "" @@ -207,7 +207,7 @@ msgid "" msgstr "" #. type: SH -#: build/C/man2/alloc_hugepages.2:133 build/C/man3/alloca.3:71 build/C/man2/madvise.2:328 build/C/man3/malloc_get_state.3:86 build/C/man3/malloc_hook.3:78 build/C/man3/malloc_trim.3:60 build/C/man3/malloc_trim.3:72 build/C/man3/malloc_usable_size.3:48 build/C/man3/mcheck.3:146 build/C/man2/mlock.2:214 build/C/man2/mmap.2:501 build/C/man2/mmap2.2:79 build/C/man2/mprotect.2:116 build/C/man2/mremap.2:192 build/C/man3/mtrace.3:78 build/C/man2/posix_fadvise.2:120 build/C/man3/posix_memalign.3:219 build/C/man3/shm_open.3:255 build/C/man7/shm_overview.7:103 build/C/man2/shmctl.2:371 build/C/man2/shmget.2:235 build/C/man2/shmop.2:245 build/C/man2/subpage_prot.2:93 build/C/man2/sync_file_range.2:183 +#: 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 #, no-wrap msgid "NOTES" msgstr "" @@ -216,9 +216,9 @@ msgstr "" #: build/C/man2/alloc_hugepages.2:141 msgid "" "These system calls are gone; they existed only in Linux 2.5.36 through to " -"2.5.54. Now the hugetlbfs file system can be used instead. Memory backed " -"by huge pages (if the CPU supports them) is obtained by using B(2) to " -"map files in this virtual file system." +"2.5.54. Now the hugetlbfs filesystem can be used instead. Memory backed by " +"huge pages (if the CPU supports them) is obtained by using B(2) to " +"map files in this virtual filesystem." msgstr "" #. type: Plain text @@ -229,54 +229,55 @@ msgid "" msgstr "" #. type: SH -#: build/C/man2/alloc_hugepages.2:150 build/C/man3/alloca.3:153 build/C/man2/cacheflush.2:88 build/C/man2/fallocate.2:195 build/C/man2/madvise.2:360 build/C/man3/malloc_get_state.3:112 build/C/man3/malloc_hook.3:138 build/C/man3/malloc_trim.3:80 build/C/man3/malloc_usable_size.3:62 build/C/man3/mallopt.3:580 build/C/man3/mcheck.3:211 build/C/man2/mlock.2:337 build/C/man2/mmap.2:671 build/C/man2/mmap2.2:98 build/C/man2/mprotect.2:223 build/C/man2/mremap.2:214 build/C/man2/msync.2:122 build/C/man3/mtrace.3:170 build/C/man2/posix_fadvise.2:188 build/C/man3/posix_fallocate.3:130 build/C/man3/posix_memalign.3:275 build/C/man2/readahead.2:98 build/C/man2/remap_file_pages.2:162 build/C/man3/shm_open.3:280 build/C/man7/shm_overview.7:127 build/C/man2/shmctl.2:410 build/C/man2/shmget.2:298 build/C/man2/shmop.2:290 build/C/man2/subpage_prot.2:126 build/C/man2/sync_file_range.2:222 +#: 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 #, no-wrap msgid "COLOPHON" msgstr "" #. type: Plain text -#: build/C/man2/alloc_hugepages.2:157 build/C/man3/alloca.3:160 build/C/man2/cacheflush.2:95 build/C/man2/fallocate.2:202 build/C/man2/madvise.2:367 build/C/man3/malloc_get_state.3:119 build/C/man3/malloc_hook.3:145 build/C/man3/malloc_trim.3:87 build/C/man3/malloc_usable_size.3:69 build/C/man3/mallopt.3:587 build/C/man3/mcheck.3:218 build/C/man2/mlock.2:344 build/C/man2/mmap.2:678 build/C/man2/mmap2.2:105 build/C/man2/mprotect.2:230 build/C/man2/mremap.2:221 build/C/man2/msync.2:129 build/C/man3/mtrace.3:177 build/C/man2/posix_fadvise.2:195 build/C/man3/posix_fallocate.3:137 build/C/man3/posix_memalign.3:282 build/C/man2/readahead.2:105 build/C/man2/remap_file_pages.2:169 build/C/man3/shm_open.3:287 build/C/man7/shm_overview.7:134 build/C/man2/shmctl.2:417 build/C/man2/shmget.2:305 build/C/man2/shmop.2:297 build/C/man2/subpage_prot.2:133 build/C/man2/sync_file_range.2:229 +#: 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 msgid "" -"This page is part of release 3.40 of the Linux I project. A " -"description of the project, and information about reporting bugs, can be " -"found at http://www.kernel.org/doc/man-pages/." +"This page is part of release 3.79 of the Linux I project. A " +"description of the project, information about reporting bugs, and the latest " +"version of this page, can be found at " +"\\%http://www.kernel.org/doc/man-pages/." msgstr "" #. type: TH -#: build/C/man3/alloca.3:41 +#: build/C/man3/alloca.3:43 #, no-wrap msgid "ALLOCA" msgstr "" #. type: TH -#: build/C/man3/alloca.3:41 +#: build/C/man3/alloca.3:43 #, no-wrap -msgid "2008-01-24" +msgid "2013-10-07" msgstr "" #. type: TH -#: build/C/man3/alloca.3:41 build/C/man3/malloc_get_state.3:23 build/C/man3/malloc_hook.3:6 build/C/man3/malloc_usable_size.3:23 build/C/man3/mcheck.3:23 build/C/man3/mtrace.3:23 build/C/man3/posix_fallocate.3:23 build/C/man3/posix_memalign.3:28 +#: 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 #, no-wrap msgid "GNU" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:44 +#: build/C/man3/alloca.3:46 msgid "alloca - allocate memory that is automatically freed" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:46 +#: build/C/man3/alloca.3:48 msgid "B<#include Ealloca.hE>" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:48 +#: build/C/man3/alloca.3:50 msgid "BIB<);>" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:58 +#: build/C/man3/alloca.3:60 msgid "" "The B() function allocates I bytes of space in the stack " "frame of the caller. This temporary space is automatically freed when the " @@ -284,20 +285,37 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:63 +#: build/C/man3/alloca.3:65 msgid "" "The B() function returns a pointer to the beginning of the " "allocated space. If the allocation causes stack overflow, program behavior " "is undefined." msgstr "" +#. type: SH +#: build/C/man3/alloca.3:65 build/C/man3/malloc_usable_size.3:48 build/C/man3/posix_fallocate.3:103 +#, no-wrap +msgid "ATTRIBUTES" +msgstr "" + +#. type: SS +#: build/C/man3/alloca.3:66 build/C/man3/malloc_usable_size.3:49 build/C/man3/posix_fallocate.3:104 +#, no-wrap +msgid "Multithreading (see pthreads(7))" +msgstr "" + #. type: Plain text -#: build/C/man3/alloca.3:65 +#: build/C/man3/alloca.3:70 +msgid "The B() function is thread-safe." +msgstr "" + +#. type: Plain text +#: build/C/man3/alloca.3:72 msgid "This function is not in POSIX.1-2001." msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:71 +#: build/C/man3/alloca.3:78 msgid "" "There is evidence that the B() function appeared in 32V, PWB, " "PWB.2, 3BSD, and 4BSD. There is a man page for it in 4.3BSD. Linux uses " @@ -305,7 +323,7 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:86 +#: build/C/man3/alloca.3:93 msgid "" "The B() function is machine- and compiler-dependent. For certain " "applications, its use can improve efficiency compared to the use of " @@ -315,7 +333,7 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:95 +#: build/C/man3/alloca.3:102 msgid "" "Because the space allocated by B() is allocated within the stack " "frame, that space is automatically freed if the function return is jumped " @@ -323,40 +341,43 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:100 +#: build/C/man3/alloca.3:107 msgid "Do not attempt to B(3) space allocated by B()!" msgstr "" #. type: SS -#: build/C/man3/alloca.3:100 +#: build/C/man3/alloca.3:107 #, no-wrap -msgid "Notes on the GNU Version" +msgid "Notes on the GNU version" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:122 +#: build/C/man3/alloca.3:129 msgid "" "Normally, B(1) translates calls to B() with inlined code. " "This is not done when either the I<-ansi>, I<-std=c89>, I<-std=c99>, or the " -"I<-fno-builtin> option is given (and the header Ialloca.hE> is not " -"included). But beware! By default the glibc version of " -"Istdlib.hE> includes Ialloca.hE> and that contains the " -"line:" +"I<-std=c11> option is given B the header Ialloca.hE> is not " +"included. Otherwise, (without an -ansi or -std=c* option) the glibc version " +"of Istdlib.hE> includes Ialloca.hE> and that contains " +"the lines:" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:125 +#: build/C/man3/alloca.3:134 #, no-wrap -msgid " #define alloca(size) __builtin_alloca (size)\n" +msgid "" +" #ifdef __GNUC__\n" +" #define alloca(size) __builtin_alloca (size)\n" +" #endif\n" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:128 +#: build/C/man3/alloca.3:137 msgid "with messy consequences if one has a private version of this function." msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:132 +#: build/C/man3/alloca.3:141 msgid "" "The fact that the code is inlined means that it is impossible to take the " "address of this function, or to change its behavior by linking with a " @@ -364,7 +385,7 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:136 +#: build/C/man3/alloca.3:145 msgid "" "The inlined code often consists of a single instruction adjusting the stack " "pointer, and does not check for stack overflow. Thus, there is no NULL " @@ -372,13 +393,13 @@ msgid "" msgstr "" #. type: SH -#: build/C/man3/alloca.3:136 build/C/man2/cacheflush.2:81 build/C/man3/mallopt.3:404 build/C/man2/mlock.2:305 build/C/man2/mmap.2:544 build/C/man3/mtrace.3:100 build/C/man2/posix_fadvise.2:177 build/C/man2/shmget.2:284 +#: 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 #, no-wrap msgid "BUGS" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:141 +#: build/C/man3/alloca.3:150 msgid "" "There is no error indication if the stack frame cannot be extended. " "(However, after a failed allocation, the program is likely to receive a " @@ -386,7 +407,7 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:149 +#: build/C/man3/alloca.3:158 msgid "" "On many systems B() cannot be used inside the list of arguments of " "a function call, because the stack space reserved by B() would " @@ -394,47 +415,47 @@ msgid "" msgstr "" #. type: SH -#: build/C/man3/alloca.3:149 build/C/man2/fallocate.2:191 build/C/man2/madvise.2:353 build/C/man3/malloc_get_state.3:109 build/C/man3/malloc_hook.3:133 build/C/man3/malloc_trim.3:76 build/C/man3/malloc_usable_size.3:60 build/C/man3/mallopt.3:568 build/C/man3/mcheck.3:204 build/C/man2/mlock.2:330 build/C/man2/mmap.2:653 build/C/man2/mmap2.2:92 build/C/man2/mprotect.2:220 build/C/man2/mremap.2:200 build/C/man2/msync.2:118 build/C/man3/mtrace.3:165 build/C/man2/posix_fadvise.2:182 build/C/man3/posix_fallocate.3:126 build/C/man3/posix_memalign.3:270 build/C/man2/readahead.2:92 build/C/man2/remap_file_pages.2:155 build/C/man3/shm_open.3:269 build/C/man7/shm_overview.7:114 build/C/man2/shmctl.2:403 build/C/man2/shmget.2:290 build/C/man2/shmop.2:282 build/C/man2/subpage_prot.2:120 build/C/man2/sync_file_range.2:217 +#: 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 #, no-wrap msgid "SEE ALSO" msgstr "" #. type: Plain text -#: build/C/man3/alloca.3:153 +#: build/C/man3/alloca.3:162 msgid "B(2), B(3), B(3)" msgstr "" #. type: TH -#: build/C/man2/cacheflush.2:24 +#: build/C/man2/cacheflush.2:25 #, no-wrap msgid "CACHEFLUSH" msgstr "" #. type: TH -#: build/C/man2/cacheflush.2:24 +#: build/C/man2/cacheflush.2:25 #, no-wrap msgid "2007-05-26" msgstr "" #. type: Plain text -#: build/C/man2/cacheflush.2:27 +#: build/C/man2/cacheflush.2:28 msgid "cacheflush - flush contents of instruction and/or data cache" msgstr "" #. type: Plain text -#: build/C/man2/cacheflush.2:30 +#: build/C/man2/cacheflush.2:31 #, no-wrap msgid "B<#include Easm/cachectl.hE>\n" msgstr "" #. type: Plain text -#: build/C/man2/cacheflush.2:32 +#: build/C/man2/cacheflush.2:33 #, no-wrap msgid "BIB<, int >IB<, int >IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man2/cacheflush.2:42 +#: build/C/man2/cacheflush.2:43 msgid "" "B() flushes the contents of the indicated cache(s) for the user " "addresses in the range I to I<(addr+nbytes-1)>. I may be one " @@ -442,106 +463,106 @@ msgid "" msgstr "" #. type: TP -#: build/C/man2/cacheflush.2:42 +#: build/C/man2/cacheflush.2:43 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/cacheflush.2:45 +#: build/C/man2/cacheflush.2:46 msgid "Flush the instruction cache." msgstr "" #. type: TP -#: build/C/man2/cacheflush.2:45 +#: build/C/man2/cacheflush.2:46 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/cacheflush.2:48 +#: build/C/man2/cacheflush.2:49 msgid "Write back to memory and invalidate the affected valid cache lines." msgstr "" #. type: TP -#: build/C/man2/cacheflush.2:48 +#: build/C/man2/cacheflush.2:49 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/cacheflush.2:52 +#: build/C/man2/cacheflush.2:53 msgid "Same as B<(ICACHE|DCACHE)>." msgstr "" #. type: Plain text -#: build/C/man2/cacheflush.2:58 +#: build/C/man2/cacheflush.2:59 msgid "" "B() returns 0 on success or -1 on error. If errors are " "detected, I will indicate the error." msgstr "" #. type: TP -#: build/C/man2/cacheflush.2:59 build/C/man2/mmap2.2:62 build/C/man2/mremap.2:143 build/C/man2/shmctl.2:303 build/C/man2/subpage_prot.2:67 +#: 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 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/cacheflush.2:66 +#: build/C/man2/cacheflush.2:67 msgid "" "Some or all of the address range I to I<(addr+nbytes-1)> is not " "accessible." msgstr "" #. type: TP -#: build/C/man2/cacheflush.2:66 build/C/man2/fallocate.2:124 build/C/man2/madvise.2:264 build/C/man2/mlock.2:158 build/C/man2/mlock.2:165 build/C/man2/mlock.2:177 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:89 build/C/man2/mremap.2:152 build/C/man2/msync.2:80 build/C/man2/posix_fadvise.2:93 build/C/man3/posix_fallocate.3:79 build/C/man3/posix_memalign.3:156 build/C/man2/readahead.2:76 build/C/man2/remap_file_pages.2:130 build/C/man2/remap_file_pages.2:137 build/C/man3/shm_open.3:211 build/C/man2/shmctl.2:317 build/C/man2/shmget.2:196 build/C/man2/shmop.2:195 build/C/man2/shmop.2:218 build/C/man2/subpage_prot.2:72 build/C/man2/sync_file_range.2:152 +#: 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 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/cacheflush.2:74 +#: build/C/man2/cacheflush.2:75 msgid "I is not one of B, B, or B." msgstr "" -#. FIXME This system call was only on MIPS back in 1.2 days, but -#. by now it is on a number of other architectures (but not i386). +#. FIXME The cacheflush() system call was only on MIPS back in 1.2 days, +#. but by now it is on a number of other architectures (but not i386). #. Investigate the details and update this page. #. Irix 6.5 appears to have a cacheflush() syscall -- mtk #. type: Plain text -#: build/C/man2/cacheflush.2:81 +#: build/C/man2/cacheflush.2:82 msgid "" -"This Linux-specific system call is only available on MIPS-based systems. It " +"This Linux-specific system call is available only on MIPS-based systems. It " "should not be used in programs intended to be portable." msgstr "" #. type: Plain text -#: build/C/man2/cacheflush.2:88 +#: build/C/man2/cacheflush.2:89 msgid "" "The current implementation ignores the I and I arguments. " "Therefore, the whole cache is always flushed." msgstr "" #. type: TH -#: build/C/man2/fallocate.2:8 +#: build/C/man2/fallocate.2:11 #, no-wrap msgid "FALLOCATE" msgstr "" #. type: TH -#: build/C/man2/fallocate.2:8 +#: 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 #, no-wrap -msgid "2012-04-23" +msgid "2015-01-22" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:11 +#: build/C/man2/fallocate.2:14 msgid "fallocate - manipulate file space" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:15 build/C/man2/readahead.2:35 +#: build/C/man2/fallocate.2:18 build/C/man2/readahead.2:35 #, no-wrap msgid "" "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" @@ -549,7 +570,7 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:18 +#: build/C/man2/fallocate.2:21 #, no-wrap msgid "" "BIB<, int >IB<, off_t >IB<, off_t " @@ -557,7 +578,7 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:24 +#: build/C/man2/fallocate.2:27 msgid "" "This is a nonportable, Linux-specific system call. For the portable, " "POSIX.1-specified method of ensuring that space is allocated for a file, see " @@ -565,7 +586,7 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:34 +#: build/C/man2/fallocate.2:37 msgid "" "B() allows the caller to directly manipulate the allocated disk " "space for the file referred to by I for the byte range starting at " @@ -573,7 +594,7 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:39 +#: build/C/man2/fallocate.2:42 msgid "" "The I argument determines the operation to be performed on the given " "range. Details of the supported operations are given in the subsections " @@ -581,25 +602,26 @@ msgid "" msgstr "" #. type: SS -#: build/C/man2/fallocate.2:39 +#: build/C/man2/fallocate.2:42 #, no-wrap msgid "Allocating disk space" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:58 +#: build/C/man2/fallocate.2:65 msgid "" "The default operation (i.e., I is zero) of B() allocates " -"and initializes to zero the disk space within the range specified by " -"I and I. The file size (as reported by B(2)) will be " -"changed if I+I is greater than the file size. This default " -"behavior closely resembles the behavior of the B(3) " -"library function, and is intended as a method of optimally implementing that " -"function." +"the disk space within the range specified by I and I. The file " +"size (as reported by B(2)) will be changed if I+I is " +"greater than the file size. Any subregion within the range specified by " +"I and I that did not contain data before the call will be " +"initialized to zero. This default behavior closely resembles the behavior " +"of the B(3) library function, and is intended as a method " +"of optimally implementing that function." msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:64 +#: build/C/man2/fallocate.2:71 msgid "" "After a successful call, subsequent writes into the range specified by " "I and I are guaranteed not to fail because of lack of disk " @@ -607,7 +629,7 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:75 +#: build/C/man2/fallocate.2:82 msgid "" "If the B flag is specified in I, the behavior of " "the call is similar, but the file size will not be changed even if " @@ -617,31 +639,31 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:79 +#: build/C/man2/fallocate.2:86 msgid "" "Because allocation is done in block size chunks, B() may " "allocate a larger range of disk space than was specified." msgstr "" #. type: SS -#: build/C/man2/fallocate.2:79 +#: build/C/man2/fallocate.2:86 #, no-wrap msgid "Deallocating file space" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:94 +#: build/C/man2/fallocate.2:101 msgid "" "Specifying the B flag (available since Linux 2.6.38) " "in I deallocates space (i.e., creates a hole) in the byte range " "starting at I and continuing for I bytes. Within the specified " -"range, partial file system blocks are zeroed, and whole file system blocks " -"are removed from the file. After a successful call, subsequent reads from " -"this range will return zeroes." +"range, partial filesystem blocks are zeroed, and whole filesystem blocks are " +"removed from the file. After a successful call, subsequent reads from this " +"range will return zeroes." msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:105 +#: build/C/man2/fallocate.2:112 msgid "" "The B flag must be ORed with B in " "I; in other words, even when punching off the end of the file, the " @@ -649,157 +671,356 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:109 +#: build/C/man2/fallocate.2:117 msgid "" -"Not all file systems support B; if a file system " -"doesn't support the operation, an error is returned." +"Not all filesystems support B; if a filesystem doesn't " +"support the operation, an error is returned. The operation is supported on " +"at least the following filesystems:" +msgstr "" + +#. type: IP +#: 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 +#, no-wrap +msgid "*" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:112 -msgid "B() returns zero on success, and -1 on failure." +#: build/C/man2/fallocate.2:119 +msgid "XFS (since Linux 2.6.38)" +msgstr "" + +#. commit a4bb6b64e39abc0e41ca077725f2a72c868e7622 +#. type: Plain text +#: build/C/man2/fallocate.2:122 +msgid "ext4 (since Linux 3.0)" +msgstr "" + +#. type: Plain text +#: build/C/man2/fallocate.2:124 +msgid "Btrfs (since Linux 3.7)" +msgstr "" + +#. commit 83e4fa9c16e4af7122e31be3eca5d57881d236fe +#. type: Plain text +#: build/C/man2/fallocate.2:127 +msgid "tmpfs (since Linux 3.5)" +msgstr "" + +#. type: SS +#: build/C/man2/fallocate.2:127 +#, no-wrap +msgid "Collapsing file space" +msgstr "" + +#. commit 00f5e61998dd17f5375d9dfc01331f104b83f841 +#. type: Plain text +#: build/C/man2/fallocate.2:147 +msgid "" +"Specifying the B flag (available since Linux 3.15) " +"in I removes a byte range from a file, without leaving a hole. The " +"byte range to be collapsed starts at I and continues for I " +"bytes. At the completion of the operation, the contents of the file " +"starting at the location I will be appended at the location " +"I, and the file will be I bytes smaller." +msgstr "" + +#. type: Plain text +#: build/C/man2/fallocate.2:161 +msgid "" +"A filesystem may place limitations on the granularity of the operation, in " +"order to ensure efficient implementation. Typically, I and I " +"must be a multiple of the filesystem logical block size, which varies " +"according to the filesystem type and configuration. If a filesystem has " +"such a requirement, B() will fail with the error B if " +"this requirement is violated." +msgstr "" + +#. type: Plain text +#: build/C/man2/fallocate.2:170 +msgid "" +"If the region specified by I plus I reaches or passes the end " +"of file, an error is returned; instead, use B(2) to truncate a " +"file." +msgstr "" + +#. type: Plain text +#: build/C/man2/fallocate.2:175 +msgid "" +"No other flags may be specified in I in conjunction with " +"B." +msgstr "" + +#. commit 9eb79482a97152930b113b51dff530aba9e28c8e +#. commit e1d8fb88a64c1f8094b9f6c3b6d2d9e6719c970d +#. type: Plain text +#: build/C/man2/fallocate.2:183 +msgid "" +"As at Linux 3.15, B is supported by ext4 (only for " +"extent-based files) and XFS." +msgstr "" + +#. type: SS +#: build/C/man2/fallocate.2:183 +#, no-wrap +msgid "Zeroing file space" +msgstr "" + +#. commit 409332b65d3ed8cfa7a8030f1e9d52f372219642 +#. type: Plain text +#: build/C/man2/fallocate.2:199 +msgid "" +"Specifying the B flag (available since Linux 3.14) in " +"I zeroes space in the byte range starting at I and continuing " +"for I bytes. Within the specified range, blocks are preallocated for " +"the regions that span the holes in the file. After a successful call, " +"subsequent reads from this range will return zeroes." +msgstr "" + +#. type: Plain text +#: build/C/man2/fallocate.2:205 +msgid "" +"Zeroing is done within the filesystem preferably by converting the range " +"into unwritten extents. This approach means that the specified range will " +"not be physically zeroed out on the device (except for partial blocks at the " +"either end of the range), and I/O is (otherwise) required only to update " +"metadata." +msgstr "" + +#. type: Plain text +#: build/C/man2/fallocate.2:217 +msgid "" +"If the B flag is additionally specified in I, the " +"behavior of the call is similar, but the file size will not be changed even " +"if I+I is greater than the file size. This behavior is the " +"same as when preallocating space with B specified." +msgstr "" + +#. type: Plain text +#: build/C/man2/fallocate.2:222 +msgid "" +"Not all filesystems support B; if a filesystem doesn't " +"support the operation, an error is returned. The operation is supported on " +"at least the following filesystems:" +msgstr "" + +#. commit 376ba313147b4172f3e8cf620b9fb591f3e8cdfa +#. type: Plain text +#: build/C/man2/fallocate.2:225 +msgid "XFS (since Linux 3.14)" +msgstr "" + +#. commit b8a8684502a0fc852afa0056c6bb2a9273f6fcc0 +#. type: Plain text +#: build/C/man2/fallocate.2:228 +msgid "ext4, for extent-based files (since Linux 3.14)" +msgstr "" + +#. type: Plain text +#: build/C/man2/fallocate.2:235 +msgid "" +"On success, B() returns zero. On error, -1 is returned and " +"I is set to indicate the error." msgstr "" #. type: TP -#: build/C/man2/fallocate.2:113 build/C/man2/madvise.2:261 build/C/man2/mmap.2:415 build/C/man2/posix_fadvise.2:90 build/C/man3/posix_fallocate.3:71 build/C/man2/readahead.2:72 build/C/man2/sync_file_range.2:148 +#: 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 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:117 build/C/man3/posix_fallocate.3:75 +#: build/C/man2/fallocate.2:240 build/C/man3/posix_fallocate.3:77 msgid "I is not a valid file descriptor, or is not opened for writing." msgstr "" #. type: TP -#: build/C/man2/fallocate.2:117 build/C/man3/posix_fallocate.3:75 +#: build/C/man2/fallocate.2:240 build/C/man3/posix_fallocate.3:77 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:121 +#: build/C/man2/fallocate.2:244 msgid "I+I exceeds the maximum file size." msgstr "" #. type: TP -#: build/C/man2/fallocate.2:121 +#: build/C/man2/fallocate.2:244 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:124 +#: build/C/man2/fallocate.2:247 msgid "A signal was caught during execution." msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:136 build/C/man3/posix_fallocate.3:85 +#: build/C/man2/fallocate.2:259 build/C/man3/posix_fallocate.3:87 msgid "I was less than 0, or I was less than or equal to 0." msgstr "" +#. type: Plain text +#: build/C/man2/fallocate.2:269 +msgid "" +"I is B and the range specified by I " +"plus I reaches or passes the end of the file." +msgstr "" + +#. type: Plain text +#: build/C/man2/fallocate.2:279 +msgid "" +"I is B, but either I or I is " +"not a multiple of the filesystem block size." +msgstr "" + +#. type: Plain text +#: build/C/man2/fallocate.2:287 +msgid "" +"I contains both B and other flags; no other " +"flags are permitted with B." +msgstr "" + +#. There was a inconsistency in 3.15-rc1, that should be resolved so that all +#. filesystems use this error for this case. (Tytso says ex4 will change.) +#. http://thread.gmane.org/gmane.comp.file-systems.xfs.general/60485/focus=5521 +#. From: Michael Kerrisk (man-pages +#. Subject: Re: [PATCH v5 10/10] manpage: update FALLOC_FL_COLLAPSE_RANGE flag in fallocate +#. Newsgroups: gmane.linux.man, gmane.linux.file-systems +#. Date: 2014-04-17 13:40:05 GMT +#. type: Plain text +#: build/C/man2/fallocate.2:304 +msgid "" +"I is B or B, but the " +"file referred to by I is not a regular file." +msgstr "" + #. type: TP -#: build/C/man2/fallocate.2:136 build/C/man2/madvise.2:292 build/C/man2/sync_file_range.2:160 +#: build/C/man2/fallocate.2:304 build/C/man2/madvise.2:310 build/C/man2/sync_file_range.2:160 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:139 -msgid "An I/O error occurred while reading from or writing to a file system." +#: build/C/man2/fallocate.2:307 +msgid "An I/O error occurred while reading from or writing to a filesystem." msgstr "" #. type: TP -#: build/C/man2/fallocate.2:139 build/C/man2/mmap.2:450 build/C/man3/posix_fallocate.3:85 +#: 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 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:146 +#: build/C/man2/fallocate.2:314 msgid "" "I does not refer to a regular file or a directory. (If I is a pipe " "or FIFO, a different error results.)" msgstr "" #. type: TP -#: build/C/man2/fallocate.2:146 build/C/man3/posix_fallocate.3:89 build/C/man2/shmget.2:214 build/C/man2/sync_file_range.2:166 +#: 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 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:151 build/C/man3/posix_fallocate.3:94 +#: build/C/man2/fallocate.2:319 build/C/man3/posix_fallocate.3:96 msgid "" "There is not enough space left on the device containing the file referred to " "by I." msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:155 +#: build/C/man2/fallocate.2:323 msgid "This kernel does not implement B()." msgstr "" #. type: TP -#: build/C/man2/fallocate.2:155 +#: build/C/man2/fallocate.2:323 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:164 +#: build/C/man2/fallocate.2:332 msgid "" -"The file system containing the file referred to by I does not support " -"this operation; or the I is not supported by the file system " -"containing the file referred to by I." +"The filesystem containing the file referred to by I does not support " +"this operation; or the I is not supported by the filesystem containing " +"the file referred to by I." msgstr "" #. type: TP -#: build/C/man2/fallocate.2:164 build/C/man2/mlock.2:144 build/C/man2/mlock.2:183 build/C/man2/mmap.2:458 build/C/man2/shmctl.2:342 build/C/man2/shmget.2:222 +#: 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 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:180 +#: build/C/man2/fallocate.2:338 +msgid "The file referred to by I is marked immutable (see B(1))." +msgstr "" + +#. type: Plain text +#: build/C/man2/fallocate.2:351 msgid "" -"The file referred to by I is marked immutable (see B(1)). Or: " -"I specifies B and the file referred to by I " -"is marked append-only (see B(1))." +"I specifies B or B and " +"the file referred to by I is marked append-only (see B(1))." +msgstr "" + +#. type: Plain text +#: build/C/man2/fallocate.2:355 build/C/man2/mmap.2:471 +msgid "The operation was prevented by a file seal; see B(2)." msgstr "" #. type: TP -#: build/C/man2/fallocate.2:180 build/C/man2/posix_fadvise.2:96 build/C/man3/posix_fallocate.3:94 build/C/man2/sync_file_range.2:169 +#: 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 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:184 +#: build/C/man2/fallocate.2:359 msgid "I refers to a pipe or FIFO." msgstr "" +#. type: TP +#: build/C/man2/fallocate.2:359 build/C/man2/mmap.2:471 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/fallocate.2:367 +msgid "" +"I specifies B, but the file referred to by " +"I is currently being executed." +msgstr "" + #. type: SH -#: build/C/man2/fallocate.2:184 build/C/man3/mcheck.3:133 build/C/man2/mmap2.2:74 build/C/man2/posix_fadvise.2:103 build/C/man3/posix_fallocate.3:98 build/C/man3/posix_memalign.3:165 build/C/man2/readahead.2:82 build/C/man2/remap_file_pages.2:146 build/C/man3/shm_open.3:247 build/C/man2/subpage_prot.2:85 build/C/man2/sync_file_range.2:177 +#: 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 #, no-wrap msgid "VERSIONS" msgstr "" +#. See http://sourceware.org/bugzilla/show_bug.cgi?id=14964 #. type: Plain text -#: build/C/man2/fallocate.2:188 +#: build/C/man2/fallocate.2:375 msgid "" "B() is available on Linux since kernel 2.6.23. Support is " -"provided by glibc since version 2.10." +"provided by glibc since version 2.10. The B flags are defined " +"in glibc headers only since version 2.18." msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:191 +#: build/C/man2/fallocate.2:378 msgid "B() is Linux-specific." msgstr "" #. type: Plain text -#: build/C/man2/fallocate.2:195 -msgid "B(2), B(3), B(3)" +#: build/C/man2/fallocate.2:383 +msgid "B(1), B(2), B(3), B(3)" msgstr "" #. type: TH @@ -809,9 +1030,9 @@ msgid "MADVISE" msgstr "" #. type: TH -#: build/C/man2/madvise.2:35 +#: build/C/man2/madvise.2:35 build/C/man2/posix_fadvise.2:28 #, no-wrap -msgid "2011-09-18" +msgid "2014-12-31" msgstr "" #. type: Plain text @@ -830,7 +1051,7 @@ msgid "BIB<, size_t >IB<, int >IB<);>" msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:46 build/C/man2/posix_fadvise.2:42 build/C/man3/posix_fallocate.3:37 build/C/man3/posix_memalign.3:48 +#: 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 msgid "Feature Test Macro Requirements for glibc (see B(7)):" msgstr "" @@ -927,7 +1148,7 @@ msgstr "" #. type: TP #: build/C/man2/madvise.2:100 #, no-wrap -msgid "B (Since Linux 2.6.16)" +msgid "B (since Linux 2.6.16)" msgstr "" #. 2.6.18-rc5 @@ -939,14 +1160,14 @@ msgstr "" #: build/C/man2/madvise.2:113 msgid "" "Free up a given range of pages and its associated backing store. Currently, " -"only shmfs/tmpfs supports this; other file systems return with the error " +"only shmfs/tmpfs supports this; other filesystems return with the error " "B." msgstr "" #. type: TP #: build/C/man2/madvise.2:113 #, no-wrap -msgid "B (Since Linux 2.6.16)" +msgid "B (since Linux 2.6.16)" msgstr "" #. See http://lwn.net/Articles/171941/ @@ -984,7 +1205,7 @@ msgstr "" #. type: TP #: build/C/man2/madvise.2:144 #, no-wrap -msgid "B (Since Linux 2.6.16)" +msgid "B (since Linux 2.6.16)" msgstr "" #. type: Plain text @@ -997,24 +1218,24 @@ msgstr "" #. type: TP #: build/C/man2/madvise.2:150 #, no-wrap -msgid "B (Since Linux 2.6.32)" +msgid "B (since Linux 2.6.32)" msgstr "" #. type: Plain text #: build/C/man2/madvise.2:162 msgid "" "Poison a page and handle it like a hardware memory corruption. This " -"operation is only available for privileged (B) processes. " +"operation is available only for privileged (B) processes. " "This operation may result in the calling process receiving a B and " "the page being unmapped. This feature is intended for testing of memory " -"error-handling code; it is only available if the kernel was configured with " +"error-handling code; it is available only if the kernel was configured with " "B." msgstr "" #. type: TP #: build/C/man2/madvise.2:162 #, no-wrap -msgid "B (Since Linux 2.6.33)" +msgid "B (since Linux 2.6.33)" msgstr "" #. type: Plain text @@ -1027,7 +1248,7 @@ msgid "" "out of normal memory management). The effect of the B " "operation is invisible to (i.e., does not change the semantics of) the " "calling process. This feature is intended for testing of memory " -"error-handling code; it is only available if the kernel was configured with " +"error-handling code; it is available only if the kernel was configured with " "B." msgstr "" @@ -1045,12 +1266,12 @@ msgid "" "memory that have been marked as mergeable, looking for pages with identical " "content. These are replaced by a single write-protected page (which is " "automatically copied if a process later wants to update the content of the " -"page). KSM only merges private anonymous pages (see B(2)). The KSM " +"page). KSM merges only private anonymous pages (see B(2)). The KSM " "feature is intended for applications that generate many instances of the " "same data (e.g., virtualization systems such as KVM). It can consume a lot " -"of processing power; use with care. See the kernel source file " +"of processing power; use with care. See the Linux kernel source file " "I for more details. The B and " -"B operations are only available if the kernel was " +"B operations are available only if the kernel was " "configured with B." msgstr "" @@ -1080,19 +1301,19 @@ msgstr "" #: build/C/man2/madvise.2:243 msgid "" "Enables Transparent Huge Pages (THP) for pages in the range specified by " -"I and I. Currently, Transparent Huge Pages only work with " +"I and I. Currently, Transparent Huge Pages work only with " "private anonymous pages (see B(2)). The kernel will regularly scan " "the areas marked as huge page candidates to replace them with huge pages. " "The kernel will also allocate huge pages directly when the region is " "naturally aligned to the huge page size (see B(2)). This " "feature is primarily aimed at applications that use large mappings of data " -"and access large regions of that memory at a time (e.g. virtualization " -"systems such as QEMU). It can very easily waste memory (e.g. a 2MB mapping " +"and access large regions of that memory at a time (e.g., virtualization " +"systems such as QEMU). It can very easily waste memory (e.g., a 2MB mapping " "that only ever accesses 1 byte will result in 2MB of wired memory instead of " -"one 4KB page). See the kernel source file I " -"for more details. The B and B operations " -"are only available if the kernel was configured with " -"B." +"one 4KB page). See the Linux kernel source file " +"I for more details. The B " +"and B operations are available only if the kernel was " +"configured with B." msgstr "" #. type: TP @@ -1108,120 +1329,150 @@ msgid "" "will not be collapsed into huge pages." msgstr "" +#. type: TP +#: build/C/man2/madvise.2:250 +#, no-wrap +msgid "B (since Linux 3.4)" +msgstr "" + +#. type: Plain text +#: build/C/man2/madvise.2:264 +msgid "" +"Exclude from a core dump those pages in the range specified by I and " +"I. This is useful in applications that have large areas of memory " +"that are known not to be useful in a core dump. The effect of " +"B takes precedence over the bit mask that is set via the " +"I file (see B(5))." +msgstr "" + +#. type: TP +#: build/C/man2/madvise.2:264 +#, no-wrap +msgid "B (since Linux 3.4)" +msgstr "" + +#. type: Plain text +#: build/C/man2/madvise.2:268 +msgid "Undo the effect of an earlier B." +msgstr "" + #. type: Plain text -#: build/C/man2/madvise.2:257 +#: build/C/man2/madvise.2:275 msgid "" "On success B() returns zero. On error, it returns -1 and I " "is set appropriately." msgstr "" #. type: TP -#: build/C/man2/madvise.2:258 build/C/man2/mlock.2:155 build/C/man2/mmap.2:411 build/C/man2/mremap.2:137 +#: build/C/man2/madvise.2:276 build/C/man2/mlock.2:154 build/C/man2/mmap.2:411 build/C/man2/mremap.2:136 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:261 +#: build/C/man2/madvise.2:279 msgid "A kernel resource was temporarily unavailable." msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:264 +#: build/C/man2/madvise.2:282 msgid "The map exists, but the area maps something that isn't a file." msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:267 +#: build/C/man2/madvise.2:285 msgid "This error can occur for the following reasons:" msgstr "" -#. type: IP -#: build/C/man2/madvise.2:268 build/C/man2/madvise.2:274 build/C/man2/madvise.2:277 build/C/man2/madvise.2:280 build/C/man2/madvise.2:283 build/C/man3/mallopt.3:233 build/C/man3/mallopt.3:239 -#, no-wrap -msgid "*" -msgstr "" - #. .I len #. is zero, #. type: Plain text -#: build/C/man2/madvise.2:274 +#: build/C/man2/madvise.2:292 msgid "The value I is negative." msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:277 +#: build/C/man2/madvise.2:295 msgid "I is not page-aligned." msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:280 +#: build/C/man2/madvise.2:298 msgid "I is not a valid value" msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:283 +#: build/C/man2/madvise.2:301 msgid "" "The application is attempting to release locked or shared pages (with " "B)." msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:291 +#: build/C/man2/madvise.2:309 msgid "" "B or B was specified in I, but the " "kernel was not configured with B." msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:298 +#: build/C/man2/madvise.2:316 msgid "" "(for B) Paging in this area would exceed the process's " "maximum resident set size." msgstr "" #. type: TP -#: build/C/man2/madvise.2:298 build/C/man2/madvise.2:303 build/C/man2/mlock.2:124 build/C/man2/mlock.2:132 build/C/man2/mlock.2:170 build/C/man2/mmap.2:454 build/C/man2/mprotect.2:94 build/C/man2/mprotect.2:97 build/C/man2/mremap.2:180 build/C/man2/msync.2:93 build/C/man3/posix_memalign.3:162 build/C/man2/shmctl.2:326 build/C/man2/shmget.2:211 build/C/man2/shmop.2:209 build/C/man2/subpage_prot.2:82 build/C/man2/sync_file_range.2:163 +#: 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 #, no-wrap msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:303 +#: build/C/man2/madvise.2:321 msgid "(for B) Not enough memory: paging in failed." msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:307 +#: build/C/man2/madvise.2:325 msgid "" "Addresses in the specified range are not currently mapped, or are outside " "the address space of the process." msgstr "" -#. FIXME . Write a posix_fadvise(3) page. +#. commit d3ac21cacc24790eb45d735769f35753f5b56ceb +#. type: Plain text +#: build/C/man2/madvise.2:332 +msgid "" +"Since Linux 3.18, support for this system call is optional, depending on the " +"setting of the B configuration option." +msgstr "" + +#. FIXME . Write a posix_madvise(3) page. #. type: Plain text -#: build/C/man2/madvise.2:319 +#: build/C/man2/madvise.2:345 msgid "" "POSIX.1b. POSIX.1-2001 describes B(3) with constants " -"B, etc., with a behavior close to that described here. " -"There is a similar B(2) for file access." +"B, B, and so on, with a behavior close " +"to that described here. There is a similar B(2) for file " +"access." msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:328 +#: build/C/man2/madvise.2:354 msgid "" "B, B, B, B, " "B, and B are Linux-specific." msgstr "" #. type: SS -#: build/C/man2/madvise.2:329 build/C/man2/mlock.2:268 build/C/man2/shmget.2:278 +#: build/C/man2/madvise.2:355 build/C/man2/mlock.2:274 build/C/man2/shmget.2:370 #, no-wrap -msgid "Linux Notes" +msgid "Linux notes" msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:337 +#: build/C/man2/madvise.2:363 msgid "" "The current Linux implementation (2.4.0) views this system call more as a " "command than as advice and hence may return an error when it cannot do what " @@ -1234,7 +1485,7 @@ msgstr "" #. .BR madvise () #. function first appeared in 4.4BSD. #. type: Plain text -#: build/C/man2/madvise.2:353 +#: build/C/man2/madvise.2:379 msgid "" "The Linux implementation requires that the address I be page-aligned, " "and allows I to be zero. If there are some parts of the specified " @@ -1244,6453 +1495,8351 @@ msgid "" msgstr "" #. type: Plain text -#: build/C/man2/madvise.2:360 +#: build/C/man2/madvise.2:388 msgid "" "B(2), B(2), B(2), B(2), B(2), " -"B(2)" +"B(2), B(2), B(5)" msgstr "" #. type: TH -#: build/C/man3/malloc_get_state.3:23 +#: build/C/man3/mallinfo.3:26 #, no-wrap -msgid "MALLOC_GET_STATE" +msgid "MALLINFO" msgstr "" #. type: TH -#: build/C/man3/malloc_get_state.3:23 +#: build/C/man3/mallinfo.3:26 build/C/man3/malloc_stats.3:26 #, no-wrap -msgid "2012-03-26" +msgid "2012-05-06" msgstr "" #. type: Plain text -#: build/C/man3/malloc_get_state.3:26 -msgid "" -"get_malloc_state, set_malloc_state - record and restore state of malloc " -"implementation" +#: build/C/man3/mallinfo.3:29 +msgid "mallinfo - obtain memory allocation information" msgstr "" #. type: Plain text -#: build/C/man3/malloc_get_state.3:29 build/C/man3/posix_memalign.3:34 -#, no-wrap -msgid "B<#include Estdlib.hE>\n" +#: 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 +msgid "B<#include Emalloc.hE>" msgstr "" #. type: Plain text -#: build/C/man3/malloc_get_state.3:31 -#, no-wrap -msgid "B\n" +#: build/C/man3/mallinfo.3:33 +msgid "B" msgstr "" #. type: Plain text -#: build/C/man3/malloc_get_state.3:33 -#, no-wrap -msgid "BIB<);>\n" +#: build/C/man3/mallinfo.3:41 +msgid "" +"The B() function returns a copy of a structure containing " +"information about memory allocations performed by B(3) and related " +"functions. This structure is defined as follows:" msgstr "" #. type: Plain text -#: build/C/man3/malloc_get_state.3:51 +#: build/C/man3/mallinfo.3:56 +#, no-wrap msgid "" -"The B() function records the current state of all " -"B(3) internal bookkeeping variables (but not the actual contents of " -"the heap or the state of B(3) functions pointers). The state " -"is recorded in a system-dependent opaque data structure dynamically " -"allocated via B(3), and a pointer to that data structure is returned " -"as the function result. (It is the caller's responsibility to B(3) " -"this memory.)" +"struct mallinfo {\n" +" int arena; /* Non-mmapped space allocated (bytes) */\n" +" int ordblks; /* Number of free chunks */\n" +" int smblks; /* Number of free fastbin blocks */\n" +" int hblks; /* Number of mmapped regions */\n" +" int hblkhd; /* Space allocated in mmapped regions (bytes) */\n" +" int usmblks; /* Maximum total allocated space (bytes) */\n" +" int fsmblks; /* Space in freed fastbin blocks (bytes) */\n" +" int uordblks; /* Total allocated space (bytes) */\n" +" int fordblks; /* Total free space (bytes) */\n" +" int keepcost; /* Top-most, releasable space (bytes) */\n" +"};\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_get_state.3:59 -msgid "" -"The B() function restores the state of all B(3) " -"internal bookkeeping variables to the values recorded in the opaque data " -"structure pointed to by I." +#: build/C/man3/mallinfo.3:62 +msgid "The fields of the I structure contain the following information:" msgstr "" -#. type: Plain text -#: build/C/man3/malloc_get_state.3:66 -msgid "" -"On success, B() returns a pointer to a newly allocated " -"opaque data structure. On error (for example, memory could not be allocated " -"for the data structure), B() returns NULL." +#. type: TP +#: build/C/man3/mallinfo.3:62 +#, no-wrap +msgid "I" msgstr "" -#. if(ms->magic != MALLOC_STATE_MAGIC) return -1; -#. /* Must fail if the major version is too high. */ -#. if((ms->version & ~0xffl) > (MALLOC_STATE_VERSION & ~0xffl)) return -2; #. type: Plain text -#: build/C/man3/malloc_get_state.3:84 +#: build/C/man3/mallinfo.3:68 msgid "" -"On success, B() returns 0. If the implementation detects " -"that I does not point to a correctly formed data structure, " -"B() returns -1. If the implementation detects that the " -"version of the data structure referred to by I is a more recent " -"version than this implementation knows about, B() returns " -"-2." +"The total amount of memory allocated by means other than B(2) (i.e., " +"memory allocated on the heap). This figure includes both in-use blocks and " +"blocks on the free list." msgstr "" -#. type: Plain text -#: build/C/man3/malloc_get_state.3:86 build/C/man3/malloc_hook.3:78 build/C/man3/mcheck.3:146 build/C/man3/mtrace.3:78 -msgid "These functions are GNU extensions." +#. type: TP +#: build/C/man3/mallinfo.3:68 +#, no-wrap +msgid "I" msgstr "" #. type: Plain text -#: build/C/man3/malloc_get_state.3:92 -msgid "" -"These functions are especially useful when using this B(3) " -"implementation as part of a shared library, and the heap contents are " -"saved/restored via some other method. This technique is used by the GNU " -"Emacs to implement its \"dumping\" function." +#: build/C/man3/mallinfo.3:71 +msgid "The number of ordinary (i.e., non-fastbin) free blocks." msgstr "" -#. i.e., calls __malloc_check_init() -#. i.e., malloc checking is not already in use -#. and the caller requested malloc checking -#. type: Plain text -#: build/C/man3/malloc_get_state.3:109 -msgid "" -"Hook function pointers are never saved or restored by these functions, with " -"two exceptions: if malloc checking (see B(3)) was in use when " -"B() was called, then B() resets malloc " -"checking hooks if possible; if malloc checking was not in use in the " -"recorded state, but the caller has requested malloc checking, then the hooks " -"are reset to 0." +#. type: TP +#: build/C/man3/mallinfo.3:71 +#, no-wrap +msgid "I" msgstr "" #. type: Plain text -#: build/C/man3/malloc_get_state.3:112 -msgid "B(3), B(3)" -msgstr "" - -#. type: TH -#: build/C/man3/malloc_hook.3:6 -#, no-wrap -msgid "MALLOC_HOOK" +#: build/C/man3/mallinfo.3:75 +msgid "The number of fastbin free blocks (see B(3))." msgstr "" -#. type: TH -#: build/C/man3/malloc_hook.3:6 +#. type: TP +#: build/C/man3/mallinfo.3:75 #, no-wrap -msgid "2010-10-13" +msgid "I" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:11 +#: build/C/man3/mallinfo.3:83 msgid "" -"__malloc_hook, __malloc_initialize_hook, __memalign_hook, __free_hook, " -"__realloc_hook, __after_morecore_hook - malloc debugging variables" +"The number of blocks currently allocated using B(2). (See the " +"discussion of B in B(3).)" msgstr "" -#. type: Plain text -#: build/C/man3/malloc_hook.3:14 build/C/man3/posix_memalign.3:40 +#. type: TP +#: build/C/man3/mallinfo.3:83 #, no-wrap -msgid "B<#include Emalloc.hE>\n" +msgid "I" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:16 -#, no-wrap -msgid "BIB<, const void *>IB<);>\n" +#: build/C/man3/mallinfo.3:87 +msgid "The number of bytes in blocks currently allocated using B(2)." msgstr "" -#. type: Plain text -#: build/C/man3/malloc_hook.3:19 +#. type: TP +#: build/C/man3/mallinfo.3:87 #, no-wrap -msgid "" -"BIB<, size_t >IB<, const void " -"*>IB<);>\n" +msgid "I" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:22 -#, no-wrap +#: build/C/man3/mallinfo.3:92 msgid "" -"BIB<, size_t >IB<,>\n" -"B< const void *>IB<);>\n" +"The \"highwater mark\" for allocated space\\(emthat is, the maximum amount " +"of space that was ever allocated. This field is maintained only in " +"nonthreading environments." msgstr "" -#. type: Plain text -#: build/C/man3/malloc_hook.3:24 +#. type: TP +#: build/C/man3/mallinfo.3:92 #, no-wrap -msgid "BIB<, const void *>IB<);>\n" +msgid "I" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:26 -#, no-wrap -msgid "B\n" +#: build/C/man3/mallinfo.3:95 +msgid "The total number of bytes in fastbin free blocks." msgstr "" -#. type: Plain text -#: build/C/man3/malloc_hook.3:28 +#. type: TP +#: build/C/man3/mallinfo.3:95 #, no-wrap -msgid "B\n" +msgid "I" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:39 -msgid "" -"The GNU C library lets you modify the behavior of B(3), " -"B(3), and B(3) by specifying appropriate hook functions. " -"You can use these hooks to help you debug programs that use dynamic memory " -"allocation, for example." +#: build/C/man3/mallinfo.3:98 +msgid "The total number of bytes used by in-use allocations." msgstr "" -#. type: Plain text -#: build/C/man3/malloc_hook.3:46 -msgid "" -"The variable B<__malloc_initialize_hook> points at a function that is called " -"once when the malloc implementation is initialized. This is a weak " -"variable, so it can be overridden in the application with a definition like " -"the following:" +#. type: TP +#: build/C/man3/mallinfo.3:98 +#, no-wrap +msgid "I" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:49 +#: build/C/man3/mallinfo.3:101 +msgid "The total number of bytes in free blocks." +msgstr "" + +#. type: TP +#: build/C/man3/mallinfo.3:101 #, no-wrap -msgid " void (*__malloc_initialize_hook)(void) = my_init_hook;\n" +msgid "I" msgstr "" +#. .SH VERSIONS +#. Available already in glibc 2.0, possibly earlier #. type: Plain text -#: build/C/man3/malloc_hook.3:54 -msgid "Now the function I() can do the initialization of all hooks." +#: build/C/man3/mallinfo.3:110 +msgid "" +"The total amount of releasable free space at the top of the heap. This is " +"the maximum number of bytes that could ideally (i.e., ignoring page " +"alignment restrictions, and so on) be released by B(3)." msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:70 +#: build/C/man3/mallinfo.3:114 msgid "" -"The four functions pointed to by B<__malloc_hook>, B<__realloc_hook>, " -"B<__memalign_hook>, B<__free_hook> have a prototype like the functions " -"B(3), B(3), B(3), B(3), respectively, " -"except that they have a final argument I that gives the address of " -"the caller of B(3), etc." +"This function is not specified by POSIX or the C standards. A similar " +"function exists on many System V derivatives, and was specified in the SVID." msgstr "" +#. FIXME . http://sourceware.org/bugzilla/show_bug.cgi?id=208 +#. See the 24 Aug 2011 mail by Paul Pluzhnikov: +#. "[patch] Fix mallinfo() to accumulate results for all arenas" +#. on libc-alpha@sourceware.org #. type: Plain text -#: build/C/man3/malloc_hook.3:76 +#: build/C/man3/mallinfo.3:126 msgid "" -"The variable B<__after_morecore_hook> points at a function that is called " -"each time after B(2) was asked for more memory." +"B " +"Allocations in other arenas are excluded. See B(3) and " +"B(3) for alternatives that include information about other " +"arenas." msgstr "" -#. https://bugzilla.redhat.com/show_bug.cgi?id=450187 -#. http://sourceware.org/bugzilla/show_bug.cgi?id=9957 #. type: Plain text -#: build/C/man3/malloc_hook.3:85 +#: build/C/man3/mallinfo.3:134 msgid "" -"The use of these hook functions is not safe in multithreaded programs, and " -"they are now deprecated. Programmers should instead preempt calls to the " -"relevant functions by defining and exporting functions such as \"malloc\" " -"and \"free\"." +"The fields of the I structure are typed as I. However, " +"because some internal bookkeeping values may be of type I, the " +"reported values may wrap around zero and thus be inaccurate." msgstr "" #. type: SH -#: build/C/man3/malloc_hook.3:85 build/C/man3/mallopt.3:464 build/C/man3/mcheck.3:159 build/C/man2/mmap.2:571 build/C/man2/mprotect.2:142 build/C/man3/mtrace.3:106 +#: 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 #, no-wrap msgid "EXAMPLE" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:87 -msgid "Here is a short example of how to use these variables." +#: build/C/man3/mallinfo.3:140 +msgid "" +"The program below employs B() to retrieve memory allocation " +"statistics before and after allocating and freeing some blocks of memory. " +"The statistics are displayed on standard output." msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:91 -#, no-wrap +#: build/C/man3/mallinfo.3:144 msgid "" -"#include Estdio.hE\n" -"#include Emalloc.hE\n" +"The first two command-line arguments specify the number and size of blocks " +"to be allocated with B(3)." msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:95 -#, no-wrap +#: build/C/man3/mallinfo.3:158 msgid "" -"/* Prototypes for our hooks. */\n" -"static void my_init_hook(void);\n" -"static void *my_malloc_hook(size_t, const void *);\n" +"The remaining three arguments specify which of the allocated blocks should " +"be freed with B(3). These three arguments are optional, and specify " +"(in order): the step size to be used in the loop that frees blocks (the " +"default is 1, meaning free all blocks in the range); the ordinal position of " +"the first block to be freed (default 0, meaning the first allocated block); " +"and a number one greater than the ordinal position of the last block to be " +"freed (default is one greater than the maximum block number). If these " +"three arguments are omitted, then the defaults cause all allocated blocks to " +"be freed." msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:98 -#, no-wrap +#: build/C/man3/mallinfo.3:162 msgid "" -"/* Variables to save original hooks. */\n" -"static void *(*old_malloc_hook)(size_t, const void *);\n" +"In the following example run of the program, 1000 allocations of 100 bytes " +"are performed, and then every second allocated block is freed:" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:101 +#: build/C/man3/mallinfo.3:177 #, no-wrap msgid "" -"/* Override initializing hook from the C library. */\n" -"void (*__malloc_initialize_hook) (void) = my_init_hook;\n" +"$ B<./a.out 1000 100 2>\n" +"============== Before allocating blocks ==============\n" +"Total non-mmapped bytes (arena): 0\n" +"# of free chunks (ordblks): 1\n" +"# of free fastbin blocks (smblks): 0\n" +"# of mapped regions (hblks): 0\n" +"Bytes in mapped regions (hblkhd): 0\n" +"Max. total allocated space (usmblks): 0\n" +"Free bytes held in fastbins (fsmblks): 0\n" +"Total allocated space (uordblks): 0\n" +"Total free space (fordblks): 0\n" +"Topmost releasable block (keepcost): 0\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:108 +#: build/C/man3/mallinfo.3:189 #, no-wrap msgid "" -"static void\n" -"my_init_hook(void)\n" -"{\n" -" old_malloc_hook = __malloc_hook;\n" -" __malloc_hook = my_malloc_hook;\n" -"}\n" +"============== After allocating blocks ==============\n" +"Total non-mmapped bytes (arena): 135168\n" +"# of free chunks (ordblks): 1\n" +"# of free fastbin blocks (smblks): 0\n" +"# of mapped regions (hblks): 0\n" +"Bytes in mapped regions (hblkhd): 0\n" +"Max. total allocated space (usmblks): 0\n" +"Free bytes held in fastbins (fsmblks): 0\n" +"Total allocated space (uordblks): 104000\n" +"Total free space (fordblks): 31168\n" +"Topmost releasable block (keepcost): 31168\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:113 +#: build/C/man3/mallinfo.3:201 #, no-wrap msgid "" -"static void *\n" -"my_malloc_hook(size_t size, const void *caller)\n" -"{\n" -" void *result;\n" +"============== After freeing blocks ==============\n" +"Total non-mmapped bytes (arena): 135168\n" +"# of free chunks (ordblks): 501\n" +"# of free fastbin blocks (smblks): 0\n" +"# of mapped regions (hblks): 0\n" +"Bytes in mapped regions (hblkhd): 0\n" +"Max. total allocated space (usmblks): 0\n" +"Free bytes held in fastbins (fsmblks): 0\n" +"Total allocated space (uordblks): 52000\n" +"Total free space (fordblks): 83168\n" +"Topmost releasable block (keepcost): 31168\n" msgstr "" -#. type: Plain text -#: build/C/man3/malloc_hook.3:116 +#. type: SS +#: 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 #, no-wrap -msgid "" -" /* Restore all old hooks */\n" -" __malloc_hook = old_malloc_hook;\n" +msgid "Program source" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:119 +#: build/C/man3/mallinfo.3:208 #, no-wrap msgid "" -" /* Call recursively */\n" -" result = malloc(size);\n" +"#include Emalloc.hE\n" +"#include \"tlpi_hdr.h\"\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:122 +#: build/C/man3/mallinfo.3:213 #, no-wrap msgid "" -" /* Save underlying hooks */\n" -" old_malloc_hook = __malloc_hook;\n" +"static void\n" +"display_mallinfo(void)\n" +"{\n" +" struct mallinfo mi;\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:126 +#: build/C/man3/mallinfo.3:215 #, no-wrap -msgid "" -" /* printf() might call malloc(), so protect it too. */\n" -" printf(\"malloc(%u) called from %p returns %p\\en\",\n" -" (unsigned int) size, caller, result);\n" +msgid " mi = mallinfo();\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:129 +#: build/C/man3/mallinfo.3:227 #, no-wrap msgid "" -" /* Restore our own hooks */\n" -" __malloc_hook = my_malloc_hook;\n" +" printf(\"Total non-mmapped bytes (arena): %d\\en\", mi.arena);\n" +" printf(\"# of free chunks (ordblks): %d\\en\", mi.ordblks);\n" +" printf(\"# of free fastbin blocks (smblks): %d\\en\", mi.smblks);\n" +" printf(\"# of mapped regions (hblks): %d\\en\", mi.hblks);\n" +" printf(\"Bytes in mapped regions (hblkhd): %d\\en\", mi.hblkhd);\n" +" printf(\"Max. total allocated space (usmblks): %d\\en\", mi.usmblks);\n" +" printf(\"Free bytes held in fastbins (fsmblks): %d\\en\", mi.fsmblks);\n" +" printf(\"Total allocated space (uordblks): %d\\en\", " +"mi.uordblks);\n" +" printf(\"Total free space (fordblks): %d\\en\", " +"mi.fordblks);\n" +" printf(\"Topmost releasable block (keepcost): %d\\en\", " +"mi.keepcost);\n" +"}\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:132 +#: build/C/man3/mallinfo.3:235 #, no-wrap msgid "" -" return result;\n" -"}\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +"#define MAX_ALLOCS 2000000\n" +" char *alloc[MAX_ALLOCS];\n" +" int numBlocks, j, freeBegin, freeEnd, freeStep;\n" +" size_t blockSize;\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_hook.3:138 -msgid "B(3), B(3), B(3), B(3)" +#: build/C/man3/mallinfo.3:239 +#, no-wrap +msgid "" +" if (argc E 3 || strcmp(argv[1], \"--help\") == 0)\n" +" usageErr(\"%s num-blocks block-size [free-step [start-free \"\n" +" \"[end-free]]]\\en\", argv[0]);\n" msgstr "" -#. type: TH -#: build/C/man3/malloc_trim.3:24 +#. type: Plain text +#: build/C/man3/mallinfo.3:245 #, no-wrap -msgid "MALLOC_TRIM" +msgid "" +" numBlocks = atoi(argv[1]);\n" +" blockSize = atoi(argv[2]);\n" +" freeStep = (argc E 3) ? atoi(argv[3]) : 1;\n" +" freeBegin = (argc E 4) ? atoi(argv[4]) : 0;\n" +" freeEnd = (argc E 5) ? atoi(argv[5]) : numBlocks;\n" msgstr "" -#. type: TH -#: build/C/man3/malloc_trim.3:24 build/C/man3/malloc_usable_size.3:23 +#. type: Plain text +#: build/C/man3/mallinfo.3:248 #, no-wrap -msgid "2012-03-29" +msgid "" +" printf(\"============== Before allocating blocks " +"==============\\en\");\n" +" display_mallinfo();\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_trim.3:27 -msgid "malloc_trim - release free memory from the top of the heap" +#: build/C/man3/mallinfo.3:252 +#, no-wrap +msgid "" +" for (j = 0; j E numBlocks; j++) {\n" +" if (numBlocks E= MAX_ALLOCS)\n" +" fatal(\"Too many allocations\");\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_trim.3:29 build/C/man3/malloc_usable_size.3:28 build/C/man3/mallopt.3:29 -msgid "B<#include Emalloc.hE>" +#: build/C/man3/mallinfo.3:257 +#, no-wrap +msgid "" +" alloc[j] = malloc(blockSize);\n" +" if (alloc[j] == NULL)\n" +" errExit(\"malloc\");\n" +" }\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_trim.3:31 -msgid "BIB<);>" +#: build/C/man3/mallinfo.3:260 +#, no-wrap +msgid "" +" printf(\"\\en============== After allocating blocks " +"==============\\en\");\n" +" display_mallinfo();\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_trim.3:38 +#: build/C/man3/mallinfo.3:263 +#, no-wrap msgid "" -"The B() function attempts to release free memory at the top of " -"the heap (by calling B(2) with a suitable argument)." +" for (j = freeBegin; j E freeEnd; j += freeStep)\n" +" free(alloc[j]);\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_trim.3:49 +#: build/C/man3/mallinfo.3:266 +#, no-wrap msgid "" -"The I argument specifies the amount of free space to leave untrimmed at " -"the top of the heap. If this argument is 0, only the minimum amount of " -"memory is maintained at the top of the heap (i.e., one page or less). A " -"nonzero argument can be used to maintain some trailing space at the top of " -"the heap in order to allow future allocations to be made without having to " -"extend the heap with B(2)." +" printf(\"\\en============== After freeing blocks " +"==============\\en\");\n" +" display_mallinfo();\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_trim.3:54 +#: 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 +#, no-wrap msgid "" -"The B() function returns 1 if memory was actually released " -"back to the system, or 0 if it was not possible to release any memory." +" exit(EXIT_SUCCESS);\n" +"}\n" msgstr "" -#. .SH VERSIONS -#. Available already in glibc 2.0, possibly earlier #. type: Plain text -#: build/C/man3/malloc_trim.3:58 -msgid "No errors are defined." +#: build/C/man3/mallinfo.3:279 +msgid "" +"B(2), B(3), B(3), B(3), " +"B(3), B(3)" msgstr "" -#. type: Plain text -#: build/C/man3/malloc_trim.3:60 build/C/man3/malloc_usable_size.3:48 -msgid "This function is a GNU extension." +#. type: TH +#: build/C/man3/malloc_get_state.3:25 +#, no-wrap +msgid "MALLOC_GET_STATE" msgstr "" -#. type: Plain text -#: build/C/man3/malloc_trim.3:69 -msgid "" -"This function is automatically called by B(3) in certain " -"circumstances; see the discussion of B and B in " -"B(3)." +#. type: TH +#: build/C/man3/malloc_get_state.3:25 build/C/man3/malloc_usable_size.3:25 +#, no-wrap +msgid "2014-06-13" msgstr "" #. type: Plain text -#: build/C/man3/malloc_trim.3:72 +#: build/C/man3/malloc_get_state.3:28 msgid "" -"This function cannot release free memory located at places other than the " -"top of the heap." +"malloc_get_state, malloc_set_state - record and restore state of malloc " +"implementation" msgstr "" -#. malloc/malloc.c::mTRIm(): -#. return result | (av == &main_arena ? sYSTRIm (pad, av) : 0); #. type: Plain text -#: build/C/man3/malloc_trim.3:76 -msgid "This function only releases memory in the main arena." +#: 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 +#, no-wrap +msgid "B<#include Emalloc.hE>\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_trim.3:80 -msgid "B(2), B(3), B(3)" +#: build/C/man3/malloc_get_state.3:33 +#, no-wrap +msgid "B\n" msgstr "" -#. type: TH -#: build/C/man3/malloc_usable_size.3:23 +#. type: Plain text +#: build/C/man3/malloc_get_state.3:35 #, no-wrap -msgid "MALLOC_USABLE_SIZE" +msgid "BIB<);>\n" msgstr "" #. type: Plain text -#: build/C/man3/malloc_usable_size.3:26 -msgid "malloc_usable_size - obtain size of block of memory allocated from heap" +#: build/C/man3/malloc_get_state.3:53 +msgid "" +"The B() function records the current state of all " +"B(3) internal bookkeeping variables (but not the actual contents of " +"the heap or the state of B(3) functions pointers). The state " +"is recorded in a system-dependent opaque data structure dynamically " +"allocated via B(3), and a pointer to that data structure is returned " +"as the function result. (It is the caller's responsibility to B(3) " +"this memory.)" msgstr "" #. type: Plain text -#: build/C/man3/malloc_usable_size.3:30 -msgid "BIB<);>" +#: build/C/man3/malloc_get_state.3:61 +msgid "" +"The B() function restores the state of all B(3) " +"internal bookkeeping variables to the values recorded in the opaque data " +"structure pointed to by I." msgstr "" #. type: Plain text -#: build/C/man3/malloc_usable_size.3:38 +#: build/C/man3/malloc_get_state.3:68 msgid "" -"The B() function returns the number of usable bytes in " -"the block pointed to by I, a pointer to a block of memory allocated by " -"B(3) or a related function." +"On success, B() returns a pointer to a newly allocated " +"opaque data structure. On error (for example, memory could not be allocated " +"for the data structure), B() returns NULL." msgstr "" +#. if(ms->magic != MALLOC_STATE_MAGIC) return -1; +#. /* Must fail if the major version is too high. */ +#. if((ms->version & ~0xffl) > (MALLOC_STATE_VERSION & ~0xffl)) return -2; #. type: Plain text -#: build/C/man3/malloc_usable_size.3:46 +#: build/C/man3/malloc_get_state.3:86 msgid "" -"B() returns the number of usable bytes in the block of " -"allocated memory pointed to by I. If I is NULL, 0 is returned." +"On success, B() returns 0. If the implementation detects " +"that I does not point to a correctly formed data structure, " +"B() returns -1. If the implementation detects that the " +"version of the data structure referred to by I is a more recent " +"version than this implementation knows about, B() returns " +"-2." +msgstr "" + +#. type: Plain text +#: 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 +msgid "These functions are GNU extensions." msgstr "" #. type: Plain text -#: build/C/man3/malloc_usable_size.3:58 +#: build/C/man3/malloc_get_state.3:94 msgid "" -"The value returned by B() may be greater than the " -"requested size of the allocation because of alignment and minimum size " -"constraints. Although the excess bytes can be overwritten by the " -"application without ill effects, this is not good programming practice: the " -"number of excess bytes in an allocation depends on the underlying " -"implementation." +"These functions are useful when using this B(3) implementation as " +"part of a shared library, and the heap contents are saved/restored via some " +"other method. This technique is used by GNU Emacs to implement its " +"\"dumping\" function." msgstr "" +#. i.e., calls __malloc_check_init() +#. i.e., malloc checking is not already in use +#. and the caller requested malloc checking #. type: Plain text -#: build/C/man3/malloc_usable_size.3:60 -msgid "The main use of this function is for debugging and introspection." +#: build/C/man3/malloc_get_state.3:111 +msgid "" +"Hook function pointers are never saved or restored by these functions, with " +"two exceptions: if malloc checking (see B(3)) was in use when " +"B() was called, then B() resets malloc " +"checking hooks if possible; if malloc checking was not in use in the " +"recorded state, but the caller has requested malloc checking, then the hooks " +"are reset to 0." msgstr "" #. type: Plain text -#: build/C/man3/malloc_usable_size.3:62 -msgid "B(3)" +#: build/C/man3/malloc_get_state.3:114 +msgid "B(3), B(3)" msgstr "" #. type: TH -#: build/C/man3/mallopt.3:24 +#: build/C/man3/malloc_hook.3:10 #, no-wrap -msgid "MALLOPT" +msgid "MALLOC_HOOK" msgstr "" #. type: TH -#: build/C/man3/mallopt.3:24 build/C/man3/mcheck.3:23 build/C/man3/mtrace.3:23 +#: build/C/man3/malloc_hook.3:10 #, no-wrap -msgid "2012-04-18" +msgid "2010-10-13" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:27 -msgid "mallopt - set memory allocation parameters" +#: build/C/man3/malloc_hook.3:15 +msgid "" +"__malloc_hook, __malloc_initialize_hook, __memalign_hook, __free_hook, " +"__realloc_hook, __after_morecore_hook - malloc debugging variables" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:31 -msgid "BIB<, int >IB<);>" +#: build/C/man3/malloc_hook.3:20 +#, no-wrap +msgid "BIB<, const void *>IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:42 +#: build/C/man3/malloc_hook.3:23 +#, no-wrap msgid "" -"The B() function adjusts parameters that control the behavior of " -"the memory-allocation functions (see B(3)). The I argument " -"specifies the parameter to be modified, and I specifies the new value " -"for that parameter." +"BIB<, size_t >IB<, const void " +"*>IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:45 -msgid "The following values can be specified for I:" +#: build/C/man3/malloc_hook.3:26 +#, no-wrap +msgid "" +"BIB<, size_t >IB<,>\n" +"B< const void *>IB<);>\n" msgstr "" -#. type: TP -#: build/C/man3/mallopt.3:45 +#. type: Plain text +#: build/C/man3/malloc_hook.3:28 #, no-wrap -msgid "B" +msgid "BIB<, const void *>IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:51 -msgid "" -"Setting this parameter controls how glibc responds when various kinds of " -"programming errors are detected (e.g., freeing the same pointer twice). The " -"3 least significant bits (2, 1, and 0) of the value assigned to this " -"parameter determine the glibc behavior, as follows:" +#: build/C/man3/malloc_hook.3:30 +#, no-wrap +msgid "B\n" msgstr "" -#. type: TP -#: build/C/man3/mallopt.3:52 +#. type: Plain text +#: build/C/man3/malloc_hook.3:32 #, no-wrap -msgid "Bit 0" +msgid "B\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:62 +#: build/C/man3/malloc_hook.3:43 msgid "" -"If this bit is set, then print a one-line message on I that provides " -"details about the error. The message starts with the string \"***\\ glibc " -"detected\\ ***\", followed by the program name, the name of the " -"memory-allocation function in which the error was detected, a brief " -"description of the error, and the memory address where the error was " -"detected." -msgstr "" - -#. type: TP -#: build/C/man3/mallopt.3:62 -#, no-wrap -msgid "Bit 1" +"The GNU C library lets you modify the behavior of B(3), " +"B(3), and B(3) by specifying appropriate hook functions. " +"You can use these hooks to help you debug programs that use dynamic memory " +"allocation, for example." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:77 +#: build/C/man3/malloc_hook.3:50 msgid "" -"If this bit is set, then, after printing any error message specified by bit " -"0, the program is terminated by calling B(3). In glibc versions " -"since 2.4, if bit 0 is also set, then, between printing the error message " -"and aborting, the program also prints a stack trace in the manner of " -"B(3), and prints the process's memory mapping in the style of " -"I (see B(5))." +"The variable B<__malloc_initialize_hook> points at a function that is called " +"once when the malloc implementation is initialized. This is a weak " +"variable, so it can be overridden in the application with a definition like " +"the following:" msgstr "" -#. type: TP -#: build/C/man3/mallopt.3:77 +#. type: Plain text +#: build/C/man3/malloc_hook.3:53 #, no-wrap -msgid "Bit 2 (since glibc 2.4)" +msgid " void (*__malloc_initialize_hook)(void) = my_init_hook;\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:84 -msgid "" -"This bit has an effect only if bit 0 is also set. If this bit is set, then " -"the one-line message describing the error is simplified to contain just the " -"name of the function where the error was detected and the brief description " -"of the error." +#: build/C/man3/malloc_hook.3:58 +msgid "Now the function I() can do the initialization of all hooks." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:89 -msgid "The remaining bits in I are ignored." +#: build/C/man3/malloc_hook.3:74 +msgid "" +"The four functions pointed to by B<__malloc_hook>, B<__realloc_hook>, " +"B<__memalign_hook>, B<__free_hook> have a prototype like the functions " +"B(3), B(3), B(3), B(3), respectively, " +"except that they have a final argument I that gives the address of " +"the caller of B(3), etc." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:93 +#: build/C/man3/malloc_hook.3:80 msgid "" -"Combining the above details, the following numeric values are meaningful for " -"B:" +"The variable B<__after_morecore_hook> points at a function that is called " +"each time after B(2) was asked for more memory." msgstr "" -#. type: IP -#: build/C/man3/mallopt.3:94 -#, no-wrap -msgid "0" +#. https://bugzilla.redhat.com/show_bug.cgi?id=450187 +#. http://sourceware.org/bugzilla/show_bug.cgi?id=9957 +#. type: Plain text +#: build/C/man3/malloc_hook.3:89 +msgid "" +"The use of these hook functions is not safe in multithreaded programs, and " +"they are now deprecated. Programmers should instead preempt calls to the " +"relevant functions by defining and exporting functions such as \"malloc\" " +"and \"free\"." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:96 -msgid "Ignore error conditions; continue execution (with undefined results)." +#: build/C/man3/malloc_hook.3:91 +msgid "Here is a short example of how to use these variables." msgstr "" -#. type: IP -#: build/C/man3/mallopt.3:96 +#. type: Plain text +#: build/C/man3/malloc_hook.3:95 #, no-wrap -msgid "1" +msgid "" +"#include Estdio.hE\n" +"#include Emalloc.hE\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:98 -msgid "Print a detailed error message and continue execution." +#: build/C/man3/malloc_hook.3:99 +#, no-wrap +msgid "" +"/* Prototypes for our hooks. */\n" +"static void my_init_hook(void);\n" +"static void *my_malloc_hook(size_t, const void *);\n" msgstr "" -#. type: IP -#: build/C/man3/mallopt.3:98 +#. type: Plain text +#: build/C/man3/malloc_hook.3:102 #, no-wrap -msgid "2" +msgid "" +"/* Variables to save original hooks. */\n" +"static void *(*old_malloc_hook)(size_t, const void *);\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:100 -msgid "Abort the program." +#: build/C/man3/malloc_hook.3:105 +#, no-wrap +msgid "" +"/* Override initializing hook from the C library. */\n" +"void (*__malloc_initialize_hook) (void) = my_init_hook;\n" msgstr "" -#. type: IP -#: build/C/man3/mallopt.3:100 +#. type: Plain text +#: build/C/man3/malloc_hook.3:112 #, no-wrap -msgid "3" +msgid "" +"static void\n" +"my_init_hook(void)\n" +"{\n" +" old_malloc_hook = __malloc_hook;\n" +" __malloc_hook = my_malloc_hook;\n" +"}\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:103 +#: build/C/man3/malloc_hook.3:117 +#, no-wrap msgid "" -"Print detailed error message, stack trace, and memory mappings, and abort " -"the program." +"static void *\n" +"my_malloc_hook(size_t size, const void *caller)\n" +"{\n" +" void *result;\n" msgstr "" -#. type: IP -#: build/C/man3/mallopt.3:103 +#. type: Plain text +#: build/C/man3/malloc_hook.3:120 #, no-wrap -msgid "5" +msgid "" +" /* Restore all old hooks */\n" +" __malloc_hook = old_malloc_hook;\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:105 -msgid "Print a simple error message and continue execution." +#: build/C/man3/malloc_hook.3:123 +#, no-wrap +msgid "" +" /* Call recursively */\n" +" result = malloc(size);\n" msgstr "" -#. type: IP -#: build/C/man3/mallopt.3:105 +#. type: Plain text +#: build/C/man3/malloc_hook.3:126 #, no-wrap -msgid "7" +msgid "" +" /* Save underlying hooks */\n" +" old_malloc_hook = __malloc_hook;\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:108 +#: build/C/man3/malloc_hook.3:130 +#, no-wrap msgid "" -"Print simple error message, stack trace, and memory mappings, and abort the " -"program." +" /* printf() might call malloc(), so protect it too. */\n" +" printf(\"malloc(%u) called from %p returns %p\\en\",\n" +" (unsigned int) size, caller, result);\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:114 +#: build/C/man3/malloc_hook.3:133 +#, no-wrap msgid "" -"Since glibc 2.3.4, the default value for the B parameter is " -"3. In glibc version 2.3.3 and earlier, the default value is 1." +" /* Restore our own hooks */\n" +" __malloc_hook = my_malloc_hook;\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:119 +#: build/C/man3/malloc_hook.3:136 +#, no-wrap msgid "" -"Using a nonzero B value can be useful because otherwise a " -"crash may happen much later, and the true cause of the problem is then very " -"hard to track down." +" return result;\n" +"}\n" msgstr "" -#. type: TP -#: build/C/man3/mallopt.3:119 +#. type: Plain text +#: build/C/man3/malloc_hook.3:142 +msgid "B(3), B(3), B(3), B(3)" +msgstr "" + +#. type: TH +#: build/C/man3/malloc_info.3:25 #, no-wrap -msgid "B" +msgid "MALLOC_INFO" msgstr "" -#. The following text adapted from comments in the glibc source: #. type: Plain text -#: build/C/man3/mallopt.3:129 -msgid "" -"This parameter specifies the maximum number of allocation requests that may " -"be simultaneously serviced using B(2). This parameter exists because " -"some systems have a limited number of internal tables for use by B(2), " -"and using more than a few of them may degrade performance." +#: build/C/man3/malloc_info.3:28 +msgid "malloc_info - export malloc state to a stream" +msgstr "" + +#. type: Plain text +#: build/C/man3/malloc_info.3:33 +#, no-wrap +msgid "BIB<, FILE *>IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:136 +#: build/C/man3/malloc_info.3:44 msgid "" -"The default value is 65,536, a value which has no special significance and " -"which servers only as a safeguard. Setting this parameter to 0 disables the " -"use of B(2) for servicing large allocation requests." +"The B() function exports an XML string that describes the " +"current state of the memory-allocation implementation in the caller. The " +"string is printed on the file stream I. The exported string " +"includes information about all arenas (see B(3))." msgstr "" -#. type: TP -#: build/C/man3/mallopt.3:136 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man3/malloc_info.3:48 +msgid "As currently implemented, I must be zero." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:145 +#: build/C/man3/malloc_info.3:55 msgid "" -"For allocations greater than or equal to the limit specified (in bytes) by " -"B that can't be satisfied from the free list, the " -"memory-allocation functions employ B(2) instead of increasing the " -"program break using B(2)." +"On success, B() returns 0; on error, it returns -1, with " +"I set to indicate the cause." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:165 -msgid "" -"Allocating memory using B(2) has the significant advantage that the " -"allocated memory blocks can always be independently released back to the " -"system. (By contrast, the heap can be trimmed only if memory is freed at " -"the top end.) On the other hand, there are some disadvantages to the use of " -"B(2): deallocated space is not placed on the free list for reuse by " -"later allocations; memory may be wasted because B(2) allocations must " -"be page-aligned; and the kernel must perform the expensive task of zeroing " -"out memory allocated via B(2). Balancing these factors leads to a " -"default setting of 128*1024 for the B parameter." +#: build/C/man3/malloc_info.3:60 +msgid "I was nonzero." +msgstr "" + +#. type: Plain text +#: build/C/man3/malloc_info.3:63 +msgid "B() was added to glibc in version 2.10." +msgstr "" + +#. type: Plain text +#: 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 +msgid "This function is a GNU extension." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:172 +#: build/C/man3/malloc_info.3:71 msgid "" -"The lower limit for this parameter is 0. The upper limit is " -"B: 512*1024 on 32-bit systems or " -"I<4*1024*1024*sizeof(long)> on 64-bit systems." +"The memory-allocation information is provided as an XML string (rather than " +"a C structure) because the information may change over time (according to " +"changes in the underlying implementation). The output XML string includes a " +"version field." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:190 +#: build/C/man3/malloc_info.3:77 msgid "" -"I Nowadays, glibc uses a dynamic mmap threshold by default. The " -"initial value of the threshold is 128*1024, but when blocks larger than the " -"current threshold and less than or equal to B " -"are freed, the threshold is adjusted upwards to the size of the freed " -"block. When dynamic mmap thresholding is in effect, the threshold for " -"trimming the heap is also dynamically adjusted to be twice the dynamic mmap " -"threshold. Dynamic adjustment of the mmap threshold is disabled if any of " -"the B, B, B, or B " -"parameters is set." +"The B(3) function can be used to send the output of " +"B() directly into a buffer in memory, rather than to a file." msgstr "" -#. type: TP -#: build/C/man3/mallopt.3:190 -#, no-wrap -msgid "B (since glibc 2.3)" +#. type: Plain text +#: build/C/man3/malloc_info.3:84 +msgid "" +"The B() function is designed to address deficiencies in " +"B(3) and B(3)." msgstr "" -#. The following text adapted from comments in the glibc sources: #. type: Plain text -#: build/C/man3/mallopt.3:210 +#: build/C/man3/malloc_info.3:95 msgid "" -"Set the upper limit for memory allocation requests that are satisfied using " -"\"fastbins\". (The measurement unit for this parameter is bytes.) Fastbins " -"are storage areas that hold deallocated blocks of memory of the same size " -"without merging adjacent free blocks. Subsequent reallocation of blocks of " -"the same size can be handled very quickly by allocating from the fastbin, " -"although memory fragmentation and the overall memory footprint of the " -"program can increase. The default value for this parameter is " -"I<64*sizeof(size_t)/4> (i.e., 64 on 32-bit architectures). The range for " -"this parameter is 0 to I<80*sizeof(size_t)/4>. Setting B to 0 " -"disables the use of fastbins." +"The program below takes up to four command-line arguments, of which the " +"first three are mandatory. The first argument specifies the number of " +"threads that the program should create. All of the threads, including the " +"main thread, allocate the number of blocks of memory specified by the second " +"argument. The third argument controls the size of the blocks to be " +"allocated. The main thread creates blocks of this size, the second thread " +"created by the program allocates blocks of twice this size, the third thread " +"allocates blocks of three times this size, and so on." msgstr "" -#. type: TP -#: build/C/man3/mallopt.3:210 -#, no-wrap -msgid "B (since glibc 2.4)" +#. type: Plain text +#: build/C/man3/malloc_info.3:102 +msgid "" +"The program calls B() twice to display the memory-allocation " +"state. The first call takes place before any threads are created or memory " +"allocated. The second call is performed after all threads have allocated " +"memory." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:225 +#: build/C/man3/malloc_info.3:110 msgid "" -"If this parameter is set to a nonzero value, then bytes of allocated memory " -"(other than allocations via B(3)) are initialized to the complement " -"of the value in the least significant byte of I, and when allocated " -"memory is released using B(3), the freed bytes are set to the least " -"significant byte of I. This can be useful for detecting errors where " -"programs incorrectly rely on allocated memory being initialized to zero, or " -"reuse values in memory that has already been freed." +"In the following example, the command-line arguments specify the creation of " +"one additional thread, and both the main thread and the additional thread " +"allocate 10000 blocks of memory. After the blocks of memory have been " +"allocated, B() shows the state of two allocation arenas." msgstr "" -#. type: TP -#: build/C/man3/mallopt.3:225 +#. type: Plain text +#: build/C/man3/malloc_info.3:135 #, no-wrap -msgid "B" +msgid "" +"$ B\n" +"glibc 2.13\n" +"$ B<./a.out 1 10000 100>\n" +"============ Before allocating blocks ============\n" +"Emalloc version=\"1\"E\n" +"Eheap nr=\"0\"E\n" +"EsizesE\n" +"E/sizesE\n" +"Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" +"Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" +"Esystem type=\"current\" size=\"135168\"/E\n" +"Esystem type=\"max\" size=\"135168\"/E\n" +"Easpace type=\"total\" size=\"135168\"/E\n" +"Easpace type=\"mprotect\" size=\"135168\"/E\n" +"E/heapE\n" +"Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" +"Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" +"Esystem type=\"current\" size=\"135168\"/E\n" +"Esystem type=\"max\" size=\"135168\"/E\n" +"Easpace type=\"total\" size=\"135168\"/E\n" +"Easpace type=\"mprotect\" size=\"135168\"/E\n" +"E/mallocE\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:232 +#: build/C/man3/malloc_info.3:165 +#, no-wrap msgid "" -"This parameter defines the amount of padding to employ when calling " -"B(2) to modify the program break. (The measurement unit for this " -"parameter is bytes.) This parameter has an effect in the following " -"circumstances:" +"============ After allocating blocks ============\n" +"Emalloc version=\"1\"E\n" +"Eheap nr=\"0\"E\n" +"EsizesE\n" +"E/sizesE\n" +"Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" +"Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" +"Esystem type=\"current\" size=\"1081344\"/E\n" +"Esystem type=\"max\" size=\"1081344\"/E\n" +"Easpace type=\"total\" size=\"1081344\"/E\n" +"Easpace type=\"mprotect\" size=\"1081344\"/E\n" +"E/heapE\n" +"Eheap nr=\"1\"E\n" +"EsizesE\n" +"E/sizesE\n" +"Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" +"Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" +"Esystem type=\"current\" size=\"1032192\"/E\n" +"Esystem type=\"max\" size=\"1032192\"/E\n" +"Easpace type=\"total\" size=\"1032192\"/E\n" +"Easpace type=\"mprotect\" size=\"1032192\"/E\n" +"E/heapE\n" +"Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" +"Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" +"Esystem type=\"current\" size=\"2113536\"/E\n" +"Esystem type=\"max\" size=\"2113536\"/E\n" +"Easpace type=\"total\" size=\"2113536\"/E\n" +"Easpace type=\"mprotect\" size=\"2113536\"/E\n" +"E/mallocE\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:239 +#: build/C/man3/malloc_info.3:175 +#, no-wrap msgid "" -"When the program break is increased, then B bytes are added to " -"the B(2) request." +"#include Eunistd.hE\n" +"#include Estdlib.hE\n" +"#include Epthread.hE\n" +"#include Emalloc.hE\n" +"#include Eerrno.hE\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:245 +#: build/C/man3/malloc_info.3:178 +#, no-wrap msgid "" -"When the heap is trimmed as a consequence of calling B(3) (see the " -"discussion of B) this much free space is preserved at the " -"top of the heap." +"static size_t blockSize;\n" +"static int numThreads, numBlocks;\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:249 +#: build/C/man3/malloc_info.3:181 build/C/man2/memfd_create.2:368 build/C/man2/memfd_create.2:450 +#, no-wrap msgid "" -"In either case, the amount of padding is always rounded to a system page " -"boundary." +"#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \\e\n" +" } while (0)\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:256 +#: build/C/man3/malloc_info.3:187 +#, no-wrap msgid "" -"Modifying B is a trade-off between increasing the number of " -"system calls (when the parameter is set low) and wasting unused memory at " -"the top of the heap (when the parameter is set high)." +"static void *\n" +"thread_func(void *arg)\n" +"{\n" +" int j;\n" +" int tn = (int) arg;\n" msgstr "" -#. DEFAULT_TOP_PAD in glibc source #. type: Plain text -#: build/C/man3/mallopt.3:259 -msgid "The default value for this parameter is 128*1024." +#: build/C/man3/malloc_info.3:190 +#, no-wrap +msgid "" +" /* The multiplier \\(aq(2 + tn)\\(aq ensures that each thread " +"(including\n" +" the main thread) allocates a different amount of memory */\n" msgstr "" -#. type: TP -#: build/C/man3/mallopt.3:259 +#. type: Plain text +#: build/C/man3/malloc_info.3:194 #, no-wrap -msgid "B" +msgid "" +" for (j = 0; j E numBlocks; j++)\n" +" if (malloc(blockSize * (2 + tn)) == NULL)\n" +" errExit(\"malloc-thread\");\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:275 +#: build/C/man3/malloc_info.3:198 +#, no-wrap msgid "" -"When the amount of contiguous free memory at the top of the heap grows " -"sufficiently large, B(3) employs B(2) to release this memory " -"back to the system. (This can be useful in programs that continue to " -"execute for a long period after freeing a significant amount of memory.) " -"The B parameter specifies the minimum size (in bytes) that " -"this block of memory must reach before B(2) is used to trim the heap." +" sleep(100); /* Sleep until main thread terminates */\n" +" return NULL;\n" +"}\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:280 +#: build/C/man3/malloc_info.3:204 +#, no-wrap msgid "" -"The default value for this parameter is 128*1024. Setting " -"B to -1 disables trimming completely." +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" int j, tn, sleepTime;\n" +" pthread_t *thr;\n" msgstr "" -#. FIXME Do the arena parameters need to be documented? -#. .TP -#. .BR M_ARENA_TEST " (since glibc 2.10)" -#. .TP -#. .BR M_ARENA_MAX " (since glibc 2.10)" -# -#. Environment variables -#. MALLOC_ARENA_MAX_ -#. MALLOC_ARENA_TEST_ -# -#. http://udrepper.livejournal.com/20948.html describes some details -#. of the MALLOC_ARENA_* environment variables. -# -#. These macros aren't enabled in production releases until 2.15? -#. (see glibc malloc/Makefile) #. type: Plain text -#: build/C/man3/mallopt.3:303 +#: build/C/man3/malloc_info.3:211 +#, no-wrap msgid "" -"Modifying B is a trade-off between increasing the number " -"of system calls (when the parameter is set low) and wasting unused memory " -"at the top of the heap (when the parameter is set high)." +" if (argc E 4) {\n" +" fprintf(stderr,\n" +" \"%s num-threads num-blocks block-size [sleep-time]\\en\",\n" +" argv[0]);\n" +" exit(EXIT_FAILURE);\n" +" }\n" msgstr "" -#. type: SS -#: build/C/man3/mallopt.3:303 +#. type: Plain text +#: build/C/man3/malloc_info.3:216 #, no-wrap -msgid "Environment Variables" +msgid "" +" numThreads = atoi(argv[1]);\n" +" numBlocks = atoi(argv[2]);\n" +" blockSize = atoi(argv[3]);\n" +" sleepTime = (argc E 4) ? atoi(argv[4]) : 0;\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:318 +#: build/C/man3/malloc_info.3:220 +#, no-wrap msgid "" -"A number of environment variables can be defined to modify some of the same " -"parameters as are controlled by B(). Using these variables has the " -"advantage that the source code of the program need not be changed. To be " -"effective, these variables must be defined before the first call to a " -"memory-allocation function. (If the same parameters are adjusted via " -"B() then the B() settings take precedence.) For " -"security reasons, these variables are ignored in set-user-ID and " -"set-group-ID programs." +" thr = calloc(numThreads, sizeof(pthread_t));\n" +" if (thr == NULL)\n" +" errExit(\"calloc\");\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:321 +#: build/C/man3/malloc_info.3:223 +#, no-wrap msgid "" -"The environment variables are as follows (note the trailing underscore at " -"the end of the name of each variable):" +" printf(\"============ Before allocating blocks ============\\en\");\n" +" malloc_info(0, stdout);\n" msgstr "" -#. type: TP -#: build/C/man3/mallopt.3:321 +#. type: Plain text +#: build/C/man3/malloc_info.3:225 #, no-wrap -msgid "B" +msgid " /* Create threads that allocate different amounts of memory */\n" msgstr "" -#. On glibc 2.12/x86, a simple malloc()+free() loop is about 70% slower -#. when MALLOC_CHECK_ was set. #. type: Plain text -#: build/C/man3/mallopt.3:338 +#: build/C/man3/malloc_info.3:231 +#, no-wrap msgid "" -"This environment variable controls the same parameter as B() " -"B. If this variable is set to a nonzero value, then a " -"special implementation of the memory-allocation functions is used. (This is " -"accomplished using the B(3) feature.) This implementation " -"performs additional error checking, but is slower than the standard set of " -"memory-allocation functions. (This implementation does not detect all " -"possible errors; memory leaks can still occur.)" +" for (tn = 0; tn E numThreads; tn++) {\n" +" errno = pthread_create(&thr[tn], NULL, thread_func,\n" +" (void *) tn);\n" +" if (errno != 0)\n" +" errExit(\"pthread_create\");\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:343 +#: build/C/man3/malloc_info.3:236 +#, no-wrap msgid "" -"The value assigned to this environment variable should be a single digit, " -"whose meaning is as described for B. Any characters beyond " -"the initial digit are ignored." +" /* If we add a sleep interval after the start-up of each\n" +" thread, the threads likely won\\(aqt contend for malloc\n" +" mutexes, and therefore additional arenas won\\(aqt be\n" +" allocated (see malloc(3)). */\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:352 +#: build/C/man3/malloc_info.3:240 +#, no-wrap msgid "" -"For security reasons, the effect of B is disabled by default " -"for set-user-ID and set-group-ID programs. However, if the file " -"I exists (the content of the file is irrelevant), then " -"B also has an effect for set-user-ID and set-group-ID " -"programs." +" if (sleepTime E 0)\n" +" sleep(sleepTime);\n" +" }\n" msgstr "" -#. type: TP -#: build/C/man3/mallopt.3:352 +#. type: Plain text +#: build/C/man3/malloc_info.3:242 #, no-wrap -msgid "B" +msgid " /* The main thread also allocates some memory */\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:357 -msgid "Controls the same parameter as B() B." -msgstr "" - -#. type: TP -#: build/C/man3/mallopt.3:357 +#: build/C/man3/malloc_info.3:246 #, no-wrap -msgid "B" +msgid "" +" for (j = 0; j E numBlocks; j++)\n" +" if (malloc(blockSize) == NULL)\n" +" errExit(\"malloc\");\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:362 -msgid "Controls the same parameter as B() B." -msgstr "" - -#. type: TP -#: build/C/man3/mallopt.3:362 +#: build/C/man3/malloc_info.3:249 #, no-wrap -msgid "B" +msgid "" +" sleep(2); /* Give all threads a chance to\n" +" complete allocations */\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:367 -msgid "Controls the same parameter as B() B." -msgstr "" - -#. type: TP -#: build/C/man3/mallopt.3:367 +#: build/C/man3/malloc_info.3:252 #, no-wrap -msgid "B" +msgid "" +" printf(\"\\en============ After allocating blocks ============\\en\");\n" +" malloc_info(0, stdout);\n" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:372 -msgid "Controls the same parameter as B() B." +#: build/C/man3/malloc_info.3:262 +msgid "" +"B(3), B(3), B(3), B(3), " +"B(3)" msgstr "" -#. type: TP -#: build/C/man3/mallopt.3:372 +#. type: TH +#: build/C/man3/malloc_stats.3:26 #, no-wrap -msgid "B" +msgid "MALLOC_STATS" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:377 -msgid "Controls the same parameter as B() B." +#: build/C/man3/malloc_stats.3:29 +msgid "malloc_stats - print memory allocation statistics" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:382 -msgid "On success, B() returns 1. On error, it returns 0." +#: build/C/man3/malloc_stats.3:33 +msgid "B" msgstr "" #. .SH VERSIONS #. Available already in glibc 2.0, possibly earlier #. type: Plain text -#: build/C/man3/mallopt.3:390 -msgid "On error, I is I set." +#: build/C/man3/malloc_stats.3:55 +msgid "" +"The B() function prints (on standard error) statistics about " +"memory allocated by B(3) and related functions. For each arena " +"(allocation area), this function prints the total amount of memory allocated " +"and the total number of bytes consumed by in-use allocations. (These two " +"values correspond to the I and I fields retrieved by " +"B(3).) In addition, the function prints the sum of these two " +"statistics for all arenas, and the maximum number of blocks and bytes that " +"were ever simultaneously allocated using B(2)." msgstr "" -#. .SH NOTES #. type: Plain text -#: build/C/man3/mallopt.3:404 +#: build/C/man3/malloc_stats.3:61 msgid "" -"This function is not specified by POSIX or the C standards. A similar " -"function exists on many System V derivatives, but the range of values for " -"I varies across systems. The SVID defined options B, " -"B, B, and B, but only the first of these is " -"implemented in glibc." +"More detailed information about memory allocations in the main arena can be " +"obtained using B(3)." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:408 -msgid "Specifying an invalid value for I does not generate an error." +#: build/C/man3/malloc_stats.3:67 +msgid "B(2), B(3), B(3), B(3), B(3)" msgstr "" -#. FIXME This looks buggy: -#. setting the M_MXFAST limit rounds up: (s + SIZE_SZ) & ~MALLOC_ALIGN_MASK) -#. malloc requests are rounded up: -#. (req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK -#. http://sources.redhat.com/bugzilla/show_bug.cgi?id=12129 -#. type: Plain text -#: build/C/man3/mallopt.3:416 -msgid "" -"A calculation error within the glibc implementation means that a call of the " -"form:" +#. type: TH +#: build/C/man3/malloc_trim.3:26 +#, no-wrap +msgid "MALLOC_TRIM" msgstr "" -#. type: Plain text -#: build/C/man3/mallopt.3:419 +#. type: TH +#: build/C/man3/malloc_trim.3:26 build/C/man2/remap_file_pages.2:28 #, no-wrap -msgid " mallopt(M_MXFAST, n)\n" +msgid "2014-05-28" msgstr "" -#. Bins are multiples of 2 * sizeof(size_t) + sizeof(size_t) #. type: Plain text -#: build/C/man3/mallopt.3:431 -msgid "" -"does not result in fastbins being employed for all allocations of size up to " -"I. To ensure desired results, I should be rounded up to the next " -"multiple greater than or equal to I<(2k+1)*sizeof(size_t)>, where I is an " -"integer." +#: build/C/man3/malloc_trim.3:29 +msgid "malloc_trim - release free memory from the top of the heap" msgstr "" -#. FIXME MALLOC_MMAP_THRESHOLD_ and MALLOC_MMAP_MAX_ -#. do have an effect for set-user-ID programs (but not -#. set-group-ID programs). -#. http://sources.redhat.com/bugzilla/show_bug.cgi?id=12155 #. type: Plain text -#: build/C/man3/mallopt.3:443 -msgid "" -"The B and B variables are I " -"ignored in set-group-ID programs." +#: build/C/man3/malloc_trim.3:33 +msgid "BIB<);>" msgstr "" -#. FIXME http://sources.redhat.com/bugzilla/show_bug.cgi?id=12140 #. type: Plain text -#: build/C/man3/mallopt.3:464 +#: build/C/man3/malloc_trim.3:40 msgid "" -"If B() is used to set B, then, as expected, the bytes " -"of allocated memory are initialized to the complement of the byte in " -"I, and when that memory is freed, the bytes of the region are " -"initialized to the byte specified in I. However, there is an " -"off-by-I error in the implementation: instead of " -"initializing precisely the block of memory being freed by the call " -"I, the block starting at I is initialized." +"The B() function attempts to release free memory at the top of " +"the heap (by calling B(2) with a suitable argument)." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:473 +#: build/C/man3/malloc_trim.3:51 msgid "" -"The program below demonstrates the use of B. If the program " -"is supplied with an (integer) command-line argument, then that argument is " -"used to set the B parameter. The program then allocates a " -"block of memory, and frees it twice (an error)." +"The I argument specifies the amount of free space to leave untrimmed at " +"the top of the heap. If this argument is 0, only the minimum amount of " +"memory is maintained at the top of the heap (i.e., one page or less). A " +"nonzero argument can be used to maintain some trailing space at the top of " +"the heap in order to allow future allocations to be made without having to " +"extend the heap with B(2)." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:477 +#: build/C/man3/malloc_trim.3:56 msgid "" -"The following shell session shows what happens when we run this program " -"under glibc, with the default value for B:" +"The B() function returns 1 if memory was actually released " +"back to the system, or 0 if it was not possible to release any memory." msgstr "" +#. .SH VERSIONS +#. Available already in glibc 2.0, possibly earlier #. type: Plain text -#: build/C/man3/mallopt.3:496 -#, no-wrap -msgid "" -"$ B<./a.out>\n" -"*** glibc detected *** ./a.out: double free or corruption (top): 0x09d30008 " -"***\n" -"======= Backtrace: =========\n" -"/lib/libc.so.6(+0x6c501)[0x523501]\n" -"/lib/libc.so.6(+0x6dd70)[0x524d70]\n" -"/lib/libc.so.6(cfree+0x6d)[0x527e5d]\n" -"\\&./a.out[0x80485db]\n" -"/lib/libc.so.6(__libc_start_main+0xe7)[0x4cdce7]\n" -"\\&./a.out[0x8048471]\n" -"======= Memory map: ========\n" -"001e4000-001fe000 r-xp 00000000 08:06 1083555 /lib/libgcc_s.so.1\n" -"001fe000-001ff000 r--p 00019000 08:06 1083555 /lib/libgcc_s.so.1\n" -"[some lines omitted]\n" -"b7814000-b7817000 rw-p 00000000 00:00 0\n" -"bff53000-bff74000 rw-p 00000000 00:00 0 [stack]\n" -"Aborted (core dumped)\n" +#: build/C/man3/malloc_trim.3:60 +msgid "No errors are defined." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:501 +#: build/C/man3/malloc_trim.3:71 msgid "" -"The following runs show the results when employing other values for " -"B:" +"This function is automatically called by B(3) in certain " +"circumstances; see the discussion of B and B in " +"B(3)." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:514 -#, no-wrap +#: build/C/man3/malloc_trim.3:74 msgid "" -"$ B<./a.out 1> # Diagnose error and continue\n" -"main(): returned from first free() call\n" -"*** glibc detected *** ./a.out: double free or corruption (top): 0x09cbe008 " -"***\n" -"main(): returned from second free() call\n" -"$ B<./a.out 2> # Abort without error message\n" -"main(): returned from first free() call\n" -"Aborted (core dumped)\n" -"$ B<./a.out 0> # Ignore error and continue\n" -"main(): returned from first free() call\n" -"main(): returned from second free() call\n" +"This function cannot release free memory located at places other than the " +"top of the heap." msgstr "" +#. malloc/malloc.c::mTRIm(): +#. return result | (av == &main_arena ? sYSTRIm (pad, av) : 0); #. type: Plain text -#: build/C/man3/mallopt.3:520 -msgid "" -"The next run shows how to set the same parameter using the B " -"environment variable:" +#: build/C/man3/malloc_trim.3:78 +msgid "This function releases only memory in the main arena." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:527 -#, no-wrap -msgid "" -"$ B\n" -"main(): returned from first free() call\n" -"*** glibc detected *** ./a.out: free(): invalid pointer: 0x092c2008 ***\n" -"main(): returned from second free() call\n" +#: build/C/man3/malloc_trim.3:82 +msgid "B(2), B(3), B(3)" msgstr "" -#. type: SS -#: build/C/man3/mallopt.3:529 build/C/man3/mcheck.3:176 build/C/man2/mprotect.2:159 +#. type: TH +#: build/C/man3/malloc_usable_size.3:25 #, no-wrap -msgid "Program source" +msgid "MALLOC_USABLE_SIZE" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:535 -#, no-wrap -msgid "" -"#include Emalloc.hE\n" -"#include Estdio.hE\n" -"#include Estdlib.hE\n" +#: build/C/man3/malloc_usable_size.3:28 +msgid "malloc_usable_size - obtain size of block of memory allocated from heap" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:540 build/C/man3/mcheck.3:187 -#, no-wrap -msgid "" -"int\n" -"main(int argc, char *argv[])\n" -"{\n" -" char *p;\n" +#: build/C/man3/malloc_usable_size.3:32 +msgid "BIB<);>" msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:547 -#, no-wrap +#: build/C/man3/malloc_usable_size.3:40 msgid "" -" if (argc E 1) {\n" -" if (argc != 2) {\n" -" fprintf(stderr, \"%s EM_CHECK_ACTION-valueE\\en\", " -"argv[0]);\n" -" exit(EXIT_FAILURE);\n" -" }\n" -" }\n" +"The B() function returns the number of usable bytes in " +"the block pointed to by I, a pointer to a block of memory allocated by " +"B(3) or a related function." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:552 -#, no-wrap +#: build/C/man3/malloc_usable_size.3:48 msgid "" -" if (mallopt(M_CHECK_ACTION, atoi(argv[1])) != 1) {\n" -" fprintf(stderr, \"mallopt() failed\");\n" -" exit(EXIT_FAILURE);\n" -" }\n" +"B() returns the number of usable bytes in the block of " +"allocated memory pointed to by I. If I is NULL, 0 is returned." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:558 -#, no-wrap -msgid "" -" p = malloc(1000);\n" -" if (p == NULL) {\n" -" fprintf(stderr, \"malloc() failed\");\n" -" exit(EXIT_FAILURE);\n" -" }\n" +#: build/C/man3/malloc_usable_size.3:53 +msgid "The B() function is thread-safe." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:561 -#, no-wrap +#: build/C/man3/malloc_usable_size.3:65 msgid "" -" free(p);\n" -" printf(\"main(): returned from first free() call\\en\");\n" +"The value returned by B() may be greater than the " +"requested size of the allocation because of alignment and minimum size " +"constraints. Although the excess bytes can be overwritten by the " +"application without ill effects, this is not good programming practice: the " +"number of excess bytes in an allocation depends on the underlying " +"implementation." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:564 -#, no-wrap -msgid "" -" free(p);\n" -" printf(\"main(): returned from second free() call\\en\");\n" +#: build/C/man3/malloc_usable_size.3:67 +msgid "The main use of this function is for debugging and introspection." msgstr "" #. type: Plain text -#: build/C/man3/mallopt.3:567 build/C/man3/mcheck.3:203 build/C/man2/mmap.2:652 -#, no-wrap -msgid "" -" exit(EXIT_SUCCESS);\n" -"}\n" +#: build/C/man3/malloc_usable_size.3:69 +msgid "B(3)" msgstr "" -#. type: Plain text -#: build/C/man3/mallopt.3:580 -msgid "" -"B(2) B(2), B(3), B(3), B(3), " -"B(3), B(3), B(3), B(3)" +#. type: TH +#: build/C/man3/mallopt.3:26 +#, no-wrap +msgid "MALLOPT" msgstr "" #. type: TH -#: build/C/man3/mcheck.3:23 +#: build/C/man3/mallopt.3:26 build/C/man2/shmop.2:41 #, no-wrap -msgid "MCHECK" +msgid "2014-07-08" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:26 -msgid "" -"mcheck, mcheck_check_all, mcheck_pedantic, mprobe - heap consistency " -"checking" +#: build/C/man3/mallopt.3:29 +msgid "mallopt - set memory allocation parameters" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:29 -#, no-wrap -msgid "B<#include Emcheck.hE>\n" +#: build/C/man3/mallopt.3:33 +msgid "BIB<, int >IB<);>" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:31 -#, no-wrap -msgid "BIB<)(enum mcheck_status >IB<));>\n" +#: build/C/man3/mallopt.3:44 +msgid "" +"The B() function adjusts parameters that control the behavior of " +"the memory-allocation functions (see B(3)). The I argument " +"specifies the parameter to be modified, and I specifies the new value " +"for that parameter." msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:33 -#, no-wrap -msgid "" -"BIB<)(enum mcheck_status " -">IB<));>\n" +#: build/C/man3/mallopt.3:47 +msgid "The following values can be specified for I:" msgstr "" -#. type: Plain text -#: build/C/man3/mcheck.3:35 +#. type: TP +#: build/C/man3/mallopt.3:47 #, no-wrap -msgid "B\n" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:37 +#: build/C/man3/mallopt.3:53 +msgid "" +"Setting this parameter controls how glibc responds when various kinds of " +"programming errors are detected (e.g., freeing the same pointer twice). The " +"3 least significant bits (2, 1, and 0) of the value assigned to this " +"parameter determine the glibc behavior, as follows:" +msgstr "" + +#. type: TP +#: build/C/man3/mallopt.3:54 #, no-wrap -msgid "BIB<);>\n" +msgid "Bit 0" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:50 +#: build/C/man3/mallopt.3:64 msgid "" -"The B() function installs a set of debugging hooks for the " -"B(3) family of memory-allocation functions. These hooks cause " -"certain consistency checks to be performed on the state of the heap. The " -"checks can detect application errors such as freeing a block of memory more " -"than once or corrupting the bookkeeping data structures that immediately " -"precede a block of allocated memory." +"If this bit is set, then print a one-line message on I that provides " +"details about the error. The message starts with the string \"***\\ glibc " +"detected\\ ***\", followed by the program name, the name of the " +"memory-allocation function in which the error was detected, a brief " +"description of the error, and the memory address where the error was " +"detected." msgstr "" -#. type: Plain text -#: build/C/man3/mcheck.3:62 -msgid "" -"To be effective, the B() function must be called before the first " -"call to B(3) or a related function. In cases where this is " -"difficult to ensure, linking the program with I<-mcheck> inserts an implicit " -"call to B() (with a NULL argument) before the first call to a " -"memory-allocation function." +#. type: TP +#: build/C/man3/mallopt.3:64 +#, no-wrap +msgid "Bit 1" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:70 +#: build/C/man3/mallopt.3:79 msgid "" -"The B() function is similar to B(), but performs " -"checks on all allocated blocks whenever one of the memory-allocation " -"functions is called. This can be very slow!" +"If this bit is set, then, after printing any error message specified by bit " +"0, the program is terminated by calling B(3). In glibc versions " +"since 2.4, if bit 0 is also set, then, between printing the error message " +"and aborting, the program also prints a stack trace in the manner of " +"B(3), and prints the process's memory mapping in the style of " +"I (see B(5))." msgstr "" -#. type: Plain text -#: build/C/man3/mcheck.3:77 -msgid "" -"The B() function causes an immediate check on all " -"allocated blocks. This call is only effective if B() is called " -"beforehand." +#. type: TP +#: build/C/man3/mallopt.3:79 +#, no-wrap +msgid "Bit 2 (since glibc 2.4)" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:90 +#: build/C/man3/mallopt.3:86 msgid "" -"If the system detects an inconsistency in the heap, the caller-supplied " -"function pointed to by I is invoked with a single argument " -"argument, I, that indicates what type of inconsistency was " -"detected. If I is NULL, a default function prints an error " -"message on I and calls B(3)." +"This bit has an effect only if bit 0 is also set. If this bit is set, then " +"the one-line message describing the error is simplified to contain just the " +"name of the function where the error was detected and the brief description " +"of the error." msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:102 -msgid "" -"The B() function performs a consistency check on the block of " -"allocated memory pointed to by I. The B() function should be " -"called beforehand (otherwise B() returns B)." +#: build/C/man3/mallopt.3:91 +msgid "The remaining bits in I are ignored." msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:110 +#: build/C/man3/mallopt.3:95 msgid "" -"The following list describes the values returned by B() or passed " -"as the I argument when I is invoked:" +"Combining the above details, the following numeric values are meaningful for " +"B:" msgstr "" -#. type: TP -#: build/C/man3/mcheck.3:110 +#. type: IP +#: build/C/man3/mallopt.3:96 #, no-wrap -msgid "B (B() only)" +msgid "0" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:115 -msgid "" -"B() was not called before the first memory allocation function was " -"called. Consistency checking is not possible." +#: build/C/man3/mallopt.3:98 +msgid "Ignore error conditions; continue execution (with undefined results)." msgstr "" -#. type: TP -#: build/C/man3/mcheck.3:115 +#. type: IP +#: build/C/man3/mallopt.3:98 #, no-wrap -msgid "B (B() only)" +msgid "1" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:118 -msgid "No inconsistency detected." +#: build/C/man3/mallopt.3:100 +msgid "Print a detailed error message and continue execution." msgstr "" -#. type: TP -#: build/C/man3/mcheck.3:118 +#. type: IP +#: build/C/man3/mallopt.3:100 #, no-wrap -msgid "B" +msgid "2" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:121 -msgid "Memory preceding an allocated block was clobbered." +#: build/C/man3/mallopt.3:102 +msgid "Abort the program." msgstr "" -#. type: TP -#: build/C/man3/mcheck.3:121 +#. type: IP +#: build/C/man3/mallopt.3:102 #, no-wrap -msgid "B" +msgid "3" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:124 -msgid "Memory following an allocated block was clobbered." +#: build/C/man3/mallopt.3:105 +msgid "" +"Print detailed error message, stack trace, and memory mappings, and abort " +"the program." msgstr "" -#. type: TP -#: build/C/man3/mcheck.3:124 +#. type: IP +#: build/C/man3/mallopt.3:105 #, no-wrap -msgid "B" +msgid "5" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:128 -msgid "A block of memory was freed twice." +#: build/C/man3/mallopt.3:107 +msgid "Print a simple error message and continue execution." msgstr "" -#. type: Plain text -#: build/C/man3/mcheck.3:133 -msgid "B() and B() return 0 on success, or -1 on error." +#. type: IP +#: build/C/man3/mallopt.3:107 +#, no-wrap +msgid "7" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:144 +#: build/C/man3/mallopt.3:110 msgid "" -"The B() and B() functions are available " -"since glibc 2.2. The B and B functions are present " -"since at least glibc 2.0" +"Print simple error message, stack trace, and memory mappings, and abort the " +"program." msgstr "" -#. But is MALLOC_CHECK_ slower? #. type: Plain text -#: build/C/man3/mcheck.3:158 +#: build/C/man3/mallopt.3:116 msgid "" -"Linking a program with I<-lmcheck> and using the B " -"environment variable (described in B(3)) cause the same kinds of " -"errors to be detected. But, using B does not require the " -"application to be relinked." +"Since glibc 2.3.4, the default value for the B parameter is " +"3. In glibc version 2.3.3 and earlier, the default value is 1." msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:165 +#: build/C/man3/mallopt.3:121 msgid "" -"The program below calls B() with a NULL argument and then frees the " -"same block of memory twice. The following shell session demonstrates what " -"happens when running the program:" +"Using a nonzero B value can be useful because otherwise a " +"crash may happen much later, and the true cause of the problem is then very " +"hard to track down." msgstr "" -#. type: Plain text -#: build/C/man3/mcheck.3:170 +#. type: TP +#: build/C/man3/mallopt.3:121 #, no-wrap -msgid "" -"$B< ./a.out>\n" -"About to free\n" +msgid "B" msgstr "" +#. The following text adapted from comments in the glibc source: #. type: Plain text -#: build/C/man3/mcheck.3:174 -#, no-wrap +#: build/C/man3/mallopt.3:131 msgid "" -"About to free a second time\n" -"block freed twice\n" -"Aborted (core dumped)\n" +"This parameter specifies the maximum number of allocation requests that may " +"be simultaneously serviced using B(2). This parameter exists because " +"some systems have a limited number of internal tables for use by B(2), " +"and using more than a few of them may degrade performance." msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:182 -#, no-wrap +#: build/C/man3/mallopt.3:138 msgid "" -"#include Estdlib.hE\n" -"#include Estdio.hE\n" -"#include Emcheck.hE\n" +"The default value is 65,536, a value which has no special significance and " +"which servers only as a safeguard. Setting this parameter to 0 disables the " +"use of B(2) for servicing large allocation requests." msgstr "" -#. type: Plain text -#: build/C/man3/mcheck.3:190 +#. type: TP +#: build/C/man3/mallopt.3:138 #, no-wrap -msgid "" -" if (mcheck(NULL) != 0) {\n" -" fprintf(stderr, \"mcheck() failed\\en\");\n" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:193 -#, no-wrap +#: build/C/man3/mallopt.3:147 msgid "" -" exit(EXIT_FAILURE);\n" -" }\n" +"For allocations greater than or equal to the limit specified (in bytes) by " +"B that can't be satisfied from the free list, the " +"memory-allocation functions employ B(2) instead of increasing the " +"program break using B(2)." msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:195 -#, no-wrap -msgid " p = malloc(1000);\n" +#: build/C/man3/mallopt.3:167 +msgid "" +"Allocating memory using B(2) has the significant advantage that the " +"allocated memory blocks can always be independently released back to the " +"system. (By contrast, the heap can be trimmed only if memory is freed at " +"the top end.) On the other hand, there are some disadvantages to the use of " +"B(2): deallocated space is not placed on the free list for reuse by " +"later allocations; memory may be wasted because B(2) allocations must " +"be page-aligned; and the kernel must perform the expensive task of zeroing " +"out memory allocated via B(2). Balancing these factors leads to a " +"default setting of 128*1024 for the B parameter." msgstr "" #. type: Plain text -#: build/C/man3/mcheck.3:200 -#, no-wrap +#: build/C/man3/mallopt.3:174 msgid "" -" fprintf(stderr, \"About to free\\en\");\n" -" free(p);\n" -" fprintf(stderr, \"\\enAbout to free a second time\\en\");\n" -" free(p);\n" +"The lower limit for this parameter is 0. The upper limit is " +"B: 512*1024 on 32-bit systems or " +"I<4*1024*1024*sizeof(long)> on 64-bit systems." msgstr "" -#. FIXME add SEE ALSO pointer from malloc(3) to here -#. FIXME add SEE ALSO pointer from mallopt(3) to here -#. FIXME add SEE ALSO pointer from mtrace(3) to here #. type: Plain text -#: build/C/man3/mcheck.3:211 -msgid "B(3), B(3), B(3)" -msgstr "" - -#. type: TH -#: build/C/man2/mlock.2:27 -#, no-wrap -msgid "MLOCK" +#: build/C/man3/mallopt.3:192 +msgid "" +"I Nowadays, glibc uses a dynamic mmap threshold by default. The " +"initial value of the threshold is 128*1024, but when blocks larger than the " +"current threshold and less than or equal to B " +"are freed, the threshold is adjusted upward to the size of the freed block. " +"When dynamic mmap thresholding is in effect, the threshold for trimming the " +"heap is also dynamically adjusted to be twice the dynamic mmap threshold. " +"Dynamic adjustment of the mmap threshold is disabled if any of the " +"B, B, B, or B " +"parameters is set." msgstr "" -#. type: TH -#: build/C/man2/mlock.2:27 +#. type: TP +#: build/C/man3/mallopt.3:192 #, no-wrap -msgid "2011-09-14" +msgid "B (since glibc 2.3)" msgstr "" +#. The following text adapted from comments in the glibc sources: #. type: Plain text -#: build/C/man2/mlock.2:30 -msgid "mlock, munlock, mlockall, munlockall - lock and unlock memory" +#: build/C/man3/mallopt.3:212 +msgid "" +"Set the upper limit for memory allocation requests that are satisfied using " +"\"fastbins\". (The measurement unit for this parameter is bytes.) Fastbins " +"are storage areas that hold deallocated blocks of memory of the same size " +"without merging adjacent free blocks. Subsequent reallocation of blocks of " +"the same size can be handled very quickly by allocating from the fastbin, " +"although memory fragmentation and the overall memory footprint of the " +"program can increase. The default value for this parameter is " +"I<64*sizeof(size_t)/4> (i.e., 64 on 32-bit architectures). The range for " +"this parameter is 0 to I<80*sizeof(size_t)/4>. Setting B to 0 " +"disables the use of fastbins." msgstr "" -#. type: Plain text -#: build/C/man2/mlock.2:33 build/C/man2/mmap.2:46 build/C/man2/mmap2.2:35 build/C/man2/mprotect.2:38 build/C/man2/mremap.2:39 +#. type: TP +#: build/C/man3/mallopt.3:212 #, no-wrap -msgid "B<#include Esys/mman.hE>\n" +msgid "B (since glibc 2.4)" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:36 -#, no-wrap +#: build/C/man3/mallopt.3:227 msgid "" -"BIB<, size_t >IB<);>\n" -"BIB<, size_t >IB<);>\n" +"If this parameter is set to a nonzero value, then bytes of allocated memory " +"(other than allocations via B(3)) are initialized to the complement " +"of the value in the least significant byte of I, and when allocated " +"memory is released using B(3), the freed bytes are set to the least " +"significant byte of I. This can be useful for detecting errors where " +"programs incorrectly rely on allocated memory being initialized to zero, or " +"reuse values in memory that has already been freed." +msgstr "" + +#. type: TP +#: build/C/man3/mallopt.3:227 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:234 +msgid "" +"This parameter defines the amount of padding to employ when calling " +"B(2) to modify the program break. (The measurement unit for this " +"parameter is bytes.) This parameter has an effect in the following " +"circumstances:" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:241 +msgid "" +"When the program break is increased, then B bytes are added to " +"the B(2) request." +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:247 +msgid "" +"When the heap is trimmed as a consequence of calling B(3) (see the " +"discussion of B) this much free space is preserved at the " +"top of the heap." +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:251 +msgid "" +"In either case, the amount of padding is always rounded to a system page " +"boundary." +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:258 +msgid "" +"Modifying B is a trade-off between increasing the number of " +"system calls (when the parameter is set low) and wasting unused memory at " +"the top of the heap (when the parameter is set high)." +msgstr "" + +#. DEFAULT_TOP_PAD in glibc source +#. type: Plain text +#: build/C/man3/mallopt.3:261 +msgid "The default value for this parameter is 128*1024." +msgstr "" + +#. type: TP +#: build/C/man3/mallopt.3:261 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:277 +msgid "" +"When the amount of contiguous free memory at the top of the heap grows " +"sufficiently large, B(3) employs B(2) to release this memory " +"back to the system. (This can be useful in programs that continue to " +"execute for a long period after freeing a significant amount of memory.) " +"The B parameter specifies the minimum size (in bytes) that " +"this block of memory must reach before B(2) is used to trim the heap." +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:282 +msgid "" +"The default value for this parameter is 128*1024. Setting " +"B to -1 disables trimming completely." +msgstr "" + +#. FIXME Do the arena parameters need to be documented? +#. .TP +#. .BR M_ARENA_TEST " (since glibc 2.10)" +#. .TP +#. .BR M_ARENA_MAX " (since glibc 2.10)" +# +#. Environment variables +#. MALLOC_ARENA_MAX_ +#. MALLOC_ARENA_TEST_ +# +#. http://udrepper.livejournal.com/20948.html describes some details +#. of the MALLOC_ARENA_* environment variables. +# +#. These macros aren't enabled in production releases until 2.15? +#. (see glibc malloc/Makefile) +#. type: Plain text +#: build/C/man3/mallopt.3:305 +msgid "" +"Modifying B is a trade-off between increasing the number " +"of system calls (when the parameter is set low) and wasting unused memory " +"at the top of the heap (when the parameter is set high)." +msgstr "" + +#. type: SS +#: build/C/man3/mallopt.3:305 +#, no-wrap +msgid "Environment variables" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:320 +msgid "" +"A number of environment variables can be defined to modify some of the same " +"parameters as are controlled by B(). Using these variables has the " +"advantage that the source code of the program need not be changed. To be " +"effective, these variables must be defined before the first call to a " +"memory-allocation function. (If the same parameters are adjusted via " +"B(), then the B() settings take precedence.) For " +"security reasons, these variables are ignored in set-user-ID and " +"set-group-ID programs." +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:323 +msgid "" +"The environment variables are as follows (note the trailing underscore at " +"the end of the name of each variable):" +msgstr "" + +#. type: TP +#: build/C/man3/mallopt.3:323 +#, no-wrap +msgid "B" +msgstr "" + +#. On glibc 2.12/x86, a simple malloc()+free() loop is about 70% slower +#. when MALLOC_CHECK_ was set. +#. type: Plain text +#: build/C/man3/mallopt.3:340 +msgid "" +"This environment variable controls the same parameter as B() " +"B. If this variable is set to a nonzero value, then a " +"special implementation of the memory-allocation functions is used. (This is " +"accomplished using the B(3) feature.) This implementation " +"performs additional error checking, but is slower than the standard set of " +"memory-allocation functions. (This implementation does not detect all " +"possible errors; memory leaks can still occur.)" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:345 +msgid "" +"The value assigned to this environment variable should be a single digit, " +"whose meaning is as described for B. Any characters beyond " +"the initial digit are ignored." +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:354 +msgid "" +"For security reasons, the effect of B is disabled by default " +"for set-user-ID and set-group-ID programs. However, if the file " +"I exists (the content of the file is irrelevant), then " +"B also has an effect for set-user-ID and set-group-ID " +"programs." +msgstr "" + +#. type: TP +#: build/C/man3/mallopt.3:354 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:359 +msgid "Controls the same parameter as B() B." +msgstr "" + +#. type: TP +#: build/C/man3/mallopt.3:359 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:364 +msgid "Controls the same parameter as B() B." +msgstr "" + +#. type: TP +#: build/C/man3/mallopt.3:364 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:369 +msgid "Controls the same parameter as B() B." +msgstr "" + +#. type: TP +#: build/C/man3/mallopt.3:369 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:374 +msgid "Controls the same parameter as B() B." +msgstr "" + +#. type: TP +#: build/C/man3/mallopt.3:374 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:379 +msgid "Controls the same parameter as B() B." +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:384 +msgid "On success, B() returns 1. On error, it returns 0." +msgstr "" + +#. .SH VERSIONS +#. Available already in glibc 2.0, possibly earlier +#. type: Plain text +#: build/C/man3/mallopt.3:392 +msgid "On error, I is I set." +msgstr "" + +#. .SH NOTES +#. type: Plain text +#: build/C/man3/mallopt.3:406 +msgid "" +"This function is not specified by POSIX or the C standards. A similar " +"function exists on many System V derivatives, but the range of values for " +"I varies across systems. The SVID defined options B, " +"B, B, and B, but only the first of these is " +"implemented in glibc." +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:410 +msgid "Specifying an invalid value for I does not generate an error." +msgstr "" + +#. FIXME . This looks buggy: +#. setting the M_MXFAST limit rounds up: (s + SIZE_SZ) & ~MALLOC_ALIGN_MASK) +#. malloc requests are rounded up: +#. (req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK +#. http://sources.redhat.com/bugzilla/show_bug.cgi?id=12129 +#. type: Plain text +#: build/C/man3/mallopt.3:418 +msgid "" +"A calculation error within the glibc implementation means that a call of the " +"form:" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:421 +#, no-wrap +msgid " mallopt(M_MXFAST, n)\n" +msgstr "" + +#. Bins are multiples of 2 * sizeof(size_t) + sizeof(size_t) +#. type: Plain text +#: build/C/man3/mallopt.3:433 +msgid "" +"does not result in fastbins being employed for all allocations of size up to " +"I. To ensure desired results, I should be rounded up to the next " +"multiple greater than or equal to I<(2k+1)*sizeof(size_t)>, where I is an " +"integer." +msgstr "" + +#. FIXME . http://sources.redhat.com/bugzilla/show_bug.cgi?id=12140 +#. type: Plain text +#: build/C/man3/mallopt.3:454 +msgid "" +"If B() is used to set B, then, as expected, the bytes " +"of allocated memory are initialized to the complement of the byte in " +"I, and when that memory is freed, the bytes of the region are " +"initialized to the byte specified in I. However, there is an " +"off-by-I error in the implementation: instead of " +"initializing precisely the block of memory being freed by the call " +"I, the block starting at I is initialized." +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:463 +msgid "" +"The program below demonstrates the use of B. If the program " +"is supplied with an (integer) command-line argument, then that argument is " +"used to set the B parameter. The program then allocates a " +"block of memory, and frees it twice (an error)." +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:467 +msgid "" +"The following shell session shows what happens when we run this program " +"under glibc, with the default value for B:" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:487 +#, no-wrap +msgid "" +"$ B<./a.out>\n" +"main(): returned from first free() call\n" +"*** glibc detected *** ./a.out: double free or corruption (top): 0x09d30008 " +"***\n" +"======= Backtrace: =========\n" +"/lib/libc.so.6(+0x6c501)[0x523501]\n" +"/lib/libc.so.6(+0x6dd70)[0x524d70]\n" +"/lib/libc.so.6(cfree+0x6d)[0x527e5d]\n" +"\\&./a.out[0x80485db]\n" +"/lib/libc.so.6(__libc_start_main+0xe7)[0x4cdce7]\n" +"\\&./a.out[0x8048471]\n" +"======= Memory map: ========\n" +"001e4000-001fe000 r-xp 00000000 08:06 1083555 /lib/libgcc_s.so.1\n" +"001fe000-001ff000 r--p 00019000 08:06 1083555 /lib/libgcc_s.so.1\n" +"[some lines omitted]\n" +"b7814000-b7817000 rw-p 00000000 00:00 0\n" +"bff53000-bff74000 rw-p 00000000 00:00 0 [stack]\n" +"Aborted (core dumped)\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:492 +msgid "" +"The following runs show the results when employing other values for " +"B:" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:505 +#, no-wrap +msgid "" +"$ B<./a.out 1> # Diagnose error and continue\n" +"main(): returned from first free() call\n" +"*** glibc detected *** ./a.out: double free or corruption (top): 0x09cbe008 " +"***\n" +"main(): returned from second free() call\n" +"$ B<./a.out 2> # Abort without error message\n" +"main(): returned from first free() call\n" +"Aborted (core dumped)\n" +"$ B<./a.out 0> # Ignore error and continue\n" +"main(): returned from first free() call\n" +"main(): returned from second free() call\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:511 +msgid "" +"The next run shows how to set the same parameter using the B " +"environment variable:" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:518 +#, no-wrap +msgid "" +"$ B\n" +"main(): returned from first free() call\n" +"*** glibc detected *** ./a.out: free(): invalid pointer: 0x092c2008 ***\n" +"main(): returned from second free() call\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:526 +#, no-wrap +msgid "" +"#include Emalloc.hE\n" +"#include Estdio.hE\n" +"#include Estdlib.hE\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:531 build/C/man3/mcheck.3:187 +#, no-wrap +msgid "" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" char *p;\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:538 +#, no-wrap +msgid "" +" if (argc E 1) {\n" +" if (mallopt(M_CHECK_ACTION, atoi(argv[1])) != 1) {\n" +" fprintf(stderr, \"mallopt() failed\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +" }\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:544 +#, no-wrap +msgid "" +" p = malloc(1000);\n" +" if (p == NULL) {\n" +" fprintf(stderr, \"malloc() failed\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:547 +#, no-wrap +msgid "" +" free(p);\n" +" printf(\"main(): returned from first free() call\\en\");\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:550 +#, no-wrap +msgid "" +" free(p);\n" +" printf(\"main(): returned from second free() call\\en\");\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mallopt.3:568 +msgid "" +"B(2), B(2), B(3), B(3), B(3), " +"B(3), B(3), B(3), B(3), " +"B(3), B(3)" +msgstr "" + +#. type: TH +#: build/C/man3/mcheck.3:25 +#, no-wrap +msgid "MCHECK" +msgstr "" + +#. type: TH +#: build/C/man3/mcheck.3:25 +#, no-wrap +msgid "2014-01-11" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:28 +msgid "" +"mcheck, mcheck_check_all, mcheck_pedantic, mprobe - heap consistency " +"checking" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:31 +#, no-wrap +msgid "B<#include Emcheck.hE>\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:33 +#, no-wrap +msgid "BIB<)(enum mcheck_status >IB<));>\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:35 +#, no-wrap +msgid "" +"BIB<)(enum mcheck_status " +">IB<));>\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:37 +#, no-wrap +msgid "B\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:39 +#, no-wrap +msgid "BIB<);>\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:51 +msgid "" +"The B() function installs a set of debugging hooks for the " +"B(3) family of memory-allocation functions. These hooks cause " +"certain consistency checks to be performed on the state of the heap. The " +"checks can detect application errors such as freeing a block of memory more " +"than once or corrupting the bookkeeping data structures that immediately " +"precede a block of allocated memory." +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:63 +msgid "" +"To be effective, the B() function must be called before the first " +"call to B(3) or a related function. In cases where this is " +"difficult to ensure, linking the program with I<-lmcheck> inserts an " +"implicit call to B() (with a NULL argument) before the first call " +"to a memory-allocation function." +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:71 +msgid "" +"The B() function is similar to B(), but performs " +"checks on all allocated blocks whenever one of the memory-allocation " +"functions is called. This can be very slow!" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:78 +msgid "" +"The B() function causes an immediate check on all " +"allocated blocks. This call is effective only if B() is called " +"beforehand." +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:91 +msgid "" +"If the system detects an inconsistency in the heap, the caller-supplied " +"function pointed to by I is invoked with a single argument " +"argument, I, that indicates what type of inconsistency was " +"detected. If I is NULL, a default function prints an error " +"message on I and calls B(3)." +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:103 +msgid "" +"The B() function performs a consistency check on the block of " +"allocated memory pointed to by I. The B() function should be " +"called beforehand (otherwise B() returns B)." +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:111 +msgid "" +"The following list describes the values returned by B() or passed " +"as the I argument when I is invoked:" +msgstr "" + +#. type: TP +#: build/C/man3/mcheck.3:111 +#, no-wrap +msgid "B (B() only)" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:116 +msgid "" +"B() was not called before the first memory allocation function was " +"called. Consistency checking is not possible." +msgstr "" + +#. type: TP +#: build/C/man3/mcheck.3:116 +#, no-wrap +msgid "B (B() only)" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:119 +msgid "No inconsistency detected." +msgstr "" + +#. type: TP +#: build/C/man3/mcheck.3:119 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:122 +msgid "Memory preceding an allocated block was clobbered." +msgstr "" + +#. type: TP +#: build/C/man3/mcheck.3:122 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:125 +msgid "Memory following an allocated block was clobbered." +msgstr "" + +#. type: TP +#: build/C/man3/mcheck.3:125 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:129 +msgid "A block of memory was freed twice." +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:134 +msgid "B() and B() return 0 on success, or -1 on error." +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:145 +msgid "" +"The B() and B() functions are available " +"since glibc 2.2. The B() and B() functions are present " +"since at least glibc 2.0" +msgstr "" + +#. But is MALLOC_CHECK_ slower? +#. type: Plain text +#: build/C/man3/mcheck.3:159 +msgid "" +"Linking a program with I<-lmcheck> and using the B " +"environment variable (described in B(3)) cause the same kinds of " +"errors to be detected. But, using B does not require the " +"application to be relinked." +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:165 +msgid "" +"The program below calls B() with a NULL argument and then frees the " +"same block of memory twice. The following shell session demonstrates what " +"happens when running the program:" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:170 +#, no-wrap +msgid "" +"$B< ./a.out>\n" +"About to free\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:174 +#, no-wrap +msgid "" +"About to free a second time\n" +"block freed twice\n" +"Aborted (core dumped)\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:182 +#, no-wrap +msgid "" +"#include Estdlib.hE\n" +"#include Estdio.hE\n" +"#include Emcheck.hE\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:190 +#, no-wrap +msgid "" +" if (mcheck(NULL) != 0) {\n" +" fprintf(stderr, \"mcheck() failed\\en\");\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:193 +#, no-wrap +msgid "" +" exit(EXIT_FAILURE);\n" +" }\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:195 +#, no-wrap +msgid " p = malloc(1000);\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:200 +#, no-wrap +msgid "" +" fprintf(stderr, \"About to free\\en\");\n" +" free(p);\n" +" fprintf(stderr, \"\\enAbout to free a second time\\en\");\n" +" free(p);\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mcheck.3:208 +msgid "B(3), B(3), B(3)" +msgstr "" + +#. type: TH +#: build/C/man2/mlock.2:26 +#, no-wrap +msgid "MLOCK" +msgstr "" + +#. type: TH +#: build/C/man2/mlock.2:26 +#, no-wrap +msgid "2014-04-14" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:29 +msgid "mlock, munlock, mlockall, munlockall - lock and unlock memory" +msgstr "" + +#. type: Plain text +#: 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 +#, no-wrap +msgid "B<#include Esys/mman.hE>\n" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:35 +#, no-wrap +msgid "" +"BIB<, size_t >IB<);>\n" +"BIB<, size_t >IB<);>\n" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:38 +#, no-wrap +msgid "" +"BIB<);>\n" +"B\n" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:54 +msgid "" +"B() and B() respectively lock part or all of the calling " +"process's virtual address space into RAM, preventing that memory from being " +"paged to the swap area. B() and B() perform the " +"converse operation, respectively unlocking part or all of the calling " +"process's virtual address space, so that pages in the specified virtual " +"address range may once more to be swapped out if required by the kernel " +"memory manager. Memory locking and unlocking are performed in units of " +"whole pages." +msgstr "" + +#. type: SS +#: build/C/man2/mlock.2:54 +#, no-wrap +msgid "mlock() and munlock()" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:64 +msgid "" +"B() locks pages in the address range starting at I and " +"continuing for I bytes. All pages that contain a part of the specified " +"address range are guaranteed to be resident in RAM when the call returns " +"successfully; the pages are guaranteed to stay in RAM until later unlocked." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:73 +msgid "" +"B() unlocks pages in the address range starting at I and " +"continuing for I bytes. After this call, all pages that contain a part " +"of the specified memory range can be moved to external swap space again by " +"the kernel." +msgstr "" + +#. type: SS +#: build/C/man2/mlock.2:73 +#, no-wrap +msgid "mlockall() and munlockall()" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:83 +msgid "" +"B() locks all pages mapped into the address space of the calling " +"process. This includes the pages of the code, data and stack segment, as " +"well as shared libraries, user space kernel data, shared memory, and " +"memory-mapped files. All mapped pages are guaranteed to be resident in RAM " +"when the call returns successfully; the pages are guaranteed to stay in RAM " +"until later unlocked." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:88 +msgid "" +"The I argument is constructed as the bitwise OR of one or more of the " +"following constants:" +msgstr "" + +#. type: TP +#: build/C/man2/mlock.2:88 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:92 +msgid "" +"Lock all pages which are currently mapped into the address space of the " +"process." +msgstr "" + +#. type: TP +#: build/C/man2/mlock.2:92 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:99 +msgid "" +"Lock all pages which will become mapped into the address space of the " +"process in the future. These could be for instance new pages required by a " +"growing heap and stack as well as new memory-mapped files or shared memory " +"regions." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:112 +msgid "" +"If B has been specified, then a later system call (e.g., " +"B(2), B(2), B(3)), may fail if it would cause the number " +"of locked bytes to exceed the permitted maximum (see below). In the same " +"circumstances, stack growth may likewise fail: the kernel will deny stack " +"expansion and deliver a B signal to the process." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:116 +msgid "" +"B() unlocks all pages mapped into the address space of the " +"calling process." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:122 +msgid "" +"On success these system calls return 0. On error, -1 is returned, I " +"is set appropriately, and no changes are made to any locks in the address " +"space of the process." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:131 +msgid "" +"(Linux 2.6.9 and later) the caller had a nonzero B soft " +"resource limit, but tried to lock more memory than the limit permitted. " +"This limit is not enforced if the process is privileged (B)." +msgstr "" + +#. In the case of mlock(), this check is somewhat buggy: it doesn't +#. take into account whether the to-be-locked range overlaps with +#. already locked pages. Thus, suppose we allocate +#. (num_physpages / 4 + 1) of memory, and lock those pages once using +#. mlock(), and then lock the *same* page range a second time. +#. In the case, the second mlock() call will fail, since the check +#. calculates that the process is trying to lock (num_physpages / 2 + 2) +#. pages, which of course is not true. (MTK, Nov 04, kernel 2.4.28) +#. type: Plain text +#: build/C/man2/mlock.2:143 +msgid "" +"(Linux 2.4 and earlier) the calling process tried to lock more than half of " +"RAM." +msgstr "" + +#. SVr4 documents an additional EAGAIN error code. +#. type: Plain text +#: build/C/man2/mlock.2:149 +msgid "" +"The caller is not privileged, but needs privilege (B) to " +"perform the requested operation." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:154 +msgid "For B() and B():" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:157 +msgid "Some or all of the specified address range could not be locked." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:164 +msgid "" +"The result of the addition I+I was less than I (e.g., the " +"addition may have resulted in an overflow)." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:169 +msgid "(Not on Linux) I was not a multiple of the page size." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:173 +msgid "" +"Some of the specified address range does not correspond to mapped pages in " +"the address space of the process." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:176 +msgid "For B():" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:179 +msgid "Unknown I were specified." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:182 +msgid "For B():" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:186 +msgid "(Linux 2.6.8 and earlier) The caller was not privileged (B)." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:188 +msgid "POSIX.1-2001, SVr4." +msgstr "" + +#. type: SH +#: build/C/man2/mlock.2:188 build/C/man2/mmap.2:503 build/C/man2/msync.2:105 +#, no-wrap +msgid "AVAILABILITY" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:200 +msgid "" +"On POSIX systems on which B() and B() are available, " +"B<_POSIX_MEMLOCK_RANGE> is defined in Iunistd.hE> and the number " +"of bytes in a page can be determined from the constant B (if " +"defined) in Ilimits.hE> or by calling I." +msgstr "" + +#. POSIX.1-2001: It shall be defined to -1 or 0 or 200112L. +#. -1: unavailable, 0: ask using sysconf(). +#. glibc defines it to 1. +#. type: Plain text +#: build/C/man2/mlock.2:213 +msgid "" +"On POSIX systems on which B() and B() are available, " +"B<_POSIX_MEMLOCK> is defined in Iunistd.hE> to a value greater " +"than 0. (See also B(3).)" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:231 +msgid "" +"Memory locking has two main applications: real-time algorithms and " +"high-security data processing. Real-time applications require deterministic " +"timing, and, like scheduling, paging is one major cause of unexpected " +"program execution delays. Real-time applications will usually also switch " +"to a real-time scheduler with B(2). Cryptographic " +"security software often handles critical bytes like passwords or secret keys " +"as data structures. As a result of paging, these secrets could be " +"transferred onto a persistent swap store medium, where they might be " +"accessible to the enemy long after the security software has erased the " +"secrets in RAM and terminated. (But be aware that the suspend mode on " +"laptops and some desktop computers will save a copy of the system's RAM to " +"disk, regardless of memory locks.)" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:244 +msgid "" +"Real-time processes that are using B() to prevent delays on page " +"faults should reserve enough locked stack pages before entering the " +"time-critical section, so that no page fault can be caused by function " +"calls. This can be achieved by calling a function that allocates a " +"sufficiently large automatic variable (an array) and writes to the memory " +"occupied by this array in order to touch these stack pages. This way, " +"enough pages will be mapped for the stack and can be locked into RAM. The " +"dummy writes ensure that not even copy-on-write page faults can occur in the " +"critical section." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:257 +msgid "" +"Memory locks are not inherited by a child created via B(2) and are " +"automatically removed (unlocked) during an B(2) or when the process " +"terminates. The B() B setting is not inherited by a " +"child created via B(2) and is cleared during an B(2)." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:261 +msgid "" +"The memory lock on an address range is automatically removed if the address " +"range is unmapped via B(2)." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:274 +msgid "" +"Memory locks do not stack, that is, pages which have been locked several " +"times by calls to B() or B() will be unlocked by a single " +"call to B() for the corresponding range or by B(). " +"Pages which are mapped to several locations or by several processes stay " +"locked into RAM as long as they are locked at least at one location or by at " +"least one process." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:285 +msgid "" +"Under Linux, B() and B() automatically round I down " +"to the nearest page boundary. However, POSIX.1-2001 allows an " +"implementation to require that I is page aligned, so portable " +"applications should ensure this." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:298 +msgid "" +"The I field of the Linux-specific I file shows how " +"many kilobytes of memory the process with ID I has locked using " +"B(), B(), and B(2) B." +msgstr "" + +#. type: SS +#: build/C/man2/mlock.2:298 +#, no-wrap +msgid "Limits and permissions" +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:305 +msgid "" +"In Linux 2.6.8 and earlier, a process must be privileged (B) " +"in order to lock memory and the B soft resource limit " +"defines a limit on how much memory the process may lock." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:311 +msgid "" +"Since Linux 2.6.9, no limits are placed on the amount of memory that a " +"privileged process can lock and the B soft resource limit " +"instead defines a limit on how much memory an unprivileged process may lock." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:319 +msgid "" +"In the 2.4 series Linux kernels up to and including 2.4.17, a bug caused the " +"B() B flag to be inherited across a B(2). This " +"was rectified in kernel 2.4.18." +msgstr "" + +#. See the following LKML thread: +#. http://marc.theaimsgroup.com/?l=linux-kernel&m=113801392825023&w=2 +#. "Rationale for RLIMIT_MEMLOCK" +#. 23 Jan 2006 +#. type: Plain text +#: build/C/man2/mlock.2:336 +msgid "" +"Since kernel 2.6.9, if a privileged process calls I " +"and later drops privileges (loses the B capability by, for " +"example, setting its effective UID to a nonzero value), then subsequent " +"memory allocations (e.g., B(2), B(2)) will fail if the " +"B resource limit is encountered." +msgstr "" + +#. type: Plain text +#: build/C/man2/mlock.2:343 +msgid "" +"B(2), B(2), B(2), B(3), B(5), " +"B(7)" +msgstr "" + +#. type: TH +#: build/C/man2/mmap.2:40 +#, no-wrap +msgid "MMAP" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:43 +msgid "mmap, munmap - map or unmap files or devices into memory" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:51 +#, no-wrap +msgid "" +"BIB<, size_t >IB<, int >IB<, int " +">IB<,>\n" +"B< int >IB<, off_t >IB<);>\n" +"BIB<, size_t >IB<);>\n" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:54 +msgid "See NOTES for information on feature test macro requirements." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:63 +msgid "" +"B() creates a new mapping in the virtual address space of the calling " +"process. The starting address for the new mapping is specified in I. " +"The I argument specifies the length of the mapping." +msgstr "" + +#. Before Linux 2.6.24, the address was rounded up to the next page +#. boundary; since 2.6.24, it is rounded down! +#. type: Plain text +#: build/C/man2/mmap.2:77 +msgid "" +"If I is NULL, then the kernel chooses the address at which to create " +"the mapping; this is the most portable method of creating a new mapping. If " +"I is not NULL, then the kernel takes it as a hint about where to place " +"the mapping; on Linux, the mapping will be created at a nearby page " +"boundary. The address of the new mapping is returned as the result of the " +"call." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:89 +msgid "" +"The contents of a file mapping (as opposed to an anonymous mapping; see " +"B below), are initialized using I bytes starting at " +"offset I in the file (or other object) referred to by the file " +"descriptor I. I must be a multiple of the page size as returned " +"by I." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:97 +msgid "" +"The I argument describes the desired memory protection of the mapping " +"(and must not conflict with the open mode of the file). It is either " +"B or the bitwise OR of one or more of the following flags:" +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:97 build/C/man2/mprotect.2:74 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:100 +msgid "Pages may be executed." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:100 build/C/man2/mprotect.2:68 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:103 +msgid "Pages may be read." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:103 build/C/man2/mprotect.2:71 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:106 +msgid "Pages may be written." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:106 build/C/man2/mprotect.2:65 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:109 +msgid "Pages may not be accessed." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:118 +msgid "" +"The I argument determines whether updates to the mapping are visible " +"to other processes mapping the same region, and whether updates are carried " +"through to the underlying file. This behavior is determined by including " +"exactly one of the following values in I:" +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:118 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:128 +msgid "" +"Share this mapping. Updates to the mapping are visible to other processes " +"that map this file, and are carried through to the underlying file. The " +"file may not actually be updated until B(2) or B() is " +"called." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:128 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:137 +msgid "" +"Create a private copy-on-write mapping. Updates to the mapping are not " +"visible to other processes mapping the same file, and are not carried " +"through to the underlying file. It is unspecified whether changes made to " +"the file after the B() call are visible in the mapped region." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:139 +msgid "Both of these flags are described in POSIX.1-2001." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:142 +msgid "In addition, zero or more of the following values can be ORed in I:" +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:142 +#, no-wrap +msgid "B (since Linux 2.4.20, 2.6)" +msgstr "" + +#. See http://lwn.net/Articles/294642 "Tangled up in threads", 19 Aug 08 +#. type: Plain text +#: build/C/man2/mmap.2:158 +msgid "" +"Put the mapping into the first 2 Gigabytes of the process address space. " +"This flag is supported only on x86-64, for 64-bit programs. It was added to " +"allow thread stacks to be allocated somewhere in the first 2GB of memory, so " +"as to improve context-switch performance on some early 64-bit processors. " +"Modern x86-64 processors no longer have this performance problem, so use of " +"this flag is not required on those systems. The B flag is " +"ignored when B is set." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:158 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:163 +msgid "Synonym for B. Deprecated." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:163 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:185 +msgid "" +"The mapping is not backed by any file; its contents are initialized to " +"zero. The I and I arguments are ignored; however, some " +"implementations require I to be -1 if B (or B) " +"is specified, and portable applications should ensure this. The use of " +"B in conjunction with B is supported on Linux " +"only since kernel 2.4." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:185 +#, no-wrap +msgid "B" +msgstr "" + +#. Introduced in 1.1.36, removed in 1.3.24. +#. type: Plain text +#: build/C/man2/mmap.2:193 +msgid "" +"This flag is ignored. (Long ago, it signaled that attempts to write to the " +"underlying file should fail with B. But this was a source of " +"denial-of-service attacks.)" +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:193 +#, no-wrap +msgid "B" +msgstr "" + +#. Introduced in 1.1.38, removed in 1.3.24. Flag tested in proc_follow_link. +#. (Long ago, it signaled that the underlying file is an executable. +#. However, that information was not really used anywhere.) +#. Linus talked about DOS related to MAP_EXECUTABLE, but he was thinking of +#. MAP_DENYWRITE? +#. type: Plain text +#: build/C/man2/mmap.2:201 +msgid "This flag is ignored." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:201 +#, no-wrap +msgid "B" +msgstr "" + +#. On some systems, this was required as the opposite of +#. MAP_ANONYMOUS -- mtk, 1 May 2007 +#. type: Plain text +#: build/C/man2/mmap.2:207 +msgid "Compatibility flag. Ignored." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:207 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:225 +msgid "" +"Don't interpret I as a hint: place the mapping at exactly that " +"address. I must be a multiple of the page size. If the memory region " +"specified by I and I overlaps pages of any existing mapping(s), " +"then the overlapped part of the existing mapping(s) will be discarded. If " +"the specified address cannot be used, B() will fail. Because " +"requiring a fixed address for a mapping is less portable, the use of this " +"option is discouraged." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:225 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:39 +#: build/C/man2/mmap.2:230 +msgid "" +"Used for stacks. Indicates to the kernel virtual memory system that the " +"mapping should extend downward in memory." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:230 #, no-wrap +msgid "B (since Linux 2.6.32)" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:236 msgid "" -"BIB<);>\n" -"B\n" +"Allocate the mapping using \"huge pages.\" See the Linux kernel source file " +"I for further information." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:236 +#, no-wrap +msgid "B (since Linux 2.5.37)" msgstr "" +#. If set, the mapped pages will not be swapped out. #. type: Plain text -#: build/C/man2/mlock.2:55 +#: build/C/man2/mmap.2:242 msgid "" -"B() and B() respectively lock part or all of the calling " -"process's virtual address space into RAM, preventing that memory from being " -"paged to the swap area. B() and B() perform the " -"converse operation, respectively unlocking part or all of the calling " -"process's virtual address space, so that pages in the specified virtual " -"address range may once more to be swapped out if required by the kernel " -"memory manager. Memory locking and unlocking are performed in units of " -"whole pages." +"Lock the pages of the mapped region into memory in the manner of " +"B(2). This flag is ignored in older kernels." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:242 +#, no-wrap +msgid "B (since Linux 2.5.46)" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:257 +msgid "" +"Only meaningful in conjunction with B. Don't perform " +"read-ahead: create page tables entries only for pages that are already " +"present in RAM. Since Linux 2.6.23, this flag causes B to do " +"nothing. One day the combination of B and B may " +"be reimplemented." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:257 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:272 +msgid "" +"Do not reserve swap space for this mapping. When swap space is reserved, " +"one has the guarantee that it is possible to modify the mapping. When swap " +"space is not reserved one might get B upon a write if no physical " +"memory is available. See also the discussion of the file " +"I in B(5). In kernels before 2.6, " +"this flag had effect only for private writable mappings." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:272 +#, no-wrap +msgid "B (since Linux 2.5.46)" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:279 +msgid "" +"Populate (prefault) page tables for a mapping. For a file mapping, this " +"causes read-ahead on the file. Later accesses to the mapping will not be " +"blocked by page faults. B is supported for private mappings " +"only since Linux 2.6.23." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:279 +#, no-wrap +msgid "B (since Linux 2.6.27)" +msgstr "" + +#. See http://lwn.net/Articles/294642 "Tangled up in threads", 19 Aug 08 +#. commit cd98a04a59e2f94fa64d5bf1e26498d27427d5e7 +#. http://thread.gmane.org/gmane.linux.kernel/720412 +#. "pthread_create() slow for many threads; also time to revisit 64b +#. context switch optimization?" +#. type: Plain text +#: build/C/man2/mmap.2:292 +msgid "" +"Allocate the mapping at an address suitable for a process or thread stack. " +"This flag is currently a no-op, but is used in the glibc threading " +"implementation so that if some architectures require special treatment for " +"stack allocations, support can later be transparently implemented for glibc." +msgstr "" + +#. type: TP +#: build/C/man2/mmap.2:292 +#, no-wrap +msgid "B (since Linux 2.6.33)" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:302 +msgid "" +"Don't clear anonymous pages. This flag is intended to improve performance " +"on embedded devices. This flag is honored only if the kernel was configured " +"with the B option. Because of the security " +"implications, that option is normally enabled only on embedded devices " +"(i.e., devices where one has complete control of the contents of user " +"memory)." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:310 +msgid "" +"Of the above flags, only B is specified in POSIX.1-2001. " +"However, most systems also support B (or its synonym " +"B)." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:317 +msgid "" +"Some systems document the additional flags B, " +"B, B, and B." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:323 +msgid "" +"Memory mapped by B() is preserved across B(2), with the same " +"attributes." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:331 +msgid "" +"A file is mapped in multiples of the page size. For a file that is not a " +"multiple of the page size, the remaining memory is zeroed when mapped, and " +"writes to that region are not written out to the file. The effect of " +"changing the size of the underlying file of a mapping on the pages that " +"correspond to added or removed regions of the file is unspecified." msgstr "" #. type: SS -#: build/C/man2/mlock.2:55 +#: build/C/man2/mmap.2:331 #, no-wrap -msgid "mlock() and munlock()" +msgid "munmap()" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:341 +msgid "" +"The B() system call deletes the mappings for the specified address " +"range, and causes further references to addresses within the range to " +"generate invalid memory references. The region is also automatically " +"unmapped when the process is terminated. On the other hand, closing the " +"file descriptor does not unmap the region." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:351 +msgid "" +"The address I must be a multiple of the page size. All pages " +"containing a part of the indicated range are unmapped, and subsequent " +"references to these pages will generate B. It is not an error if " +"the indicated range does not contain any mapped pages." +msgstr "" + +#. type: SS +#: build/C/man2/mmap.2:351 +#, no-wrap +msgid "Timestamps changes for file-backed mappings" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:358 +msgid "" +"For file-backed mappings, the I field for the mapped file may be " +"updated at any time between the B() and the corresponding unmapping; " +"the first reference to a mapped page will update the field if it has not " +"been already." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:375 +msgid "" +"The I and I field for a file mapped with B " +"and B will be updated after a write to the mapped region, and " +"before a subsequent B(2) with the B or B flag, if " +"one occurs." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:392 +msgid "" +"On success, B() returns a pointer to the mapped area. On error, the " +"value B (that is, I<(void\\ *)\\ -1>) is returned, and I " +"is set appropriately. On success, B() returns 0, on failure -1, " +"and I is set (probably to B)." +msgstr "" + +#. type: TP +#: 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 +#, no-wrap +msgid "B" +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:411 +msgid "" +"A file descriptor refers to a non-regular file. Or a file mapping was " +"requested, but I is not open for reading. Or B was " +"requested and B is set, but I is not open in read/write " +"(B) mode. Or B is set, but the file is append-only." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:415 +msgid "" +"The file has been locked, or too much memory has been locked (see " +"B(2))." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:421 +msgid "I is not a valid file descriptor (and B was not set)." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:429 +msgid "" +"We don't like I, I, or I (e.g., they are too large, or " +"not aligned on a page boundary)." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:434 +msgid "(since Linux 2.6.12) I was 0." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:442 +msgid "" +"I contained neither B or B, or contained " +"both of these values." +msgstr "" + +#. type: TP +#: 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 +#, no-wrap +msgid "B" +msgstr "" + +#. [2.6.7] shmem_zero_setup()-->shmem_file_setup()-->get_empty_filp() +#. type: Plain text +#: build/C/man2/mmap.2:450 build/C/man2/shmget.2:225 +msgid "The system limit on the total number of open files has been reached." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:454 +msgid "" +"The underlying filesystem of the specified file does not support memory " +"mapping." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap.2:458 +msgid "" +"No memory is available, or the process's maximum number of mappings would " +"have been exceeded." msgstr "" +#. (Since 2.4.25 / 2.6.0.) #. type: Plain text -#: build/C/man2/mlock.2:65 +#: build/C/man2/mmap.2:467 msgid "" -"B() locks pages in the address range starting at I and " -"continuing for I bytes. All pages that contain a part of the specified " -"address range are guaranteed to be resident in RAM when the call returns " -"successfully; the pages are guaranteed to stay in RAM until later unlocked." +"The I argument asks for B but the mapped area belongs to a " +"file on a filesystem that was mounted no-exec." msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:74 +#: build/C/man2/mmap.2:477 msgid "" -"B() unlocks pages in the address range starting at I and " -"continuing for I bytes. After this call, all pages that contain a part " -"of the specified memory range can be moved to external swap space again by " -"the kernel." +"B was set but the object specified by I is open for " +"writing." msgstr "" -#. type: SS -#: build/C/man2/mlock.2:74 +#. type: TP +#: build/C/man2/mmap.2:477 build/C/man2/shmctl.2:348 #, no-wrap -msgid "mlockall() and munlockall()" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:84 +#: build/C/man2/mmap.2:489 msgid "" -"B() locks all pages mapped into the address space of the calling " -"process. This includes the pages of the code, data and stack segment, as " -"well as shared libraries, user space kernel data, shared memory, and " -"memory-mapped files. All mapped pages are guaranteed to be resident in RAM " -"when the call returns successfully; the pages are guaranteed to stay in RAM " -"until later unlocked." +"On 32-bit architecture together with the large file extension (i.e., using " +"64-bit I): the number of pages used for I plus number of " +"pages used for I would overflow I (32 bits)." msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:89 -msgid "" -"The I argument is constructed as the bitwise OR of one or more of the " -"following constants:" +#: build/C/man2/mmap.2:491 +msgid "Use of a mapped region can result in these signals:" msgstr "" #. type: TP -#: build/C/man2/mlock.2:89 +#: build/C/man2/mmap.2:491 #, no-wrap -msgid "B" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:93 -msgid "" -"Lock all pages which are currently mapped into the address space of the " -"process." +#: build/C/man2/mmap.2:494 +msgid "Attempted write into a region mapped as read-only." msgstr "" #. type: TP -#: build/C/man2/mlock.2:93 +#: build/C/man2/mmap.2:494 #, no-wrap -msgid "B" -msgstr "" - -#. type: Plain text -#: build/C/man2/mlock.2:100 -msgid "" -"Lock all pages which will become mapped into the address space of the " -"process in the future. These could be for instance new pages required by a " -"growing heap and stack as well as new memory mapped files or shared memory " -"regions." +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:113 +#: build/C/man2/mmap.2:499 msgid "" -"If B has been specified, then a later system call (e.g., " -"B(2), B(2), B(3)), may fail if it would cause the number " -"of locked bytes to exceed the permitted maximum (see below). In the same " -"circumstances, stack growth may likewise fail: the kernel will deny stack " -"expansion and deliver a B signal to the process." +"Attempted access to a portion of the buffer that does not correspond to the " +"file (for example, beyond the end of the file, including the case where " +"another process has truncated the file)." msgstr "" +#. SVr4 documents additional error codes ENXIO and ENODEV. +#. SUSv2 documents additional error codes EMFILE and EOVERFLOW. #. type: Plain text -#: build/C/man2/mlock.2:117 -msgid "" -"B() unlocks all pages mapped into the address space of the " -"calling process." +#: build/C/man2/mmap.2:503 +msgid "SVr4, 4.4BSD, POSIX.1-2001." msgstr "" +#. POSIX.1-2001: It shall be defined to -1 or 0 or 200112L. +#. -1: unavailable, 0: ask using sysconf(). +#. glibc defines it to 1. #. type: Plain text -#: build/C/man2/mlock.2:123 +#: build/C/man2/mmap.2:517 msgid "" -"On success these system calls return 0. On error, -1 is returned, I " -"is set appropriately, and no changes are made to any locks in the address " -"space of the process." +"On POSIX systems on which B(), B(2), and B() are " +"available, B<_POSIX_MAPPED_FILES> is defined in Iunistd.hE> to a " +"value greater than 0. (See also B(3).)" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:132 +#: build/C/man2/mmap.2:530 msgid "" -"(Linux 2.6.9 and later) the caller had a nonzero B soft " -"resource limit, but tried to lock more memory than the limit permitted. " -"This limit is not enforced if the process is privileged (B)." +"On some hardware architectures (e.g., i386), B implies " +"B. It is architecture dependent whether B implies " +"B or not. Portable programs should always set B if " +"they intend to execute code in the new mapping." msgstr "" -#. In the case of mlock(), this check is somewhat buggy: it doesn't -#. take into account whether the to-be-locked range overlaps with -#. already locked pages. Thus, suppose we allocate -#. (num_physpages / 4 + 1) of memory, and lock those pages once using -#. mlock(), and then lock the *same* page range a second time. -#. In the case, the second mlock() call will fail, since the check -#. calculates that the process is trying to lock (num_physpages / 2 + 2) -#. pages, which of course is not true. (MTK, Nov 04, kernel 2.4.28) #. type: Plain text -#: build/C/man2/mlock.2:144 +#: build/C/man2/mmap.2:545 msgid "" -"(Linux 2.4 and earlier) the calling process tried to lock more than half of " -"RAM." +"The portable way to create a mapping is to specify I as 0 (NULL), and " +"omit B from I. In this case, the system chooses the " +"address for the mapping; the address is chosen so as not to conflict with " +"any existing mapping, and will not be 0. If the B flag is " +"specified, and I is 0 (NULL), then the mapped address will be 0 " +"(NULL)." msgstr "" -#. SVr4 documents an additional EAGAIN error code. #. type: Plain text -#: build/C/man2/mlock.2:150 +#: build/C/man2/mmap.2:575 msgid "" -"The caller is not privileged, but needs privilege (B) to " -"perform the requested operation." -msgstr "" - -#. type: Plain text -#: build/C/man2/mlock.2:155 -msgid "For B() and B():" +"Certain I constants are defined only if either B<_BSD_SOURCE> or " +"B<_SVID_SOURCE> is defined. (Requiring B<_GNU_SOURCE> also suffices, and " +"requiring that macro specifically would have been more logical, since these " +"flags are all Linux-specific.) The relevant flags are: B, " +"B (and the synonym B), B, " +"B, B, B, B, " +"B, B, B, B, and " +"B." msgstr "" -#. type: Plain text -#: build/C/man2/mlock.2:158 -msgid "Some or all of the specified address range could not be locked." +#. type: SS +#: build/C/man2/mmap.2:575 +#, no-wrap +msgid "C library/kernel ABI differences" msgstr "" +#. Since around glibc 2.1/2.2, depending on the platform. #. type: Plain text -#: build/C/man2/mlock.2:165 +#: build/C/man2/mmap.2:590 msgid "" -"The result of the addition I+I was less than I (e.g., the " -"addition may have resulted in an overflow)." -msgstr "" - -#. type: Plain text -#: build/C/man2/mlock.2:170 -msgid "(Not on Linux) I was not a multiple of the page size." +"This page describes the interface provided by the glibc B() wrapper " +"function. Originally, this function invoked a system call of the same " +"name. Since kernel 2.4, that system call has been superseded by " +"B(2), and nowadays the glibc B() wrapper function invokes " +"B(2) with a suitably adjusted value for I." msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:174 +#: build/C/man2/mmap.2:595 msgid "" -"Some of the specified address range does not correspond to mapped pages in " -"the address space of the process." +"On Linux there are no guarantees like those suggested above under " +"B. By default, any process can be killed at any moment when " +"the system runs out of memory." msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:177 -msgid "For B():" +#: build/C/man2/mmap.2:602 +msgid "" +"In kernels before 2.6.7, the B flag has effect only if I " +"is specified as B." msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:180 -msgid "Unknown I were specified." +#: build/C/man2/mmap.2:617 +msgid "" +"SUSv3 specifies that B() should fail if I is 0. However, in " +"kernels before 2.6.12, B() succeeded in this case: no mapping was " +"created and the call returned I. Since kernel 2.6.12, B() " +"fails with the error B for this case." msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:183 -msgid "For B():" +#: build/C/man2/mmap.2:633 +msgid "" +"POSIX specifies that the system shall always zero fill any partial page at " +"the end of the object and that system will never write any modification of " +"the object beyond its end. On Linux, when you write data to such partial " +"page after the end of the object, the data stays in the page cache even " +"after the file is closed and unmapped and even though the data is never " +"written to the file itself, subsequent mappings may see the modified " +"content. In some cases, this could be fixed by calling B(2) before " +"the unmap takes place; however, this doesn't work on tmpfs (for example, " +"when using POSIX shared memory interface documented in B(7))." msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:187 -msgid "(Linux 2.6.8 and earlier) The caller was not privileged (B)." +#: build/C/man2/mmap.2:645 +msgid "" +"The following program prints part of the file specified in its first " +"command-line argument to standard output. The range of bytes to be printed " +"is specified via offset and length values in the second and third " +"command-line arguments. The program creates a memory mapping of the " +"required pages of the file and then uses B(2) to output the desired " +"bytes." msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:189 -msgid "POSIX.1-2001, SVr4." -msgstr "" - -#. type: SH -#: build/C/man2/mlock.2:189 build/C/man2/mmap.2:487 build/C/man2/msync.2:105 +#: build/C/man2/mmap.2:653 #, no-wrap -msgid "AVAILABILITY" +msgid "" +"#include Esys/mman.hE\n" +"#include Esys/stat.hE\n" +"#include Efcntl.hE\n" +"#include Estdio.hE\n" +"#include Estdlib.hE\n" +"#include Eunistd.hE\n" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:201 +#: build/C/man2/mmap.2:656 build/C/man2/mprotect.2:177 +#, no-wrap msgid "" -"On POSIX systems on which B() and B() are available, " -"B<_POSIX_MEMLOCK_RANGE> is defined in Iunistd.hE> and the number " -"of bytes in a page can be determined from the constant B (if " -"defined) in Ilimits.hE> or by calling I." +"#define handle_error(msg) \\e\n" +" do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" msgstr "" -#. POSIX.1-2001: It shall be defined to -1 or 0 or 200112L. -#. -1: unavailable, 0: ask using sysconf(). -#. glibc defines it to 1. #. type: Plain text -#: build/C/man2/mlock.2:214 +#: build/C/man2/mmap.2:666 +#, no-wrap msgid "" -"On POSIX systems on which B() and B() are available, " -"B<_POSIX_MEMLOCK> is defined in Iunistd.hE> to a value greater " -"than 0. (See also B(3).)" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" char *addr;\n" +" int fd;\n" +" struct stat sb;\n" +" off_t offset, pa_offset;\n" +" size_t length;\n" +" ssize_t s;\n" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:232 +#: build/C/man2/mmap.2:671 +#, no-wrap msgid "" -"Memory locking has two main applications: real-time algorithms and " -"high-security data processing. Real-time applications require deterministic " -"timing, and, like scheduling, paging is one major cause of unexpected " -"program execution delays. Real-time applications will usually also switch " -"to a real-time scheduler with B(2). Cryptographic " -"security software often handles critical bytes like passwords or secret keys " -"as data structures. As a result of paging, these secrets could be " -"transferred onto a persistent swap store medium, where they might be " -"accessible to the enemy long after the security software has erased the " -"secrets in RAM and terminated. (But be aware that the suspend mode on " -"laptops and some desktop computers will save a copy of the system's RAM to " -"disk, regardless of memory locks.)" +" if (argc E 3 || argc E 4) {\n" +" fprintf(stderr, \"%s file offset [length]\\en\", argv[0]);\n" +" exit(EXIT_FAILURE);\n" +" }\n" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:245 +#: build/C/man2/mmap.2:675 +#, no-wrap msgid "" -"Real-time processes that are using B() to prevent delays on page " -"faults should reserve enough locked stack pages before entering the " -"time-critical section, so that no page fault can be caused by function " -"calls. This can be achieved by calling a function that allocates a " -"sufficiently large automatic variable (an array) and writes to the memory " -"occupied by this array in order to touch these stack pages. This way, " -"enough pages will be mapped for the stack and can be locked into RAM. The " -"dummy writes ensure that not even copy-on-write page faults can occur in the " -"critical section." +" fd = open(argv[1], O_RDONLY);\n" +" if (fd == -1)\n" +" handle_error(\"open\");\n" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:251 +#: build/C/man2/mmap.2:678 +#, no-wrap msgid "" -"Memory locks are not inherited by a child created via B(2) and are " -"automatically removed (unlocked) during an B(2) or when the process " -"terminates." +" if (fstat(fd, &sb) == -1) /* To obtain file size */\n" +" handle_error(\"fstat\");\n" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:255 +#: build/C/man2/mmap.2:682 +#, no-wrap msgid "" -"The memory lock on an address range is automatically removed if the address " -"range is unmapped via B(2)." +" offset = atoi(argv[2]);\n" +" pa_offset = offset & ~(sysconf(_SC_PAGE_SIZE) - 1);\n" +" /* offset for mmap() must be page aligned */\n" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:268 +#: build/C/man2/mmap.2:687 +#, no-wrap msgid "" -"Memory locks do not stack, that is, pages which have been locked several " -"times by calls to B() or B() will be unlocked by a single " -"call to B() for the corresponding range or by B(). " -"Pages which are mapped to several locations or by several processes stay " -"locked into RAM as long as they are locked at least at one location or by at " -"least one process." +" if (offset E= sb.st_size) {\n" +" fprintf(stderr, \"offset is past end of file\\en\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:279 +#: build/C/man2/mmap.2:693 +#, no-wrap msgid "" -"Under Linux, B() and B() automatically round I down " -"to the nearest page boundary. However, POSIX.1-2001 allows an " -"implementation to require that I is page aligned, so portable " -"applications should ensure this." +" if (argc == 4) {\n" +" length = atoi(argv[3]);\n" +" if (offset + length E sb.st_size)\n" +" length = sb.st_size - offset;\n" +" /* Can\\(aqt display bytes past end of file */\n" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:292 +#: build/C/man2/mmap.2:697 +#, no-wrap msgid "" -"The I field of the Linux-specific I file shows how " -"many kilobytes of memory the process with ID I has locked using " -"B(), B(), and B(2) B." +" } else { /* No length arg ==E display to end of file */\n" +" length = sb.st_size - offset;\n" +" }\n" msgstr "" -#. type: SS -#: build/C/man2/mlock.2:292 +#. type: Plain text +#: build/C/man2/mmap.2:702 #, no-wrap -msgid "Limits and permissions" +msgid "" +" addr = mmap(NULL, length + offset - pa_offset, PROT_READ,\n" +" MAP_PRIVATE, fd, pa_offset);\n" +" if (addr == MAP_FAILED)\n" +" handle_error(\"mmap\");\n" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:299 +#: build/C/man2/mmap.2:707 +#, no-wrap msgid "" -"In Linux 2.6.8 and earlier, a process must be privileged (B) " -"in order to lock memory and the B soft resource limit " -"defines a limit on how much memory the process may lock." +" s = write(STDOUT_FILENO, addr + offset - pa_offset, length);\n" +" if (s != length) {\n" +" if (s == -1)\n" +" handle_error(\"write\");\n" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:305 +#: build/C/man2/mmap.2:711 +#, no-wrap msgid "" -"Since Linux 2.6.9, no limits are placed on the amount of memory that a " -"privileged process can lock and the B soft resource limit " -"instead defines a limit on how much memory an unprivileged process may lock." +" fprintf(stderr, \"partial write\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:313 +#: build/C/man2/mmap.2:729 msgid "" -"In the 2.4 series Linux kernels up to and including 2.4.17, a bug caused the " -"B() B flag to be inherited across a B(2). This " -"was rectified in kernel 2.4.18." +"B(2), B(2), B(2), B(2), " +"B(2), B(2), B(2), B(2), " +"B(2), B(2), B(2), B(3), " +"B(7)" msgstr "" -#. See the following LKML thread: -#. http://marc.theaimsgroup.com/?l=linux-kernel&m=113801392825023&w=2 -#. "Rationale for RLIMIT_MEMLOCK" -#. 23 Jan 2006 #. type: Plain text -#: build/C/man2/mlock.2:330 +#: build/C/man2/mmap.2:736 msgid "" -"Since kernel 2.6.9, if a privileged process calls I " -"and later drops privileges (loses the B capability by, for " -"example, setting its effective UID to a nonzero value), then subsequent " -"memory allocations (e.g., B(2), B(2)) will fail if the " -"B resource limit is encountered." +"The descriptions of the following files in B(5): I, " +"I, and I." msgstr "" #. type: Plain text -#: build/C/man2/mlock.2:337 -msgid "" -"B(2), B(2), B(2), B(3), B(5), " -"B(7)" +#: build/C/man2/mmap.2:741 build/C/man2/msync.2:151 +msgid "B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391." msgstr "" #. type: TH -#: build/C/man2/mmap.2:40 +#: build/C/man2/mmap2.2:29 #, no-wrap -msgid "MMAP" +msgid "MMAP2" msgstr "" #. type: TH -#: build/C/man2/mmap.2:40 build/C/man2/mmap2.2:29 +#: build/C/man2/mmap2.2:29 #, no-wrap -msgid "2012-04-16" +msgid "2014-02-25" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:43 -msgid "mmap, munmap - map or unmap files or devices into memory" +#: build/C/man2/mmap2.2:32 +msgid "mmap2 - map files or devices into memory" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:51 +#: build/C/man2/mmap2.2:38 #, no-wrap msgid "" -"BIB<, size_t >IB<, int >IB<, int " -">IB<,>\n" -"B< int >IB<, off_t >IB<);>\n" -"BIB<, size_t >IB<);>\n" +"BIB<, size_t >IB<, int >IB<,>\n" +"B< int >IB<, int >IB<, off_t >IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:61 +#: build/C/man2/mmap2.2:43 msgid "" -"B() creates a new mapping in the virtual address space of the calling " -"process. The starting address for the new mapping is specified in I. " -"The I argument specifies the length of the mapping." +"This is probably not the system call that you are interested in; instead, " +"see B(2), which describes the glibc wrapper function that invokes this " +"system call." msgstr "" -#. Before Linux 2.6.24, the address was rounded up to the next page -#. boundary; since 2.6.24, it is rounded down! #. type: Plain text -#: build/C/man2/mmap.2:75 +#: build/C/man2/mmap2.2:54 msgid "" -"If I is NULL, then the kernel chooses the address at which to create " -"the mapping; this is the most portable method of creating a new mapping. If " -"I is not NULL, then the kernel takes it as a hint about where to place " -"the mapping; on Linux, the mapping will be created at a nearby page " -"boundary. The address of the new mapping is returned as the result of the " -"call." +"The B() system call provides the same interface as B(2), " +"except that the final argument specifies the offset into the file in " +"4096-byte units (instead of bytes, as is done by B(2)). This enables " +"applications that use a 32-bit I to map large files (up to 2^44 " +"bytes)." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:87 +#: build/C/man2/mmap2.2:61 msgid "" -"The contents of a file mapping (as opposed to an anonymous mapping; see " -"B below), are initialized using I bytes starting at " -"offset I in the file (or other object) referred to by the file " -"descriptor I. I must be a multiple of the page size as returned " -"by I." +"On success, B() returns a pointer to the mapped area. On error, -1 " +"is returned and I is set appropriately." +msgstr "" + +#. type: Plain text +#: build/C/man2/mmap2.2:65 +msgid "Problem with getting the data from user space." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:95 +#: build/C/man2/mmap2.2:70 msgid "" -"The I argument describes the desired memory protection of the mapping " -"(and must not conflict with the open mode of the file). It is either " -"B or the bitwise OR of one or more of the following flags:" +"(Various platforms where the page size is not 4096 bytes.) I is not a multiple of the system page size." msgstr "" -#. type: TP -#: build/C/man2/mmap.2:95 build/C/man2/mprotect.2:67 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/mmap2.2:74 +msgid "B() can also return any of the errors described in B(2)." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:98 -msgid "Pages may be executed." +#: build/C/man2/mmap2.2:77 +msgid "B() is available since Linux 2.3.31." msgstr "" -#. type: TP -#: build/C/man2/mmap.2:98 build/C/man2/mprotect.2:61 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/mmap2.2:79 build/C/man2/subpage_prot.2:98 +msgid "This system call is Linux-specific." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:101 -msgid "Pages may be read." +#: build/C/man2/mmap2.2:86 +msgid "" +"On architectures where this system call is present, the glibc B() " +"wrapper function invokes this system call rather than the B(2) system " +"call." msgstr "" -#. type: TP -#: build/C/man2/mmap.2:101 build/C/man2/mprotect.2:64 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/mmap2.2:88 +msgid "This system call does not exist on x86-64." msgstr "" +#. ia64 can have page sizes ranging from 4kB to 64kB. +#. On cris, it looks like the unit might also be the page size, +#. which is 8192 bytes. -- mtk, June 2007 #. type: Plain text -#: build/C/man2/mmap.2:104 -msgid "Pages may be written." +#: build/C/man2/mmap2.2:95 +msgid "" +"On ia64, the unit for I is actually the system page size, rather " +"than 4096 bytes." msgstr "" -#. type: TP -#: build/C/man2/mmap.2:104 build/C/man2/mprotect.2:58 +#. type: Plain text +#: build/C/man2/mmap2.2:101 +msgid "B(2), B(2), B(2), B(2), B(3)" +msgstr "" + +#. type: TH +#: build/C/man2/mprotect.2:39 #, no-wrap -msgid "B" +msgid "MPROTECT" msgstr "" -#. type: Plain text -#: build/C/man2/mmap.2:107 -msgid "Pages may not be accessed." +#. type: TH +#: build/C/man2/mprotect.2:39 +#, no-wrap +msgid "2014-01-05" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:116 -msgid "" -"The I argument determines whether updates to the mapping are visible " -"to other processes mapping the same region, and whether updates are carried " -"through to the underlying file. This behavior is determined by including " -"exactly one of the following values in I:" +#: build/C/man2/mprotect.2:42 +msgid "mprotect - set protection on a region of memory" msgstr "" -#. type: TP -#: build/C/man2/mmap.2:116 +#. type: Plain text +#: build/C/man2/mprotect.2:47 #, no-wrap -msgid "B" +msgid "BIB<, size_t >IB<, int >IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:126 +#: build/C/man2/mprotect.2:55 msgid "" -"Share this mapping. Updates to the mapping are visible to other processes " -"that map this file, and are carried through to the underlying file. The " -"file may not actually be updated until B(2) or B() is " -"called." +"B() changes protection for the calling process's memory page(s) " +"containing any part of the address range in the interval [I,\\ " +"I+I-1]. I must be aligned to a page boundary." msgstr "" -#. type: TP -#: build/C/man2/mmap.2:126 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/mprotect.2:60 +msgid "" +"If the calling process tries to access memory in a manner that violates the " +"protection, then the kernel generates a B signal for the process." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:135 +#: build/C/man2/mprotect.2:65 msgid "" -"Create a private copy-on-write mapping. Updates to the mapping are not " -"visible to other processes mapping the same file, and are not carried " -"through to the underlying file. It is unspecified whether changes made to " -"the file after the B() call are visible in the mapped region." +"I is either B or a bitwise-or of the other values in the " +"following list:" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:137 -msgid "Both of these flags are described in POSIX.1-2001." +#: build/C/man2/mprotect.2:68 +msgid "The memory cannot be accessed at all." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:140 -msgid "In addition, zero or more of the following values can be ORed in I:" +#: build/C/man2/mprotect.2:71 +msgid "The memory can be read." msgstr "" -#. type: TP -#: build/C/man2/mmap.2:140 -#, no-wrap -msgid "B (since Linux 2.4.20, 2.6)" +#. type: Plain text +#: build/C/man2/mprotect.2:74 +msgid "The memory can be modified." +msgstr "" + +#. type: Plain text +#: build/C/man2/mprotect.2:77 +msgid "The memory can be executed." msgstr "" -#. See http://lwn.net/Articles/294642 "Tangled up in threads", 19 Aug 08 #. type: Plain text -#: build/C/man2/mmap.2:156 +#: build/C/man2/mprotect.2:84 msgid "" -"Put the mapping into the first 2 Gigabytes of the process address space. " -"This flag is only supported on x86-64, for 64-bit programs. It was added to " -"allow thread stacks to be allocated somewhere in the first 2GB of memory, so " -"as to improve context-switch performance on some early 64-bit processors. " -"Modern x86-64 processors no longer have this performance problem, so use of " -"this flag is not required on those systems. The B flag is " -"ignored when B is set." +"On success, B() returns zero. On error, -1 is returned, and " +"I is set appropriately." msgstr "" -#. type: TP -#: build/C/man2/mmap.2:156 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/mprotect.2:94 +msgid "" +"The memory cannot be given the specified access. This can happen, for " +"example, if you B(2) a file to which you have read-only access, then " +"ask B() to mark it B." msgstr "" +#. Or: both PROT_GROWSUP and PROT_GROWSDOWN were specified in 'prot'. #. type: Plain text -#: build/C/man2/mmap.2:161 -msgid "Synonym for B. Deprecated." +#: build/C/man2/mprotect.2:99 +msgid "I is not a valid pointer, or not a multiple of the system page size." msgstr "" -#. type: TP -#: build/C/man2/mmap.2:161 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/mprotect.2:102 +msgid "Internal kernel structures could not be allocated." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:183 +#: build/C/man2/mprotect.2:112 msgid "" -"The mapping is not backed by any file; its contents are initialized to " -"zero. The I and I arguments are ignored; however, some " -"implementations require I to be -1 if B (or B) " -"is specified, and portable applications should ensure this. The use of " -"B in conjunction with B is only supported on " -"Linux since kernel 2.4." +"Addresses in the range [I, I+I-1] are invalid for the " +"address space of the process, or specify one or more pages that are not " +"mapped. (Before kernel 2.4.19, the error B was incorrectly produced " +"for these cases.)" msgstr "" -#. type: TP -#: build/C/man2/mmap.2:183 -#, no-wrap -msgid "B" +#. SVr4 defines an additional error +#. code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's. +#. type: Plain text +#: build/C/man2/mprotect.2:121 +msgid "" +"SVr4, POSIX.1-2001. POSIX says that the behavior of B() is " +"unspecified if it is applied to a region of memory that was not obtained via " +"B(2)." msgstr "" -#. Introduced in 1.1.36, removed in 1.3.24. #. type: Plain text -#: build/C/man2/mmap.2:191 +#: build/C/man2/mprotect.2:128 msgid "" -"This flag is ignored. (Long ago, it signaled that attempts to write to the " -"underlying file should fail with B. But this was a source of " -"denial-of-service attacks.)" +"On Linux it is always permissible to call B() on any address in a " +"process's address space (except for the kernel vsyscall area). In " +"particular it can be used to change existing code mappings to be writable." msgstr "" -#. type: TP -#: build/C/man2/mmap.2:191 +#. type: Plain text +#: build/C/man2/mprotect.2:138 +msgid "" +"Whether B has any effect different from B is " +"architecture- and kernel version-dependent. On some hardware architectures " +"(e.g., i386), B implies B." +msgstr "" + +#. type: Plain text +#: build/C/man2/mprotect.2:147 +msgid "" +"POSIX.1-2001 says that an implementation may permit access other than that " +"specified in I, but at a minimum can allow write access only if " +"B has been set, and must not allow any access if B " +"has been set." +msgstr "" + +#. type: Plain text +#: build/C/man2/mprotect.2:153 +msgid "" +"The program below allocates four pages of memory, makes the third of these " +"pages read-only, and then executes a loop that walks upward through the " +"allocated region modifying bytes." +msgstr "" + +#. type: Plain text +#: build/C/man2/mprotect.2:156 +msgid "An example of what we might see when running the program is the following:" +msgstr "" + +#. type: Plain text +#: build/C/man2/mprotect.2:162 #, no-wrap -msgid "B" +msgid "" +"$B< ./a.out>\n" +"Start of region: 0x804c000\n" +"Got SIGSEGV at address: 0x804e000\n" msgstr "" -#. Introduced in 1.1.38, removed in 1.3.24. Flag tested in proc_follow_link. -#. (Long ago, it signaled that the underlying file is an executable. -#. However, that information was not really used anywhere.) -#. Linus talked about DOS related to MAP_EXECUTABLE, but he was thinking of -#. MAP_DENYWRITE? #. type: Plain text -#: build/C/man2/mmap.2:199 -msgid "This flag is ignored." +#: build/C/man2/mprotect.2:174 +#, no-wrap +msgid "" +"#include Eunistd.hE\n" +"#include Esignal.hE\n" +"#include Estdio.hE\n" +"#include Emalloc.hE\n" +"#include Estdlib.hE\n" +"#include Eerrno.hE\n" +"#include Esys/mman.hE\n" msgstr "" -#. type: TP -#: build/C/man2/mmap.2:199 +#. type: Plain text +#: build/C/man2/mprotect.2:179 #, no-wrap -msgid "B" +msgid "static char *buffer;\n" msgstr "" -#. On some systems, this was required as the opposite of -#. MAP_ANONYMOUS -- mtk, 1 May 2007 #. type: Plain text -#: build/C/man2/mmap.2:205 -msgid "Compatibility flag. Ignored." -msgstr "" - -#. type: TP -#: build/C/man2/mmap.2:205 +#: build/C/man2/mprotect.2:187 #, no-wrap -msgid "B" +msgid "" +"static void\n" +"handler(int sig, siginfo_t *si, void *unused)\n" +"{\n" +" printf(\"Got SIGSEGV at address: 0x%lx\\en\",\n" +" (long) si-Esi_addr);\n" +" exit(EXIT_FAILURE);\n" +"}\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:223 +#: build/C/man2/mprotect.2:194 +#, no-wrap msgid "" -"Don't interpret I as a hint: place the mapping at exactly that " -"address. I must be a multiple of the page size. If the memory region " -"specified by I and I overlaps pages of any existing mapping(s), " -"then the overlapped part of the existing mapping(s) will be discarded. If " -"the specified address cannot be used, B() will fail. Because " -"requiring a fixed address for a mapping is less portable, the use of this " -"option is discouraged." +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" char *p;\n" +" int pagesize;\n" +" struct sigaction sa;\n" msgstr "" -#. type: TP -#: build/C/man2/mmap.2:223 +#. type: Plain text +#: build/C/man2/mprotect.2:200 #, no-wrap -msgid "B" +msgid "" +" sa.sa_flags = SA_SIGINFO;\n" +" sigemptyset(&sa.sa_mask);\n" +" sa.sa_sigaction = handler;\n" +" if (sigaction(SIGSEGV, &sa, NULL) == -1)\n" +" handle_error(\"sigaction\");\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:228 +#: build/C/man2/mprotect.2:204 +#, no-wrap msgid "" -"Used for stacks. Indicates to the kernel virtual memory system that the " -"mapping should extend downward in memory." +" pagesize = sysconf(_SC_PAGE_SIZE);\n" +" if (pagesize == -1)\n" +" handle_error(\"sysconf\");\n" msgstr "" -#. type: TP -#: build/C/man2/mmap.2:228 +#. type: Plain text +#: build/C/man2/mprotect.2:207 #, no-wrap -msgid "B (since Linux 2.6.32)" +msgid "" +" /* Allocate a buffer aligned on a page boundary;\n" +" initial protection is PROT_READ | PROT_WRITE */\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:234 +#: build/C/man2/mprotect.2:211 +#, no-wrap msgid "" -"Allocate the mapping using \"huge pages.\" See the kernel source file " -"I for further information." +" buffer = memalign(pagesize, 4 * pagesize);\n" +" if (buffer == NULL)\n" +" handle_error(\"memalign\");\n" msgstr "" -#. type: TP -#: build/C/man2/mmap.2:234 +#. type: Plain text +#: build/C/man2/mprotect.2:213 #, no-wrap -msgid "B (since Linux 2.5.37)" +msgid " printf(\"Start of region: 0x%lx\\en\", (long) buffer);\n" msgstr "" -#. If set, the mapped pages will not be swapped out. #. type: Plain text -#: build/C/man2/mmap.2:240 +#: build/C/man2/mprotect.2:217 +#, no-wrap msgid "" -"Lock the pages of the mapped region into memory in the manner of " -"B(2). This flag is ignored in older kernels." +" if (mprotect(buffer + pagesize * 2, pagesize,\n" +" PROT_READ) == -1)\n" +" handle_error(\"mprotect\");\n" msgstr "" -#. type: TP -#: build/C/man2/mmap.2:240 +#. type: Plain text +#: build/C/man2/mprotect.2:220 #, no-wrap -msgid "B (since Linux 2.5.46)" +msgid "" +" for (p = buffer ; ; )\n" +" *(p++) = \\(aqa\\(aq;\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:255 +#: build/C/man2/mprotect.2:224 +#, no-wrap msgid "" -"Only meaningful in conjunction with B. Don't perform " -"read-ahead: only create page tables entries for pages that are already " -"present in RAM. Since Linux 2.6.23, this flag causes B to do " -"nothing. One day the combination of B and B may " -"be reimplemented." +" printf(\"Loop completed\\en\"); /* Should never happen */\n" +" exit(EXIT_SUCCESS);\n" +"}\n" msgstr "" -#. type: TP -#: build/C/man2/mmap.2:255 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/mprotect.2:228 +msgid "B(2), B(3)" msgstr "" -#. type: Plain text -#: build/C/man2/mmap.2:270 -msgid "" -"Do not reserve swap space for this mapping. When swap space is reserved, " -"one has the guarantee that it is possible to modify the mapping. When swap " -"space is not reserved one might get B upon a write if no physical " -"memory is available. See also the discussion of the file " -"I in B(5). In kernels before 2.6, " -"this flag only had effect for private writable mappings." +#. type: TH +#: build/C/man2/mremap.2:30 +#, no-wrap +msgid "MREMAP" msgstr "" -#. type: TP -#: build/C/man2/mmap.2:270 +#. type: TH +#: build/C/man2/mremap.2:30 #, no-wrap -msgid "B (since Linux 2.5.46)" +msgid "2010-06-10" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:277 -msgid "" -"Populate (prefault) page tables for a mapping. For a file mapping, this " -"causes read-ahead on the file. Later accesses to the mapping will not be " -"blocked by page faults. B is only supported for private " -"mappings since Linux 2.6.23." +#: build/C/man2/mremap.2:33 +msgid "mremap - remap a virtual memory address" msgstr "" -#. type: TP -#: build/C/man2/mmap.2:277 +#. type: Plain text +#: build/C/man2/mremap.2:36 #, no-wrap -msgid "B (since Linux 2.6.27)" +msgid "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" msgstr "" -#. See http://lwn.net/Articles/294642 "Tangled up in threads", 19 Aug 08 -#. commit cd98a04a59e2f94fa64d5bf1e26498d27427d5e7 -#. http://thread.gmane.org/gmane.linux.kernel/720412 -#. "pthread_create() slow for many threads; also time to revisit 64b -#. context switch optimization?" #. type: Plain text -#: build/C/man2/mmap.2:290 -msgid "" -"Allocate the mapping at an address suitable for a process or thread stack. " -"This flag is currently a no-op, but is used in the glibc threading " -"implementation so that if some architectures require special treatment for " -"stack allocations, support can later be transparently implemented for glibc." -msgstr "" - -#. type: TP -#: build/C/man2/mmap.2:290 +#: build/C/man2/mremap.2:41 #, no-wrap -msgid "B (since Linux 2.6.33)" +msgid "" +"BIB<, size_t >IB<,>\n" +"B< size_t >IB<, int >IB<, ... /* void " +"*>IB< */);>\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:300 +#: build/C/man2/mremap.2:47 msgid "" -"Don't clear anonymous pages. This flag is intended to improve performance " -"on embedded devices. This flag is only honored if the kernel was configured " -"with the B option. Because of the security " -"implications, that option is normally enabled only on embedded devices " -"(i.e., devices where one has complete control of the contents of user " -"memory)." +"B() expands (or shrinks) an existing memory mapping, potentially " +"moving it at the same time (controlled by the I argument and the " +"available virtual address space)." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:308 +#: build/C/man2/mremap.2:61 msgid "" -"Of the above flags, only B is specified in POSIX.1-2001. " -"However, most systems also support B (or its synonym " -"B)." +"I is the old address of the virtual memory block that you want " +"to expand (or shrink). Note that I has to be page aligned. " +"I is the old size of the virtual memory block. I is the " +"requested size of the virtual memory block after the resize. An optional " +"fifth argument, I, may be provided; see the description of " +"B below." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:315 +#: build/C/man2/mremap.2:73 msgid "" -"Some systems document the additional flags B, " -"B, B, and B." +"In Linux the memory is divided into pages. A user process has (one or) " +"several linear virtual memory segments. Each virtual memory segment has one " +"or more mappings to real memory pages (in the page table). Each virtual " +"memory segment has its own protection (access rights), which may cause a " +"segmentation violation if the memory is accessed incorrectly (e.g., writing " +"to a read-only segment). Accessing virtual memory outside of the segments " +"will also cause a segmentation violation." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:321 +#: build/C/man2/mremap.2:81 msgid "" -"Memory mapped by B() is preserved across B(2), with the same " -"attributes." +"B() uses the Linux page table scheme. B() changes the " +"mapping between virtual addresses and memory pages. This can be used to " +"implement a very efficient B(3)." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:329 -msgid "" -"A file is mapped in multiples of the page size. For a file that is not a " -"multiple of the page size, the remaining memory is zeroed when mapped, and " -"writes to that region are not written out to the file. The effect of " -"changing the size of the underlying file of a mapping on the pages that " -"correspond to added or removed regions of the file is unspecified." +#: build/C/man2/mremap.2:83 +msgid "The I bit-mask argument may be 0, or include the following flag:" msgstr "" -#. type: SS -#: build/C/man2/mmap.2:329 +#. type: TP +#: build/C/man2/mremap.2:83 #, no-wrap -msgid "munmap()" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:339 +#: build/C/man2/mremap.2:95 msgid "" -"The B() system call deletes the mappings for the specified address " -"range, and causes further references to addresses within the range to " -"generate invalid memory references. The region is also automatically " -"unmapped when the process is terminated. On the other hand, closing the " -"file descriptor does not unmap the region." +"By default, if there is not sufficient space to expand a mapping at its " +"current location, then B() fails. If this flag is specified, then " +"the kernel is permitted to relocate the mapping to a new virtual address, if " +"necessary. If the mapping is relocated, then absolute pointers into the old " +"mapping location become invalid (offsets relative to the starting address of " +"the mapping should be employed)." msgstr "" -#. type: Plain text -#: build/C/man2/mmap.2:349 -msgid "" -"The address I must be a multiple of the page size. All pages " -"containing a part of the indicated range are unmapped, and subsequent " -"references to these pages will generate B. It is not an error if " -"the indicated range does not contain any mapped pages." +#. type: TP +#: build/C/man2/mremap.2:95 +#, no-wrap +msgid "B (since Linux 2.3.31)" msgstr "" -#. type: SS -#: build/C/man2/mmap.2:349 -#, no-wrap -msgid "Timestamps changes for file-backed mappings" +#. type: Plain text +#: build/C/man2/mremap.2:117 +msgid "" +"This flag serves a similar purpose to the B flag of B(2). " +"If this flag is specified, then B() accepts a fifth argument, " +"I, which specifies a page-aligned address to which the " +"mapping must be moved. Any previous mapping at the address range specified " +"by I and I is unmapped. If B is " +"specified, then B must also be specified." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:356 +#: build/C/man2/mremap.2:127 msgid "" -"For file-backed mappings, the I field for the mapped file may be " -"updated at any time between the B() and the corresponding unmapping; " -"the first reference to a mapped page will update the field if it has not " -"been already." +"If the memory segment specified by I and I is locked " +"(using B(2) or similar), then this lock is maintained when the " +"segment is resized and/or relocated. As a consequence, the amount of memory " +"locked by the process may change." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:373 +#: build/C/man2/mremap.2:135 msgid "" -"The I and I field for a file mapped with B " -"and B will be updated after a write to the mapped region, and " -"before a subsequent B(2) with the B or B flag, if " -"one occurs." +"On success B() returns a pointer to the new virtual memory area. " +"On error, the value B (that is, I<(void\\ *)\\ -1>) is returned, " +"and I is set appropriately." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:390 +#: build/C/man2/mremap.2:142 msgid "" -"On success, B() returns a pointer to the mapped area. On error, the " -"value B (that is, I<(void\\ *)\\ -1>) is returned, and I " -"is set appropriately. On success, B() returns 0, on failure -1, " -"and I is set (probably to B)." +"The caller tried to expand a memory segment that is locked, but this was not " +"possible without exceeding the B resource limit." msgstr "" -#. type: TP -#: build/C/man2/mmap.2:391 build/C/man2/mprotect.2:80 build/C/man3/shm_open.3:185 build/C/man3/shm_open.3:190 build/C/man2/shmctl.2:295 build/C/man2/shmget.2:186 build/C/man2/shmop.2:189 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/mremap.2:151 +msgid "" +"\"Segmentation fault.\" Some address in the range I to " +"I+I is an invalid virtual memory address for this " +"process. You can also get B even if there exist mappings that cover " +"the whole address space requested, but those mappings are of different " +"types." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:411 +#: build/C/man2/mremap.2:179 msgid "" -"A file descriptor refers to a non-regular file. Or B was " -"requested, but I is not open for reading. Or B was " -"requested and B is set, but I is not open in read/write " -"(B) mode. Or B is set, but the file is append-only." +"An invalid argument was given. Possible causes are: I was not " +"page aligned; a value other than B or B was " +"specified in I; I was zero; I or I " +"was invalid; or the new address range specified by I and " +"I overlapped the old address range specified by I and " +"I; or B was specified without also specifying " +"B." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:415 +#: build/C/man2/mremap.2:185 msgid "" -"The file has been locked, or too much memory has been locked (see " -"B(2))." +"The memory area cannot be expanded at the current virtual address, and the " +"B flag is not set in I. Or, there is not enough " +"(virtual) memory available." msgstr "" +#. 4.2BSD had a (never actually implemented) +#. .BR mremap (2) +#. call with completely different semantics. #. type: Plain text -#: build/C/man2/mmap.2:421 -msgid "I is not a valid file descriptor (and B was not set)." +#: build/C/man2/mremap.2:191 +msgid "" +"This call is Linux-specific, and should not be used in programs intended to " +"be portable." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:429 +#: build/C/man2/mremap.2:199 msgid "" -"We don't like I, I, or I (e.g., they are too large, or " -"not aligned on a page boundary)." +"Prior to version 2.4, glibc did not expose the definition of " +"B, and the prototype for B() did not allow for the " +"I argument." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:434 -msgid "(since Linux 2.6.12) I was 0." +#: build/C/man2/mremap.2:208 +msgid "" +"B(2), B(2), B(2), B(2), B(2), " +"B(2), B(3), B(3)" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:442 +#: build/C/man2/mremap.2:214 msgid "" -"I contained neither B or B, or contained " -"both of these values." +"Your favorite text book on operating systems for more information on paged " +"memory (e.g., I by Andrew S. Tanenbaum, I by Randolf Bentson, I by " +"Maurice J. Bach)" msgstr "" -#. type: TP -#: build/C/man2/mmap.2:442 build/C/man3/shm_open.3:227 build/C/man2/shmget.2:202 +#. type: TH +#: build/C/man2/msync.2:25 #, no-wrap -msgid "B" +msgid "MSYNC" +msgstr "" + +#. type: TH +#: build/C/man2/msync.2:25 +#, no-wrap +msgid "2014-04-20" msgstr "" -#. [2.6.7] shmem_zero_setup()-->shmem_file_setup()-->get_empty_filp() #. type: Plain text -#: build/C/man2/mmap.2:450 build/C/man2/shmget.2:206 -msgid "The system limit on the total number of open files has been reached." +#: build/C/man2/msync.2:28 +msgid "msync - synchronize a file with a memory map" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:454 +#: build/C/man2/msync.2:32 +msgid "BIB<, size_t >IB<, int >IB<);>" +msgstr "" + +#. type: Plain text +#: build/C/man2/msync.2:48 msgid "" -"The underlying file system of the specified file does not support memory " -"mapping." +"B() flushes changes made to the in-core copy of a file that was " +"mapped into memory using B(2) back to the filesystem. Without use of " +"this call there is no guarantee that changes are written back before " +"B(2) is called. To be more precise, the part of the file that " +"corresponds to the memory area starting at I and having length " +"I is updated." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:458 +#: build/C/man2/msync.2:68 msgid "" -"No memory is available, or the process's maximum number of mappings would " -"have been exceeded." +"The I argument may have the bits B, B, and " +"B set, but not both B and B. B " +"specifies that an update be scheduled, but the call returns immediately. " +"B asks for an update and waits for it to complete. " +"B asks to invalidate other mappings of the same file (so that " +"they can be updated with the fresh values just written)." msgstr "" -#. (Since 2.4.25 / 2.6.0.) #. type: Plain text -#: build/C/man2/mmap.2:467 +#: build/C/man2/msync.2:73 msgid "" -"The I argument asks for B but the mapped area belongs to a " -"file on a file system that was mounted no-exec." +"On success, zero is returned. On error, -1 is returned, and I is set " +"appropriately." msgstr "" #. type: TP -#: build/C/man2/mmap.2:467 +#: build/C/man2/msync.2:74 #, no-wrap -msgid "B" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:473 +#: build/C/man2/msync.2:80 msgid "" -"B was set but the object specified by I is open for " -"writing." +"B was specified in I, and a memory lock exists for the " +"specified address range." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:475 -msgid "Use of a mapped region can result in these signals:" -msgstr "" - -#. type: TP -#: build/C/man2/mmap.2:475 -#, no-wrap -msgid "B" +#: build/C/man2/msync.2:93 +msgid "" +"I is not a multiple of PAGESIZE; or any bit other than B | " +"B | B is set in I; or both B and " +"B are set in I." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:478 -msgid "Attempted write into a region mapped as read-only." -msgstr "" - -#. type: TP -#: build/C/man2/mmap.2:478 -#, no-wrap -msgid "B" +#: build/C/man2/msync.2:96 +msgid "The indicated memory (or part of it) was not mapped." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:483 -msgid "" -"Attempted access to a portion of the buffer that does not correspond to the " -"file (for example, beyond the end of the file, including the case where " -"another process has truncated the file)." +#: 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 +msgid "POSIX.1-2001." msgstr "" -#. SVr4 documents additional error codes ENXIO and ENODEV. -#. SUSv2 documents additional error codes EMFILE and EOVERFLOW. #. type: Plain text -#: build/C/man2/mmap.2:487 -msgid "SVr4, 4.4BSD, POSIX.1-2001." +#: build/C/man2/msync.2:105 +msgid "" +"This call was introduced in Linux 1.3.21, and then used B instead of " +"B. In Linux 2.4.19, this was changed to the POSIX value B." msgstr "" #. POSIX.1-2001: It shall be defined to -1 or 0 or 200112L. #. -1: unavailable, 0: ask using sysconf(). -#. glibc defines it to 1. +#. glibc defines them to 1. #. type: Plain text -#: build/C/man2/mmap.2:501 +#: build/C/man2/msync.2:120 msgid "" -"On POSIX systems on which B(), B(2) and B() are " -"available, B<_POSIX_MAPPED_FILES> is defined in Iunistd.hE> to a " -"value greater than 0. (See also B(3).)" +"On POSIX systems on which B() is available, both " +"B<_POSIX_MAPPED_FILES> and B<_POSIX_SYNCHRONIZED_IO> are defined in " +"Iunistd.hE> to a value greater than 0. (See also B(3).)" msgstr "" -#. Since around glibc 2.1/2.2, depending on the platform. +#. commit 204ec841fbea3e5138168edbc3a76d46747cc987 #. type: Plain text -#: build/C/man2/mmap.2:516 +#: build/C/man2/msync.2:147 msgid "" -"This page describes the interface provided by the glibc B() wrapper " -"function. Originally, this function invoked a system call of the same " -"name. Since kernel 2.4, that system call has been superseded by " -"B(2), and nowadays the glibc B() wrapper function invokes " -"B(2) with a suitably adjusted value for I." +"According to POSIX, either B or B must be specified in " +"I, and indeed failure to include one of these flags will cause " +"B() to fail on some systems. However, Linux permits a call to " +"B() that specifies neither of these flags, with semantics that are " +"(currently) equivalent to specifying B. (Since Linux 2.6.19, " +"B is in fact a no-op, since the kernel properly tracks dirty pages " +"and flushes them to storage as necessary.) Notwithstanding the Linux " +"behavior, portable, future-proof applications should ensure that they " +"specify either B or B in I." +msgstr "" + +#. type: TP +#: build/C/man2/msync.2:149 build/C/man7/shm_overview.7:46 +#, no-wrap +msgid "B(2)" +msgstr "" + +#. type: TH +#: build/C/man3/mtrace.3:25 +#, no-wrap +msgid "MTRACE" +msgstr "" + +#. type: TH +#: build/C/man3/mtrace.3:25 +#, no-wrap +msgid "2012-04-18" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:529 -msgid "" -"On some hardware architectures (e.g., i386), B implies " -"B. It is architecture dependent whether B implies " -"B or not. Portable programs should always set B if " -"they intend to execute code in the new mapping." +#: build/C/man3/mtrace.3:28 +msgid "mtrace, muntrace - malloc tracing" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:544 -msgid "" -"The portable way to create a mapping is to specify I as 0 (NULL), and " -"omit B from I. In this case, the system chooses the " -"address for the mapping; the address is chosen so as not to conflict with " -"any existing mapping, and will not be 0. If the B flag is " -"specified, and I is 0 (NULL), then the mapped address will be 0 " -"(NULL)." +#: build/C/man3/mtrace.3:30 +msgid "B<#include Emcheck.hE>" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:549 -msgid "" -"On Linux there are no guarantees like those suggested above under " -"B. By default, any process can be killed at any moment when " -"the system runs out of memory." +#: build/C/man3/mtrace.3:32 +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:556 -msgid "" -"In kernels before 2.6.7, the B flag only has effect if I " -"is specified as B." +#: build/C/man3/mtrace.3:34 +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:571 +#: build/C/man3/mtrace.3:46 msgid "" -"SUSv3 specifies that B() should fail if I is 0. However, in " -"kernels before 2.6.12, B() succeeded in this case: no mapping was " -"created and the call returned I. Since kernel 2.6.12, B() " -"fails with the error B for this case." +"The B() function installs hook functions for the memory-allocation " +"functions (B(3), B(3) B(3), B(3)). These " +"hook functions record tracing information about memory allocation and " +"deallocation. The tracing information can be used to discover memory leaks " +"and attempts to free nonallocated memory in a program." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:583 +#: build/C/man3/mtrace.3:57 msgid "" -"The following program prints part of the file specified in its first " -"command-line argument to standard output. The range of bytes to be printed " -"is specified via offset and length values in the second and third " -"command-line arguments. The program creates a memory mapping of the " -"required pages of the file and then uses B(2) to output the desired " -"bytes." +"The B() function disables the hook functions installed by " +"B(), so that tracing information is no longer recorded for the " +"memory-allocation functions. If no hook functions were successfully " +"installed by B(), B() does nothing." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:591 -#, no-wrap +#: build/C/man3/mtrace.3:65 msgid "" -"#include Esys/mman.hE\n" -"#include Esys/stat.hE\n" -"#include Efcntl.hE\n" -"#include Estdio.hE\n" -"#include Estdlib.hE\n" -"#include Eunistd.hE\n" +"When B() is called, it checks the value of the environment variable " +"B, which should contain the pathname of a file in which the " +"tracing information is to be recorded. If the pathname is successfully " +"opened, it is truncated to zero length." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:594 build/C/man2/mprotect.2:172 -#, no-wrap +#: build/C/man3/mtrace.3:78 msgid "" -"#define handle_error(msg) \\e\n" -" do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" +"If B is not set, or the pathname it specifies is invalid or " +"not writable, then no hook functions are installed, and B() has no " +"effect. In set-user-ID and set-group-ID programs, B is " +"ignored, and B() has no effect." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:604 -#, no-wrap +#: build/C/man3/mtrace.3:86 msgid "" -"int\n" -"main(int argc, char *argv[])\n" -"{\n" -" char *addr;\n" -" int fd;\n" -" struct stat sb;\n" -" off_t offset, pa_offset;\n" -" size_t length;\n" -" ssize_t s;\n" +"In normal usage, B() is called once at the start of execution of a " +"program, and B() is never called." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:609 -#, no-wrap +#: build/C/man3/mtrace.3:96 msgid "" -" if (argc E 3 || argc E 4) {\n" -" fprintf(stderr, \"%s file offset [length]\\en\", argv[0]);\n" -" exit(EXIT_FAILURE);\n" -" }\n" +"The tracing output produced after a call to B() is textual, but not " +"designed to be human readable. The GNU C library provides a Perl script, " +"B(1), that interprets the trace log and produces human-readable " +"output. For best results, the traced program should be compiled with " +"debugging enabled, so that line-number information is recorded in the " +"executable." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:613 -#, no-wrap +#: build/C/man3/mtrace.3:102 msgid "" -" fd = open(argv[1], O_RDONLY);\n" -" if (fd == -1)\n" -" handle_error(\"open\");\n" +"The tracing performed by B() incurs a performance penalty (if " +"B points to a valid, writable pathname)." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:616 -#, no-wrap +#: build/C/man3/mtrace.3:108 msgid "" -" if (fstat(fd, &sb) == -1) /* To obtain file size */\n" -" handle_error(\"fstat\");\n" +"The line-number information produced by B(1) is not always precise: " +"the line number references may refer to the previous or following (nonblank) " +"line of the source code." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:620 -#, no-wrap +#: build/C/man3/mtrace.3:115 msgid "" -" offset = atoi(argv[2]);\n" -" pa_offset = offset & ~(sysconf(_SC_PAGE_SIZE) - 1);\n" -" /* offset for mmap() must be page aligned */\n" +"The shell session below demonstrates the use of the B() function " +"and the B(1) command in a program that has memory leaks at two " +"different locations. The demonstration uses the following program:" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:625 +#: build/C/man3/mtrace.3:122 #, no-wrap msgid "" -" if (offset E= sb.st_size) {\n" -" fprintf(stderr, \"offset is past end of file\\en\");\n" -" exit(EXIT_FAILURE);\n" -" }\n" +"$ B\n" +"#include Emcheck.hE\n" +"#include Estdlib.hE\n" +"#include Estdio.hE\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:631 +#: build/C/man3/mtrace.3:127 #, no-wrap msgid "" -" if (argc == 4) {\n" -" length = atoi(argv[3]);\n" -" if (offset + length E sb.st_size)\n" -" length = sb.st_size - offset;\n" -" /* Can\\(aqt display bytes past end of file */\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" int j;\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:635 +#: build/C/man3/mtrace.3:129 #, no-wrap -msgid "" -" } else { /* No length arg ==E display to end of file */\n" -" length = sb.st_size - offset;\n" -" }\n" +msgid " mtrace();\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:640 +#: build/C/man3/mtrace.3:132 #, no-wrap msgid "" -" addr = mmap(NULL, length + offset - pa_offset, PROT_READ,\n" -" MAP_PRIVATE, fd, pa_offset);\n" -" if (addr == MAP_FAILED)\n" -" handle_error(\"mmap\");\n" +" for (j = 0; j E 2; j++)\n" +" malloc(100); /* Never freed--a memory leak */\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:645 +#: build/C/man3/mtrace.3:136 #, no-wrap msgid "" -" s = write(STDOUT_FILENO, addr + offset - pa_offset, length);\n" -" if (s != length) {\n" -" if (s == -1)\n" -" handle_error(\"write\");\n" +" calloc(16, 16); /* Never freed--a memory leak */\n" +" exit(EXIT_SUCCESS);\n" +"}\n" +msgstr "" + +#. type: Plain text +#: build/C/man3/mtrace.3:142 +msgid "" +"When we run the program as follows, we see that B() diagnosed " +"memory leaks at two different locations in the program:" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:649 +#: build/C/man3/mtrace.3:155 #, no-wrap msgid "" -" fprintf(stderr, \"partial write\");\n" -" exit(EXIT_FAILURE);\n" -" }\n" +"$ B\n" +"$ B\n" +"$ B<./t_mtrace>\n" +"$ B\n" +"Memory not freed:\n" +"-----------------\n" +" Address Size Caller\n" +"0x084c9378 0x64 at /home/cecilia/t_mtrace.c:12\n" +"0x084c93e0 0x64 at /home/cecilia/t_mtrace.c:12\n" +"0x084c9448 0x100 at /home/cecilia/t_mtrace.c:16\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:666 +#: build/C/man3/mtrace.3:167 msgid "" -"B(2), B(2), B(2), B(2), B(2), " -"B(2), B(2), B(2), B(2), " -"B(2), B(3), B(7)" +"The first two messages about unfreed memory correspond to the two " +"B(3) calls inside the I loop. The final message corresponds " +"to the call to B(3) (which in turn calls B(3))." msgstr "" #. type: Plain text -#: build/C/man2/mmap.2:671 build/C/man2/msync.2:122 -msgid "B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391." +#: build/C/man3/mtrace.3:172 +msgid "B(1), B(3), B(3), B(3)" msgstr "" #. type: TH -#: build/C/man2/mmap2.2:29 +#: build/C/man2/posix_fadvise.2:28 #, no-wrap -msgid "MMAP2" +msgid "POSIX_FADVISE" msgstr "" #. type: Plain text -#: build/C/man2/mmap2.2:32 -msgid "mmap2 - map files or devices into memory" +#: build/C/man2/posix_fadvise.2:31 +msgid "posix_fadvise - predeclare an access pattern for file data" msgstr "" #. type: Plain text -#: build/C/man2/mmap2.2:38 +#: build/C/man2/posix_fadvise.2:34 build/C/man3/posix_fallocate.3:31 #, no-wrap -msgid "" -"BIB<, size_t >IB<, int >IB<,>\n" -"B< int >IB<, int >IB<, off_t >IB<);>\n" -msgstr "" - -#. type: Plain text -#: build/C/man2/mmap2.2:43 -msgid "" -"This is probably not the system call you are interested; instead, see " -"B(2), which describes the glibc wrapper function that invokes this " -"system call." +msgid "B<#include Efcntl.hE>\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap2.2:54 +#: build/C/man2/posix_fadvise.2:37 +#, no-wrap msgid "" -"The B() system call provides the same interface as B(2), " -"except that the final argument specifies the offset into the file in " -"4096-byte units (instead of bytes, as is done by B(2)). This enables " -"applications that use a 32-bit I to map large files (up to 2^44 " -"bytes)." +"BIB<, off_t >IB<, off_t >IB<, int " +">IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man2/mmap2.2:61 -msgid "" -"On success, B() returns a pointer to the mapped area. On error -1 " -"is returned and I is set appropriately." +#: build/C/man2/posix_fadvise.2:46 +msgid "B():" msgstr "" #. type: Plain text -#: build/C/man2/mmap2.2:65 -msgid "Problem with getting the data from userspace." +#: build/C/man2/posix_fadvise.2:48 build/C/man3/posix_fallocate.3:44 +msgid "_XOPEN_SOURCE\\ E=\\ 600 || _POSIX_C_SOURCE\\ E=\\ 200112L" msgstr "" #. type: Plain text -#: build/C/man2/mmap2.2:70 +#: build/C/man2/posix_fadvise.2:56 msgid "" -"(Various platforms where the page size is not 4096 bytes.) I " -"is not a multiple of the system page size." +"Programs can use B() to announce an intention to access file " +"data in a specific pattern in the future, thus allowing the kernel to " +"perform appropriate optimizations." msgstr "" #. type: Plain text -#: build/C/man2/mmap2.2:74 -msgid "B() can also return any of the errors described in B(2)." +#: build/C/man2/posix_fadvise.2:63 +msgid "" +"The I applies to a (not necessarily existent) region starting at " +"I and extending for I bytes (or until the end of the file if " +"I is 0) within the file referred to by I. The I is not " +"binding; it merely constitutes an expectation on behalf of the application." msgstr "" #. type: Plain text -#: build/C/man2/mmap2.2:77 -msgid "B() is available since Linux 2.3.31." +#: build/C/man2/posix_fadvise.2:65 +msgid "Permissible values for I include:" msgstr "" -#. type: Plain text -#: build/C/man2/mmap2.2:79 build/C/man2/subpage_prot.2:93 -msgid "This system call is Linux-specific." +#. type: TP +#: build/C/man2/posix_fadvise.2:65 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mmap2.2:85 +#: build/C/man2/posix_fadvise.2:71 msgid "" -"Nowadays, the glibc B() wrapper function invokes this system call " -"rather than the B(2) system call." +"Indicates that the application has no advice to give about its access " +"pattern for the specified data. If no advice is given for an open file, " +"this is the default assumption." msgstr "" -#. ia64 can have page sizes ranging from 4kB to 64kB. -#. On cris, it looks like the unit might also be the page size, -#. which is 8192 bytes. -- mtk, June 2007 -#. type: Plain text -#: build/C/man2/mmap2.2:92 -msgid "" -"On ia64, the unit for I is actually the system page size, rather " -"than 4096 bytes." +#. type: TP +#: build/C/man2/posix_fadvise.2:71 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mmap2.2:98 -msgid "B(2), B(2), B(2), B(2), B(3)" -msgstr "" - -#. type: TH -#: build/C/man2/mprotect.2:32 -#, no-wrap -msgid "MPROTECT" +#: build/C/man2/posix_fadvise.2:75 +msgid "" +"The application expects to access the specified data sequentially (with " +"lower offsets read before higher ones)." msgstr "" -#. type: TH -#: build/C/man2/mprotect.2:32 +#. type: TP +#: build/C/man2/posix_fadvise.2:75 #, no-wrap -msgid "2011-09-08" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:35 -msgid "mprotect - set protection on a region of memory" +#: build/C/man2/posix_fadvise.2:78 +msgid "The specified data will be accessed in random order." msgstr "" -#. type: Plain text -#: build/C/man2/mprotect.2:40 +#. type: TP +#: build/C/man2/posix_fadvise.2:78 #, no-wrap -msgid "BIB<, size_t >IB<, int >IB<);>\n" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:48 -msgid "" -"B() changes protection for the calling process's memory page(s) " -"containing any part of the address range in the interval [I,\\ " -"I+I-1]. I must be aligned to a page boundary." +#: build/C/man2/posix_fadvise.2:81 +msgid "The specified data will be accessed only once." msgstr "" -#. type: Plain text -#: build/C/man2/mprotect.2:53 -msgid "" -"If the calling process tries to access memory in a manner that violates the " -"protection, then the kernel generates a B signal for the process." +#. type: TP +#: build/C/man2/posix_fadvise.2:81 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:58 -msgid "" -"I is either B or a bitwise-or of the other values in the " -"following list:" +#: build/C/man2/posix_fadvise.2:84 +msgid "The specified data will be accessed in the near future." msgstr "" -#. type: Plain text -#: build/C/man2/mprotect.2:61 -msgid "The memory cannot be accessed at all." +#. type: TP +#: build/C/man2/posix_fadvise.2:84 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:64 -msgid "The memory can be read." +#: build/C/man2/posix_fadvise.2:87 +msgid "The specified data will not be accessed in the near future." msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:67 -msgid "The memory can be modified." +#: build/C/man2/posix_fadvise.2:90 +msgid "On success, zero is returned. On error, an error number is returned." msgstr "" -#. FIXME -#. Document PROT_GROWSUP and PROT_GROWSDOWN #. type: Plain text -#: build/C/man2/mprotect.2:72 -msgid "The memory can be executed." +#: build/C/man2/posix_fadvise.2:94 +msgid "The I argument was not a valid file descriptor." msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:79 -msgid "" -"On success, B() returns zero. On error, -1 is returned, and " -"I is set appropriately." +#: build/C/man2/posix_fadvise.2:97 +msgid "An invalid value was specified for I." msgstr "" +#. commit 87ba81dba431232548ce29d5d224115d0c2355ac #. type: Plain text -#: build/C/man2/mprotect.2:89 +#: build/C/man2/posix_fadvise.2:107 msgid "" -"The memory cannot be given the specified access. This can happen, for " -"example, if you B(2) a file to which you have read-only access, then " -"ask B() to mark it B." +"The specified file descriptor refers to a pipe or FIFO. (B is the " +"error specified by POSIX, but before kernel version 2.16, Linux returned " +"B in this case.)" msgstr "" -#. Or: both PROT_GROWSUP and PROT_GROWSDOWN were specified in 'prot'. +#. of fadvise64_64() #. type: Plain text -#: build/C/man2/mprotect.2:94 -msgid "I is not a valid pointer, or not a multiple of the system page size." +#: build/C/man2/posix_fadvise.2:115 +msgid "" +"Kernel support first appeared in Linux 2.5.60; the underlying system call is " +"called B(). Library support has been provided since glibc " +"version 2.2, via the wrapper function B()." msgstr "" +#. commit d3ac21cacc24790eb45d735769f35753f5b56ceb #. type: Plain text -#: build/C/man2/mprotect.2:97 -msgid "Internal kernel structures could not be allocated." +#: build/C/man2/posix_fadvise.2:122 +msgid "" +"Since Linux 3.18, support for the underlying system call is optional, " +"depending on the setting of the B configuration " +"option." msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:107 +#: build/C/man2/posix_fadvise.2:131 msgid "" -"Addresses in the range [I, I+I-1] are invalid for the " -"address space of the process, or specify one or more pages that are not " -"mapped. (Before kernel 2.4.19, the error B was incorrectly produced " -"for these cases.)" +"POSIX.1-2001. Note that the type of the I argument was changed from " +"I to I in POSIX.1-2003 TC1." msgstr "" -#. SVr4 defines an additional error -#. code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's. #. type: Plain text -#: build/C/man2/mprotect.2:116 +#: build/C/man2/posix_fadvise.2:137 msgid "" -"SVr4, POSIX.1-2001. POSIX says that the behavior of B() is " -"unspecified if it is applied to a region of memory that was not obtained via " -"B(2)." +"Under Linux, B sets the readahead window to the default " +"size for the backing device; B doubles this size, and " +"B disables file readahead entirely. These changes affect " +"the entire file, not just the specified region (but other open file handles " +"to the same file are unaffected)." msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:123 +#: build/C/man2/posix_fadvise.2:144 msgid "" -"On Linux it is always permissible to call B() on any address in a " -"process's address space (except for the kernel vsyscall area). In " -"particular it can be used to change existing code mappings to be writable." +"B initiates a nonblocking read of the specified region " +"into the page cache. The amount of data read may be decreased by the kernel " +"depending on virtual memory load. (A few megabytes will usually be fully " +"satisfied, and more is rarely useful.)" msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:133 +#: build/C/man2/posix_fadvise.2:148 msgid "" -"Whether B has any effect different from B is " -"architecture- and kernel version-dependent. On some hardware architectures " -"(e.g., i386), B implies B." +"In kernels before 2.6.18, B had the same semantics as " +"B. This was probably a bug; since kernel 2.6.18, this " +"flag is a no-op." msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:142 +#: build/C/man2/posix_fadvise.2:156 msgid "" -"POSIX.1-2001 says that an implementation may permit access other than that " -"specified in I, but at a minimum can only allow write access if " -"B has been set, and must not allow any access if B " -"has been set." +"B attempts to free cached pages associated with the " +"specified region. This is useful, for example, while streaming large " +"files. A program may periodically request the kernel to free cached data " +"that has already been used, so that more useful cached pages are not " +"discarded instead." msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:148 +#: build/C/man2/posix_fadvise.2:164 msgid "" -"The program below allocates four pages of memory, makes the third of these " -"pages read-only, and then executes a loop that walks upward through the " -"allocated region modifying bytes." +"Requests to discard partial pages are ignored. It is preferable to preserve " +"needed data than discard unneeded data. If the application requires that " +"data be considered for discarding then I and I must be " +"page-aligned." msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:151 -msgid "An example of what we might see when running the program is the following:" +#: build/C/man2/posix_fadvise.2:172 +msgid "" +"Pages that have not yet been written out will be unaffected, so if the " +"application wishes to guarantee that pages will be released, it should call " +"B(2) or B(2) first." msgstr "" -#. type: Plain text -#: build/C/man2/mprotect.2:157 +#. type: SS +#: build/C/man2/posix_fadvise.2:172 #, no-wrap -msgid "" -"$B< ./a.out>\n" -"Start of region: 0x804c000\n" -"Got SIGSEGV at address: 0x804e000\n" +msgid "Architecture-specific variants" msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:169 -#, no-wrap +#: build/C/man2/posix_fadvise.2:189 msgid "" -"#include Eunistd.hE\n" -"#include Esignal.hE\n" -"#include Estdio.hE\n" -"#include Emalloc.hE\n" -"#include Estdlib.hE\n" -"#include Eerrno.hE\n" -"#include Esys/mman.hE\n" +"Some architectures require 64-bit arguments to be aligned in a suitable pair " +"of registers (see B(2) for further detail). On such " +"architectures, the call signature of B() shown in the " +"SYNOPSIS would force a register to be wasted as padding between the I " +"and I arguments. Therefore, these architectures define a version of " +"the system call that orders the arguments suitably, but otherwise is " +"otherwise exactly the same as B()." msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:174 -#, no-wrap -msgid "char *buffer;\n" +#: build/C/man2/posix_fadvise.2:191 +msgid "For example, since Linux 2.6.14, ARM has the following system call:" msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:182 +#: build/C/man2/posix_fadvise.2:196 #, no-wrap msgid "" -"static void\n" -"handler(int sig, siginfo_t *si, void *unused)\n" -"{\n" -" printf(\"Got SIGSEGV at address: 0x%lx\\en\",\n" -" (long) si-Esi_addr);\n" -" exit(EXIT_FAILURE);\n" -"}\n" +"BIB<, int >IB<,>\n" +"B< loff_t >IB<, loff_t >IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:189 -#, no-wrap +#: build/C/man2/posix_fadvise.2:204 msgid "" -"int\n" -"main(int argc, char *argv[])\n" -"{\n" -" char *p;\n" -" int pagesize;\n" -" struct sigaction sa;\n" +"These architecture-specific details are generally hidden from applications " +"by the glibc B() wrapper function, which invokes the " +"appropriate architecture-specific system call." msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:195 -#, no-wrap +#: build/C/man2/posix_fadvise.2:209 msgid "" -" sa.sa_flags = SA_SIGINFO;\n" -" sigemptyset(&sa.sa_mask);\n" -" sa.sa_sigaction = handler;\n" -" if (sigaction(SIGSEGV, &sa, NULL) == -1)\n" -" handle_error(\"sigaction\");\n" +"In kernels before 2.6.6, if I was specified as 0, then this was " +"interpreted literally as \"zero bytes\", rather than as meaning \"all bytes " +"through to the end of the file\"." msgstr "" +#. FIXME . Write a posix_fadvise(3) page. #. type: Plain text -#: build/C/man2/mprotect.2:199 -#, no-wrap +#: build/C/man2/posix_fadvise.2:215 msgid "" -" pagesize = sysconf(_SC_PAGE_SIZE);\n" -" if (pagesize == -1)\n" -" handle_error(\"sysconf\");\n" +"B(2), B(2), B(3), " +"B(3)" msgstr "" -#. type: Plain text -#: build/C/man2/mprotect.2:202 +#. type: TH +#: build/C/man3/posix_fallocate.3:25 #, no-wrap -msgid "" -" /* Allocate a buffer aligned on a page boundary;\n" -" initial protection is PROT_READ | PROT_WRITE */\n" +msgid "POSIX_FALLOCATE" msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:206 -#, no-wrap -msgid "" -" buffer = memalign(pagesize, 4 * pagesize);\n" -" if (buffer == NULL)\n" -" handle_error(\"memalign\");\n" +#: build/C/man3/posix_fallocate.3:28 +msgid "posix_fallocate - allocate file space" msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:208 +#: build/C/man3/posix_fallocate.3:33 #, no-wrap -msgid " printf(\"Start of region: 0x%lx\\en\", (long) buffer);\n" +msgid "BIB<, off_t >IB<, off_t >IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:212 -#, no-wrap -msgid "" -" if (mprotect(buffer + pagesize * 2, pagesize,\n" -" PROT_READ) == -1)\n" -" handle_error(\"mprotect\");\n" +#: build/C/man3/posix_fallocate.3:42 +msgid "B():" msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:215 -#, no-wrap +#: build/C/man3/posix_fallocate.3:61 msgid "" -" for (p = buffer ; ; )\n" -" *(p++) = \\(aqa\\(aq;\n" +"The function B() ensures that disk space is allocated for " +"the file referred to by the descriptor I for the bytes in the range " +"starting at I and continuing for I bytes. After a successful " +"call to B(), subsequent writes to bytes in the specified " +"range are guaranteed not to fail because of lack of disk space." msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:219 -#, no-wrap +#: build/C/man3/posix_fallocate.3:66 msgid "" -" printf(\"Loop completed\\en\"); /* Should never happen */\n" -" exit(EXIT_SUCCESS);\n" -"}\n" +"If the size of the file is less than I+I, then the file is " +"increased to this size; otherwise the file size is left unchanged." msgstr "" #. type: Plain text -#: build/C/man2/mprotect.2:223 -msgid "B(2), B(3)" -msgstr "" - -#. type: TH -#: build/C/man2/mremap.2:31 -#, no-wrap -msgid "MREMAP" +#: build/C/man3/posix_fallocate.3:72 +msgid "" +"B() returns zero on success, or an error number on " +"failure. Note that I is not set." msgstr "" -#. type: TH -#: build/C/man2/mremap.2:31 -#, no-wrap -msgid "2010-06-10" +#. type: Plain text +#: build/C/man3/posix_fallocate.3:81 +msgid "I exceeds the maximum file size." msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:34 -msgid "mremap - remap a virtual memory address" +#: build/C/man3/posix_fallocate.3:91 +msgid "I does not refer to a regular file." msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:37 -#, no-wrap -msgid "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" +#: build/C/man3/posix_fallocate.3:100 +msgid "I refers to a pipe." msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:42 -#, no-wrap -msgid "" -"BIB<, size_t >IB<,>\n" -"B< size_t >IB<, int >IB<, ... /* void " -"*>IB< */);>\n" +#: build/C/man3/posix_fallocate.3:103 +msgid "B() is available since glibc 2.1.94." msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:48 -msgid "" -"B() expands (or shrinks) an existing memory mapping, potentially " -"moving it at the same time (controlled by the I argument and the " -"available virtual address space)." +#: build/C/man3/posix_fallocate.3:108 +msgid "The B() function is thread-safe." msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:62 +#: build/C/man3/posix_fallocate.3:133 msgid "" -"I is the old address of the virtual memory block that you want " -"to expand (or shrink). Note that I has to be page aligned. " -"I is the old size of the virtual memory block. I is the " -"requested size of the virtual memory block after the resize. An optional " -"fifth argument, I, may be provided; see the description of " -"B below." +"POSIX.1-2008 says that an implementation I give the B error " +"if I was 0, or I was less than 0. POSIX.1-2001 says that an " +"implementation I give the B error if I is less than 0, " +"or I was less than 0, and I give the error if I equals " +"zero." msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:74 +#: build/C/man3/posix_fallocate.3:138 msgid "" -"In Linux the memory is divided into pages. A user process has (one or) " -"several linear virtual memory segments. Each virtual memory segment has one " -"or more mappings to real memory pages (in the page table). Each virtual " -"memory segment has its own protection (access rights), which may cause a " -"segmentation violation if the memory is accessed incorrectly (e.g., writing " -"to a read-only segment). Accessing virtual memory outside of the segments " -"will also cause a segmentation violation." +"In the glibc implementation, B() is implemented using " +"B(2)." msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:82 -msgid "" -"B() uses the Linux page table scheme. B() changes the " -"mapping between virtual addresses and memory pages. This can be used to " -"implement a very efficient B(3)." +#: build/C/man3/posix_fallocate.3:143 +msgid "B(1), B(2), B(2), B(2)" msgstr "" -#. type: Plain text -#: build/C/man2/mremap.2:84 -msgid "The I bit-mask argument may be 0, or include the following flag:" +#. type: TH +#: build/C/man3/posix_memalign.3:29 +#, no-wrap +msgid "POSIX_MEMALIGN" msgstr "" -#. type: TP -#: build/C/man2/mremap.2:84 +#. type: TH +#: build/C/man3/posix_memalign.3:29 #, no-wrap -msgid "B" +msgid "2013-09-02" msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:96 +#: build/C/man3/posix_memalign.3:32 msgid "" -"By default, if there is not sufficient space to expand a mapping at its " -"current location, then B() fails. If this flag is specified, then " -"the kernel is permitted to relocate the mapping to a new virtual address, if " -"necessary. If the mapping is relocated, then absolute pointers into the old " -"mapping location become invalid (offsets relative to the starting address of " -"the mapping should be employed)." +"posix_memalign, aligned_alloc, memalign, valloc, pvalloc - allocate aligned " +"memory" msgstr "" -#. type: TP -#: build/C/man2/mremap.2:96 +#. type: Plain text +#: build/C/man3/posix_memalign.3:35 #, no-wrap -msgid "B (since Linux 2.3.31)" +msgid "B<#include Estdlib.hE>\n" msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:118 +#: build/C/man3/posix_memalign.3:39 +#, no-wrap msgid "" -"This flag serves a similar purpose to the B flag of B(2). " -"If this flag is specified, then B() accepts a fifth argument, " -"I, which specifies a page-aligned address to which the " -"mapping must be moved. Any previous mapping at the address range specified " -"by I and I is unmapped. If B is " -"specified, then B must also be specified." +"BIB<, size_t >IB<, size_t " +">IB<);>\n" +"BIB<, size_t >IB<);>\n" +"BIB<);>\n" msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:128 +#: build/C/man3/posix_memalign.3:44 +#, no-wrap msgid "" -"If the memory segment specified by I and I is locked " -"(using B(2) or similar), then this lock is maintained when the " -"segment is resized and/or relocated. As a consequence, the amount of memory " -"locked by the process may change." +"BIB<, size_t >IB<);>\n" +"BIB<);>\n" msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:136 +#: build/C/man3/posix_memalign.3:54 msgid "" -"On success B() returns a pointer to the new virtual memory area. " -"On error, the value B (that is, I<(void\\ *)\\ -1>) is returned, " -"and I is set appropriately." +"B(): _POSIX_C_SOURCE\\ E=\\ 200112L || _XOPEN_SOURCE\\ " +"E=\\ 600" msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:143 -msgid "" -"The caller tried to expand a memory segment that is locked, but this was not " -"possible without exceeding the B resource limit." +#: build/C/man3/posix_memalign.3:57 +msgid "B(): _ISOC11_SOURCE" msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:152 -msgid "" -"\"Segmentation fault.\" Some address in the range I to " -"I+I is an invalid virtual memory address for this " -"process. You can also get B even if there exist mappings that cover " -"the whole address space requested, but those mappings are of different " -"types." +#: build/C/man3/posix_memalign.3:59 +msgid "B():" msgstr "" -#. type: Plain text -#: build/C/man2/mremap.2:180 -msgid "" -"An invalid argument was given. Possible causes are: I was not " -"page aligned; a value other than B or B was " -"specified in I; I was zero; I or I " -"was invalid; or the new address range specified by I and " -"I overlapped the old address range specified by I and " -"I; or B was specified without also specifying " -"B." +#. type: TP +#: build/C/man3/posix_memalign.3:62 +#, no-wrap +msgid "Since glibc 2.12:" msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:186 +#: build/C/man3/posix_memalign.3:69 +#, no-wrap msgid "" -"The memory area cannot be expanded at the current virtual address, and the " -"B flag is not set in I. Or, there is not enough " -"(virtual) memory available." +"_BSD_SOURCE ||\n" +" (_XOPEN_SOURCE\\ E=\\ 500 ||\n" +" _XOPEN_SOURCE\\ &&\\ _XOPEN_SOURCE_EXTENDED) &&\n" +" !(_POSIX_C_SOURCE\\ E=\\ 200112L || _XOPEN_SOURCE\\ E=\\ 600)\n" msgstr "" -#. 4.2BSD had a (never actually implemented) -#. .BR mremap (2) -#. call with completely different semantics. -#. type: Plain text -#: build/C/man2/mremap.2:192 -msgid "" -"This call is Linux-specific, and should not be used in programs intended to " -"be portable." +#. type: TP +#: build/C/man3/posix_memalign.3:71 +#, no-wrap +msgid "Before glibc 2.12:" msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:200 +#: build/C/man3/posix_memalign.3:75 msgid "" -"Prior to version 2.4, glibc did not expose the definition of " -"B, and the prototype for B() did not allow for the " -"I argument." +"_BSD_SOURCE || _XOPEN_SOURCE\\ E=\\ 500 || _XOPEN_SOURCE\\ &&\\ " +"_XOPEN_SOURCE_EXTENDED" msgstr "" #. type: Plain text -#: build/C/man2/mremap.2:209 +#: build/C/man3/posix_memalign.3:82 msgid "" -"B(2), B(2), B(2), B(2), B(2), " -"B(2), B(3), B(3)" +"(The (nonstandard) header file Imalloc.hE> also exposes the " +"declaration of B(); no feature test macros are required.)" msgstr "" +#. glibc does this: #. type: Plain text -#: build/C/man2/mremap.2:214 +#: build/C/man3/posix_memalign.3:104 msgid "" -"Your favorite OS text book for more information on paged memory. (I by Andrew S. Tanenbaum, I by Randolf " -"Bentson, I by Maurice J. Bach.)" -msgstr "" - -#. type: TH -#: build/C/man2/msync.2:25 -#, no-wrap -msgid "MSYNC" -msgstr "" - -#. type: TH -#: build/C/man2/msync.2:25 build/C/man2/remap_file_pages.2:26 -#, no-wrap -msgid "2008-04-22" +"The function B() allocates I bytes and places the " +"address of the allocated memory in I<*memptr>. The address of the allocated " +"memory will be a multiple of I, which must be a power of two and " +"a multiple of I. If I is 0, then the value placed " +"in I<*memptr> is either NULL, or a unique pointer value that can later be " +"successfully passed to B(3)." msgstr "" +#. The behavior of memalign() for size==0 is as for posix_memalign() +#. but no standards govern this. #. type: Plain text -#: build/C/man2/msync.2:28 -msgid "msync - synchronize a file with a memory map" +#: build/C/man3/posix_memalign.3:115 +msgid "" +"The obsolete function B() allocates I bytes and returns a " +"pointer to the allocated memory. The memory address will be a multiple of " +"I, which must be a power of two." msgstr "" #. type: Plain text -#: build/C/man2/msync.2:32 -msgid "BIB<, size_t >IB<, int >IB<);>" +#: build/C/man3/posix_memalign.3:124 +msgid "" +"The function B() is the same as B(), except for " +"the added restriction that I should be a multiple of I." msgstr "" #. type: Plain text -#: build/C/man2/msync.2:48 +#: build/C/man3/posix_memalign.3:133 msgid "" -"B() flushes changes made to the in-core copy of a file that was " -"mapped into memory using B(2) back to disk. Without use of this call " -"there is no guarantee that changes are written back before B(2) is " -"called. To be more precise, the part of the file that corresponds to the " -"memory area starting at I and having length I is updated." +"The obsolete function B() allocates I bytes and returns a " +"pointer to the allocated memory. The memory address will be a multiple of " +"the page size. It is equivalent to I." msgstr "" #. type: Plain text -#: build/C/man2/msync.2:68 +#: build/C/man3/posix_memalign.3:140 msgid "" -"The I argument may have the bits B, B, and " -"B set, but not both B and B. B " -"specifies that an update be scheduled, but the call returns immediately. " -"B asks for an update and waits for it to complete. " -"B asks to invalidate other mappings of the same file (so that " -"they can be updated with the fresh values just written)." +"The obsolete function B() is similar to B(), but rounds " +"the size of the allocation up to the next multiple of the system page size." msgstr "" #. type: Plain text -#: build/C/man2/msync.2:73 -msgid "" -"On success, zero is returned. On error, -1 is returned, and I is set " -"appropriately." +#: build/C/man3/posix_memalign.3:142 +msgid "For all of these functions, the memory is not zeroed." msgstr "" -#. type: TP -#: build/C/man2/msync.2:74 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man3/posix_memalign.3:149 +msgid "" +"B(), B(), B(), and B() return a " +"pointer to the allocated memory, or NULL if the request fails." msgstr "" #. type: Plain text -#: build/C/man2/msync.2:80 +#: build/C/man3/posix_memalign.3:157 msgid "" -"B was specified in I, and a memory lock exists for the " -"specified address range." +"B() returns zero on success, or one of the error values " +"listed in the next section on failure. The value of I is " +"indeterminate after a call to B()." msgstr "" #. type: Plain text -#: build/C/man2/msync.2:93 +#: build/C/man3/posix_memalign.3:164 msgid "" -"I is not a multiple of PAGESIZE; or any bit other than B | " -"B | B is set in I; or both B and " -"B are set in I." +"The I argument was not a power of two, or was not a multiple of " +"I." msgstr "" #. type: Plain text -#: build/C/man2/msync.2:96 -msgid "The indicated memory (or part of it) was not mapped." +#: build/C/man3/posix_memalign.3:167 +msgid "There was insufficient memory to fulfill the allocation request." msgstr "" #. type: Plain text -#: build/C/man2/msync.2:98 build/C/man3/posix_fallocate.3:103 build/C/man3/shm_open.3:251 build/C/man7/shm_overview.7:103 -msgid "POSIX.1-2001." +#: build/C/man3/posix_memalign.3:174 +msgid "" +"The functions B(), B(), and B() have been " +"available in all Linux libc libraries." msgstr "" #. type: Plain text -#: build/C/man2/msync.2:105 -msgid "" -"This call was introduced in Linux 1.3.21, and then used B instead of " -"B. In Linux 2.4.19 this was changed to the POSIX value B." +#: build/C/man3/posix_memalign.3:178 +msgid "The function B() was added to glibc in version 2.16." msgstr "" -#. POSIX.1-2001: It shall be defined to -1 or 0 or 200112L. -#. -1: unavailable, 0: ask using sysconf(). -#. glibc defines them to 1. #. type: Plain text -#: build/C/man2/msync.2:118 -msgid "" -"On POSIX systems on which B() is available, both " -"B<_POSIX_MAPPED_FILES> and B<_POSIX_SYNCHRONIZED_IO> are defined in " -"Iunistd.hE> to a value greater than 0. (See also B(3).)" +#: build/C/man3/posix_memalign.3:182 +msgid "The function B() is available since glibc 2.1.91." msgstr "" -#. type: TP -#: build/C/man2/msync.2:120 build/C/man7/shm_overview.7:46 -#, no-wrap -msgid "B(2)" +#. type: Plain text +#: build/C/man3/posix_memalign.3:189 +msgid "" +"The function B() appeared in 3.0BSD. It is documented as being " +"obsolete in 4.3BSD, and as legacy in SUSv2. It does not appear in " +"POSIX.1-2001." msgstr "" -#. type: TH -#: build/C/man3/mtrace.3:23 -#, no-wrap -msgid "MTRACE" +#. type: Plain text +#: build/C/man3/posix_memalign.3:193 +msgid "The function B() is a GNU extension." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:26 -msgid "mtrace, muntrace - malloc tracing" +#: build/C/man3/posix_memalign.3:197 +msgid "The function B() appears in SunOS 4.1.3 but not in 4.4BSD." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:28 -msgid "B<#include Emcheck.hE>" +#: build/C/man3/posix_memalign.3:201 +msgid "The function B() comes from POSIX.1d." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:30 -msgid "B" +#: build/C/man3/posix_memalign.3:206 +msgid "The function B() is specified in the C11 standard." msgstr "" -#. type: Plain text -#: build/C/man3/mtrace.3:32 -msgid "B" +#. type: SS +#: build/C/man3/posix_memalign.3:206 +#, no-wrap +msgid "Headers" msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:44 +#: build/C/man3/posix_memalign.3:210 msgid "" -"The B() function installs hook functions for the memory-allocation " -"functions (B(3), B(3) B(3), B(3)). These " -"hook functions record tracing information about memory allocation and " -"deallocation. The tracing information can be used to discover memory leaks " -"and attempts to free nonallocated memory in a program." +"Everybody agrees that B() is declared in " +"Istdlib.hE>." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:55 +#: build/C/man3/posix_memalign.3:214 msgid "" -"The B() function disables the hook functions installed by " -"B(), so that tracing information is no longer recorded for the " -"memory-allocation functions. If no hook functions were successfully " -"installed by B(), B() does nothing." +"On some systems B() is declared in Istdlib.hE> instead " +"of Imalloc.hE>." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:63 +#: build/C/man3/posix_memalign.3:221 msgid "" -"When B(3) is called, it checks the value of the environment " -"variable B, which should contain the pathname of a file in " -"which the tracing information is to be recorded. If the pathname is " -"successfully opened, it is truncated to zero length." +"According to SUSv2, B() is declared in Istdlib.hE>. " +"Libc4,5 and glibc declare it in Imalloc.hE>, and also in " +"Istdlib.hE> if suitable feature test macros are defined (see " +"above)." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:76 +#: build/C/man3/posix_memalign.3:230 msgid "" -"If B is not set, or the pathname it specifies is invalid or " -"not writable, then no hook functions are installed, and B() has no " -"effect. In set-user-ID and set-group-ID programs, B is " -"ignored, and B() has no effect." +"On many systems there are alignment restrictions, for example, on buffers " +"used for direct block device I/O. POSIX specifies the " +"I call that tells what alignment is " +"needed. Now one can use B() to satisfy this requirement." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:84 +#: build/C/man3/posix_memalign.3:239 msgid "" -"In normal usage, B() is called once at the start of execution of a " -"program, and B() is never called." +"B() verifies that I matches the requirements " +"detailed above. B() may not check that the I argument " +"is correct." msgstr "" +#. Other systems allow passing the result of +#. .IR valloc () +#. to +#. .IR free (3), +#. but not to +#. .IR realloc (3). #. type: Plain text -#: build/C/man3/mtrace.3:94 +#: build/C/man3/posix_memalign.3:267 msgid "" -"The tracing output produced after a call to B() is textual, but not " -"designed to be human readable. The GNU C library provides a Perl script, " -"B(1), that interprets the trace log and produces human-readable " -"output. For best results, the traced program should be compiled with " -"debugging enabled, so that line-number information is recorded in the " -"executable." +"POSIX requires that memory obtained from B() can be freed " +"using B(3). Some systems provide no way to reclaim memory allocated " +"with B() or B() (because one can pass to B(3) " +"only a pointer obtained from B(3), while, for example, B() " +"would call B(3) and then align the obtained value). The glibc " +"implementation allows memory obtained from any of these functions to be " +"reclaimed with B(3)." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:100 +#: build/C/man3/posix_memalign.3:272 msgid "" -"The tracing performed by B() incurs a performance penalty (if " -"B points to a valid, writable pathname)." +"The glibc B(3) always returns 8-byte aligned memory addresses, so " +"these functions are needed only if you require larger alignment values." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:106 -msgid "" -"The line-number information produced by B(1) is not always precise: " -"the line number references may refer to the previous or following " -"(non-blank) line of the source code." +#: build/C/man3/posix_memalign.3:277 +msgid "B(2), B(2), B(3), B(3)" +msgstr "" + +#. type: TH +#: build/C/man2/readahead.2:28 +#, no-wrap +msgid "READAHEAD" +msgstr "" + +#. type: TH +#: build/C/man2/readahead.2:28 +#, no-wrap +msgid "2014-03-15" msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:113 -msgid "" -"The shell session below demonstrates the use of the B() function " -"and the B(1) command in a program that has memory leaks at two " -"different locations. The demonstration uses the following program:" +#: build/C/man2/readahead.2:31 +msgid "readahead - initiate file readahead into page cache" msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:120 +#: build/C/man2/readahead.2:37 #, no-wrap msgid "" -"$ B\n" -"#include Emcheck.hE\n" -"#include Estdlib.hE\n" -"#include Estdio.hE\n" +"BIB<, off64_t >IB<, size_t " +">IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:125 -#, no-wrap +#: build/C/man2/readahead.2:44 msgid "" -"int\n" -"main(int argc, char *argv[])\n" -"{\n" -" int j;\n" +"B() initiates readahead on a file so that subsequent reads from " +"that file will be satisfied from the cache, and not block on disk I/O " +"(assuming the readahead was initiated early enough and that other activity " +"on the system did not in the meantime flush pages from the cache)." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:127 -#, no-wrap -msgid " mtrace();\n" +#: build/C/man2/readahead.2:66 +msgid "" +"The I argument is a file descriptor identifying the file which is to be " +"read. The I argument specifies the starting point from which data " +"is to be read and I specifies the number of bytes to be read. I/O is " +"performed in whole pages, so that I is effectively rounded down to a " +"page boundary and bytes are read up to the next page boundary greater than " +"or equal to I<(offset+count)>. B() does not read beyond the end " +"of the file. The current file offset of the open file referred to by I " +"is left unchanged." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:130 -#, no-wrap +#: build/C/man2/readahead.2:72 msgid "" -" for (j = 0; j E 2; j++)\n" -" malloc(100); /* Never freed--a memory leak */\n" +"On success, B() returns 0; on failure, -1 is returned, with " +"I set to indicate the cause of the error." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:134 -#, no-wrap -msgid "" -" calloc(16, 16); /* Never freed--a memory leak */\n" -" exit(EXIT_SUCCESS);\n" -"}\n" +#: build/C/man2/readahead.2:77 +msgid "I is not a valid file descriptor or is not open for reading." +msgstr "" + +#. type: Plain text +#: build/C/man2/readahead.2:83 +msgid "I does not refer to a file type to which B() can be applied." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:140 +#: build/C/man2/readahead.2:88 msgid "" -"When we run the program as follows, we see that B() diagnosed " -"memory leaks at two different locations in the program:" +"The B() system call appeared in Linux 2.4.13; glibc support has " +"been provided since version 2.3." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:153 -#, no-wrap +#: build/C/man2/readahead.2:93 msgid "" -"$ B\n" -"$ B\n" -"$ B<./t_mtrace>\n" -"$ B\n" -"Memory not freed:\n" -"-----------------\n" -" Address Size Caller\n" -"0x084c9378 0x64 at /home/cecilia/t_mtrace.c:12\n" -"0x084c93e0 0x64 at /home/cecilia/t_mtrace.c:12\n" -"0x084c9448 0x100 at /home/cecilia/t_mtrace.c:16\n" +"The B() system call is Linux-specific, and its use should be " +"avoided in portable applications." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:165 +#: build/C/man2/readahead.2:98 msgid "" -"The first two messages about unfreed memory correspond to the two " -"B(3) calls inside the I loop. The final message corresponds " -"to the call to B(3) (which in turn calls B(3))." +"On some 32-bit architectures, the calling signature for this system call " +"differs, for the reasons described in B(2)." msgstr "" #. type: Plain text -#: build/C/man3/mtrace.3:170 -msgid "B(1), B(3), B(3), B(3)" +#: build/C/man2/readahead.2:107 +msgid "" +"B() attempts to schedule the reads in the background and return " +"immediately. However, it may block while it reads the filesystem metadata " +"needed to locate the requested blocks. This occurs frequently with ext[234] " +"on large files using indirect blocks instead of extents, giving the " +"appearance that the call blocks until the requested data has been read." msgstr "" -#. type: TH -#: build/C/man2/posix_fadvise.2:27 -#, no-wrap -msgid "POSIX_FADVISE" +#. type: Plain text +#: build/C/man2/readahead.2:113 +msgid "B(2), B(2), B(2), B(2), B(2)" msgstr "" #. type: TH -#: build/C/man2/posix_fadvise.2:27 build/C/man2/sync_file_range.2:30 +#: build/C/man2/remap_file_pages.2:28 #, no-wrap -msgid "2010-10-09" +msgid "REMAP_FILE_PAGES" msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:30 -msgid "posix_fadvise - predeclare an access pattern for file data" +#: build/C/man2/remap_file_pages.2:31 +msgid "remap_file_pages - create a nonlinear file mapping" msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:33 build/C/man3/posix_fallocate.3:29 +#: build/C/man2/remap_file_pages.2:35 #, no-wrap -msgid "B<#include Efcntl.hE>\n" +msgid "" +"B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" +"B<#include Esys/mman.hE>\n" msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:36 +#: build/C/man2/remap_file_pages.2:38 #, no-wrap msgid "" -"BIB<, off_t >IB<, off_t >IB<, int " -">IB<);>\n" +"BIB<, size_t >IB<, int " +">IB<,>\n" +"B< size_t >IB<, int >IB<);>\n" msgstr "" +#. commit 33041a0d76d3c3e0aff28ac95a2ffdedf1282dbc +#. http://lwn.net/Articles/597632/ #. type: Plain text -#: build/C/man2/posix_fadvise.2:45 -msgid "B():" +#: build/C/man2/remap_file_pages.2:47 +msgid "" +"B: this system call is (since Linux 3.16) deprecated and will " +"eventually be replaced by a slower in-kernel emulation. Those few " +"applications that use this system call should consider migrating to " +"alternatives." msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:47 build/C/man3/posix_fallocate.3:42 -msgid "_XOPEN_SOURCE\\ E=\\ 600 || _POSIX_C_SOURCE\\ E=\\ 200112L" +#: build/C/man2/remap_file_pages.2:59 +msgid "" +"The B() system call is used to create a nonlinear " +"mapping, that is, a mapping in which the pages of the file are mapped into a " +"nonsequential order in memory. The advantage of using B() " +"over using repeated calls to B(2) is that the former approach does " +"not require the kernel to create additional VMA (Virtual Memory Area) data " +"structures." msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:55 -msgid "" -"Programs can use B() to announce an intention to access file " -"data in a specific pattern in the future, thus allowing the kernel to " -"perform appropriate optimizations." +#: build/C/man2/remap_file_pages.2:61 +msgid "To create a nonlinear mapping we perform the following steps:" msgstr "" -#. type: Plain text -#: build/C/man2/posix_fadvise.2:62 -msgid "" -"The I applies to a (not necessarily existent) region starting at " -"I and extending for I bytes (or until the end of the file if " -"I is 0) within the file referred to by I. The I is not " -"binding; it merely constitutes an expectation on behalf of the application." +#. type: IP +#: build/C/man2/remap_file_pages.2:61 build/C/man2/memfd_create.2:219 +#, no-wrap +msgid "1." msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:64 -msgid "Permissible values for I include:" +#: build/C/man2/remap_file_pages.2:69 +msgid "" +"Use B(2) to create a mapping (which is initially linear). This " +"mapping must be created with the B flag." msgstr "" -#. type: TP -#: build/C/man2/posix_fadvise.2:64 +#. type: IP +#: build/C/man2/remap_file_pages.2:69 build/C/man2/memfd_create.2:225 #, no-wrap -msgid "B" +msgid "2." msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:70 +#: build/C/man2/remap_file_pages.2:77 msgid "" -"Indicates that the application has no advice to give about its access " -"pattern for the specified data. If no advice is given for an open file, " -"this is the default assumption." +"Use one or more calls to B() to rearrange the " +"correspondence between the pages of the mapping and the pages of the file. " +"It is possible to map the same page of a file into multiple locations within " +"the mapped region." msgstr "" -#. type: TP -#: build/C/man2/posix_fadvise.2:70 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/remap_file_pages.2:88 +msgid "" +"The I and I arguments specify the region of the file that is to " +"be relocated within the mapping: I is a file offset in units of the " +"system page size; I is the length of the region in bytes." msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:74 +#: build/C/man2/remap_file_pages.2:106 msgid "" -"The application expects to access the specified data sequentially (with " -"lower offsets read before higher ones)." +"The I argument serves two purposes. First, it identifies the mapping " +"whose pages we want to rearrange. Thus, I must be an address that " +"falls within a region previously mapped by a call to B(2). Second, " +"I specifies the address at which the file pages identified by I " +"and I will be placed." msgstr "" -#. type: TP -#: build/C/man2/posix_fadvise.2:74 -#, no-wrap -msgid "B" +#. This rounding is weird, and not consistent with the treatment of +#. the analogous arguments for munmap()/mprotect() and for mlock(). +#. MTK, 14 Sep 2005 +#. type: Plain text +#: build/C/man2/remap_file_pages.2:120 +msgid "" +"The values specified in I and I should be multiples of the " +"system page size. If they are not, then the kernel rounds I values " +"I to the nearest multiple of the page size." msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:77 -msgid "The specified data will be accessed in random order." +#: build/C/man2/remap_file_pages.2:124 +msgid "The I argument must be specified as 0." msgstr "" -#. type: TP -#: build/C/man2/posix_fadvise.2:77 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/remap_file_pages.2:132 +msgid "" +"The I argument has the same meaning as for B(2), but all flags " +"other than B are ignored." msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:80 -msgid "The specified data will be accessed only once." +#: build/C/man2/remap_file_pages.2:139 +msgid "" +"On success, B() returns 0. On error, -1 is returned, and " +"I is set appropriately." msgstr "" -#. type: TP -#: build/C/man2/posix_fadvise.2:80 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/remap_file_pages.2:147 +msgid "" +"I does not refer to a valid mapping created with the B " +"flag." +msgstr "" + +#. And possibly others from vma->vm_ops->populate() +#. type: Plain text +#: build/C/man2/remap_file_pages.2:156 +msgid "I, I, I, or I is invalid." msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:83 -msgid "The specified data will be accessed in the near future." +#: build/C/man2/remap_file_pages.2:161 +msgid "" +"The B() system call appeared in Linux 2.5.46; glibc " +"support was added in version 2.3.3." msgstr "" -#. type: TP -#: build/C/man2/posix_fadvise.2:83 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/remap_file_pages.2:165 +msgid "The B() system call is Linux-specific." msgstr "" +#. commit 3ee6dafc677a68e461a7ddafc94a580ebab80735 #. type: Plain text -#: build/C/man2/posix_fadvise.2:86 -msgid "The specified data will not be accessed in the near future." +#: build/C/man2/remap_file_pages.2:176 +msgid "" +"Since Linux 2.6.23, B() creates non-linear mappings only " +"on in-memory file systems such as tmpfs, hugetlbfs or ramfs. On filesystems " +"with a backing store, B() is not much more efficient than " +"using B(2) to adjust which parts of the file are mapped to which " +"addresses." msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:89 -msgid "On success, zero is returned. On error, an error number is returned." +#: build/C/man2/remap_file_pages.2:183 +msgid "" +"B(2), B(2), B(2), B(2), B(2), " +"B(2)" msgstr "" -#. type: Plain text -#: build/C/man2/posix_fadvise.2:93 -msgid "The I argument was not a valid file descriptor." +#. type: TH +#: build/C/man3/shm_open.3:26 +#, no-wrap +msgid "SHM_OPEN" msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:96 -msgid "An invalid value was specified for I." +#: build/C/man3/shm_open.3:29 +msgid "shm_open, shm_unlink - create/open or unlink POSIX shared memory objects" msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:103 -msgid "" -"The specified file descriptor refers to a pipe or FIFO. (Linux actually " -"returns B in this case.)" +#: build/C/man3/shm_open.3:33 +msgid "B<#include Esys/stat.hE> /* For mode constants */" msgstr "" -#. of fadvise64_64() #. type: Plain text -#: build/C/man2/posix_fadvise.2:111 -msgid "" -"Kernel support first appeared in Linux 2.5.60; the underlying system call is " -"called B(). Library support has been provided since glibc " -"version 2.2, via the wrapper function B()." +#: build/C/man3/shm_open.3:35 +msgid "B<#include Efcntl.hE> /* For O_* constants */" msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:120 -msgid "" -"POSIX.1-2001. Note that the type of the I argument was changed from " -"I to I in POSIX.1-2003 TC1." +#: build/C/man3/shm_open.3:37 +msgid "BIB<, int >IB<, mode_t >IB<);>" msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:126 -msgid "" -"Under Linux, B sets the readahead window to the default " -"size for the backing device; B doubles this size, and " -"B disables file readahead entirely. These changes affect " -"the entire file, not just the specified region (but other open file handles " -"to the same file are unaffected)." +#: build/C/man3/shm_open.3:39 +msgid "BIB<);>" msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:133 -msgid "" -"B initiates a nonblocking read of the specified region " -"into the page cache. The amount of data read may be decreased by the kernel " -"depending on virtual memory load. (A few megabytes will usually be fully " -"satisfied, and more is rarely useful.)" +#: build/C/man3/shm_open.3:41 +msgid "Link with I<-lrt>." msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:137 +#: build/C/man3/shm_open.3:53 msgid "" -"In kernels before 2.6.18, B had the same semantics as " -"B. This was probably a bug; since kernel 2.6.18, this " -"flag is a no-op." +"B() creates and opens a new, or opens an existing, POSIX shared " +"memory object. A POSIX shared memory object is in effect a handle which can " +"be used by unrelated processes to B(2) the same region of shared " +"memory. The B() function performs the converse operation, " +"removing an object previously created by B()." msgstr "" +#. glibc allows the initial slash to be omitted, and makes +#. multiple initial slashes equivalent to a single slash. +#. This differs from the implementation of POSIX message queues. +#. glibc allows subdirectory components in the name, in which +#. case the subdirectory must exist under /dev/shm, and allow the +#. required permissions if a user wants to create a shared memory +#. object in that subdirectory. #. type: Plain text -#: build/C/man2/posix_fadvise.2:145 +#: build/C/man3/shm_open.3:74 msgid "" -"B attempts to free cached pages associated with the " -"specified region. This is useful, for example, while streaming large " -"files. A program may periodically request the kernel to free cached data " -"that has already been used, so that more useful cached pages are not " -"discarded instead." +"The operation of B() is analogous to that of B(2). I " +"specifies the shared memory object to be created or opened. For portable " +"use, a shared memory object should be identified by a name of the form " +"I; that is, a null-terminated string of up to B (i.e., " +"255) characters consisting of an initial slash, followed by one or more " +"characters, none of which are slashes." msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:153 +#: build/C/man3/shm_open.3:81 msgid "" -"Pages that have not yet been written out will be unaffected, so if the " -"application wishes to guarantee that pages will be released, it should call " -"B(2) or B(2) first." +"I is a bit mask created by ORing together exactly one of B " +"or B and any of the other flags listed here:" msgstr "" -#. type: SS -#: build/C/man2/posix_fadvise.2:153 +#. type: TP +#: build/C/man3/shm_open.3:81 #, no-wrap -msgid "arm_fadvise()" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/posix_fadvise.2:165 +#: build/C/man3/shm_open.3:89 msgid "" -"The ARM architecture needs 64-bit arguments to be aligned in a suitable pair " -"of registers. On this architecture, the call signature of " -"B() is flawed, since it forces a register to be wasted as " -"padding between the I and I arguments. Therefore, since Linux " -"2.6.14, ARM defines a different system call that orders the arguments " -"suitably:" +"Open the object for read access. A shared memory object opened in this way " +"can be B(2)ed only for read (B) access." msgstr "" -#. type: Plain text -#: build/C/man2/posix_fadvise.2:170 +#. type: TP +#: build/C/man3/shm_open.3:89 #, no-wrap -msgid "" -"BIB<, int >IB<,>\n" -"B< loff_t >IB<, loff_t >IB<);>\n" +msgid "B" msgstr "" -#. No ARM support in glibc. #. type: Plain text -#: build/C/man2/posix_fadvise.2:177 -msgid "" -"The behavior of this system call is otherwise exactly the same as " -"B(). No library support is provided for this system call in " -"glibc." +#: build/C/man3/shm_open.3:92 +msgid "Open the object for read-write access." +msgstr "" + +#. type: TP +#: build/C/man3/shm_open.3:92 +#, no-wrap +msgid "B" msgstr "" +#. In truth it is actually the filesystem IDs on Linux, but these +#. are nearly always the same as the effective IDs. (MTK, Jul 05) #. type: Plain text -#: build/C/man2/posix_fadvise.2:182 +#: build/C/man3/shm_open.3:112 msgid "" -"In kernels before 2.6.6, if I was specified as 0, then this was " -"interpreted literally as \"zero bytes\", rather than as meaning \"all bytes " -"through to the end of the file\"." +"Create the shared memory object if it does not exist. The user and group " +"ownership of the object are taken from the corresponding effective IDs of " +"the calling process, and the object's permission bits are set according to " +"the low-order 9 bits of I, except that those bits set in the process " +"file mode creation mask (see B(2)) are cleared for the new object. " +"A set of macro constants which can be used to define I is listed in " +"B(2). (Symbolic definitions of these constants can be obtained by " +"including Isys/stat.hE>.)" msgstr "" -#. FIXME . Write a posix_fadvise(3) page. #. type: Plain text -#: build/C/man2/posix_fadvise.2:188 +#: build/C/man3/shm_open.3:118 msgid "" -"B(2), B(2), B(3), " -"B(3)" +"A new shared memory object initially has zero length\\(emthe size of the " +"object can be set using B(2). The newly allocated bytes of a " +"shared memory object are automatically initialized to 0." msgstr "" -#. type: TH -#: build/C/man3/posix_fallocate.3:23 +#. type: TP +#: build/C/man3/shm_open.3:118 #, no-wrap -msgid "POSIX_FALLOCATE" +msgid "B" msgstr "" -#. type: TH -#: build/C/man3/posix_fallocate.3:23 +#. type: Plain text +#: build/C/man3/shm_open.3:127 +msgid "" +"If B was also specified, and a shared memory object with the given " +"I already exists, return an error. The check for the existence of the " +"object, and its creation if it does not exist, are performed atomically." +msgstr "" + +#. type: TP +#: build/C/man3/shm_open.3:127 #, no-wrap -msgid "2010-09-20" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man3/posix_fallocate.3:26 -msgid "posix_fallocate - allocate file space" +#: build/C/man3/shm_open.3:130 +msgid "If the shared memory object already exists, truncate it to zero bytes." msgstr "" #. type: Plain text -#: build/C/man3/posix_fallocate.3:31 -#, no-wrap -msgid "BIB<, off_t >IB<, off_t >IB<);>\n" +#: build/C/man3/shm_open.3:133 +msgid "" +"Definitions of these flag values can be obtained by including " +"Ifcntl.hE>." msgstr "" #. type: Plain text -#: build/C/man3/posix_fallocate.3:40 -msgid "B():" +#: build/C/man3/shm_open.3:144 +msgid "" +"On successful completion B() returns a new file descriptor " +"referring to the shared memory object. This file descriptor is guaranteed " +"to be the lowest-numbered file descriptor not previously opened within the " +"process. The B flag (see B(2)) is set for the file " +"descriptor." msgstr "" #. type: Plain text -#: build/C/man3/posix_fallocate.3:59 +#: build/C/man3/shm_open.3:153 msgid "" -"The function B() ensures that disk space is allocated for " -"the file referred to by the descriptor I for the bytes in the range " -"starting at I and continuing for I bytes. After a successful " -"call to B(), subsequent writes to bytes in the specified " -"range are guaranteed not to fail because of lack of disk space." +"The file descriptor is normally used in subsequent calls to B(2) " +"(for a newly created object) and B(2). After a call to B(2) " +"the file descriptor may be closed without affecting the memory mapping." msgstr "" #. type: Plain text -#: build/C/man3/posix_fallocate.3:64 +#: build/C/man3/shm_open.3:171 msgid "" -"If the size of the file is less than I+I, then the file is " -"increased to this size; otherwise the file size is left unchanged." +"The operation of B() is analogous to B(2): it removes a " +"shared memory object name, and, once all processes have unmapped the object, " +"de-allocates and destroys the contents of the associated memory region. " +"After a successful B(), attempts to B() an object " +"with the same I will fail (unless B was specified, in which " +"case a new, distinct object is created)." msgstr "" #. type: Plain text -#: build/C/man3/posix_fallocate.3:70 +#: build/C/man3/shm_open.3:180 msgid "" -"B() returns zero on success, or an error number on " -"failure. Note that I is not set." +"On success, B() returns a nonnegative file descriptor. On " +"failure, B() returns -1. B() returns 0 on success, " +"or -1 on error." msgstr "" #. type: Plain text -#: build/C/man3/posix_fallocate.3:79 -msgid "I exceeds the maximum file size." +#: build/C/man3/shm_open.3:187 +msgid "" +"On failure, I is set to indicate the cause of the error. Values " +"which may appear in I include the following:" msgstr "" #. type: Plain text -#: build/C/man3/posix_fallocate.3:89 -msgid "I does not refer to a regular file." +#: build/C/man3/shm_open.3:192 +msgid "Permission to B() the shared memory object was denied." msgstr "" #. type: Plain text -#: build/C/man3/posix_fallocate.3:98 -msgid "I refers to a pipe." +#: build/C/man3/shm_open.3:202 +msgid "" +"Permission was denied to B() I in the specified I, or " +"B was specified and the caller does not have write permission on " +"the object." msgstr "" -#. type: Plain text -#: build/C/man3/posix_fallocate.3:101 -msgid "B() is available since glibc 2.1.94." +#. type: TP +#: build/C/man3/shm_open.3:202 build/C/man2/shmget.2:198 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man3/posix_fallocate.3:126 +#: build/C/man3/shm_open.3:213 msgid "" -"POSIX.1-2008 says that an implementation I give the B error " -"if I was 0, or I was less than 0. POSIX.1-2001 says that an " -"implementation I give the B error if I is less than 0, " -"or I was less than 0, and I give the error if I equals " -"zero." +"Both B and B were specified to B() and the " +"shared memory object specified by I already exists." msgstr "" #. type: Plain text -#: build/C/man3/posix_fallocate.3:130 -msgid "B(2), B(2), B(2)" +#: build/C/man3/shm_open.3:220 +msgid "The I argument to B() was invalid." msgstr "" -#. type: TH -#: build/C/man3/posix_memalign.3:28 +#. type: TP +#: build/C/man3/shm_open.3:220 build/C/man2/memfd_create.2:146 #, no-wrap -msgid "POSIX_MEMALIGN" +msgid "B" msgstr "" -#. type: TH -#: build/C/man3/posix_memalign.3:28 +#. type: Plain text +#: build/C/man3/shm_open.3:223 +msgid "The process already has the maximum number of files open." +msgstr "" + +#. type: TP +#: build/C/man3/shm_open.3:223 #, no-wrap -msgid "2012-03-23" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:31 -msgid "" -"posix_memalign, aligned_alloc, memalign, valloc, pvalloc - Allocate aligned " -"memory" +#: build/C/man3/shm_open.3:229 +msgid "The length of I exceeds B." msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:38 +#: build/C/man3/shm_open.3:233 +msgid "The limit on the total number of files open on the system has been reached." +msgstr "" + +#. type: TP +#: build/C/man3/shm_open.3:233 build/C/man3/shm_open.3:242 build/C/man2/shmget.2:225 #, no-wrap -msgid "" -"BIB<, size_t >IB<, size_t " -">IB<);>\n" -"BIB<, size_t >IB<);>\n" -"BIB<);>\n" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:43 -#, no-wrap +#: build/C/man3/shm_open.3:242 msgid "" -"BIB<, size_t >IB<);>\n" -"BIB<);>\n" +"An attempt was made to B() a I that did not exist, and " +"B was not specified." msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:53 -msgid "" -"B(): _POSIX_C_SOURCE\\ E=\\ 200112L || _XOPEN_SOURCE\\ " -"E=\\ 600" +#: build/C/man3/shm_open.3:249 +msgid "An attempt was to made to B() a I that does not exist." msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:56 -msgid "B(): _ISOC11_SOURCE" +#: build/C/man3/shm_open.3:251 +msgid "These functions are provided in glibc 2.2 and later." msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:58 -msgid "B():" +#: build/C/man3/shm_open.3:257 +msgid "" +"POSIX.1-2001 says that the group ownership of a newly created shared memory " +"object is set to either the calling process's effective group ID or \"a " +"system default group ID\"." msgstr "" -#. type: TP -#: build/C/man3/posix_memalign.3:61 -#, no-wrap -msgid "Since glibc 2.12:" +#. type: Plain text +#: build/C/man3/shm_open.3:266 +msgid "" +"POSIX leaves the behavior of the combination of B and B " +"unspecified. On Linux, this will successfully truncate an existing shared " +"memory object\\(emthis may not be so on other UNIX systems." msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:68 -#, no-wrap +#: build/C/man3/shm_open.3:271 msgid "" -"_BSD_SOURCE ||\n" -" (_XOPEN_SOURCE\\ E=\\ 500 ||\n" -" _XOPEN_SOURCE\\ &&\\ _XOPEN_SOURCE_EXTENDED) &&\n" -" !(_POSIX_C_SOURCE\\ E=\\ 200112L || _XOPEN_SOURCE\\ E=\\ 600)\n" +"The POSIX shared memory object implementation on Linux 2.4 makes use of a " +"dedicated filesystem, which is normally mounted under I." +msgstr "" + +#. type: Plain text +#: build/C/man3/shm_open.3:283 +msgid "" +"B(2), B(2), B(2), B(2), B(2), " +"B(2), B(2), B(2), B(2), B(2), " +"B(7)" +msgstr "" + +#. type: TH +#: build/C/man7/shm_overview.7:27 +#, no-wrap +msgid "SHM_OVERVIEW" msgstr "" -#. type: TP -#: build/C/man3/posix_memalign.3:70 +#. type: TH +#: build/C/man7/shm_overview.7:27 #, no-wrap -msgid "Before glibc 2.12:" +msgid "2010-09-10" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:74 -msgid "" -"_BSD_SOURCE || _XOPEN_SOURCE\\ E=\\ 500 || _XOPEN_SOURCE\\ &&\\ " -"_XOPEN_SOURCE_EXTENDED" +#: build/C/man7/shm_overview.7:30 +msgid "shm_overview - overview of POSIX shared memory" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:81 +#: build/C/man7/shm_overview.7:33 msgid "" -"(The (nonstandard) header file Imalloc.hE> also exposes the " -"declaration of B(); no feature test macros are required.)" +"The POSIX shared memory API allows processes to communicate information by " +"sharing a region of memory." msgstr "" -#. glibc does this: #. type: Plain text -#: build/C/man3/posix_memalign.3:102 -msgid "" -"The function B() allocates I bytes and places the " -"address of the allocated memory in I<*memptr>. The address of the allocated " -"memory will be a multiple of I, which must be a power of two and " -"a multiple of I. If I is 0, then B() " -"returns either NULL, or a unique pointer value that can later be " -"successfully passed to B(3)." +#: build/C/man7/shm_overview.7:35 +msgid "The interfaces employed in the API are:" msgstr "" -#. The behavior of memalign() for size==0 is as for posix_memalign() -#. but no standards govern this. -#. type: Plain text -#: build/C/man3/posix_memalign.3:113 -msgid "" -"The obsolete function B() allocates I bytes and returns a " -"pointer to the allocated memory. The memory address will be a multiple of " -"I, which must be a power of two." +#. type: TP +#: build/C/man7/shm_overview.7:35 +#, no-wrap +msgid "B(3)" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:122 +#: build/C/man7/shm_overview.7:42 msgid "" -"The function B() is the same as B(), except for " -"the added restriction that I should be a multiple of I." +"Create and open a new object, or open an existing object. This is analogous " +"to B(2). The call returns a file descriptor for use by the other " +"interfaces listed below." +msgstr "" + +#. type: TP +#: build/C/man7/shm_overview.7:42 +#, no-wrap +msgid "B(2)" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:132 +#: build/C/man7/shm_overview.7:46 msgid "" -"The obsolete function B() allocates I bytes and returns a " -"pointer to the allocated memory. The memory address will be a multiple of " -"the page size. It is equivalent to I." +"Set the size of the shared memory object. (A newly created shared memory " +"object has a length of zero.)" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:139 +#: build/C/man7/shm_overview.7:50 msgid "" -"The obsolete function B() is similar to B(), but rounds " -"the size of the allocation up to the next multiple of the system page size." +"Map the shared memory object into the virtual address space of the calling " +"process." msgstr "" -#. type: Plain text -#: build/C/man3/posix_memalign.3:141 -msgid "For all of these functions, the memory is not zeroed." +#. type: TP +#: build/C/man7/shm_overview.7:50 +#, no-wrap +msgid "B(2)" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:148 +#: build/C/man7/shm_overview.7:54 msgid "" -"B(), B(), B(), and B() return a " -"pointer to the allocated memory, or NULL if the request fails." +"Unmap the shared memory object from the virtual address space of the calling " +"process." msgstr "" -#. type: Plain text -#: build/C/man3/posix_memalign.3:155 -msgid "" -"B() returns zero on success, or one of the error values " -"listed in the next section on failure. Note that I is not set." +#. type: TP +#: build/C/man7/shm_overview.7:54 +#, no-wrap +msgid "B(3)" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:162 -msgid "" -"The I argument was not a power of two, or was not a multiple of " -"I." +#: build/C/man7/shm_overview.7:57 +msgid "Remove a shared memory object name." msgstr "" -#. type: Plain text -#: build/C/man3/posix_memalign.3:165 -msgid "There was insufficient memory to fulfill the allocation request." +#. type: TP +#: build/C/man7/shm_overview.7:57 +#, no-wrap +msgid "B(2)" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:172 +#: build/C/man7/shm_overview.7:62 msgid "" -"The functions B(), B(), and B() have been " -"available in all Linux libc libraries." +"Close the file descriptor allocated by B(3) when it is no longer " +"needed." msgstr "" -#. type: Plain text -#: build/C/man3/posix_memalign.3:176 -msgid "The function B() was added to glibc in version 2.16." +#. type: TP +#: build/C/man7/shm_overview.7:62 +#, no-wrap +msgid "B(2)" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:180 -msgid "The function B() is available since glibc 2.1.91." +#: build/C/man7/shm_overview.7:76 +msgid "" +"Obtain a I structure that describes the shared memory object. Among " +"the information returned by this call are the object's size (I), " +"permissions (I), owner (I), and group (I)." msgstr "" -#. type: Plain text -#: build/C/man3/posix_memalign.3:187 -msgid "" -"The function B() appeared in 3.0BSD. It is documented as being " -"obsolete in 4.3BSD, and as legacy in SUSv2. It does not appear in " -"POSIX.1-2001." +#. type: TP +#: build/C/man7/shm_overview.7:76 +#, no-wrap +msgid "B(2)" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:191 -msgid "The function B() is a GNU extension." +#: build/C/man7/shm_overview.7:79 +msgid "To change the ownership of a shared memory object." msgstr "" -#. type: Plain text -#: build/C/man3/posix_memalign.3:195 -msgid "The function B() appears in SunOS 4.1.3 but not in 4.4BSD." +#. type: TP +#: build/C/man7/shm_overview.7:79 +#, no-wrap +msgid "B(2)" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:199 -msgid "The function B() comes from POSIX.1d." +#: build/C/man7/shm_overview.7:82 +msgid "To change the permissions of a shared memory object." +msgstr "" + +#. type: SS +#: build/C/man7/shm_overview.7:82 +#, no-wrap +msgid "Versions" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:204 -msgid "The function B() is specified in the C11 standard." +#: build/C/man7/shm_overview.7:84 +msgid "POSIX shared memory is supported since Linux 2.4 and glibc 2.2." msgstr "" #. type: SS -#: build/C/man3/posix_memalign.3:204 +#: build/C/man7/shm_overview.7:84 #, no-wrap -msgid "Headers" +msgid "Persistence" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:208 +#: build/C/man7/shm_overview.7:89 msgid "" -"Everybody agrees that B() is declared in " -"Istdlib.hE>." +"POSIX shared memory objects have kernel persistence: a shared memory object " +"will exist until the system is shut down, or until all processes have " +"unmapped the object and it has been deleted with B(3)" msgstr "" -#. type: Plain text -#: build/C/man3/posix_memalign.3:212 -msgid "" -"On some systems B() is declared in Istdlib.hE> instead " -"of Imalloc.hE>." +#. type: SS +#: build/C/man7/shm_overview.7:89 +#, no-wrap +msgid "Linking" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:219 +#: build/C/man7/shm_overview.7:94 msgid "" -"According to SUSv2, B() is declared in Istdlib.hE>. " -"Libc4,5 and glibc declare it in Imalloc.hE>, and also in " -"Istdlib.hE> if suitable feature test macros are defined (see " -"above)." +"Programs using the POSIX shared memory API must be compiled with I " +"to link against the real-time library, I." msgstr "" -#. type: Plain text -#: build/C/man3/posix_memalign.3:228 -msgid "" -"On many systems there are alignment restrictions, for example, on buffers " -"used for direct block device I/O. POSIX specifies the " -"I call that tells what alignment is " -"needed. Now one can use B() to satisfy this requirement." +#. type: SS +#: build/C/man7/shm_overview.7:94 +#, no-wrap +msgid "Accessing shared memory objects via the filesystem" msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:237 +#: build/C/man7/shm_overview.7:101 msgid "" -"B() verifies that I matches the requirements " -"detailed above. B() may not check that the I argument " -"is correct." +"On Linux, shared memory objects are created in a (I) virtual " +"filesystem, normally mounted under I. Since kernel 2.6.19, Linux " +"supports the use of access control lists (ACLs) to control the permissions " +"of objects in the virtual filesystem." msgstr "" -#. Other systems allow passing the result of -#. .IR valloc () -#. to -#. .IR free (3), -#. but not to -#. .IR realloc (3). #. type: Plain text -#: build/C/man3/posix_memalign.3:265 +#: build/C/man7/shm_overview.7:106 msgid "" -"POSIX requires that memory obtained from B() can be freed " -"using B(3). Some systems provide no way to reclaim memory allocated " -"with B() or B() (because one can only pass to B(3) " -"a pointer gotten from B(3), while, for example, B() would " -"call B(3) and then align the obtained value). The glibc " -"implementation allows memory obtained from any of these functions to be " -"reclaimed with B(3)." +"Typically, processes must synchronize their access to a shared memory " +"object, using, for example, POSIX semaphores." msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:270 +#: build/C/man7/shm_overview.7:114 msgid "" -"The glibc B(3) always returns 8-byte aligned memory addresses, so " -"these functions are only needed if you require larger alignment values." +"System V shared memory (B(2), B(2), etc.) is an older shared " +"memory API. POSIX shared memory provides a simpler, and better designed " +"interface; on the other hand POSIX shared memory is somewhat less widely " +"available (especially on older systems) than System V shared memory." msgstr "" #. type: Plain text -#: build/C/man3/posix_memalign.3:275 -msgid "B(2), B(2), B(3), B(3)" +#: build/C/man7/shm_overview.7:127 +msgid "" +"B(2), B(2), B(2), B(2), B(2), " +"B(2), B(2), B(2), B(2), B(3), " +"B(3), B(7)" msgstr "" #. type: TH -#: build/C/man2/readahead.2:28 +#: build/C/man2/shmctl.2:45 #, no-wrap -msgid "READAHEAD" +msgid "SHMCTL" msgstr "" #. type: TH -#: build/C/man2/readahead.2:28 build/C/man7/shm_overview.7:27 -#, no-wrap -msgid "2010-09-10" -msgstr "" - -#. type: Plain text -#: build/C/man2/readahead.2:31 -msgid "readahead - perform file readahead into page cache" -msgstr "" - -#. type: Plain text -#: build/C/man2/readahead.2:37 +#: build/C/man2/shmctl.2:45 #, no-wrap -msgid "" -"BIB<, off64_t >IB<, size_t " -">IB<);>\n" +msgid "2014-02-07" msgstr "" #. type: Plain text -#: build/C/man2/readahead.2:65 -msgid "" -"B() populates the page cache with data from a file so that " -"subsequent reads from that file will not block on disk I/O. The I " -"argument is a file descriptor identifying the file which is to be read. The " -"I argument specifies the starting point from which data is to be " -"read and I specifies the number of bytes to be read. I/O is " -"performed in whole pages, so that I is effectively rounded down to a " -"page boundary and bytes are read up to the next page boundary greater than " -"or equal to I<(offset+count)>. B() does not read beyond the end " -"of the file. B() blocks until the specified data has been " -"read. The current file offset of the open file referred to by I is left " -"unchanged." +#: build/C/man2/shmctl.2:48 +msgid "shmctl - System V shared memory control" msgstr "" #. type: Plain text -#: build/C/man2/readahead.2:71 -msgid "" -"On success, B() returns 0; on failure, -1 is returned, with " -"I set to indicate the cause of the error." +#: build/C/man2/shmctl.2:51 build/C/man2/shmget.2:44 +msgid "B<#include Esys/ipc.hE>" msgstr "" #. type: Plain text -#: build/C/man2/readahead.2:76 -msgid "I is not a valid file descriptor or is not open for reading." +#: build/C/man2/shmctl.2:53 build/C/man2/shmget.2:46 +msgid "B<#include Esys/shm.hE>" msgstr "" #. type: Plain text -#: build/C/man2/readahead.2:82 -msgid "I does not refer to a file type to which B() can be applied." +#: build/C/man2/shmctl.2:55 +msgid "BIB<, int >IB<, struct shmid_ds *>IB<);>" msgstr "" #. type: Plain text -#: build/C/man2/readahead.2:87 +#: build/C/man2/shmctl.2:62 msgid "" -"The B() system call appeared in Linux 2.4.13; glibc support has " -"been provided since version 2.3." +"B() performs the control operation specified by I on the " +"System\\ V shared memory segment whose identifier is given in I." msgstr "" #. type: Plain text -#: build/C/man2/readahead.2:92 +#: build/C/man2/shmctl.2:67 msgid "" -"The B() system call is Linux-specific, and its use should be " -"avoided in portable applications." +"The I argument is a pointer to a I structure, defined in " +"Isys/shm.hE> as follows:" msgstr "" #. type: Plain text -#: build/C/man2/readahead.2:98 -msgid "B(2), B(2), B(2), B(2), B(2)" -msgstr "" - -#. type: TH -#: build/C/man2/remap_file_pages.2:26 +#: build/C/man2/shmctl.2:81 #, no-wrap -msgid "REMAP_FILE_PAGES" -msgstr "" - -#. type: Plain text -#: build/C/man2/remap_file_pages.2:29 -msgid "remap_file_pages - create a nonlinear file mapping" +msgid "" +"struct shmid_ds {\n" +" struct ipc_perm shm_perm; /* Ownership and permissions */\n" +" size_t shm_segsz; /* Size of segment (bytes) */\n" +" time_t shm_atime; /* Last attach time */\n" +" time_t shm_dtime; /* Last detach time */\n" +" time_t shm_ctime; /* Last change time */\n" +" pid_t shm_cpid; /* PID of creator */\n" +" pid_t shm_lpid; /* PID of last shmat(2)/shmdt(2) */\n" +" shmatt_t shm_nattch; /* No. of current attaches */\n" +" ...\n" +"};\n" msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:33 -#, no-wrap +#: build/C/man2/shmctl.2:89 msgid "" -"B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" -"B<#include Esys/mman.hE>\n" +"The I structure is defined as follows (the highlighted fields are " +"settable using B):" msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:36 +#: build/C/man2/shmctl.2:102 #, no-wrap msgid "" -"BIB<, size_t >IB<, int " -">IB<,>\n" -"B< ssize_t >IB<, int >IB<);>\n" +"struct ipc_perm {\n" +" key_t __key; /* Key supplied to shmget(2) */\n" +" uid_t B; /* Effective UID of owner */\n" +" gid_t B; /* Effective GID of owner */\n" +" uid_t cuid; /* Effective UID of creator */\n" +" gid_t cgid; /* Effective GID of creator */\n" +" unsigned short B; /* B + SHM_DEST and\n" +" SHM_LOCKED flags */\n" +" unsigned short __seq; /* Sequence number */\n" +"};\n" msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:49 -msgid "" -"The B() system call is used to create a nonlinear " -"mapping, that is, a mapping in which the pages of the file are mapped into a " -"nonsequential order in memory. The advantage of using B() " -"over using repeated calls to B(2) is that the former approach does " -"not require the kernel to create additional VMA (Virtual Memory Area) data " -"structures." +#: build/C/man2/shmctl.2:108 +msgid "Valid values for I are:" +msgstr "" + +#. type: TP +#: build/C/man2/shmctl.2:109 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:51 -msgid "To create a nonlinear mapping we perform the following steps:" +#: build/C/man2/shmctl.2:118 +msgid "" +"Copy information from the kernel data structure associated with I " +"into the I structure pointed to by I. The caller must have " +"read permission on the shared memory segment." msgstr "" #. type: TP -#: build/C/man2/remap_file_pages.2:51 +#: build/C/man2/shmctl.2:118 #, no-wrap -msgid "1." +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:59 +#: build/C/man2/shmctl.2:136 msgid "" -"Use B(2) to create a mapping (which is initially linear). This " -"mapping must be created with the B flag." +"Write the values of some members of the I structure pointed to by " +"I to the kernel data structure associated with this shared memory " +"segment, updating also its I member. The following fields can be " +"changed: I, I, and (the least significant 9 bits " +"of) I. The effective UID of the calling process must match " +"the owner (I) or creator (I) of the shared " +"memory segment, or the caller must be privileged." msgstr "" #. type: TP -#: build/C/man2/remap_file_pages.2:59 +#: build/C/man2/shmctl.2:136 #, no-wrap -msgid "2." +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:67 +#: build/C/man2/shmctl.2:149 msgid "" -"Use one or more calls to B() to rearrange the " -"correspondence between the pages of the mapping and the pages of the file. " -"It is possible to map the same page of a file into multiple locations within " -"the mapped region." +"Mark the segment to be destroyed. The segment will actually be destroyed " +"only after the last process detaches it (i.e., when the I member " +"of the associated structure I is zero). The caller must be the " +"owner or creator of the segment, or be privileged. The I argument is " +"ignored." msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:78 +#: build/C/man2/shmctl.2:157 msgid "" -"The I and I arguments specify the region of the file that is to " -"be relocated within the mapping: I is a file offset in units of the " -"system page size; I is the length of the region in bytes." +"If a segment has been marked for destruction, then the (nonstandard) " +"B flag of the I field in the associated data " +"structure retrieved by B will be set." msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:96 +#: build/C/man2/shmctl.2:160 msgid "" -"The I argument serves two purposes. First, it identifies the mapping " -"whose pages we want to rearrange. Thus, I must be an address that " -"falls within a region previously mapped by a call to B(2). Second, " -"I specifies the address at which the file pages identified by I " -"and I will be placed." +"The caller I ensure that a segment is eventually destroyed; otherwise " +"its pages that were faulted in will remain in memory or swap." msgstr "" -#. This rounding is weird, and not consistent with the treatment of -#. the analogous arguments for munmap()/mprotect() and for mlock(). -#. MTK, 14 Sep 2005 #. type: Plain text -#: build/C/man2/remap_file_pages.2:110 +#: build/C/man2/shmctl.2:165 msgid "" -"The values specified in I and I should be multiples of the " -"system page size. If they are not, then the kernel rounds I values " -"I to the nearest multiple of the page size." +"See also the description of I in " +"B(5)." msgstr "" -#. type: Plain text -#: build/C/man2/remap_file_pages.2:114 -msgid "The I argument must be specified as 0." +#. type: TP +#: build/C/man2/shmctl.2:165 +#, no-wrap +msgid "B (Linux-specific)" msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:122 +#: build/C/man2/shmctl.2:178 msgid "" -"The I argument has the same meaning as for B(2), but all flags " -"other than B are ignored." +"Return information about system-wide shared memory limits and parameters in " +"the structure pointed to by I. This structure is of type I " +"(thus, a cast is required), defined in Isys/shm.hE> if the " +"B<_GNU_SOURCE> feature test macro is defined:" msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:129 +#: build/C/man2/shmctl.2:192 +#, no-wrap msgid "" -"On success, B() returns 0. On error, -1 is returned, and " -"I is set appropriately." +"struct shminfo {\n" +" unsigned long shmmax; /* Maximum segment size */\n" +" unsigned long shmmin; /* Minimum segment size;\n" +" always 1 */\n" +" unsigned long shmmni; /* Maximum number of segments */\n" +" unsigned long shmseg; /* Maximum number of segments\n" +" that a process can attach;\n" +" unused within kernel */\n" +" unsigned long shmall; /* Maximum number of pages of\n" +" shared memory, system-wide */\n" +"};\n" msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:137 +#: build/C/man2/shmctl.2:205 msgid "" -"I does not refer to a valid mapping created with the B " -"flag." +"The I, I, and I settings can be changed via I " +"files of the same name; see B(5) for details." +msgstr "" + +#. type: TP +#: build/C/man2/shmctl.2:205 +#, no-wrap +msgid "B (Linux-specific)" msgstr "" -#. And possibly others from vma->vm_ops->populate() #. type: Plain text -#: build/C/man2/remap_file_pages.2:146 -msgid "I, I, I, or I is invalid." +#: build/C/man2/shmctl.2:216 +msgid "" +"Return a I structure whose fields contain information about system " +"resources consumed by shared memory. This structure is defined in " +"Isys/shm.hE> if the B<_GNU_SOURCE> feature test macro is defined:" msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:151 +#: build/C/man2/shmctl.2:233 +#, no-wrap msgid "" -"The B() system call appeared in Linux 2.5.46; glibc " -"support was added in version 2.3.3." +"struct shm_info {\n" +" int used_ids; /* # of currently existing\n" +" segments */\n" +" unsigned long shm_tot; /* Total number of shared\n" +" memory pages */\n" +" unsigned long shm_rss; /* # of resident shared\n" +" memory pages */\n" +" unsigned long shm_swp; /* # of swapped shared\n" +" memory pages */\n" +" unsigned long swap_attempts;\n" +" /* Unused since Linux 2.4 */\n" +" unsigned long swap_successes;\n" +" /* Unused since Linux 2.4 */\n" +"};\n" +msgstr "" + +#. type: TP +#: build/C/man2/shmctl.2:235 +#, no-wrap +msgid "B (Linux-specific)" msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:155 -msgid "The B() system call is Linux-specific." +#: build/C/man2/shmctl.2:246 +msgid "" +"Return a I structure as for B. However, the I " +"argument is not a segment identifier, but instead an index into the kernel's " +"internal array that maintains information about all shared memory segments " +"on the system." msgstr "" #. type: Plain text -#: build/C/man2/remap_file_pages.2:162 +#: build/C/man2/shmctl.2:249 msgid "" -"B(2), B(2), B(2), B(2), B(2), " -"B(2)" +"The caller can prevent or allow swapping of a shared memory segment with the " +"following I values:" msgstr "" -#. type: TH -#: build/C/man3/shm_open.3:26 +#. type: TP +#: build/C/man2/shmctl.2:250 #, no-wrap -msgid "SHM_OPEN" +msgid "B (Linux-specific)" msgstr "" -#. type: TH -#: build/C/man3/shm_open.3:26 +#. type: Plain text +#: build/C/man2/shmctl.2:262 +msgid "" +"Prevent swapping of the shared memory segment. The caller must fault in any " +"pages that are required to be present after locking is enabled. If a " +"segment has been locked, then the (nonstandard) B flag of the " +"I field in the associated data structure retrieved by " +"B will be set." +msgstr "" + +#. type: TP +#: build/C/man2/shmctl.2:262 #, no-wrap -msgid "2009-02-25" +msgid "B (Linux-specific)" msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:29 -msgid "shm_open, shm_unlink - Create/open or unlink POSIX shared memory objects" +#: build/C/man2/shmctl.2:265 +msgid "Unlock the segment, allowing it to be swapped out." msgstr "" +#. There was some weirdness in 2.6.9: SHM_LOCK and SHM_UNLOCK could +#. be applied to a segment, regardless of ownership of the segment. +#. This was a botch-up in the move to RLIMIT_MEMLOCK, and was fixed +#. in 2.6.10. MTK, May 2005 #. type: Plain text -#: build/C/man3/shm_open.3:33 -msgid "B<#include Esys/stat.hE> /* For mode constants */" +#: build/C/man2/shmctl.2:283 +msgid "" +"In kernels before 2.6.10, only a privileged process could employ B " +"and B. Since kernel 2.6.10, an unprivileged process can employ " +"these operations if its effective UID matches the owner or creator UID of " +"the segment, and (for B) the amount of memory to be locked falls " +"within the B resource limit (see B(2))." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:35 -msgid "B<#include Efcntl.hE> /* For O_* constants */" +#: build/C/man2/shmctl.2:301 +msgid "" +"A successful B or B operation returns the index of the " +"highest used entry in the kernel's internal array recording information " +"about all shared memory segments. (This information can be used with " +"repeated B operations to obtain information about all shared " +"memory segments on the system.) A successful B operation returns " +"the identifier of the shared memory segment whose index was given in " +"I. Other operations return 0 on success." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:37 -msgid "BIB<, int >IB<, mode_t >IB<);>" +#: build/C/man2/shmctl.2:305 +msgid "On error, -1 is returned, and I is set appropriately." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:39 -msgid "BIB<);>" +#: build/C/man2/shmctl.2:314 +msgid "" +"B or B is requested and I does not allow " +"read access for I, and the calling process does not have the " +"B capability." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:41 -msgid "Link with I<-lrt>." +#: build/C/man2/shmctl.2:325 +msgid "" +"The argument I has value B or B but the address " +"pointed to by I isn't accessible." +msgstr "" + +#. type: TP +#: build/C/man2/shmctl.2:325 build/C/man2/shmop.2:194 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:53 -msgid "" -"B() creates and opens a new, or opens an existing, POSIX shared " -"memory object. A POSIX shared memory object is in effect a handle which can " -"be used by unrelated processes to B(2) the same region of shared " -"memory. The B() function performs the converse operation, " -"removing an object previously created by B()." +#: build/C/man2/shmctl.2:328 build/C/man2/shmop.2:197 +msgid "I points to a removed identifier." msgstr "" -#. glibc allows the initial slash to be omitted, and makes -#. multiple initial slashes equivalent to a single slash. -#. This differs from the implementation of POSIX message queues. -#. glibc allows subdirectory components in the name, in which -#. case the subdirectory must exist under /dev/shm, and allow the -#. required permissions if a user wants to create a shared memory -#. object in that subdirectory. #. type: Plain text -#: build/C/man3/shm_open.3:74 +#: build/C/man2/shmctl.2:337 msgid "" -"The operation of B() is analogous to that of B(2). I " -"specifies the shared memory object to be created or opened. For portable " -"use, a shared memory object should be identified by a name of the form " -"I; that is, a null-terminated string of up to B (i.e., " -"255) characters consisting of an initial slash, followed by one or more " -"characters, none of which are slashes." +"I is not a valid identifier, or I is not a valid command. Or: " +"for a B operation, the index value specified in I referred " +"to an array slot that is currently unused." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:81 +#: build/C/man2/shmctl.2:348 msgid "" -"I is a bit mask created by ORing together exactly one of B " -"or B and any of the other flags listed here:" +"(In kernels since 2.6.9), B was specified and the size of the " +"to-be-locked segment would mean that the total bytes in locked shared memory " +"segments would exceed the limit for the real user ID of the calling " +"process. This limit is defined by the B soft resource limit " +"(see B(2))." msgstr "" -#. type: TP -#: build/C/man3/shm_open.3:81 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/shmctl.2:353 +msgid "" +"B is attempted, and the GID or UID value is too large to be stored " +"in the structure pointed to by I." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:87 +#: build/C/man2/shmctl.2:365 msgid "" -"Open the object for read access. A shared memory object opened in this way " -"can only be B(2)ed for read (B) access." +"B or B is attempted, and the effective user ID of the " +"calling process is not that of the creator (found in I), or " +"the owner (found in I), and the process was not privileged " +"(Linux: did not have the B capability)." msgstr "" -#. type: TP -#: build/C/man3/shm_open.3:87 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/shmctl.2:377 +msgid "" +"Or (in kernels before 2.6.9), B or B was specified, " +"but the process was not privileged (Linux: did not have the B " +"capability). (Since Linux 2.6.9, this error can also occur if the " +"B is 0 and the caller is not privileged.)" msgstr "" +#. SVr4 documents an additional error condition EMFILE. #. type: Plain text -#: build/C/man3/shm_open.3:90 -msgid "Open the object for read-write access." +#: build/C/man2/shmctl.2:382 build/C/man2/shmget.2:251 build/C/man2/shmop.2:231 +msgid "SVr4, POSIX.1-2001." msgstr "" -#. type: TP -#: build/C/man3/shm_open.3:90 -#, no-wrap -msgid "B" +#. Like Linux, the FreeBSD man pages still document +#. the inclusion of these header files. +#. type: Plain text +#: build/C/man2/shmctl.2:395 build/C/man2/shmget.2:269 +msgid "" +"The inclusion of Isys/types.hE> and Isys/ipc.hE> isn't " +"required on Linux or by any version of POSIX. However, some old " +"implementations required the inclusion of these header files, and the SVID " +"also documented their inclusion. Applications intended to be portable to " +"such old systems may need to include these header files." msgstr "" -#. In truth it is actually the file system IDs on Linux, but these -#. are nearly always the same as the effective IDs. (MTK, Jul 05) #. type: Plain text -#: build/C/man3/shm_open.3:110 +#: build/C/man2/shmctl.2:407 msgid "" -"Create the shared memory object if it does not exist. The user and group " -"ownership of the object are taken from the corresponding effective IDs of " -"the calling process, and the object's permission bits are set according to " -"the low-order 9 bits of I, except that those bits set in the process " -"file mode creation mask (see B(2)) are cleared for the new object. " -"A set of macro constants which can be used to define I is listed in " -"B(2). (Symbolic definitions of these constants can be obtained by " -"including Isys/stat.hE>.)" +"The B, B and B operations are used by the " +"B(1) program to provide information on allocated resources. In the " +"future, these may modified or moved to a I filesystem interface." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:116 +#: build/C/man2/shmctl.2:415 msgid "" -"A new shared memory object initially has zero length\\(emthe size of the " -"object can be set using B(2). The newly allocated bytes of a " -"shared memory object are automatically initialized to 0." +"Linux permits a process to attach (B(2)) a shared memory segment " +"that has already been marked for deletion using I. This " +"feature is not available on other UNIX implementations; portable " +"applications should avoid relying on it." msgstr "" -#. type: TP -#: build/C/man3/shm_open.3:116 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/shmctl.2:428 +msgid "" +"Various fields in a I were typed as I under Linux " +"2.2 and have become I under Linux 2.4. To take advantage of this, a " +"recompilation under glibc-2.1.91 or later should suffice. (The kernel " +"distinguishes old and new calls by an B flag in I.)" msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:125 +#: build/C/man2/shmctl.2:435 msgid "" -"If B was also specified, and a shared memory object with the given " -"I already exists, return an error. The check for the existence of the " -"object, and its creation if it does not exist, are performed atomically." +"B(2), B(2), B(2), B(2), B(7), " +"B(7)" msgstr "" -#. type: TP -#: build/C/man3/shm_open.3:125 +#. type: TH +#: build/C/man2/shmget.2:38 #, no-wrap -msgid "B" +msgid "SHMGET" msgstr "" -#. type: Plain text -#: build/C/man3/shm_open.3:128 -msgid "If the shared memory object already exists, truncate it to zero bytes." +#. type: TH +#: build/C/man2/shmget.2:38 +#, no-wrap +msgid "2015-01-10" msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:131 -msgid "" -"Definitions of these flag values can be obtained by including " -"Ifcntl.hE>." +#: build/C/man2/shmget.2:41 +msgid "shmget - allocates a System V shared memory segment" msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:142 -msgid "" -"On successful completion B() returns a new file descriptor " -"referring to the shared memory object. This file descriptor is guaranteed " -"to be the lowest-numbered file descriptor not previously opened within the " -"process. The B flag (see B(2)) is set for the file " -"descriptor." +#: build/C/man2/shmget.2:48 +msgid "BIB<, size_t >IB<, int >IB<);>" msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:151 +#: build/C/man2/shmget.2:72 msgid "" -"The file descriptor is normally used in subsequent calls to B(2) " -"(for a newly created object) and B(2). After a call to B(2) " -"the file descriptor may be closed without affecting the memory mapping." +"B() returns the identifier of the System\\ V shared memory segment " +"associated with the value of the argument I. A new shared memory " +"segment, with size equal to the value of I rounded up to a multiple of " +"B, is created if I has the value B or I " +"isn't B, no shared memory segment corresponding to I " +"exists, and B is specified in I." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:169 +#: build/C/man2/shmget.2:91 msgid "" -"The operation of B() is analogous to B(2): it removes a " -"shared memory object name, and, once all processes have unmapped the object, " -"de-allocates and destroys the contents of the associated memory region. " -"After a successful B(), attempts to B() an object " -"with the same I will fail (unless B was specified, in which " -"case a new, distinct object is created)." +"If I specifies both B and B and a shared memory " +"segment already exists for I, then B() fails with I set " +"to B. (This is analogous to the effect of the combination B for B(2).)" msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:178 -msgid "" -"On success, B() returns a nonnegative file descriptor. On " -"failure, B() returns -1. B() returns 0 on success, " -"or -1 on error." +#: build/C/man2/shmget.2:95 +msgid "The value I is composed of:" +msgstr "" + +#. type: TP +#: build/C/man2/shmget.2:95 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:185 +#: build/C/man2/shmget.2:102 msgid "" -"On failure, I is set to indicate the cause of the error. Values " -"which may appear in I include the following:" +"Create a new segment. If this flag is not used, then B() will find " +"the segment associated with I and check to see if the user has " +"permission to access the segment." msgstr "" -#. type: Plain text -#: build/C/man3/shm_open.3:190 -msgid "Permission to B() the shared memory object was denied." +#. type: TP +#: build/C/man2/shmget.2:102 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:200 +#: build/C/man2/shmget.2:108 msgid "" -"Permission was denied to B() I in the specified I, or " -"B was specified and the caller does not have write permission on " -"the object." +"This flag is used with B to ensure that this call creates the " +"segment. If the segment already exists, the call fails." msgstr "" #. type: TP -#: build/C/man3/shm_open.3:200 build/C/man2/shmget.2:192 +#: build/C/man2/shmget.2:108 #, no-wrap -msgid "B" +msgid "B (since Linux 2.6)" msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:211 +#: build/C/man2/shmget.2:114 msgid "" -"Both B and B were specified to B() and the " -"shared memory object specified by I already exists." -msgstr "" - -#. type: Plain text -#: build/C/man3/shm_open.3:218 -msgid "The I argument to B() was invalid." +"Allocate the segment using \"huge pages.\" See the Linux kernel source file " +"I for further information." msgstr "" #. type: TP -#: build/C/man3/shm_open.3:218 +#: build/C/man2/shmget.2:114 #, no-wrap -msgid "B" +msgid "B (since Linux 2.6.15)" msgstr "" +#. As at 2.6.17-rc2, this flag has no effect if SHM_HUGETLB was also +#. specified. #. type: Plain text -#: build/C/man3/shm_open.3:221 -msgid "The process already has the maximum number of files open." +#: build/C/man2/shmget.2:133 +msgid "" +"This flag serves the same purpose as the B(2) B flag. " +"Do not reserve swap space for this segment. When swap space is reserved, " +"one has the guarantee that it is possible to modify the segment. When swap " +"space is not reserved one might get B upon a write if no physical " +"memory is available. See also the discussion of the file " +"I in B(5)." msgstr "" -#. type: TP -#: build/C/man3/shm_open.3:221 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/shmget.2:143 +msgid "" +"In addition to the above flags, the least significant 9 bits of I " +"specify the permissions granted to the owner, group, and others. These bits " +"have the same format, and the same meaning, as the I argument of " +"B(2). Presently, execute permissions are not used by the system." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:227 -msgid "The length of I exceeds B." +#: build/C/man2/shmget.2:151 +msgid "" +"When a new shared memory segment is created, its contents are initialized to " +"zero values, and its associated data structure, I (see " +"B(2)), is initialized as follows:" msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:231 -msgid "The limit on the total number of files open on the system has been reached." +#: build/C/man2/shmget.2:156 +msgid "" +"I and I are set to the effective user ID of the " +"calling process." msgstr "" -#. type: TP -#: build/C/man3/shm_open.3:231 build/C/man3/shm_open.3:240 build/C/man2/shmget.2:206 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/shmget.2:161 +msgid "" +"I and I are set to the effective group ID of " +"the calling process." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:240 +#: build/C/man2/shmget.2:166 msgid "" -"An attempt was made to B() a I that did not exist, and " -"B was not specified." +"The least significant 9 bits of I are set to the least " +"significant 9 bit of I." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:247 -msgid "An attempt was to made to B() a I that does not exist." +#: build/C/man2/shmget.2:170 +msgid "I is set to the value of I." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:249 -msgid "These functions are provided in glibc 2.2 and later." +#: build/C/man2/shmget.2:177 +msgid "I, I, I, and I are set to 0." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:255 -msgid "" -"POSIX.1-2001 says that the group ownership of a newly created shared memory " -"object is set to either the calling process's effective group ID or \"a " -"system default group ID\"." +#: build/C/man2/shmget.2:180 +msgid "I is set to the current time." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:264 +#: build/C/man2/shmget.2:183 msgid "" -"POSIX leaves the behavior of the combination of B and B " -"unspecified. On Linux, this will successfully truncate an existing shared " -"memory object\\(emthis may not be so on other UNIX systems." +"If the shared memory segment already exists, the permissions are verified, " +"and a check is made to see if it is marked for destruction." msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:269 +#: build/C/man2/shmget.2:188 msgid "" -"The POSIX shared memory object implementation on Linux 2.4 makes use of a " -"dedicated file system, which is normally mounted under I." +"On success, a valid shared memory identifier is returned. On error, -1 is " +"returned, and I is set to indicate the error." +msgstr "" + +#. type: Plain text +#: build/C/man2/shmget.2:192 +msgid "On failure, I is set to one of the following:" msgstr "" #. type: Plain text -#: build/C/man3/shm_open.3:280 +#: build/C/man2/shmget.2:198 msgid "" -"B(2), B(2), B(2), B(2), B(2), " -"B(2), B(2), B(2), B(2), B(7)" +"The user does not have permission to access the shared memory segment, and " +"does not have the B capability." msgstr "" -#. type: TH -#: build/C/man7/shm_overview.7:27 -#, no-wrap -msgid "SHM_OVERVIEW" +#. type: Plain text +#: build/C/man2/shmget.2:207 +msgid "" +"B and B were specified in I, but a shared " +"memory segment already exists for I." msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:30 -msgid "shm_overview - Overview of POSIX shared memory" +#: build/C/man2/shmget.2:215 +msgid "" +"A new segment was to be created and I is less than B or " +"greater than B." msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:33 +#: build/C/man2/shmget.2:221 msgid "" -"The POSIX shared memory API allows processes to communicate information by " -"sharing a region of memory." +"A segment for the given I exists, but I is greater than the size " +"of that segment." msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:35 -msgid "The interfaces employed in the API are:" +#: build/C/man2/shmget.2:230 +msgid "No segment exists for the given I, and B was not specified." msgstr "" -#. type: TP -#: build/C/man7/shm_overview.7:35 -#, no-wrap -msgid "B(3)" +#. type: Plain text +#: build/C/man2/shmget.2:233 +msgid "No memory could be allocated for segment overhead." msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:42 +#: build/C/man2/shmget.2:241 msgid "" -"Create and open a new object, or open an existing object. This is analogous " -"to B(2). The call returns a file descriptor for use by the other " -"interfaces listed below." +"All possible shared memory IDs have been taken (B), or allocating a " +"segment of the requested I would cause the system to exceed the " +"system-wide limit on shared memory (B)." msgstr "" -#. type: TP -#: build/C/man7/shm_overview.7:42 -#, no-wrap -msgid "B(2)" +#. type: Plain text +#: build/C/man2/shmget.2:248 +msgid "" +"The B flag was specified, but the caller was not privileged " +"(did not have the B capability)." msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:46 -msgid "" -"Set the size of the shared memory object. (A newly created shared memory " -"object has a length of zero.)" +#: build/C/man2/shmget.2:256 +msgid "B and B are Linux extensions." msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:50 +#: build/C/man2/shmget.2:280 msgid "" -"Map the shared memory object into the virtual address space of the calling " -"process." +"B isn't a flag field but a I type. If this special " +"value is used for I, the system call ignores all but the least " +"significant 9 bits of I and creates a new shared memory segment." msgstr "" -#. type: TP -#: build/C/man7/shm_overview.7:50 +#. type: SS +#: build/C/man2/shmget.2:280 #, no-wrap -msgid "B(2)" +msgid "Shared memory limits" msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:54 +#: build/C/man2/shmget.2:284 msgid "" -"Unmap the shared memory object from the virtual address space of the calling " -"process." +"The following limits on shared memory segment resources affect the " +"B() call:" msgstr "" #. type: TP -#: build/C/man7/shm_overview.7:54 +#: build/C/man2/shmget.2:284 #, no-wrap -msgid "B(3)" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:57 -msgid "Remove a shared memory object name." +#: build/C/man2/shmget.2:288 +msgid "" +"System-wide limit on the total amount of shared memory, measured in units of " +"the system page size." msgstr "" -#. type: TP -#: build/C/man7/shm_overview.7:57 +#. commit 060028bac94bf60a65415d1d55a359c3a17d5c31 +#. type: Plain text +#: build/C/man2/shmget.2:294 +msgid "" +"On Linux, this limit can be read and modified via " +"I. Since Linux 3.16, the default value for this " +"limit is:" +msgstr "" + +#. type: Plain text +#: build/C/man2/shmget.2:296 build/C/man2/shmget.2:331 #, no-wrap -msgid "B(2)" +msgid " ULONG_MAX - 2^24\n" msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:62 +#: build/C/man2/shmget.2:307 msgid "" -"Close the file descriptor allocated by B(3) when it is no longer " -"needed." +"The effect of this value (which is suitable for both 32-bit and 64-bit " +"systems) is to impose no limitation on allocations. This value, rather " +"than B, was chosen as the default to prevent some cases where " +"historical applications simply raised the existing limit without first " +"checking its current value. Such applications would cause the value to " +"overflow if the limit was set at B." msgstr "" -#. type: TP -#: build/C/man7/shm_overview.7:62 +#. type: Plain text +#: build/C/man2/shmget.2:310 +msgid "From Linux 2.4 up to Linux 3.15, the default value for this limit was:" +msgstr "" + +#. type: Plain text +#: build/C/man2/shmget.2:312 #, no-wrap -msgid "B(2)" +msgid " SHMMAX / PAGE_SIZE * (SHMMNI / 16)\n" msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:76 +#: build/C/man2/shmget.2:320 msgid "" -"Obtain a I structure that describes the shared memory object. Among " -"the information returned by this call are the object's size (I), " -"permissions (I), owner (I), and group (I)." +"If B and B were not modified, then multiplying the result of " +"this formula by the page size (to get a value in bytes) yielded a value of 8 " +"GB as the limit on the total memory used by all shared memory segments." msgstr "" #. type: TP -#: build/C/man7/shm_overview.7:76 +#: build/C/man2/shmget.2:320 #, no-wrap -msgid "B(2)" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:79 -msgid "To change the ownership of a shared memory object." +#: build/C/man2/shmget.2:323 +msgid "Maximum size in bytes for a shared memory segment." msgstr "" -#. type: TP -#: build/C/man7/shm_overview.7:79 -#, no-wrap -msgid "B(2)" +#. commit 060028bac94bf60a65415d1d55a359c3a17d5c31 +#. type: Plain text +#: build/C/man2/shmget.2:329 +msgid "" +"On Linux, this limit can be read and modified via " +"I. Since Linux 3.16, the default value for this " +"limit is:" msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:82 -msgid "To change the permissions of a shared memory object." +#: build/C/man2/shmget.2:340 +msgid "" +"The effect of this value (which is suitable for both 32-bit and 64-bit " +"systems) is to impose no limitation on allocations. See the description of " +"B for a discussion of why this default value (rather than " +"B) is used." msgstr "" -#. type: SS -#: build/C/man7/shm_overview.7:82 -#, no-wrap -msgid "Versions" +#. type: Plain text +#: build/C/man2/shmget.2:343 +msgid "" +"From Linux 2.2 up to Linux 3.15, the default value of this limit was " +"0x2000000 (32MB)." msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:84 -msgid "POSIX shared memory is supported since Linux 2.4 and glibc 2.2." +#: build/C/man2/shmget.2:349 +msgid "" +"Because it is not possible to map just part of a shared memory segment, the " +"amount of virtual memory places another limit on the maximum size of a " +"usable segment: for example, on i386 the largest segments that can be mapped " +"have a size of around 2.8 GB, and on x86_64 the limit is around 127 TB." msgstr "" -#. type: SS -#: build/C/man7/shm_overview.7:84 +#. type: TP +#: build/C/man2/shmget.2:349 #, no-wrap -msgid "Persistence" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:89 +#: build/C/man2/shmget.2:355 msgid "" -"POSIX shared memory objects have kernel persistence: a shared memory object " -"will exist until the system is shut down, or until all processes have " -"unmapped the object and it has been deleted with B(3)" +"Minimum size in bytes for a shared memory segment: implementation dependent " +"(currently 1 byte, though B is the effective minimum size)." msgstr "" -#. type: SS -#: build/C/man7/shm_overview.7:89 +#. type: TP +#: build/C/man2/shmget.2:355 #, no-wrap -msgid "Linking" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:94 +#: build/C/man2/shmget.2:360 msgid "" -"Programs using the POSIX shared memory API must be compiled with I " -"to link against the real-time library, I." -msgstr "" - -#. type: SS -#: build/C/man7/shm_overview.7:94 -#, no-wrap -msgid "Accessing shared memory objects via the file system" +"System-wide limit on the number of shared memory segments. In Linux 2.2, " +"the default value for this limit was 128; since Linux 2.4, the default value " +"is 4096." msgstr "" +#. Kernels between 2.4.x and 2.6.8 had an off-by-one error that meant +#. that we could create one more segment than SHMMNI -- MTK +#. This /proc file is not available in Linux 2.2 and earlier -- MTK #. type: Plain text -#: build/C/man7/shm_overview.7:101 +#: build/C/man2/shmget.2:366 msgid "" -"On Linux, shared memory objects are created in a (I) virtual file " -"system, normally mounted under I. Since kernel 2.6.19, Linux " -"supports the use of access control lists (ACLs) to control the permissions " -"of objects in the virtual file system." +"On Linux, this limit can be read and modified via " +"I." msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:106 +#: build/C/man2/shmget.2:370 msgid "" -"Typically, processes must synchronize their access to a shared memory " -"object, using, for example, POSIX semaphores." +"The implementation has no specific limits for the per-process maximum number " +"of shared memory segments (B)." msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:114 +#: build/C/man2/shmget.2:376 msgid "" -"System V shared memory (B(2), B(2), etc.) is an older shared " -"memory API. POSIX shared memory provides a simpler, and better designed " -"interface; on the other hand POSIX shared memory is somewhat less widely " -"available (especially on older systems) than System V shared memory." +"Until version 2.3.30, Linux would return B for a B() on a " +"shared memory segment scheduled for deletion." msgstr "" #. type: Plain text -#: build/C/man7/shm_overview.7:127 +#: build/C/man2/shmget.2:382 msgid "" -"B(2), B(2), B(2), B(2), B(2), " -"B(2), B(2), B(2), B(2), B(3), " -"B(3), B(7)" +"The name choice B was perhaps unfortunate, B would " +"more clearly show its function." msgstr "" -#. type: TH -#: build/C/man2/shmctl.2:43 -#, no-wrap -msgid "SHMCTL" +#. type: Plain text +#: build/C/man2/shmget.2:391 +msgid "" +"B(2), B(2), B(2), B(2), B(3), " +"B(7), B(7), B(7)" msgstr "" #. type: TH -#: build/C/man2/shmctl.2:43 +#: build/C/man2/shmop.2:41 #, no-wrap -msgid "2008-08-07" +msgid "SHMOP" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:46 -msgid "shmctl - shared memory control" +#: build/C/man2/shmop.2:44 +msgid "shmat, shmdt - System V shared memory operations" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:49 build/C/man2/shmget.2:42 -msgid "B<#include Esys/ipc.hE>" +#: build/C/man2/shmop.2:48 +#, no-wrap +msgid "" +"B<#include Esys/types.hE>\n" +"B<#include Esys/shm.hE>\n" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:51 build/C/man2/shmget.2:44 -msgid "B<#include Esys/shm.hE>" +#: build/C/man2/shmop.2:50 +#, no-wrap +msgid "" +"BIB<, const void *>IB<, int " +">IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:53 -msgid "BIB<, int >IB<, struct shmid_ds *>IB<);>" +#: build/C/man2/shmop.2:52 +#, no-wrap +msgid "BIB<);>\n" msgstr "" -#. type: Plain text -#: build/C/man2/shmctl.2:60 -msgid "" -"B() performs the control operation specified by I on the " -"shared memory segment whose identifier is given in I." +#. type: SS +#: build/C/man2/shmop.2:54 +#, no-wrap +msgid "shmat()" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:65 +#: build/C/man2/shmop.2:62 msgid "" -"The I argument is a pointer to a I structure, defined in " -"Isys/shm.hE> as follows:" +"B() attaches the System\\ V shared memory segment identified by " +"I to the address space of the calling process. The attaching address " +"is specified by I with one of the following criteria:" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:79 -#, no-wrap +#: build/C/man2/shmop.2:68 msgid "" -"struct shmid_ds {\n" -" struct ipc_perm shm_perm; /* Ownership and permissions */\n" -" size_t shm_segsz; /* Size of segment (bytes) */\n" -" time_t shm_atime; /* Last attach time */\n" -" time_t shm_dtime; /* Last detach time */\n" -" time_t shm_ctime; /* Last change time */\n" -" pid_t shm_cpid; /* PID of creator */\n" -" pid_t shm_lpid; /* PID of last shmat(2)/shmdt(2) */\n" -" shmatt_t shm_nattch; /* No. of current attaches */\n" -" ...\n" -"};\n" +"If I is NULL, the system chooses a suitable (unused) address at " +"which to attach the segment." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:87 +#: build/C/man2/shmop.2:80 msgid "" -"The I structure is defined in Isys/ipc.hE> as follows " -"(the highlighted fields are settable using B):" +"If I isn't NULL and B is specified in I, the " +"attach occurs at the address equal to I rounded down to the nearest " +"multiple of B." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:100 -#, no-wrap +#: build/C/man2/shmop.2:84 msgid "" -"struct ipc_perm {\n" -" key_t __key; /* Key supplied to shmget(2) */\n" -" uid_t B; /* Effective UID of owner */\n" -" gid_t B; /* Effective GID of owner */\n" -" uid_t cuid; /* Effective UID of creator */\n" -" gid_t cgid; /* Effective GID of creator */\n" -" unsigned short B; /* B + SHM_DEST and\n" -" SHM_LOCKED flags */\n" -" unsigned short __seq; /* Sequence number */\n" -"};\n" +"Otherwise, I must be a page-aligned address at which the attach " +"occurs." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:106 -msgid "Valid values for I are:" +#: build/C/man2/shmop.2:90 +msgid "" +"In addition to B, the following flags may be specified in the " +"I bit-mask argument:" msgstr "" #. type: TP -#: build/C/man2/shmctl.2:107 +#: build/C/man2/shmop.2:90 #, no-wrap -msgid "B" +msgid "B (Linux-specific; since Linux 2.6.9)" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:116 +#: build/C/man2/shmop.2:94 msgid "" -"Copy information from the kernel data structure associated with I " -"into the I structure pointed to by I. The caller must have " -"read permission on the shared memory segment." +"Allow the contents of the segment to be executed. The caller must have " +"execute permission on the segment." msgstr "" #. type: TP -#: build/C/man2/shmctl.2:116 +#: build/C/man2/shmop.2:94 #, no-wrap -msgid "B" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:134 +#: build/C/man2/shmop.2:102 msgid "" -"Write the values of some members of the I structure pointed to by " -"I to the kernel data structure associated with this shared memory " -"segment, updating also its I member. The following fields can be " -"changed: I, I, and (the least significant 9 bits " -"of) I. The effective UID of the calling process must match " -"the owner (I) or creator (I) of the shared " -"memory segment, or the caller must be privileged." +"Attach the segment for read-only access. The process must have read " +"permission for the segment. If this flag is not specified, the segment is " +"attached for read and write access, and the process must have read and write " +"permission for the segment. There is no notion of a write-only shared " +"memory segment." msgstr "" #. type: TP -#: build/C/man2/shmctl.2:134 +#: build/C/man2/shmop.2:102 #, no-wrap -msgid "B" +msgid "B (Linux-specific)" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:151 +#: build/C/man2/shmop.2:115 msgid "" -"Mark the segment to be destroyed. The segment will only actually be " -"destroyed after the last process detaches it (i.e., when the I " -"member of the associated structure I is zero). The caller must be " -"the owner or creator, or be privileged. If a segment has been marked for " -"destruction, then the (nonstandard) B flag of the " -"I field in the associated data structure retrieved by " -"B will be set." +"This flag specifies that the mapping of the segment should replace any " +"existing mapping in the range starting at I and continuing for the " +"size of the segment. (Normally, an B error would result if a " +"mapping already exists in this address range.) In this case, I " +"must not be NULL." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:154 +#: build/C/man2/shmop.2:122 msgid "" -"The caller I ensure that a segment is eventually destroyed; otherwise " -"its pages that were faulted in will remain in memory or swap." +"The B(2) value of the calling process is not altered by the attach. " +"The segment will automatically be detached at process exit. The same " +"segment may be attached as a read and as a read-write one, and more than " +"once, in the process's address space." msgstr "" -#. type: TP -#: build/C/man2/shmctl.2:154 -#, no-wrap -msgid "B (Linux-specific)" +#. type: Plain text +#: build/C/man2/shmop.2:130 +msgid "" +"A successful B() call updates the members of the I " +"structure (see B(2)) associated with the shared memory segment as " +"follows:" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:167 -msgid "" -"Returns information about system-wide shared memory limits and parameters in " -"the structure pointed to by I. This structure is of type I " -"(thus, a cast is required), defined in Isys/shm.hE> if the " -"B<_GNU_SOURCE> feature test macro is defined:" +#: build/C/man2/shmop.2:133 +msgid "I is set to the current time." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:181 -#, no-wrap -msgid "" -"struct shminfo {\n" -" unsigned long shmmax; /* Maximum segment size */\n" -" unsigned long shmmin; /* Minimum segment size;\n" -" always 1 */\n" -" unsigned long shmmni; /* Maximum number of segments */\n" -" unsigned long shmseg; /* Maximum number of segments\n" -" that a process can attach;\n" -" unused within kernel */\n" -" unsigned long shmall; /* Maximum number of pages of\n" -" shared memory, system-wide */\n" -"};\n" +#: build/C/man2/shmop.2:136 build/C/man2/shmop.2:163 +msgid "I is set to the process-ID of the calling process." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:194 -msgid "" -"The I, I, and I settings can be changed via I " -"files of the same name; see B(5) for details." +#: build/C/man2/shmop.2:140 +msgid "I is incremented by one." msgstr "" -#. type: TP -#: build/C/man2/shmctl.2:194 +#. type: SS +#: build/C/man2/shmop.2:140 #, no-wrap -msgid "B (Linux-specific)" +msgid "shmdt()" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:205 +#: build/C/man2/shmop.2:151 msgid "" -"Returns a I structure whose fields contain information about " -"system resources consumed by shared memory. This structure is defined in " -"Isys/shm.hE> if the B<_GNU_SOURCE> feature test macro is defined:" +"B() detaches the shared memory segment located at the address " +"specified by I from the address space of the calling process. The " +"to-be-detached segment must be currently attached with I equal to " +"the value returned by the attaching B() call." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:222 -#, no-wrap +#: build/C/man2/shmop.2:157 msgid "" -"struct shm_info {\n" -" int used_ids; /* # of currently existing\n" -" segments */\n" -" unsigned long shm_tot; /* Total number of shared\n" -" memory pages */\n" -" unsigned long shm_rss; /* # of resident shared\n" -" memory pages */\n" -" unsigned long shm_swp; /* # of swapped shared\n" -" memory pages */\n" -" unsigned long swap_attempts;\n" -" /* Unused since Linux 2.4 */\n" -" unsigned long swap_successes;\n" -" /* Unused since Linux 2.4 */\n" -"};\n" +"On a successful B() call, the system updates the members of the " +"I structure associated with the shared memory segment as follows:" msgstr "" -#. type: TP -#: build/C/man2/shmctl.2:224 -#, no-wrap -msgid "B (Linux-specific)" +#. type: Plain text +#: build/C/man2/shmop.2:160 +msgid "I is set to the current time." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:235 +#: build/C/man2/shmop.2:168 msgid "" -"Returns a I structure as for B. However, the I " -"argument is not a segment identifier, but instead an index into the kernel's " -"internal array that maintains information about all shared memory segments " -"on the system." +"I is decremented by one. If it becomes 0 and the segment is " +"marked for deletion, the segment is deleted." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:238 +#: build/C/man2/shmop.2:176 msgid "" -"The caller can prevent or allow swapping of a shared memory segment with the " -"following I values:" +"On success, B() returns the address of the attached shared memory " +"segment; on error, I<(void\\ *)\\ -1> is returned, and I is set to " +"indicate the cause of the error." msgstr "" -#. type: TP -#: build/C/man2/shmctl.2:239 -#, no-wrap -msgid "B (Linux-specific)" +#. type: Plain text +#: build/C/man2/shmop.2:182 +msgid "" +"On success, B() returns 0; on error -1 is returned, and I is " +"set to indicate the cause of the error." +msgstr "" + +#. type: Plain text +#: build/C/man2/shmop.2:188 +msgid "When B() fails, I is set to one of the following:" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:251 +#: build/C/man2/shmop.2:194 msgid "" -"Prevent swapping of the shared memory segment. The caller must fault in any " -"pages that are required to be present after locking is enabled. If a " -"segment has been locked, then the (nonstandard) B flag of the " -"I field in the associated data structure retrieved by " -"B will be set." +"The calling process does not have the required permissions for the requested " +"attach type, and does not have the B capability." msgstr "" -#. type: TP -#: build/C/man2/shmctl.2:251 -#, no-wrap -msgid "B (Linux-specific)" +#. type: Plain text +#: build/C/man2/shmop.2:211 +msgid "" +"Invalid I value, unaligned (i.e., not page-aligned and B was " +"not specified) or invalid I value, or can't attach segment at " +"I, or B was specified and I was NULL." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:254 -msgid "Unlock the segment, allowing it to be swapped out." +#: build/C/man2/shmop.2:214 +msgid "Could not allocate memory for the descriptor or for the page tables." msgstr "" -#. There was some weirdness in 2.6.9: SHM_LOCK and SHM_UNLOCK could -#. be applied to a segment, regardless of ownership of the segment. -#. This was a botch-up in the move to RLIMIT_MEMLOCK, and was fixed -#. in 2.6.10. MTK, May 2005 #. type: Plain text -#: build/C/man2/shmctl.2:272 +#: build/C/man2/shmop.2:220 +msgid "When B() fails, I is set as follows:" +msgstr "" + +#. The following since 2.6.17-rc1: +#. type: Plain text +#: build/C/man2/shmop.2:228 msgid "" -"In kernels before 2.6.10, only a privileged process could employ B " -"and B. Since kernel 2.6.10, an unprivileged process can employ " -"these operations if its effective UID matches the owner or creator UID of " -"the segment, and (for B) the amount of memory to be locked falls " -"within the B resource limit (see B(2))." +"There is no shared memory segment attached at I; or, I is " +"not aligned on a page boundary." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:290 +#: build/C/man2/shmop.2:243 msgid "" -"A successful B or B operation returns the index of the " -"highest used entry in the kernel's internal array recording information " -"about all shared memory segments. (This information can be used with " -"repeated B operations to obtain information about all shared " -"memory segments on the system.) A successful B operation returns " -"the identifier of the shared memory segment whose index was given in " -"I. Other operations return 0 on success." +"In SVID 3 (or perhaps earlier), the type of the I argument was " +"changed from I into I, and the returned type of " +"B() from I into I." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:294 -msgid "On error, -1 is returned, and I is set appropriately." +#: build/C/man2/shmop.2:248 +msgid "After a B(2), the child inherits the attached shared memory segments." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:303 +#: build/C/man2/shmop.2:252 msgid "" -"B or B is requested and I does not allow " -"read access for I, and the calling process does not have the " -"B capability." +"After an B(2), all attached shared memory segments are detached from " +"the process." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:314 +#: build/C/man2/shmop.2:256 msgid "" -"The argument I has value B or B but the address " -"pointed to by I isn't accessible." -msgstr "" - -#. type: TP -#: build/C/man2/shmctl.2:314 -#, no-wrap -msgid "B" +"Upon B<_exit>(2), all attached shared memory segments are detached from the " +"process." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:317 -msgid "I points to a removed identifier." +#: build/C/man2/shmop.2:268 +msgid "" +"Using B() with I equal to NULL is the preferred, portable " +"way of attaching a shared memory segment. Be aware that the shared memory " +"segment attached in this way may be attached at different addresses in " +"different processes. Therefore, any pointers maintained within the shared " +"memory must be made relative (typically to the starting address of the " +"segment), rather than absolute." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:326 +#: build/C/man2/shmop.2:273 msgid "" -"I is not a valid identifier, or I is not a valid command. Or: " -"for a B operation, the index value specified in I referred " -"to an array slot that is currently unused." +"On Linux, it is possible to attach a shared memory segment even if it is " +"already marked to be deleted. However, POSIX.1-2001 does not specify this " +"behavior and many other implementations do not support it." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:337 -msgid "" -"(In kernels since 2.6.9), B was specified and the size of the " -"to-be-locked segment would mean that the total bytes in locked shared memory " -"segments would exceed the limit for the real user ID of the calling " -"process. This limit is defined by the B soft resource limit " -"(see B(2))." +#: build/C/man2/shmop.2:276 +msgid "The following system parameter affects B():" msgstr "" #. type: TP -#: build/C/man2/shmctl.2:337 +#: build/C/man2/shmop.2:276 #, no-wrap -msgid "B" +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:342 +#: build/C/man2/shmop.2:289 msgid "" -"B is attempted, and the GID or UID value is too large to be stored " -"in the structure pointed to by I." +"Segment low boundary address multiple. When explicitly specifying an attach " +"address in a call to B(), the caller should ensure that the address " +"is a multiple of this value. This is necessary on some architectures, in " +"order either to ensure good CPU cache performance or to ensure that " +"different attaches of the same segment have consistent views within the CPU " +"cache. B is normally some multiple of the system page size (on many " +"Linux architectures, it is the same as the system page size)." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:354 +#: build/C/man2/shmop.2:293 msgid "" -"B or B is attempted, and the effective user ID of the " -"calling process is not that of the creator (found in I), or " -"the owner (found in I), and the process was not privileged " -"(Linux: did not have the B capability)." +"The implementation places no intrinsic per-process limit on the number of " +"shared memory segments (B)." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:366 +#: build/C/man2/shmop.2:301 msgid "" -"Or (in kernels before 2.6.9), B or B was specified, " -"but the process was not privileged (Linux: did not have the B " -"capability). (Since Linux 2.6.9, this error can also occur if the " -"B is 0 and the caller is not privileged.)" +"B(2), B(2), B(2), B(2), B(7), " +"B(7), B(7)" +msgstr "" + +#. type: TH +#: build/C/man2/subpage_prot.2:30 +#, no-wrap +msgid "SUBPAGE_PROT" +msgstr "" + +#. type: TH +#: build/C/man2/subpage_prot.2:30 +#, no-wrap +msgid "2012-07-13" msgstr "" -#. SVr4 documents an additional error condition EMFILE. #. type: Plain text -#: build/C/man2/shmctl.2:371 build/C/man2/shmget.2:232 build/C/man2/shmop.2:229 -msgid "SVr4, POSIX.1-2001." +#: build/C/man2/subpage_prot.2:33 +msgid "subpage_prot - define a subpage protection for an address range" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:382 +#: build/C/man2/subpage_prot.2:37 +#, no-wrap msgid "" -"The B, B and B operations are used by the " -"B(1) program to provide information on allocated resources. In the " -"future these may modified or moved to a /proc file system interface." +"BIB<, unsigned long >IB<,>\n" +"B< uint32_t *>IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:390 +#: build/C/man2/subpage_prot.2:41 +msgid "I: There is no glibc wrapper for this system call; see NOTES." +msgstr "" + +#. type: Plain text +#: build/C/man2/subpage_prot.2:47 msgid "" -"Linux permits a process to attach (B(2)) a shared memory segment " -"that has already been marked for deletion using I. This " -"feature is not available on other UNIX implementations; portable " -"applications should avoid relying on it." +"The PowerPC-specific B() system call provides the facility to " +"control the access permissions on individual 4kB subpages on systems " +"configured with a page size of 64kB." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:403 +#: build/C/man2/subpage_prot.2:54 msgid "" -"Various fields in a I were typed as I under Linux " -"2.2 and have become I under Linux 2.4. To take advantage of this, a " -"recompilation under glibc-2.1.91 or later should suffice. (The kernel " -"distinguishes old and new calls by an B flag in I.)" +"The protection map is applied to the memory pages in the region starting at " +"I and continuing for I bytes. Both of these arguments must be " +"aligned to a 64-kB boundary." msgstr "" #. type: Plain text -#: build/C/man2/shmctl.2:410 +#: build/C/man2/subpage_prot.2:66 msgid "" -"B(2), B(2), B(2), B(2), B(7), " -"B(7)" +"The protection map is specified in the buffer pointed to by I. The map " +"has 2 bits per 4kB subpage; thus each 32-bit word specifies the protections " +"of 16 4kB subpages inside a 64kB page (so, the number of 32-bit words " +"pointed to by I should equate to the number of 64-kB pages specified by " +"I). Each 2-bit field in the protection map is either 0 to allow any " +"access, 1 to prevent writes, or 2 or 3 to prevent all accesses." msgstr "" -#. type: TH -#: build/C/man2/shmget.2:36 -#, no-wrap -msgid "SHMGET" +#. type: Plain text +#: build/C/man2/subpage_prot.2:71 +msgid "" +"On success, B() returns 0. Otherwise, one of the error codes " +"specified below is returned." msgstr "" -#. type: TH -#: build/C/man2/shmget.2:36 -#, no-wrap -msgid "2006-05-02" +#. type: Plain text +#: build/C/man2/subpage_prot.2:77 +msgid "The buffer referred to by I is not accessible." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:39 -msgid "shmget - allocates a shared memory segment" +#: build/C/man2/subpage_prot.2:87 +msgid "" +"The I or I arguments are incorrect. Both of these arguments must " +"be aligned to a multiple of the system page size, and they must not refer to " +"a region outside of the address space of the process or to a region that " +"consists of huge pages." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:46 -msgid "BIB<, size_t >IB<, int >IB<);>" +#: build/C/man2/subpage_prot.2:90 build/C/man2/sync_file_range.2:166 +msgid "Out of memory." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:70 +#: build/C/man2/subpage_prot.2:96 msgid "" -"B() returns the identifier of the shared memory segment associated " -"with the value of the argument I. A new shared memory segment, with " -"size equal to the value of I rounded up to a multiple of B, " -"is created if I has the value B or I isn't " -"B, no shared memory segment corresponding to I exists, and " -"B is specified in I." +"This system call is provided on the PowerPC architecture since Linux " +"2.6.25. The system call is provided only if the kernel is configured with " +"B. No library support is provided." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:89 +#: build/C/man2/subpage_prot.2:101 msgid "" -"If I specifies both B and B and a shared memory " -"segment already exists for I, then B() fails with I set " -"to B. (This is analogous to the effect of the combination B for B(2).)" +"Glibc does not provide a wrapper for this system call; call it using " +"B(2)." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:93 -msgid "The value I is composed of:" +#: build/C/man2/subpage_prot.2:106 +msgid "" +"Normal page protections (at the 64-kB page level) also apply; the subpage " +"protection mechanism is an additional constraint, so putting 0 in a 2-bit " +"field won't allow writes to a page that is otherwise write-protected." msgstr "" -#. type: TP -#: build/C/man2/shmget.2:93 +#. type: SS +#: build/C/man2/subpage_prot.2:106 #, no-wrap -msgid "B" +msgid "Rationale" msgstr "" +#. In the initial implementation, it was the case that: +#. In fact the whole process is switched to use 4k hardware pages when the +#. subpage_prot system call is used, but this could be improved in future +#. to switch only the affected segments. +#. But Paul Mackerass says (Oct 2010): I'm pretty sure we now only switch +#. the affected segment, not the whole process. #. type: Plain text -#: build/C/man2/shmget.2:100 +#: build/C/man2/subpage_prot.2:128 msgid "" -"to create a new segment. If this flag is not used, then B() will " -"find the segment associated with I and check to see if the user has " -"permission to access the segment." +"This system call is provided to assist writing emulators that operate using " +"64-kB pages on PowerPC systems. When emulating systems such as x86, which " +"uses a smaller page size, the emulator can no longer use the " +"memory-management unit (MMU) and normal system calls for controlling page " +"protections. (The emulator could emulate the MMU by checking and possibly " +"remapping the address for each memory access in software, but that is slow.) " +"The idea is that the emulator supplies an array of protection masks to apply " +"to a specified range of virtual addresses. These masks are applied at the " +"level where hardware page-table entries (PTEs) are inserted into the " +"hardware page table based on the Linux PTEs, so the Linux PTEs are not " +"affected. Implicit in this is that the regions of the address space that " +"are protected are switched to use 4-kB hardware pages rather than 64-kB " +"hardware pages (on machines with hardware 64-kB page support)." msgstr "" -#. type: TP -#: build/C/man2/shmget.2:100 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/subpage_prot.2:131 +msgid "B(2), B(2)" msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:103 -msgid "used with B to ensure failure if the segment already exists." +#: build/C/man2/subpage_prot.2:134 +msgid "I in the Linux kernel source tree" msgstr "" -#. type: TP -#: build/C/man2/shmget.2:103 +#. type: TH +#: build/C/man2/sync_file_range.2:30 #, no-wrap -msgid "I" +msgid "SYNC_FILE_RANGE" msgstr "" -#. type: Plain text -#: build/C/man2/shmget.2:113 -msgid "" -"(least significant 9 bits) specifying the permissions granted to the owner, " -"group, and world. These bits have the same format, and the same meaning, as " -"the I argument of B(2). Presently, the execute permissions are " -"not used by the system." +#. type: TH +#: build/C/man2/sync_file_range.2:30 +#, no-wrap +msgid "2014-08-19" msgstr "" -#. type: TP -#: build/C/man2/shmget.2:113 -#, no-wrap -msgid "B (since Linux 2.6)" +#. type: Plain text +#: build/C/man2/sync_file_range.2:33 +msgid "sync_file_range - sync a file segment with disk" msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:119 +#: build/C/man2/sync_file_range.2:37 +#, no-wrap msgid "" -"Allocate the segment using \"huge pages.\" See the kernel source file " -"I for further information." +"B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" +"B<#include Efcntl.hE>\n" msgstr "" -#. type: TP -#: build/C/man2/shmget.2:119 +#. type: Plain text +#: build/C/man2/sync_file_range.2:40 #, no-wrap -msgid "B (since Linux 2.6.15)" +msgid "" +"BIB<, off64_t >IB<, off64_t " +">IB<,>\n" +"B< unsigned int >IB<);>\n" msgstr "" -#. As at 2.6.17-rc2, this flag has no effect if SHM_HUGETLB was also -#. specified. #. type: Plain text -#: build/C/man2/shmget.2:138 +#: build/C/man2/sync_file_range.2:47 msgid "" -"This flag serves the same purpose as the B(2) B flag. " -"Do not reserve swap space for this segment. When swap space is reserved, " -"one has the guarantee that it is possible to modify the segment. When swap " -"space is not reserved one might get B upon a write if no physical " -"memory is available. See also the discussion of the file " -"I in B(5)." +"B() permits fine control when synchronizing the open file " +"referred to by the file descriptor I with disk." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:146 +#: build/C/man2/sync_file_range.2:61 msgid "" -"When a new shared memory segment is created, its contents are initialized to " -"zero values, and its associated data structure, I (see " -"B(2)), is initialized as follows:" +"I is the starting byte of the file range to be synchronized. " +"I specifies the length of the range to be synchronized, in bytes; if " +"I is zero, then all bytes from I through to the end of file " +"are synchronized. Synchronization is in units of the system page size: " +"I is rounded down to a page boundary; I<(offset+nbytes-1)> is " +"rounded up to a page boundary." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:151 -msgid "" -"I and I are set to the effective user ID of the " -"calling process." +#: build/C/man2/sync_file_range.2:65 +msgid "The I bit-mask argument can include any of the following values:" +msgstr "" + +#. type: TP +#: build/C/man2/sync_file_range.2:65 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:156 +#: build/C/man2/sync_file_range.2:70 msgid "" -"I and I are set to the effective group ID of " -"the calling process." +"Wait upon write-out of all pages in the specified range that have already " +"been submitted to the device driver for write-out before performing any " +"write." +msgstr "" + +#. type: TP +#: build/C/man2/sync_file_range.2:70 build/C/man2/sync_file_range.2:120 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:161 +#: build/C/man2/sync_file_range.2:76 msgid "" -"The least significant 9 bits of I are set to the least " -"significant 9 bit of I." +"Initiate write-out of all dirty pages in the specified range which are not " +"presently submitted write-out. Note that even this may block if you attempt " +"to write more than request queue size." msgstr "" -#. type: Plain text -#: build/C/man2/shmget.2:165 -msgid "I is set to the value of I." +#. type: TP +#: build/C/man2/sync_file_range.2:76 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:172 -msgid "I, I, I and I are set to 0." +#: build/C/man2/sync_file_range.2:80 +msgid "Wait upon write-out of all pages in the range after performing any write." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:175 -msgid "I is set to the current time." +#: build/C/man2/sync_file_range.2:84 +msgid "Specifying I as 0 is permitted, as a no-op." +msgstr "" + +#. type: SS +#: build/C/man2/sync_file_range.2:84 +#, no-wrap +msgid "Warning" msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:178 +#: build/C/man2/sync_file_range.2:100 msgid "" -"If the shared memory segment already exists, the permissions are verified, " -"and a check is made to see if it is marked for destruction." +"This system call is extremely dangerous and should not be used in portable " +"programs. None of these operations writes out the file's metadata. " +"Therefore, unless the application is strictly performing overwrites of " +"already-instantiated disk blocks, there are no guarantees that the data will " +"be available after a crash. There is no user interface to know if a write " +"is purely an overwrite. On filesystems using copy-on-write semantics (e.g., " +"I) an overwrite of existing allocated blocks is impossible. When " +"writing into preallocated space, many filesystems also require calls into " +"the block allocator, which this system call does not sync out to disk. This " +"system call does not flush disk write caches and thus does not provide any " +"data integrity on systems with volatile disk write caches." msgstr "" -#. type: Plain text -#: build/C/man2/shmget.2:182 -msgid "A valid segment identifier, I, is returned on success, -1 on error." +#. type: SS +#: build/C/man2/sync_file_range.2:100 +#, no-wrap +msgid "Some details" msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:186 -msgid "On failure, I is set to one of the following:" +#: build/C/man2/sync_file_range.2:108 +msgid "" +"B and B will detect " +"any I/O errors or B conditions and will return these to the caller." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:192 -msgid "" -"The user does not have permission to access the shared memory segment, and " -"does not have the B capability." +#: build/C/man2/sync_file_range.2:112 +msgid "Useful combinations of the I bits are:" msgstr "" -#. type: Plain text -#: build/C/man2/shmget.2:196 -msgid "B was specified and the segment exists." +#. type: TP +#: build/C/man2/sync_file_range.2:112 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:202 +#: build/C/man2/sync_file_range.2:120 msgid "" -"A new segment was to be created and I E B or I E " -"B, or no new segment was to be created, a segment with given key " -"existed, but I is greater than the size of that segment." +"Ensures that all pages in the specified range which were dirty when " +"B() was called are placed under write-out. This is a " +"start-write-for-data-integrity operation." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:211 -msgid "No segment exists for the given I, and B was not specified." +#: build/C/man2/sync_file_range.2:127 +msgid "" +"Start write-out of all dirty pages in the specified range which are not " +"presently under write-out. This is an asynchronous flush-to-disk " +"operation. This is not suitable for data integrity operations." msgstr "" -#. type: Plain text -#: build/C/man2/shmget.2:214 -msgid "No memory could be allocated for segment overhead." +#. type: TP +#: build/C/man2/sync_file_range.2:127 +#, no-wrap +msgid "B (or B)" msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:222 +#: build/C/man2/sync_file_range.2:134 msgid "" -"All possible shared memory IDs have been taken (B), or allocating a " -"segment of the requested I would cause the system to exceed the " -"system-wide limit on shared memory (B)." +"Wait for completion of write-out of all pages in the specified range. This " +"can be used after an earlier B operation to wait for completion of that operation, " +"and obtain its result." msgstr "" -#. type: Plain text -#: build/C/man2/shmget.2:229 +#. type: TP +#: build/C/man2/sync_file_range.2:134 +#, no-wrap msgid "" -"The B flag was specified, but the caller was not privileged " -"(did not have the B capability)." +"B" msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:235 -msgid "B is a nonportable Linux extension." +#: build/C/man2/sync_file_range.2:141 +msgid "" +"This is a write-for-data-integrity operation that will ensure that all pages " +"in the specified range which were dirty when B() was " +"called are committed to disk." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:245 +#: build/C/man2/sync_file_range.2:147 msgid "" -"B isn't a flag field but a I type. If this special " -"value is used for I, the system call ignores everything but the least " -"significant 9 bits of I and creates a new shared memory segment (on " -"success)." +"On success, B() returns 0; on failure -1 is returned and " +"I is set to indicate the error." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:249 -msgid "" -"The following limits on shared memory segment resources affect the " -"B() call:" +#: build/C/man2/sync_file_range.2:152 +msgid "I is not a valid file descriptor." msgstr "" -#. type: TP -#: build/C/man2/shmget.2:249 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/sync_file_range.2:160 +msgid "I specifies an invalid bit; or I or I is invalid." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:254 -msgid "" -"System wide maximum of shared memory pages (on Linux, this limit can be read " -"and modified via I)." +#: build/C/man2/sync_file_range.2:163 +msgid "I/O error." msgstr "" -#. type: TP -#: build/C/man2/shmget.2:254 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/sync_file_range.2:169 +msgid "Out of disk space." msgstr "" +#. FIXME . (bug?) Actually, how can 'fd' refer to a symbolic link (S_ISLNK)? +#. (In user space at least) it isn't possible to obtain a file descriptor +#. for a symbolic link. #. type: Plain text -#: build/C/man2/shmget.2:259 +#: build/C/man2/sync_file_range.2:177 msgid "" -"Maximum size in bytes for a shared memory segment: policy dependent (on " -"Linux, this limit can be read and modified via I)." +"I refers to something other than a regular file, a block device, a " +"directory, or a symbolic link." msgstr "" -#. type: TP -#: build/C/man2/shmget.2:259 -#, no-wrap -msgid "B" +#. type: Plain text +#: build/C/man2/sync_file_range.2:180 +msgid "B() appeared on Linux in kernel 2.6.17." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:265 +#: build/C/man2/sync_file_range.2:183 msgid "" -"Minimum size in bytes for a shared memory segment: implementation dependent " -"(currently 1 byte, though B is the effective minimum size)." +"This system call is Linux-specific, and should be avoided in portable " +"programs." msgstr "" -#. type: TP -#: build/C/man2/shmget.2:265 +#. type: SS +#: build/C/man2/sync_file_range.2:184 #, no-wrap -msgid "B" +msgid "sync_file_range2()" msgstr "" -#. Kernels between 2.4.x and 2.6.8 had an off-by-one error that meant -#. that we could create one more segment than SHMMNI -- MTK -#. This /proc file is not available in Linux 2.2 and earlier -- MTK +#. See kernel commit edd5cd4a9424f22b0fa08bef5e299d41befd5622 #. type: Plain text -#: build/C/man2/shmget.2:274 +#: build/C/man2/sync_file_range.2:201 msgid "" -"System wide maximum number of shared memory segments: implementation " -"dependent (currently 4096, was 128 before Linux 2.3.99; on Linux, this limit " -"can be read and modified via I)." +"Some architectures (e.g., PowerPC, ARM) need 64-bit arguments to be aligned " +"in a suitable pair of registers. On such architectures, the call signature " +"of B() shown in the SYNOPSIS would force a register to be " +"wasted as padding between the I and I arguments. (See " +"B(2) for details.) Therefore, these architectures define a " +"different system call that orders the arguments suitably:" msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:278 +#: build/C/man2/sync_file_range.2:206 +#, no-wrap msgid "" -"The implementation has no specific limits for the per-process maximum number " -"of shared memory segments (B)." +"BIB<, unsigned int >IB<,>\n" +"B< off64_t >IB<, off64_t >IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:284 +#: build/C/man2/sync_file_range.2:211 msgid "" -"Until version 2.3.30 Linux would return B for a B() on a " -"shared memory segment scheduled for deletion." +"The behavior of this system call is otherwise exactly the same as " +"B()." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:290 +#: build/C/man2/sync_file_range.2:222 msgid "" -"The name choice B was perhaps unfortunate, B would " -"more clearly show its function." +"A system call with this signature first appeared on the ARM architecture in " +"Linux 2.6.20, with the name B(). It was renamed in " +"Linux 2.6.22, when the analogous system call was added for PowerPC. On " +"architectures where glibc support is provided, glibc transparently wraps " +"B() under the name B()." msgstr "" #. type: Plain text -#: build/C/man2/shmget.2:298 -msgid "" -"B(2), B(2), B(2), B(3), B(7), " -"B(7), B(7)" +#: build/C/man2/sync_file_range.2:227 +msgid "B(2), B(2), B(2), B(2)" msgstr "" #. type: TH -#: build/C/man2/shmop.2:39 +#: build/C/man2/memfd_create.2:21 #, no-wrap -msgid "SHMOP" +msgid "MEMFD_CREATE" msgstr "" -#. type: TH -#: build/C/man2/shmop.2:39 -#, no-wrap -msgid "2008-06-03" +#. type: Plain text +#: build/C/man2/memfd_create.2:24 +msgid "memfd_create - create an anonymous file" msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:42 -msgid "shmat, shmdt - shared memory operations" +#: build/C/man2/memfd_create.2:26 +msgid "B<#include Esys/memfd.hE>" msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:46 -#, no-wrap -msgid "" -"B<#include Esys/types.hE>\n" -"B<#include Esys/shm.hE>\n" +#: build/C/man2/memfd_create.2:28 +msgid "BIB<, unsigned int >IB<);>" msgstr "" +#. David Herrmann: +#. memfd uses VM_NORESERVE so each page is accounted on first access. +#. This means, the overcommit-limits (see __vm_enough_memory()) and the +#. memory-cgroup limits (mem_cgroup_try_charge()) are applied. Note that +#. those are accounted on "current" and "current->mm", that is, the +#. process doing the first page access. #. type: Plain text -#: build/C/man2/shmop.2:48 -#, no-wrap +#: build/C/man2/memfd_create.2:51 msgid "" -"BIB<, const void *>IB<, int " -">IB<);>\n" +"B() creates an anonymous file and returns a file descriptor " +"that refers to it. The file behaves like a regular file, and so can be " +"modified, truncated, memory-mapped, and so on. However, unlike a regular " +"file, it lives in RAM and has a volatile backing storage. Once all " +"references to the file are dropped, it is automatically released. Anonymous " +"memory is used for all backing pages of the file. Therefore, files created " +"by B() have the same semantics as other anonymous memory " +"allocations such as those allocated using B(2) with the " +"B flag." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:50 -#, no-wrap -msgid "BIB<);>\n" +#: build/C/man2/memfd_create.2:58 +msgid "" +"The initial size of the file is set to 0. Following the call, the file size " +"should be set using B(2). (Alternatively, the file may be " +"populated by calls to B(2) or similar.)" msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:59 +#: build/C/man2/memfd_create.2:69 msgid "" -"B() attaches the shared memory segment identified by I to the " -"address space of the calling process. The attaching address is specified by " -"I with one of the following criteria:" +"The name supplied in I is used as a filename and will be displayed as " +"the target of the corresponding symbolic link in the directory " +"I. The displayed name is always prefixed with I and " +"serves only for debugging purposes. Names do not affect the behavior of the " +"file descriptor, and as such multiple files can have the same name without " +"any side effects." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:65 +#: build/C/man2/memfd_create.2:74 msgid "" -"If I is NULL, the system chooses a suitable (unused) address at " -"which to attach the segment." +"The following values may be bitwise ORed in I to change the behaviour " +"of B():" msgstr "" -#. type: Plain text -#: build/C/man2/shmop.2:80 -msgid "" -"If I isn't NULL and B is specified in I, the " -"attach occurs at the address equal to I rounded down to the nearest " -"multiple of B. Otherwise I must be a page-aligned address " -"at which the attach occurs." +#. type: TP +#: build/C/man2/memfd_create.2:74 +#, no-wrap +msgid "B" msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:90 +#: build/C/man2/memfd_create.2:84 msgid "" -"If B is specified in I, the segment is attached for " -"reading and the process must have read permission for the segment. " -"Otherwise the segment is attached for read and write and the process must " -"have read and write permission for the segment. There is no notion of a " -"write-only shared memory segment." +"Set the close-on-exec (B) flag on the new file descriptor. See " +"the description of the B flag in B(2) for reasons why this " +"may be useful." msgstr "" -#. type: Plain text -#: build/C/man2/shmop.2:105 -msgid "" -"The (Linux-specific) B flag may be specified in I to " -"indicate that the mapping of the segment should replace any existing mapping " -"in the range starting at I and continuing for the size of the " -"segment. (Normally an B error would result if a mapping already " -"exists in this address range.) In this case, I must not be NULL." +#. type: TP +#: build/C/man2/memfd_create.2:84 +#, no-wrap +msgid "B" msgstr "" +#. FIXME Why is the MFD_ALLOW_SEALING behavior not simply the default? +#. Is it worth adding some text explaining this? #. type: Plain text -#: build/C/man2/shmop.2:112 +#: build/C/man2/memfd_create.2:100 msgid "" -"The B(2) value of the calling process is not altered by the attach. " -"The segment will automatically be detached at process exit. The same " -"segment may be attached as a read and as a read-write one, and more than " -"once, in the process's address space." +"Allow sealing operations on this file. See the discussion of the " +"B and B operations in B(2), and also NOTES, " +"below. The initial set of seals is empty. If this flag is not set, the " +"initial set of seals will be B, meaning that no other seals can " +"be set on the file." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:120 -msgid "" -"A successful B() call updates the members of the I " -"structure (see B(2)) associated with the shared memory segment as " -"follows:" +#: build/C/man2/memfd_create.2:104 +msgid "Unused bits in I must be 0." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:123 -msgid "I is set to the current time." +#: build/C/man2/memfd_create.2:113 +msgid "" +"As its return value, B() returns a new file descriptor that " +"can be used to refer to the file. This file descriptor is opened for both " +"reading and writing (B) and B is set for the " +"descriptor." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:126 build/C/man2/shmop.2:152 -msgid "I is set to the process-ID of the calling process." +#: build/C/man2/memfd_create.2:126 +msgid "" +"With respect to B(2) and B(2), the usual semantics apply for " +"the file descriptor created by B(). A copy of the file " +"descriptor is inherited by the child produced by B(2) and refers to " +"the same file. The file descriptor is preserved across B(2), unless " +"the close-on-exec flag has been set." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:129 -msgid "I is incremented by one." +#: build/C/man2/memfd_create.2:133 +msgid "" +"On success, B() returns a new file descriptor. On error, -1 " +"is returned and I is set to indicate the error." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:140 -msgid "" -"B() detaches the shared memory segment located at the address " -"specified by I from the address space of the calling process. The " -"to-be-detached segment must be currently attached with I equal to " -"the value returned by the attaching B() call." +#: build/C/man2/memfd_create.2:139 +msgid "The address in I points to invalid memory." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:146 +#: build/C/man2/memfd_create.2:146 msgid "" -"On a successful B() call the system updates the members of the " -"I structure associated with the shared memory segment as follows:" +"An unsupported value was specified in one of the arguments: I " +"included unknown bits, or I was too long." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:149 -msgid "I is set to the current time." +#: build/C/man2/memfd_create.2:149 +msgid "The per-process limit on open file descriptors has been reached." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:157 -msgid "" -"I is decremented by one. If it becomes 0 and the segment is " -"marked for deletion, the segment is deleted." +#: build/C/man2/memfd_create.2:152 +msgid "The system-wide limit on the total number of open files has been reached." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:161 -msgid "After a B(2) the child inherits the attached shared memory segments." +#: build/C/man2/memfd_create.2:155 +msgid "There was insufficient memory to create a new anonymous file." msgstr "" +#. FIXME . When glibc support appears, update the following sentence: #. type: Plain text -#: build/C/man2/shmop.2:165 +#: build/C/man2/memfd_create.2:161 msgid "" -"After an B(2) all attached shared memory segments are detached from " -"the process." +"The B() system call first appeared in Linux 3.17. Support in " +"the GNU C library is pending." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:169 -msgid "" -"Upon B<_exit>(2) all attached shared memory segments are detached from the " -"process." +#: build/C/man2/memfd_create.2:165 +msgid "The B() system call is Linux-specific." msgstr "" +#. See also http://lwn.net/Articles/593918/ +#. and http://lwn.net/Articles/594919/ and http://lwn.net/Articles/591108/ #. type: Plain text -#: build/C/man2/shmop.2:177 +#: build/C/man2/memfd_create.2:178 msgid "" -"On success B() returns the address of the attached shared memory " -"segment; on error I<(void\\ *)\\ -1> is returned, and I is set to " -"indicate the cause of the error." +"The B() system call provides a simple alternative to manually " +"mounting a I filesystem and creating and opening a file in that " +"filesystem. The primary purpose of B() is to create files " +"and associated file descriptors that are used with the file-sealing APIs " +"provided by B(2)." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:183 +#: build/C/man2/memfd_create.2:192 msgid "" -"On success B() returns 0; on error -1 is returned, and I is " -"set to indicate the cause of the error." +"The B() system call also has uses without file sealing (which " +"is why file-sealing is disabled, unless explicitly requested with the " +"B flag). In particular, it can be used as an alternative " +"to creating files in I or as an alternative to using the B(2) " +"B in cases where there is no intention to actually link the " +"resulting file into the filesystem." msgstr "" -#. type: Plain text -#: build/C/man2/shmop.2:189 -msgid "When B() fails, I is set to one of the following:" +#. type: SS +#: build/C/man2/memfd_create.2:192 +#, no-wrap +msgid "File sealing" msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:195 +#: build/C/man2/memfd_create.2:210 msgid "" -"The calling process does not have the required permissions for the requested " -"attach type, and does not have the B capability." +"In the absence of file sealing, processes that communicate via shared memory " +"must either trust each other, or take measures to deal with the possibility " +"that an untrusted peer may manipulate the shared memory region in " +"problematic ways. For example, an untrusted peer might modify the contents " +"of the shared memory at any time, or shrink the shared memory region. The " +"former possibility leaves the local process vulnerable to " +"time-of-check-to-time-of-use race conditions (typically dealt with by " +"copying data from the shared memory region before checking and using it). " +"The latter possibility leaves the local process vulnerable to B " +"signals when an attempt is made to access a now-nonexistent location in the " +"shared memory region. (Dealing with this possibility necessitates the use " +"of a handler for the B signal.)" msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:209 +#: build/C/man2/memfd_create.2:216 msgid "" -"Invalid I value, unaligned (i.e., not page-aligned and B was " -"not specified) or invalid I value, or can't attach segment at " -"I, or B was specified and I was NULL." -msgstr "" - -#. type: Plain text -#: build/C/man2/shmop.2:212 -msgid "Could not allocate memory for the descriptor or for the page tables." +"Dealing with untrusted peers imposes extra complexity on code that employs " +"shared memory. Memory sealing enables that extra complexity to be " +"eliminated, by allowing a process to operate secure in the knowledge that " +"its peer can't modify the shared memory in an undesired fashion." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:218 -msgid "When B() fails, I is set as follows:" +#: build/C/man2/memfd_create.2:218 +msgid "An example of the usage of the sealing mechanism is as follows:" msgstr "" -#. The following since 2.6.17-rc1: #. type: Plain text -#: build/C/man2/shmop.2:226 +#: build/C/man2/memfd_create.2:225 msgid "" -"There is no shared memory segment attached at I; or, I is " -"not aligned on a page boundary." +"The first process creates a I file using B(). The call " +"yields a file descriptor used in subsequent steps." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:245 +#: build/C/man2/memfd_create.2:232 msgid "" -"In SVID 3 (or perhaps earlier) the type of the I argument was " -"changed from I into I, and the returned type of " -"B() from I into I. (Linux libc4 and libc5 have the " -"I prototypes; glibc2 has I.)" +"The first process sizes the file created in the previous step using " +"B(2), maps it using B(2), and populates the shared memory " +"with the desired data." msgstr "" -#. type: Plain text -#: build/C/man2/shmop.2:257 -msgid "" -"Using B() with I equal to NULL is the preferred, portable " -"way of attaching a shared memory segment. Be aware that the shared memory " -"segment attached in this way may be attached at different addresses in " -"different processes. Therefore, any pointers maintained within the shared " -"memory must be made relative (typically to the starting address of the " -"segment), rather than absolute." +#. type: IP +#: build/C/man2/memfd_create.2:232 +#, no-wrap +msgid "3." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:262 +#: build/C/man2/memfd_create.2:242 msgid "" -"On Linux, it is possible to attach a shared memory segment even if it is " -"already marked to be deleted. However, POSIX.1-2001 does not specify this " -"behavior and many other implementations do not support it." -msgstr "" - -#. type: Plain text -#: build/C/man2/shmop.2:265 -msgid "The following system parameter affects B():" +"The first process uses the B(2) B operation to place " +"one or more seals on the file, in order to restrict further modifications on " +"the file. (If placing the seal B, then it will be necessary " +"to first unmap the shared writable mapping created in the previous step.)" msgstr "" -#. FIXME A good explanation of the rationale for the existence -#. of SHMLBA would be useful here -#. type: TP -#: build/C/man2/shmop.2:265 +#. type: IP +#: build/C/man2/memfd_create.2:242 #, no-wrap -msgid "B" +msgid "4." msgstr "" -#. FIXME That last sentence isn't true for all Linux -#. architectures (i.e., SHMLBA != PAGE_SIZE for some architectures) -#. -- MTK, Nov 04 #. type: Plain text -#: build/C/man2/shmop.2:278 +#: build/C/man2/memfd_create.2:247 msgid "" -"Segment low boundary address multiple. Must be page aligned. For the " -"current implementation the B value is B." +"A second process obtains a file descriptor for the I file and maps " +"it. Among the possible ways in which this could happen are the following:" msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:282 +#: build/C/man2/memfd_create.2:258 msgid "" -"The implementation places no intrinsic limit on the per-process maximum " -"number of shared memory segments (B)." +"The process that called B() could transfer the resulting file " +"descriptor to the second process via a UNIX domain socket (see B(7) " +"and B(3)). The second process then maps the file using B(2)." msgstr "" #. type: Plain text -#: build/C/man2/shmop.2:290 +#: build/C/man2/memfd_create.2:266 msgid "" -"B(2), B(2), B(2), B(2), B(7), " -"B(7), B(7)" -msgstr "" - -#. type: TH -#: build/C/man2/subpage_prot.2:28 -#, no-wrap -msgid "SUBPAGE_PROT" -msgstr "" - -#. type: TH -#: build/C/man2/subpage_prot.2:28 -#, no-wrap -msgid "2010-10-30" +"The second process is created via B(2) and thus automatically " +"inherits the file descriptor and mapping. (Note that in this case and the " +"next, there is a natural trust relationship between the two processes, since " +"they are running under the same user ID. Therefore, file sealing would not " +"normally be necessary.)" msgstr "" #. type: Plain text -#: build/C/man2/subpage_prot.2:31 -msgid "subpage_prot - define a subpage protection for an address range" +#: build/C/man2/memfd_create.2:280 +msgid "" +"The second process opens the file IpdE/fd/EfdE>, " +"where IpidE> is the PID of the first process (the one that called " +"B()), and IfdE> is the number of the file descriptor " +"returned by the call to B() in that process. The second " +"process then maps the file using B(2)." msgstr "" -#. type: Plain text -#: build/C/man2/subpage_prot.2:35 +#. type: IP +#: build/C/man2/memfd_create.2:281 #, no-wrap -msgid "" -"BIB<, unsigned long >IB<,>\n" -"B< uint32_t *>IB<);>\n" +msgid "5." msgstr "" #. type: Plain text -#: build/C/man2/subpage_prot.2:42 +#: build/C/man2/memfd_create.2:293 msgid "" -"The PowerPC-specific B() system call provides the facility to " -"control the access permissions on individual 4kB subpages on systems " -"configured with a page size of 64kB." +"The second process uses the B(2) B operation to " +"retrieve the bit mask of seals that has been applied to the file. This bit " +"mask can be inspected in order to determine what kinds of restrictions have " +"been placed on file modifications. If desired, the second process can apply " +"further seals to impose additional restrictions (so long as the " +"B seal has not yet been applied)." msgstr "" #. type: Plain text -#: build/C/man2/subpage_prot.2:49 +#: build/C/man2/memfd_create.2:297 msgid "" -"The protection map is applied to the memory pages in the region starting at " -"I and continuing for I bytes. Both of these arguments must be " -"aligned to a 64-kB boundary." +"Below are shown two example programs that demonstrate the use of " +"B() and the file sealing API." msgstr "" #. type: Plain text -#: build/C/man2/subpage_prot.2:61 +#: build/C/man2/memfd_create.2:312 msgid "" -"The protection map is specified in the buffer pointed to by I. The map " -"has 2 bits per 4kB subpage; thus each 32-bit word specifies the protections " -"of 16 4kB subpages inside a 64kB page (so, the number of 32-bit words " -"pointed to by I should equate to the number of 64-kB pages specified by " -"I). Each 2-bit field in the protection map is either 0 to allow any " -"access, 1 to prevent writes, or 2 or 3 to prevent all accesses." +"The first program, I, creates a I file using " +"B(), sets a size for the file, maps it into memory, and " +"optionally places some seals on the file. The program accepts up to three " +"command-line arguments, of which the first two are required. The first " +"argument is the name to associate with the file, the second argument is the " +"size to be set for the file, and the optional third is a string of " +"characters that specify seals to be set on file." msgstr "" #. type: Plain text -#: build/C/man2/subpage_prot.2:66 +#: build/C/man2/memfd_create.2:318 msgid "" -"On success, B() returns 0. Otherwise, one of the error codes " -"specified below is returned." -msgstr "" - -#. type: Plain text -#: build/C/man2/subpage_prot.2:72 -msgid "The buffer referred to by I is not accessible." +"The second program, I, can be used to open an existing file " +"that was created via B() and inspect the set of seals that " +"have been applied to that file." msgstr "" #. type: Plain text -#: build/C/man2/subpage_prot.2:82 +#: build/C/man2/memfd_create.2:323 msgid "" -"The I or I arguments are incorrect. Both of these arguments must " -"be aligned to a multiple of the system page size, and they must not refer to " -"a region outside of the address space of the process or to a region that " -"consists of huge pages." +"The following shell session demonstrates the use of these programs. First " +"we create a I file and set some seals on it:" msgstr "" #. type: Plain text -#: build/C/man2/subpage_prot.2:85 build/C/man2/sync_file_range.2:166 -msgid "Out of memory." +#: build/C/man2/memfd_create.2:329 +#, no-wrap +msgid "" +"$ B<./t_memfd_create my_memfd_file 4096 sw &>\n" +"[1] 11775\n" +"PID: 11775; fd: 3; /proc/11775/fd/3\n" msgstr "" #. type: Plain text -#: build/C/man2/subpage_prot.2:91 +#: build/C/man2/memfd_create.2:347 msgid "" -"This system call is provided on the PowerPC architecture since Linux " -"2.6.25. The system call is provided only if the kernel is configured with " -"B. No library support is provided." +"At this point, the I program continues to run in the " +"background. From another program, we can obtain a file descriptor for the " +"file created by B() by opening the I file that " +"corresponds to the descriptor opened by B(). Using that " +"pathname, we inspect the content of the I symbolic link, and " +"use our I program to view the seals that have been placed on " +"the file:" msgstr "" #. type: Plain text -#: build/C/man2/subpage_prot.2:98 +#: build/C/man2/memfd_create.2:354 +#, no-wrap msgid "" -"Normal page protections (at the 64-kB page level) also apply; the subpage " -"protection mechanism is an additional constraint, so putting 0 in a 2-bit " -"field won't allow writes to a page that is otherwise write-protected." +"$ B\n" +"/memfd:my_memfd_file (deleted)\n" +"$ B<./t_get_seals /proc/11775/fd/3>\n" +"Existing seals: WRITE SHRINK\n" msgstr "" #. type: SS -#: build/C/man2/subpage_prot.2:98 +#: build/C/man2/memfd_create.2:356 #, no-wrap -msgid "Rationale" +msgid "Program source: t_memfd_create.c" msgstr "" -#. In the initial implementation, it was the case that: -#. In fact the whole process is switched to use 4k hardware pages when the -#. subpage_prot system call is used, but this could be improved in future -#. to switch only the affected segments. -#. But Paul Mackerass says (Oct 2010): I'm pretty sure we now only switch -#. the affected segment, not the whole process. #. type: Plain text -#: build/C/man2/subpage_prot.2:120 +#: build/C/man2/memfd_create.2:365 +#, no-wrap msgid "" -"This system call is provided to assist writing emulators that operate using " -"64-kB pages on PowerPC systems. When emulating systems such as x86, which " -"uses a smaller page size, the emulator can no longer use the " -"memory-management unit (MMU) and normal system calls for controlling page " -"protections. (The emulator could emulate the MMU by checking and possibly " -"remapping the address for each memory access in software, but that is slow.) " -"The idea is that the emulator supplies an array of protection masks to apply " -"to a specified range of virtual addresses. These masks are applied at the " -"level where hardware page-table entries (PTEs) are inserted into the " -"hardware page table based on the Linux PTEs, so the Linux PTEs are not " -"affected. Implicit in this is that the regions of the address space that " -"are protected are switched to use 4-kB hardware pages rather than 64-kB " -"hardware pages (on machines with hardware 64-kB page support)." +"#include Esys/memfd.hE\n" +"#include Efcntl.hE\n" +"#include Estdlib.hE\n" +"#include Eunistd.hE\n" +"#include Estring.hE\n" +"#include Estdio.hE\n" msgstr "" #. type: Plain text -#: build/C/man2/subpage_prot.2:123 -msgid "B(2), B(2);" +#: build/C/man2/memfd_create.2:377 +#, no-wrap +msgid "" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" int fd;\n" +" unsigned int seals;\n" +" char *addr;\n" +" char *name, *seals_arg;\n" +" ssize_t len;\n" msgstr "" #. type: Plain text -#: build/C/man2/subpage_prot.2:126 -msgid "the kernel source file I." -msgstr "" - -#. type: TH -#: build/C/man2/sync_file_range.2:30 +#: build/C/man2/memfd_create.2:388 #, no-wrap -msgid "SYNC_FILE_RANGE" +msgid "" +" if (argc E 3) {\n" +" fprintf(stderr, \"%s name size [seals]\\en\", argv[0]);\n" +" fprintf(stderr, \"\\et\\(aqseals\\(aq can contain any of the \"\n" +" \"following characters:\\en\");\n" +" fprintf(stderr, \"\\et\\etg - F_SEAL_GROW\\en\");\n" +" fprintf(stderr, \"\\et\\ets - F_SEAL_SHRINK\\en\");\n" +" fprintf(stderr, \"\\et\\etw - F_SEAL_WRITE\\en\");\n" +" fprintf(stderr, \"\\et\\etS - F_SEAL_SEAL\\en\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:33 -msgid "sync_file_range - sync a file segment with disk" +#: build/C/man2/memfd_create.2:392 +#, no-wrap +msgid "" +" name = argv[1];\n" +" len = atoi(argv[2]);\n" +" seals_arg = argv[3];\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:37 +#: build/C/man2/memfd_create.2:395 #, no-wrap msgid "" -"B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" -"B<#include Efcntl.hE>\n" +" /* Create an anonymous file in tmpfs; allow seals to be\n" +" placed on the file */\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:40 +#: build/C/man2/memfd_create.2:399 #, no-wrap msgid "" -"BIB<, off64_t >IB<, off64_t " -">IB<,>\n" -"B< unsigned int >IB<);>\n" +" fd = memfd_create(name, MFD_ALLOW_SEALING);\n" +" if (fd == -1)\n" +" errExit(\"memfd_create\");\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:47 -msgid "" -"B() permits fine control when synchronizing the open file " -"referred to by the file descriptor I with disk." +#: build/C/man2/memfd_create.2:401 +#, no-wrap +msgid " /* Size the file as specified on the command line */\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:61 +#: build/C/man2/memfd_create.2:404 +#, no-wrap msgid "" -"I is the starting byte of the file range to be synchronized. " -"I specifies the length of the range to be synchronized, in bytes; if " -"I is zero, then all bytes from I through to the end of file " -"are synchronized. Synchronization is in units of the system page size: " -"I is rounded down to a page boundary; I<(offset+nbytes-1)> is " -"rounded up to a page boundary." +" if (ftruncate(fd, len) == -1)\n" +" errExit(\"truncate\");\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:65 -msgid "The I bit-mask argument can include any of the following values:" +#: build/C/man2/memfd_create.2:407 +#, no-wrap +msgid "" +" printf(\"PID: %ld; fd: %d; /proc/%ld/fd/%d\\en\",\n" +" (long) getpid(), fd, (long) getpid(), fd);\n" msgstr "" -#. type: TP -#: build/C/man2/sync_file_range.2:65 +#. type: Plain text +#: build/C/man2/memfd_create.2:410 #, no-wrap -msgid "B" +msgid "" +" /* Code to map the file and populate the mapping with data\n" +" omitted */\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:70 +#: build/C/man2/memfd_create.2:413 +#, no-wrap msgid "" -"Wait upon write-out of all pages in the specified range that have already " -"been submitted to the device driver for write-out before performing any " -"write." +" /* If a \\(aqseals\\(aq command-line argument was supplied, set some\n" +" seals on the file */\n" msgstr "" -#. type: TP -#: build/C/man2/sync_file_range.2:70 build/C/man2/sync_file_range.2:120 +#. type: Plain text +#: build/C/man2/memfd_create.2:416 #, no-wrap -msgid "B" +msgid "" +" if (seals_arg != NULL) {\n" +" seals = 0;\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:76 +#: build/C/man2/memfd_create.2:425 +#, no-wrap msgid "" -"Initiate write-out of all dirty pages in the specified range which are not " -"presently submitted write-out. Note that even this may block if you attempt " -"to write more than request queue size." +" if (strchr(seals_arg, \\(aqg\\(aq) != NULL)\n" +" seals |= F_SEAL_GROW;\n" +" if (strchr(seals_arg, \\(aqs\\(aq) != NULL)\n" +" seals |= F_SEAL_SHRINK;\n" +" if (strchr(seals_arg, \\(aqw\\(aq) != NULL)\n" +" seals |= F_SEAL_WRITE;\n" +" if (strchr(seals_arg, \\(aqS\\(aq) != NULL)\n" +" seals |= F_SEAL_SEAL;\n" msgstr "" -#. type: TP -#: build/C/man2/sync_file_range.2:76 +#. type: Plain text +#: build/C/man2/memfd_create.2:429 #, no-wrap -msgid "B" +msgid "" +" if (fcntl(fd, F_ADD_SEALS, seals) == -1)\n" +" errExit(\"fcntl\");\n" +" }\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:80 -msgid "Wait upon write-out of all pages in the range after performing any write." +#: build/C/man2/memfd_create.2:432 +#, no-wrap +msgid "" +" /* Keep running, so that the file created by memfd_create()\n" +" continues to exist */\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:84 -msgid "Specifying I as 0 is permitted, as a no-op." +#: build/C/man2/memfd_create.2:434 +#, no-wrap +msgid " pause();\n" msgstr "" #. type: SS -#: build/C/man2/sync_file_range.2:84 +#: build/C/man2/memfd_create.2:438 #, no-wrap -msgid "Warning" +msgid "Program source: t_get_seals.c" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:100 +#: build/C/man2/memfd_create.2:447 +#, no-wrap msgid "" -"This system call is extremely dangerous and should not be used in portable " -"programs. None of these operations writes out the file's metadata. " -"Therefore, unless the application is strictly performing overwrites of " -"already-instantiated disk blocks, there are no guarantees that the data will " -"be available after a crash. There is no user interface to know if a write " -"is purely an overwrite. On file systems using copy-on-write semantics " -"(e.g., I) an overwrite of existing allocated blocks is impossible. " -"When writing into preallocated space, many file systems also require calls " -"into the block allocator, which this system call does not sync out to disk. " -"This system call does not flush disk write caches and thus does not provide " -"any data integrity on systems with volatile disk write caches." +"#include Esys/memfd.hE\n" +"#include Efcntl.hE\n" +"#include Eunistd.hE\n" +"#include Estdlib.hE\n" +"#include Estring.hE\n" +"#include Estdio.hE\n" msgstr "" -#. type: SS -#: build/C/man2/sync_file_range.2:100 +#. type: Plain text +#: build/C/man2/memfd_create.2:456 #, no-wrap -msgid "Some details" +msgid "" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" int fd;\n" +" unsigned int seals;\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:108 +#: build/C/man2/memfd_create.2:461 +#, no-wrap msgid "" -"B and B will detect " -"any I/O errors or B conditions and will return these to the caller." +" if (argc != 2) {\n" +" fprintf(stderr, \"%s /proc/PID/fd/FD\\en\", argv[0]);\n" +" exit(EXIT_FAILURE);\n" +" }\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:112 -msgid "Useful combinations of the I bits are:" +#: build/C/man2/memfd_create.2:465 +#, no-wrap +msgid "" +" fd = open(argv[1], O_RDWR);\n" +" if (fd == -1)\n" +" errExit(\"open\");\n" msgstr "" -#. type: TP -#: build/C/man2/sync_file_range.2:112 +#. type: Plain text +#: build/C/man2/memfd_create.2:469 #, no-wrap -msgid "B" +msgid "" +" seals = fcntl(fd, F_GET_SEALS);\n" +" if (seals == -1)\n" +" errExit(\"fcntl\");\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:120 +#: build/C/man2/memfd_create.2:480 +#, no-wrap msgid "" -"Ensures that all pages in the specified range which were dirty when " -"B() was called are placed under write-out. This is a " -"start-write-for-data-integrity operation." +" printf(\"Existing seals:\");\n" +" if (seals & F_SEAL_SEAL)\n" +" printf(\" SEAL\");\n" +" if (seals & F_SEAL_GROW)\n" +" printf(\" GROW\");\n" +" if (seals & F_SEAL_WRITE)\n" +" printf(\" WRITE\");\n" +" if (seals & F_SEAL_SHRINK)\n" +" printf(\" SHRINK\");\n" +" printf(\"\\en\");\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:127 +#: build/C/man2/memfd_create.2:483 +#, no-wrap msgid "" -"Start write-out of all dirty pages in the specified range which are not " -"presently under write-out. This is an asynchronous flush-to-disk " -"operation. This is not suitable for data integrity operations." +" /* Code to map the file and access the contents of the\n" +" resulting mapping omitted */\n" msgstr "" -#. type: TP -#: build/C/man2/sync_file_range.2:127 +#. type: Plain text +#: build/C/man2/memfd_create.2:493 +msgid "B(2), B(2), B(2), B(2), B(3)" +msgstr "" + +#. type: TH +#: build/C/man2/s390_pci_mmio_write.2:25 #, no-wrap -msgid "B (or B)" +msgid "S390_PCI_MMIO_WRITE" +msgstr "" + +#. type: TH +#: build/C/man2/s390_pci_mmio_write.2:25 +#, no-wrap +msgid "2015-01-15" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:134 +#: build/C/man2/s390_pci_mmio_write.2:29 msgid "" -"Wait for completion of write-out of all pages in the specified range. This " -"can be used after an earlier B operation to wait for completion of that operation, " -"and obtain its result." +"s390_pci_mmio_write, s390_pci_mmio_read - transfer data to/from PCI MMIO " +"memory page" msgstr "" -#. type: TP -#: build/C/man2/sync_file_range.2:134 +#. type: Plain text +#: build/C/man2/s390_pci_mmio_write.2:32 #, no-wrap -msgid "" -"B" +msgid "B<#include Easm/unistd.hE>\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:141 +#: build/C/man2/s390_pci_mmio_write.2:35 +#, no-wrap msgid "" -"This is a write-for-data-integrity operation that will ensure that all pages " -"in the specified range which were dirty when B() was " -"called are committed to disk." +"BIB<,>\n" +"B< void *>IB<, size_t >IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:147 +#: build/C/man2/s390_pci_mmio_write.2:38 +#, no-wrap msgid "" -"On success, B() returns 0; on failure -1 is returned and " -"I is set to indicate the error." +"BIB<,>\n" +"B< void *>IB<, size_t >IB<);>\n" msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:152 -msgid "I is not a valid file descriptor." +#: build/C/man2/s390_pci_mmio_write.2:57 +msgid "" +"The B() system call writes I bytes of data " +"from the user-space buffer I to the PCI MMIO memory location " +"specified by I. The B() system call reads " +"I bytes of data from the PCI MMIO memory location specified by " +"I to the user-space buffer I." msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:160 -msgid "I specifies an invalid bit; or I or I is invalid." +#: build/C/man2/s390_pci_mmio_write.2:68 +msgid "" +"These system calls must be used instead of the simple assignment or " +"data-transfer operations that are used to access the PCI MMIO memory areas " +"mapped to user space on the Linux System z platform. The address specified " +"by I must belong to a PCI MMIO memory page mapping in the " +"caller's address space, and the data being written or read must not cross a " +"page boundary. The I value cannot be greater than the system page " +"size." msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:163 -msgid "I/O error." +#: build/C/man2/s390_pci_mmio_write.2:77 +msgid "" +"On success, B() and B() return " +"0. On error, -1 is returned and I is set to one of the error codes " +"listed below." msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:169 -msgid "Out of disk space." +#: build/C/man2/s390_pci_mmio_write.2:83 +msgid "The address in I is invalid." msgstr "" -#. FIXME . (bug?) Actually, how can 'fd' refer to a symbolic link (S_ISLNK)? -#. (In userspace at least) it isn't possible to obtain a file descriptor -#. for a symbolic link. #. type: Plain text -#: build/C/man2/sync_file_range.2:177 +#: build/C/man2/s390_pci_mmio_write.2:87 msgid "" -"I refers to something other than a regular file, a block device, a " -"directory, or a symbolic link." +"I does not point to a valid location in the caller's address " +"space." msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:180 -msgid "B() appeared on Linux in kernel 2.6.17." +#: build/C/man2/s390_pci_mmio_write.2:92 +msgid "Invalid I argument." msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:183 -msgid "" -"This system call is Linux-specific, and should be avoided in portable " -"programs." +#: build/C/man2/s390_pci_mmio_write.2:95 +msgid "PCI support is not enabled." msgstr "" -#. See kernel commit edd5cd4a9424f22b0fa08bef5e299d41befd5622 #. type: Plain text -#: build/C/man2/sync_file_range.2:196 -msgid "" -"Some architectures (e.g., PowerPC, ARM) need 64-bit arguments to be aligned " -"in a suitable pair of registers. On such architectures, the call signature " -"of B() is flawed, since it forces a register to be wasted " -"as padding between the I and I arguments. Therefore, these " -"architectures define a different system call that orders the arguments " -"suitably:" +#: build/C/man2/s390_pci_mmio_write.2:98 +msgid "Insufficient memory." msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:201 -#, no-wrap -msgid "" -"BIB<, unsigned int >IB<,>\n" -"B< off64_t >IB<, off64_t >IB<);>\n" +#: build/C/man2/s390_pci_mmio_write.2:100 +msgid "These system calls are available since Linux 3.19." msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:206 +#: build/C/man2/s390_pci_mmio_write.2:103 msgid "" -"The behavior of this system call is otherwise exactly the same as " -"B()." +"This Linux-specific system call is available only on the s390 architecture. " +"The required PCI support is available beginning with System z EC12." msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:217 +#: build/C/man2/s390_pci_mmio_write.2:107 msgid "" -"A system call with this signature first appeared on the ARM architecture in " -"Linux 2.6.20, with the name B(). It was renamed in " -"Linux 2.6.22, when the analogous system call was added for PowerPC. On " -"architectures where glibc support is provided, glibc transparently wraps " -"B() under the name B()." +"Glibc does not provide a wrapper for this system call, use B(2) to " +"call it." msgstr "" #. type: Plain text -#: build/C/man2/sync_file_range.2:222 -msgid "B(2), B(2), B(2), B(2)" +#: build/C/man2/s390_pci_mmio_write.2:109 +msgid "B(2)" msgstr ""