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
386         static assert(0, "unimplemented");
387 
388     static if (DEFAULTS)
389     {
390         enum MAP_ANON = 0x20;
391         enum MS_ASYNC = 1;
392         enum MS_INVALIDATE = 2;
393         enum MS_SYNC = 4;
394     }
395 }
396 else version (Darwin)
397 {
398     enum MAP_SHARED     = 0x0001;
399     enum MAP_PRIVATE    = 0x0002;
400     enum MAP_FIXED      = 0x0010;
401     enum MAP_ANON       = 0x1000;
402 
403     enum MAP_FAILED     = cast(void*)-1;
404 
405     enum MS_ASYNC       = 0x0001;
406     enum MS_INVALIDATE  = 0x0002;
407     enum MS_SYNC        = 0x0010;
408 }
409 else version (FreeBSD)
410 {
411     enum MAP_SHARED     = 0x0001;
412     enum MAP_PRIVATE    = 0x0002;
413     enum MAP_FIXED      = 0x0010;
414     enum MAP_ANON       = 0x1000;
415 
416     enum MAP_FAILED     = cast(void*)-1;
417 
418     enum MS_SYNC        = 0x0000;
419     enum MS_ASYNC       = 0x0001;
420     enum MS_INVALIDATE  = 0x0002;
421 }
422 else version (NetBSD)
423 {
424     enum MAP_SHARED     = 0x0001;
425     enum MAP_PRIVATE    = 0x0002;
426     enum MAP_FIXED      = 0x0010;
427     enum MAP_ANON       = 0x1000;
428 
429     enum MAP_FAILED     = cast(void*)-1;
430 
431     enum MS_SYNC        = 0x0004;
432     enum MS_ASYNC       = 0x0001;
433     enum MS_INVALIDATE  = 0x0002;
434 }
435 else version (OpenBSD)
436 {
437     enum MAP_SHARED     = 0x0001;
438     enum MAP_PRIVATE    = 0x0002;
439     enum MAP_FIXED      = 0x0010;
440     enum MAP_ANON       = 0x1000;
441     enum MAP_STACK      = 0x4000;
442 
443     enum MAP_FAILED     = cast(void*)-1;
444 
445     enum MS_SYNC        = 0x0002;
446     enum MS_ASYNC       = 0x0001;
447     enum MS_INVALIDATE  = 0x0004;
448 }
449 else version (DragonFlyBSD)
450 {
451     enum MAP_SHARED     = 0x0001;
452     enum MAP_PRIVATE    = 0x0002;
453     enum MAP_FIXED      = 0x0010;
454     enum MAP_ANON       = 0x1000;
455 
456     enum MAP_FAILED     = cast(void*)-1;
457 
458     enum MS_SYNC        = 0x0000;
459     enum MS_ASYNC       = 0x0001;
460     enum MS_INVALIDATE  = 0x0002;
461 }
462 else version (Solaris)
463 {
464     enum MAP_SHARED = 0x0001;
465     enum MAP_PRIVATE = 0x0002;
466     enum MAP_FIXED = 0x0010;
467     enum MAP_ANON = 0x0100;
468 
469     enum MAP_FAILED = cast(void*)-1;
470 
471     enum MS_SYNC = 0x0004;
472     enum MS_ASYNC = 0x0001;
473     enum MS_INVALIDATE  = 0x0002;
474 }
475 else
476 {
477     static assert(false, "Unsupported platform");
478 }
479 
480 /*
481 int msync(void*, size_t, int); (MF|SIO)
482 */
483 
484 version (CRuntime_Glibc)
485 {
486     int msync(void*, size_t, int);
487 }
488 else version (Darwin)
489 {
490     int msync(void*, size_t, int);
491 }
492 else version (FreeBSD)
493 {
494     int msync(void*, size_t, int);
495 }
496 else version (NetBSD)
497 {
498     int __msync13(void*, size_t, int);
499     alias msync = __msync13;
500 }
501 else version (OpenBSD)
502 {
503     int msync(void*, size_t, int);
504 }
505 else version (DragonFlyBSD)
506 {
507     int msync(void*, size_t, int);
508 }
509 else version (Solaris)
510 {
511     int msync(void*, size_t, int);
512 }
513 else version (CRuntime_Bionic)
514 {
515     int msync(const scope void*, size_t, int);
516 }
517 else version (CRuntime_Musl)
518 {
519     int msync(void*, size_t, int);
520 }
521 else version (CRuntime_UClibc)
522 {
523     int msync(void*, size_t, int);
524 }
525 else
526 {
527     static assert(false, "Unsupported platform");
528 }
529 
530 //
531 // Process Memory Locking (ML)
532 //
533 /*
534 MCL_CURRENT
535 MCL_FUTURE
536 */
537 
538 version (linux)
539 {
540     version (SPARC_Any) enum
541     {
542         MCL_CURRENT = 0x2000,
543         MCL_FUTURE = 0x4000,
544     }
545     else version (PPC_Any) enum
546     {
547         MCL_CURRENT = 0x2000,
548         MCL_FUTURE = 0x4000,
549     }
550     else version (Alpha) enum
551     {
552         MCL_CURRENT = 8192,
553         MCL_FUTURE = 16384,
554     }
555     else enum
556     {
557         MCL_CURRENT = 1,
558         MCL_FUTURE = 2,
559     }
560 }
561 else version (Darwin)
562 {
563     enum MCL_CURRENT    = 0x0001;
564     enum MCL_FUTURE     = 0x0002;
565 }
566 else version (FreeBSD)
567 {
568     enum MCL_CURRENT    = 0x0001;
569     enum MCL_FUTURE     = 0x0002;
570 }
571 else version (NetBSD)
572 {
573     enum MCL_CURRENT    = 0x0001;
574     enum MCL_FUTURE     = 0x0002;
575 }
576 else version (OpenBSD)
577 {
578     enum MCL_CURRENT    = 0x0001;
579     enum MCL_FUTURE     = 0x0002;
580 }
581 else version (DragonFlyBSD)
582 {
583     enum MCL_CURRENT    = 0x0001;
584     enum MCL_FUTURE     = 0x0002;
585 }
586 else version (Solaris)
587 {
588     enum MCL_CURRENT = 0x0001;
589     enum MCL_FUTURE = 0x0002;
590 }
591 else
592 {
593     static assert(false, "Unsupported platform");
594 }
595 
596 /*
597 int mlockall(int);
598 int munlockall();
599 */
600 
601 version (CRuntime_Glibc)
602 {
603     int mlockall(int);
604     int munlockall();
605 }
606 else version (Darwin)
607 {
608     int mlockall(int);
609     int munlockall();
610 }
611 else version (FreeBSD)
612 {
613     int mlockall(int);
614     int munlockall();
615 }
616 else version (NetBSD)
617 {
618     int mlockall(int);
619     int munlockall();
620 }
621 else version (OpenBSD)
622 {
623     int mlockall(int);
624     int munlockall();
625 }
626 else version (DragonFlyBSD)
627 {
628     int mlockall(int);
629     int munlockall();
630 }
631 else version (Solaris)
632 {
633     int mlockall(int);
634     int munlockall();
635 }
636 else version (CRuntime_Bionic)
637 {
638     int mlockall(int);
639     int munlockall();
640 }
641 else version (CRuntime_Musl)
642 {
643     int mlockall(int);
644     int munlockall();
645 }
646 else version (CRuntime_UClibc)
647 {
648     int mlockall(int);
649     int munlockall();
650 }
651 else
652 {
653     static assert(false, "Unsupported platform");
654 }
655 
656 //
657 // Range Memory Locking (MLR)
658 //
659 /*
660 int mlock(const scope void*, size_t);
661 int munlock(const scope void*, size_t);
662 */
663 
664 version (CRuntime_Glibc)
665 {
666     int mlock(const scope void*, size_t);
667     int munlock(const scope void*, size_t);
668 }
669 else version (Darwin)
670 {
671     int mlock(const scope void*, size_t);
672     int munlock(const scope void*, size_t);
673 }
674 else version (FreeBSD)
675 {
676     int mlock(const scope void*, size_t);
677     int munlock(const scope void*, size_t);
678 }
679 else version (NetBSD)
680 {
681     int mlock(const scope void*, size_t);
682     int munlock(const scope void*, size_t);
683 }
684 else version (OpenBSD)
685 {
686     int mlock(const scope void*, size_t);
687     int munlock(const scope void*, size_t);
688 }
689 else version (DragonFlyBSD)
690 {
691     int mlock(const scope void*, size_t);
692     int munlock(const scope void*, size_t);
693 }
694 else version (Solaris)
695 {
696     int mlock(const scope void*, size_t);
697     int munlock(const scope void*, size_t);
698 }
699 else version (CRuntime_Bionic)
700 {
701     int mlock(const scope void*, size_t);
702     int munlock(const scope void*, size_t);
703 }
704 else version (CRuntime_Musl)
705 {
706     int mlock(const scope void*, size_t);
707     int munlock(const scope void*, size_t);
708 }
709 else version (CRuntime_UClibc)
710 {
711     int mlock(const scope void*, size_t);
712     int munlock(const scope void*, size_t);
713 }
714 else
715 {
716     static assert(false, "Unsupported platform");
717 }
718 
719 //
720 // Memory Protection (MPR)
721 //
722 /*
723 int mprotect(void*, size_t, int);
724 */
725 
726 version (CRuntime_Glibc)
727 {
728     int mprotect(void*, size_t, int);
729 }
730 else version (Darwin)
731 {
732     int mprotect(void*, size_t, int);
733 }
734 else version (FreeBSD)
735 {
736     int mprotect(void*, size_t, int);
737 }
738 else version (NetBSD)
739 {
740     int mprotect(void*, size_t, int);
741 }
742 else version (OpenBSD)
743 {
744     int mprotect(void*, size_t, int);
745 }
746 else version (DragonFlyBSD)
747 {
748     int mprotect(void*, size_t, int);
749 }
750 else version (Solaris)
751 {
752     int mprotect(void*, size_t, int);
753 }
754 else version (CRuntime_Bionic)
755 {
756     int mprotect(const scope void*, size_t, int);
757 }
758 else version (CRuntime_Musl)
759 {
760     int mprotect(void*, size_t, int);
761 }
762 else version (CRuntime_UClibc)
763 {
764     int mprotect(void*, size_t, int);
765 }
766 else
767 {
768     static assert(false, "Unsupported platform");
769 }
770 
771 //
772 // Shared Memory Objects (SHM)
773 //
774 /*
775 int shm_open(const scope char*, int, mode_t);
776 int shm_unlink(const scope char*);
777 */
778 
779 version (CRuntime_Glibc)
780 {
781     int shm_open(const scope char*, int, mode_t);
782     int shm_unlink(const scope char*);
783 }
784 else version (Darwin)
785 {
786     int shm_open(const scope char*, int, mode_t);
787     int shm_unlink(const scope char*);
788 }
789 else version (FreeBSD)
790 {
791     int shm_open(const scope char*, int, mode_t);
792     int shm_unlink(const scope char*);
793 }
794 else version (NetBSD)
795 {
796     int shm_open(const scope char*, int, mode_t);
797     int shm_unlink(const scope char*);
798 }
799 else version (OpenBSD)
800 {
801     int shm_open(const scope char*, int, mode_t);
802     int shm_unlink(const scope char*);
803 }
804 else version (DragonFlyBSD)
805 {
806     int shm_open(const scope char*, int, mode_t);
807     int shm_unlink(const scope char*);
808 }
809 else version (Solaris)
810 {
811     int shm_open(const scope char*, int, mode_t);
812     int shm_unlink(const scope char*);
813 }
814 else version (CRuntime_Bionic)
815 {
816 }
817 else version (CRuntime_Musl)
818 {
819     int shm_open(const scope char*, int, mode_t);
820     int shm_unlink(const scope char*);
821 }
822 else version (CRuntime_UClibc)
823 {
824     int shm_open(const scope char*, int, mode_t);
825     int shm_unlink(const scope char*);
826 }
827 else
828 {
829     static assert(false, "Unsupported platform");
830 }
831 
832 //
833 // Typed Memory Objects (TYM)
834 //
835 /*
836 POSIX_TYPED_MEM_ALLOCATE
837 POSIX_TYPED_MEM_ALLOCATE_CONTIG
838 POSIX_TYPED_MEM_MAP_ALLOCATABLE
839 
840 struct posix_typed_mem_info
841 {
842     size_t posix_tmi_length;
843 }
844 
845 int posix_mem_offset(const scope void*, size_t, off_t *, size_t *, int *);
846 int posix_typed_mem_get_info(int, struct posix_typed_mem_info *);
847 int posix_typed_mem_open(const scope char*, int, int);
848 */