diff --git a/libc/include/sys/mman.h b/libc/include/sys/mman.h index 97c7022c..c7433b19 100644 --- a/libc/include/sys/mman.h +++ b/libc/include/sys/mman.h @@ -10,6 +10,10 @@ #define MAP_FAILED (void*)-1 +#define MS_SYNC 1 +#define MS_ASYNC 2 +#define MS_INVALIDATE 4 + #ifdef __cplusplus extern "C" { @@ -21,6 +25,9 @@ extern "C" /* Remove a memory mapping. */ int munmap(void* addr, size_t len); + /* Write modified shared memory back to its associated file. */ + int msync(void* addr, size_t len, int flags); + #ifdef __cplusplus } #endif diff --git a/libc/include/unistd.h b/libc/include/unistd.h index af3b60da..5293b839 100644 --- a/libc/include/unistd.h +++ b/libc/include/unistd.h @@ -18,6 +18,9 @@ #define _POSIX_CHOWN_RESTRICTED 200112L #define _POSIX_SHELL 200112L +#define _POSIX_MAPPED_FILES 200112L +#define _POSIX_SYNCHRONIZED_IO 200112L +#define _POSIX_SAVED_IDS 200112L #define _POSIX_VDISABLE (-2) #ifdef __cplusplus diff --git a/libc/src/sys/mman.cpp b/libc/src/sys/mman.cpp index 2f855366..9fdc7a2d 100644 --- a/libc/src/sys/mman.cpp +++ b/libc/src/sys/mman.cpp @@ -19,4 +19,10 @@ extern "C" long rc = syscall(SYS_munmap, addr, len); __errno_return(rc, int); } + + int msync(void* addr, size_t len, int) + { + long rc = syscall(SYS_msync, addr, len); + __errno_return(rc, int); + } }