Make mmap() work better

- Mapping file offsets now works on Windows
- Mapping stack memory now works on OpenBSD
This commit is contained in:
Justine Tunney 2021-02-03 00:10:12 -08:00
parent 23a14b537c
commit 27c899af56
10 changed files with 71 additions and 56 deletions

View file

@ -205,10 +205,10 @@ syscon sig SIGRTMIN 0 0 65 0 0
# │││ │ ┌┴───dwDesiredAccess
# N │││ │ │
# group name GNU/Systemd XNU's Not UNIX FreeBSD OpenBSD T │││┌─┴┐│ Commentary
syscon open O_RDONLY 0 0 0 0 0x80000000 # unix consensus & kNtGenericRead
syscon open O_RDONLY 0 0 0 0 0xA0000000 # unix consensus & kNtGenericRead|kNtGenericExecute
syscon open O_WRONLY 1 1 1 1 0x40000000 # unix consensus & kNtGenericWrite
syscon open O_RDWR 2 2 2 2 0xc0000000 # unix consensus & kNtGenericRead|kNtGenericWrite
syscon open O_ACCMODE 3 3 3 3 0xc0000000 # O_RDONLY|O_WRONLY|O_RDWR
syscon open O_RDWR 2 2 2 2 0xE0000000 # unix consensus & kNtGenericRead|kNtGenericWrite|kNtGenericExecute
syscon open O_ACCMODE 3 3 3 3 0xE0000000 # O_RDONLY|O_WRONLY|O_RDWR
syscon open O_APPEND 0x0400 8 8 8 0x00000004 # bsd consensus & kNtFileAppendData; won't pose issues w/ mknod(S_IFIFO)
syscon open O_CREAT 0x40 0x0200 0x0200 0x0200 0x00000040 # bsd consensus & NT faked as Linux
syscon open O_EXCL 0x80 0x0800 0x0800 0x0800 0x00000080 # bsd consensus & NT faked as Linux

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon open O_ACCMODE 3 3 3 3 0xc0000000
.syscon open O_ACCMODE 3 3 3 3 0xE0000000

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon open O_RDONLY 0 0 0 0 0x80000000
.syscon open O_RDONLY 0 0 0 0 0xA0000000

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon open O_RDWR 2 2 2 2 0xc0000000
.syscon open O_RDWR 2 2 2 2 0xE0000000