Kernel+LibC: Add msync() system call

This allows userspace to trigger a full (FIXME) flush of a shared file
mapping to disk. We iterate over all the mapped pages in the VMObject
and write them out to the underlying inode, one by one. This is rather
naive, and there's lots of room for improvement.

Note that shared file mappings are currently not possible since mmap()
returns ENOTSUP for PROT_WRITE+MAP_SHARED. That restriction will be
removed in a subsequent commit. :^)
This commit is contained in:
Andreas Kling 2021-11-17 19:33:00 +01:00
commit 32aa37d5dc
Notes: sideshowbarker 2024-07-18 01:03:13 +09:00
8 changed files with 51 additions and 0 deletions

View file

@ -34,6 +34,10 @@ extern "C" {
#define MADV_SET_VOLATILE 0x100
#define MADV_SET_NONVOLATILE 0x200
#define MS_SYNC 1
#define MS_ASYNC 2
#define MS_INVALIDATE 4
#ifdef __cplusplus
}
#endif