1 /**
2  * D header file for POSIX.
3  *
4  * Copyright: Copyright Sean Kelly 2005 - 2009.
5  * License:   $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
6  * Authors:   Sean Kelly, Alex Rønne Petersen
7  * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
8  */
9 
10 /*          Copyright Sean Kelly 2005 - 2009.
11  * Distributed under the Boost Software License, Version 1.0.
12  *    (See accompanying file LICENSE or copy at
13  *          http://www.boost.org/LICENSE_1_0.txt)
14  */
15 module core.sys.posix.sys.mman;
16 
17 import core.sys.posix.config;
18 public import core.sys.posix.sys.types; // for off_t, mode_t
19 
20 version (OSX)
21     version = Darwin;
22 else version (iOS)
23     version = Darwin;
24 else version (TVOS)
25     version = Darwin;
26 else version (WatchOS)
27     version = Darwin;
28 
29 version (ARM)     version = ARM_Any;
30 version (AArch64) version = ARM_Any;
31 version (HPPA)    version = HPPA_Any;
32 version (HPPA64)  version = HPPA_Any;
33 version (MIPS32)  version = MIPS_Any;
34 version (MIPS64)  version = MIPS_Any;
35 version (PPC)     version = PPC_Any;
36 version (PPC64)   version = PPC_Any;
37 version (RISCV32) version = RISCV_Any;
38 version (RISCV64) version = RISCV_Any;
39 version (S390)    version = IBMZ_Any;
40 version (SPARC)   version = SPARC_Any;
41 version (SPARC64) version = SPARC_Any;
42 version (SystemZ) version = IBMZ_Any;
43 version (X86)     version = X86_Any;
44 version (X86_64)  version = X86_Any;
45 
46 version (Posix):
47 extern (C) nothrow @nogc:
48 
49 //
50 // Advisory Information (ADV)
51 //
52 /*
53 int posix_madvise(void*, size_t, int);
54 */
55 
56 version (CRuntime_Glibc)
57 {
58     static if (_XOPEN_SOURCE >= 600)
59     {
60         int posix_madvise(void *__addr, size_t __len, int __advice);
61     }
62 }
63 else version (Darwin)
64 {
65     int posix_madvise(void *addr, size_t len, int advice);
66 }
67 else version (FreeBSD)
68 {
69     int posix_madvise(void *addr, size_t len, int advice);
70 }
71 else version (NetBSD)
72 {
73     int posix_madvise(void *addr, size_t len, int advice);
74 }
75 else version (OpenBSD)
76 {
77     int posix_madvise(void *addr, size_t len, int advice);
78 }
79 else version (DragonFlyBSD)
80 {
81     int posix_madvise(void *addr, size_t len, int advice);
82 }
83 else version (Solaris)
84 {
85 }
86 else version (CRuntime_Bionic)
87 {
88 }
89 else version (CRuntime_Musl)
90 {
91     int posix_madvise(void *, size_t, int);
92 }
93 else version (CRuntime_UClibc)
94 {
95     int posix_madvise(void *__addr, size_t __len, int __advice);
96 }
97 else
98 {
99     static assert(false, "Unsupported platform");
100 }
101 
102 
103 //
104 // Advisory Information and either Memory Mapped Files or Shared Memory Objects (MC1)
105 //
106 /*
107 POSIX_MADV_NORMAL
108 POSIX_MADV_SEQUENTIAL
109 POSIX_MADV_RANDOM
110 POSIX_MADV_WILLNEED
111 POSIX_MADV_DONTNEED
112 */
113 
114 version (linux)
115 {
116     version (Alpha)
117         private enum __POSIX_MADV_DONTNEED = 6;
118     else
119         private enum __POSIX_MADV_DONTNEED = 4;
120 
121     enum
122     {
123         POSIX_MADV_NORMAL = 0,
124         POSIX_MADV_RANDOM = 1,
125         POSIX_MADV_SEQUENTIAL = 2,
126         POSIX_MADV_WILLNEED = 3,
127         POSIX_MADV_DONTNEED = __POSIX_MADV_DONTNEED,
128     }
129 }
130 else version (Darwin)
131 {
132     enum POSIX_MADV_NORMAL      = 0;
133     enum POSIX_MADV_RANDOM      = 1;
134     enum POSIX_MADV_SEQUENTIAL  = 2;
135     enum POSIX_MADV_WILLNEED    = 3;
136     enum POSIX_MADV_DONTNEED    = 4;
137 }
138 else version (FreeBSD)
139 {
140     enum POSIX_MADV_NORMAL      = 0;
141     enum POSIX_MADV_RANDOM      = 1;
142     enum POSIX_MADV_SEQUENTIAL  = 2;
143     enum POSIX_MADV_WILLNEED    = 3;
144     enum POSIX_MADV_DONTNEED    = 4;
145 }
146 else version (NetBSD)
147 {
148     enum POSIX_MADV_NORMAL      = 0;
149     enum POSIX_MADV_RANDOM      = 1;
150     enum POSIX_MADV_SEQUENTIAL  = 2;
151     enum POSIX_MADV_WILLNEED    = 3;
152     enum POSIX_MADV_DONTNEED    = 4;
153 }
154 else version (OpenBSD)
155 {
156     enum POSIX_MADV_NORMAL      = 0;
157     enum POSIX_MADV_RANDOM      = 1;
158     enum POSIX_MADV_SEQUENTIAL  = 2;
159     enum POSIX_MADV_WILLNEED    = 3;
160     enum POSIX_MADV_DONTNEED    = 4;
161 }
162 else version (DragonFlyBSD)
163 {
164     enum POSIX_MADV_NORMAL      = 0;
165     enum POSIX_MADV_RANDOM      = 1;
166     enum POSIX_MADV_SEQUENTIAL  = 2;
167     enum POSIX_MADV_WILLNEED    = 3;
168     enum POSIX_MADV_DONTNEED    = 4;
169 }
170 else version (Solaris)
171 {
172 }
173 else
174 {
175     static assert(false, "Unsupported platform");
176 }
177 
178 //
179 // Memory Mapped Files, Shared Memory Objects, or Memory Protection (MC2)
180 //
181 /*
182 PROT_READ
183 PROT_WRITE
184 PROT_EXEC
185 PROT_NONE
186 */
187 
188 version (linux)
189 {
190     enum PROT_NONE      = 0x0;
191     enum PROT_READ      = 0x1;
192     enum PROT_WRITE     = 0x2;
193     enum PROT_EXEC      = 0x4;
194 }
195 else version (Darwin)
196 {
197     enum PROT_NONE      = 0x00;
198     enum PROT_READ      = 0x01;
199     enum PROT_WRITE     = 0x02;
200     enum PROT_EXEC      = 0x04;
201 }
202 else version (FreeBSD)
203 {
204     enum PROT_NONE      = 0x00;
205     enum PROT_READ      = 0x01;
206     enum PROT_WRITE     = 0x02;
207     enum PROT_EXEC      = 0x04;
208 }
209 else version (NetBSD)
210 {
211     enum PROT_NONE      = 0x00;
212     enum PROT_READ      = 0x01;
213     enum PROT_WRITE     = 0x02;
214     enum PROT_EXEC      = 0x04;
215 }
216 else version (OpenBSD)
217 {
218     enum PROT_NONE      = 0x00;
219     enum PROT_READ      = 0x01;
220     enum PROT_WRITE     = 0x02;
221     enum PROT_EXEC      = 0x04;
222 }
223 else version (DragonFlyBSD)
224 {
225     enum PROT_NONE      = 0x00;
226     enum PROT_READ      = 0x01;
227     enum PROT_WRITE     = 0x02;
228     enum PROT_EXEC      = 0x04;
229 }
230 else version (Solaris)
231 {
232     enum PROT_NONE = 0x00;
233     enum PROT_READ = 0x01;
234     enum PROT_WRITE = 0x02;
235     enum PROT_EXEC = 0x04;
236 }
237 else
238 {
239     static assert(false, "Unsupported platform");
240 }
241 
242 //
243 // Memory Mapped Files, Shared Memory Objects, or Typed Memory Objects (MC3)
244 //
245 /*
246 void* mmap(void*, size_t, int, int, int, off_t);
247 int munmap(void*, size_t);
248 */
249 
250 version (CRuntime_Glibc)
251 {
252     static if (__USE_LARGEFILE64) void* mmap64(void*, size_t, int, int, int, off_t);
253     static if (__USE_FILE_OFFSET64)
254         alias mmap = mmap64;
255     else
256         void* mmap(void*, size_t, int, int, int, off_t);
257     int munmap(void*, size_t);
258 }
259 else version (Darwin)
260 {
261     void* mmap(void*, size_t, int, int, int, off_t);
262     int   munmap(void*, size_t);
263 }
264 else version (FreeBSD)
265 {
266     void* mmap(void*, size_t, int, int, int, off_t);
267     int   munmap(void*, size_t);
268 }
269 else version (NetBSD)
270 {
271     void* mmap(void*, size_t, int, int, int, off_t);
272     int   munmap(void*, size_t);
273 }
274 else version (OpenBSD)
275 {
276     void* mmap(void*, size_t, int, int, int, off_t);
277     int   munmap(void*, size_t);
278 }
279 else version (DragonFlyBSD)
280 {
281     void* mmap(void*, size_t, int, int, int, off_t);
282     int   munmap(void*, size_t);
283 }
284 else version (Solaris)
285 {
286     void* mmap(void*, size_t, int, int, int, off_t);
287     int   munmap(void*, size_t);
288 }
289 else version (CRuntime_Bionic)
290 {
291     void* mmap(void*, size_t, int, int, int, off_t);
292     int   munmap(void*, size_t);
293 }
294 else version (CRuntime_Musl)
295 {
296     static if (__USE_LARGEFILE64) void* mmap64(void*, size_t, int, int, int, off_t);
297     static if (__USE_FILE_OFFSET64)
298         alias mmap = mmap64;
299     else
300         void* mmap(void*, size_t, int, int, int, off_t);
301     int munmap(void*, size_t);
302 }
303 else version (CRuntime_UClibc)
304 {
305     static if (__USE_LARGEFILE64) void* mmap64(void*, size_t, int, int, int, off_t);
306     static if (__USE_FILE_OFFSET64)
307         alias mmap = mmap64;
308     else
309         void* mmap(void*, size_t, int, int, int, off_t);
310     int munmap(void*, size_t);
311 }
312 else
313 {
314     static assert(false, "Unsupported platform");
315 }
316 
317 //
318 // Memory Mapped Files (MF)
319 //
320 /*
321 MAP_SHARED (MF|SHM)
322 MAP_PRIVATE (MF|SHM)
323 MAP_FIXED  (MF|SHM)
324 MAP_FAILED (MF|SHM)
325 
326 MS_ASYNC (MF|SIO)
327 MS_SYNC (MF|SIO)
328 MS_INVALIDATE (MF|SIO)
329 */
330 
331 version (linux)
332 {
333     enum MAP_SHARED     = 0x01;
334     enum MAP_PRIVATE    = 0x02;
335     enum MAP_FIXED      = 0x10;
336 
337     enum MAP_FAILED     = cast(void*) -1;
338 
339     version (MICROBLAZE)
340         private enum DEFAULTS = true;
341     else version (Alpha)
342     {
343         private enum DEFAULTS = false;
344         enum MAP_ANON = 0x10;
345         enum MS_ASYNC = 1;
346         enum MS_SYNC = 2;
347         enum MS_INVALIDATE = 4;
348     }
349     else version (SH)
350         private enum DEFAULTS = true;
351     else version (ARM_Any)
352         private enum DEFAULTS = true;
353     else version (IBMZ_Any)
354         private enum DEFAULTS = true;
355     else version (IA64)
356         private enum DEFAULTS = true;
357     else version (HPPA_Any)
358     {
359         private enum DEFAULTS = false;
360         enum MAP_ANON = 0x10;
361         enum MS_SYNC = 1;
362         enum MS_ASYNC = 2;
363         enum MS_INVALIDATE = 4;
364     }
365     else version (M68K)
366         private enum DEFAULTS = true;
367     else version (TILE)
368         private enum DEFAULTS = true;
369     else version (X86_Any)
370         private enum DEFAULTS = true;
371     else version (MIPS_Any)
372     {
373         private enum DEFAULTS = false;
374         enum MAP_ANON = 0x0800;
375         enum MS_ASYNC = 1;
376         enum MS_INVALIDATE = 2;
377         enum MS_SYNC = 4;
378     }
379     else version (RISCV_Any)
380         private enum DEFAULTS = true;
381     else version (SPARC_Any)
382         private enum DEFAULTS = true;
383     else version (PPC_Any)
384         private enum DEFAULTS = true;
385     else version (LoongArch64)
386         private enum DEFAULTS = true;
387     else
388         static assert(0, "unimplemented");
389 
390     static if (DEFAULTS)
391     {
392         enum MAP_ANON = 0x20;
393         enum MS_ASYNC = 1;
394         enum MS_INVALIDATE = 2;
395         enum MS_SYNC = 4;
396     }
397 }
398 else version (Darwin)
399 {
400     enum MAP_SHARED     = 0x0001;
401     enum MAP_PRIVATE    = 0x0002;
402     enum MAP_FIXED      = 0x0010;
403     enum MAP_ANON       = 0x1000;
404 
405     enum MAP_FAILED     = cast(void*)-1;
406 
407     enum MS_ASYNC       = 0x0001;
408     enum MS_INVALIDATE  = 0x0002;
409     enum MS_SYNC        = 0x0010;
410 }
411 else version (FreeBSD)
412 {
413     enum MAP_SHARED     = 0x0001;
414     enum MAP_PRIVATE    = 0x0002;
415     enum MAP_FIXED      = 0x0010;
416     enum MAP_ANON       = 0x1000;
417 
418     enum MAP_FAILED     = cast(void*)-1;
419 
420     enum MS_SYNC        = 0x0000;
421     enum MS_ASYNC       = 0x0001;
422     enum MS_INVALIDATE  = 0x0002;
423 }
424 else version (NetBSD)
425 {
426     enum MAP_SHARED     = 0x0001;
427     enum MAP_PRIVATE    = 0x0002;
428     enum MAP_FIXED      = 0x0010;
429     enum MAP_ANON       = 0x1000;
430 
431     enum MAP_FAILED     = cast(void*)-1;
432 
433     enum MS_SYNC        = 0x0004;
434     enum MS_ASYNC       = 0x0001;
435     enum MS_INVALIDATE  = 0x0002;
436 }
437 else version (OpenBSD)
438 {
439     enum MAP_SHARED     = 0x0001;
440     enum MAP_PRIVATE    = 0x0002;
441     enum MAP_FIXED      = 0x0010;
442     enum MAP_ANON       = 0x1000;
443     enum MAP_STACK      = 0x4000;
444 
445     enum MAP_FAILED     = cast(void*)-1;
446 
447     enum MS_SYNC        = 0x0002;
448     enum MS_ASYNC       = 0x0001;
449     enum MS_INVALIDATE  = 0x0004;
450 }
451 else version (DragonFlyBSD)
452 {
453     enum MAP_SHARED     = 0x0001;
454     enum MAP_PRIVATE    = 0x0002;
455     enum MAP_FIXED      = 0x0010;
456     enum MAP_ANON       = 0x1000;
457 
458     enum MAP_FAILED     = cast(void*)-1;
459 
460     enum MS_SYNC        = 0x0000;
461     enum MS_ASYNC       = 0x0001;
462     enum MS_INVALIDATE  = 0x0002;
463 }
464 else version (Solaris)
465 {
466     enum MAP_SHARED = 0x0001;
467     enum MAP_PRIVATE = 0x0002;
468     enum MAP_FIXED = 0x0010;
469     enum MAP_ANON = 0x0100;
470 
471     enum MAP_FAILED = cast(void*)-1;
472 
473     enum MS_SYNC = 0x0004;
474     enum MS_ASYNC = 0x0001;
475     enum MS_INVALIDATE  = 0x0002;
476 }
477 else
478 {
479     static assert(false, "Unsupported platform");
480 }
481 
482 /*
483 int msync(void*, size_t, int); (MF|SIO)
484 */
485 
486 version (CRuntime_Glibc)
487 {
488     int msync(void*, size_t, int);
489 }
490 else version (Darwin)
491 {
492     int msync(void*, size_t, int);
493 }
494 else version (FreeBSD)
495 {
496     int msync(void*, size_t, int);
497 }
498 else version (NetBSD)
499 {
500     int __msync13(void*, size_t, int);
501     alias msync = __msync13;
502 }
503 else version (OpenBSD)
504 {
505     int msync(void*, size_t, int);
506 }
507 else version (DragonFlyBSD)
508 {
509     int msync(void*, size_t, int);
510 }
511 else version (Solaris)
512 {
513     int msync(void*, size_t, int);
514 }
515 else version (CRuntime_Bionic)
516 {
517     int msync(const scope void*, size_t, int);
518 }
519 else version (CRuntime_Musl)
520 {
521     int msync(void*, size_t, int);
522 }
523 else version (CRuntime_UClibc)
524 {
525     int msync(void*, size_t, int);
526 }
527 else
528 {
529     static assert(false, "Unsupported platform");
530 }
531 
532 //
533 // Process Memory Locking (ML)
534 //
535 /*
536 MCL_CURRENT
537 MCL_FUTURE
538 */
539 
540 version (linux)
541 {
542     version (SPARC_Any) enum
543     {
544         MCL_CURRENT = 0x2000,
545         MCL_FUTURE = 0x4000,
546     }
547     else version (PPC_Any) enum
548     {
549         MCL_CURRENT = 0x2000,
550         MCL_FUTURE = 0x4000,
551     }
552     else version (Alpha) enum
553     {
554         MCL_CURRENT = 8192,
555         MCL_FUTURE = 16384,
556     }
557     else enum
558     {
559         MCL_CURRENT = 1,
560         MCL_FUTURE = 2,
561     }
562 }
563 else version (Darwin)
564 {
565     enum MCL_CURRENT    = 0x0001;
566     enum MCL_FUTURE     = 0x0002;
567 }
568 else version (FreeBSD)
569 {
570     enum MCL_CURRENT    = 0x0001;
571     enum MCL_FUTURE     = 0x0002;
572 }
573 else version (NetBSD)
574 {
575     enum MCL_CURRENT    = 0x0001;
576     enum MCL_FUTURE     = 0x0002;
577 }
578 else version (OpenBSD)
579 {
580     enum MCL_CURRENT    = 0x0001;
581     enum MCL_FUTURE     = 0x0002;
582 }
583 else version (DragonFlyBSD)
584 {
585     enum MCL_CURRENT    = 0x0001;
586     enum MCL_FUTURE     = 0x0002;
587 }
588 else version (Solaris)
589 {
590     enum MCL_CURRENT = 0x0001;
591     enum MCL_FUTURE = 0x0002;
592 }
593 else
594 {
595     static assert(false, "Unsupported platform");
596 }
597 
598 /*
599 int mlockall(int);
600 int munlockall();
601 */
602 
603 version (CRuntime_Glibc)
604 {
605     int mlockall(int);
606     int munlockall();
607 }
608 else version (Darwin)
609 {
610     int mlockall(int);
611     int munlockall();
612 }
613 else version (FreeBSD)
614 {
615     int mlockall(int);
616     int munlockall();
617 }
618 else version (NetBSD)
619 {
620     int mlockall(int);
621     int munlockall();
622 }
623 else version (OpenBSD)
624 {
625     int mlockall(int);
626     int munlockall();
627 }
628 else version (DragonFlyBSD)
629 {
630     int mlockall(int);
631     int munlockall();
632 }
633 else version (Solaris)
634 {
635     int mlockall(int);
636     int munlockall();
637 }
638 else version (CRuntime_Bionic)
639 {
640     int mlockall(int);
641     int munlockall();
642 }
643 else version (CRuntime_Musl)
644 {
645     int mlockall(int);
646     int munlockall();
647 }
648 else version (CRuntime_UClibc)
649 {
650     int mlockall(int);
651     int munlockall();
652 }
653 else
654 {
655     static assert(false, "Unsupported platform");
656 }
657 
658 //
659 // Range Memory Locking (MLR)
660 //
661 /*
662 int mlock(const scope void*, size_t);
663 int munlock(const scope void*, size_t);
664 */
665 
666 version (CRuntime_Glibc)
667 {
668     int mlock(const scope void*, size_t);
669     int munlock(const scope void*, size_t);
670 }
671 else version (Darwin)
672 {
673     int mlock(const scope void*, size_t);
674     int munlock(const scope void*, size_t);
675 }
676 else version (FreeBSD)
677 {
678     int mlock(const scope void*, size_t);
679     int munlock(const scope void*, size_t);
680 }
681 else version (NetBSD)
682 {
683     int mlock(const scope void*, size_t);
684     int munlock(const scope void*, size_t);
685 }
686 else version (OpenBSD)
687 {
688     int mlock(const scope void*, size_t);
689     int munlock(const scope void*, size_t);
690 }
691 else version (DragonFlyBSD)
692 {
693     int mlock(const scope void*, size_t);
694     int munlock(const scope void*, size_t);
695 }
696 else version (Solaris)
697 {
698     int mlock(const scope void*, size_t);
699     int munlock(const scope void*, size_t);
700 }
701 else version (CRuntime_Bionic)
702 {
703     int mlock(const scope void*, size_t);
704     int munlock(const scope void*, size_t);
705 }
706 else version (CRuntime_Musl)
707 {
708     int mlock(const scope void*, size_t);
709     int munlock(const scope void*, size_t);
710 }
711 else version (CRuntime_UClibc)
712 {
713     int mlock(const scope void*, size_t);
714     int munlock(const scope void*, size_t);
715 }
716 else
717 {
718     static assert(false, "Unsupported platform");
719 }
720 
721 //
722 // Memory Protection (MPR)
723 //
724 /*
725 int mprotect(void*, size_t, int);
726 */
727 
728 version (CRuntime_Glibc)
729 {
730     int mprotect(void*, size_t, int);
731 }
732 else version (Darwin)
733 {
734     int mprotect(void*, size_t, int);
735 }
736 else version (FreeBSD)
737 {
738     int mprotect(void*, size_t, int);
739 }
740 else version (NetBSD)
741 {
742     int mprotect(void*, size_t, int);
743 }
744 else version (OpenBSD)
745 {
746     int mprotect(void*, size_t, int);
747 }
748 else version (DragonFlyBSD)
749 {
750     int mprotect(void*, size_t, int);
751 }
752 else version (Solaris)
753 {
754     int mprotect(void*, size_t, int);
755 }
756 else version (CRuntime_Bionic)
757 {
758     int mprotect(const scope void*, size_t, int);
759 }
760 else version (CRuntime_Musl)
761 {
762     int mprotect(void*, size_t, int);
763 }
764 else version (CRuntime_UClibc)
765 {
766     int mprotect(void*, size_t, int);
767 }
768 else
769 {
770     static assert(false, "Unsupported platform");
771 }
772 
773 //
774 // Shared Memory Objects (SHM)
775 //
776 /*
777 int shm_open(const scope char*, int, mode_t);
778 int shm_unlink(const scope char*);
779 */
780 
781 version (CRuntime_Glibc)
782 {
783     int shm_open(const scope char*, int, mode_t);
784     int shm_unlink(const scope char*);
785 }
786 else version (Darwin)
787 {
788     int shm_open(const scope char*, int, mode_t);
789     int shm_unlink(const scope char*);
790 }
791 else version (FreeBSD)
792 {
793     int shm_open(const scope char*, int, mode_t);
794     int shm_unlink(const scope char*);
795 }
796 else version (NetBSD)
797 {
798     int shm_open(const scope char*, int, mode_t);
799     int shm_unlink(const scope char*);
800 }
801 else version (OpenBSD)
802 {
803     int shm_open(const scope char*, int, mode_t);
804     int shm_unlink(const scope char*);
805 }
806 else version (DragonFlyBSD)
807 {
808     int shm_open(const scope char*, int, mode_t);
809     int shm_unlink(const scope char*);
810 }
811 else version (Solaris)
812 {
813     int shm_open(const scope char*, int, mode_t);
814     int shm_unlink(const scope char*);
815 }
816 else version (CRuntime_Bionic)
817 {
818 }
819 else version (CRuntime_Musl)
820 {
821     int shm_open(const scope char*, int, mode_t);
822     int shm_unlink(const scope char*);
823 }
824 else version (CRuntime_UClibc)
825 {
826     int shm_open(const scope char*, int, mode_t);
827     int shm_unlink(const scope char*);
828 }
829 else
830 {
831     static assert(false, "Unsupported platform");
832 }
833 
834 //
835 // Typed Memory Objects (TYM)
836 //
837 /*
838 POSIX_TYPED_MEM_ALLOCATE
839 POSIX_TYPED_MEM_ALLOCATE_CONTIG
840 POSIX_TYPED_MEM_MAP_ALLOCATABLE
841 
842 struct posix_typed_mem_info
843 {
844     size_t posix_tmi_length;
845 }
846 
847 int posix_mem_offset(const scope void*, size_t, off_t *, size_t *, int *);
848 int posix_typed_mem_get_info(int, struct posix_typed_mem_info *);
849 int posix_typed_mem_open(const scope char*, int, int);
850 */