1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +00:00

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
parent f2d5548d7a
commit 32aa37d5dc
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

View file

@ -124,6 +124,7 @@ enum class NeedsBigProcessLock {
S(mount, NeedsBigProcessLock::Yes) \
S(mprotect, NeedsBigProcessLock::Yes) \
S(mremap, NeedsBigProcessLock::Yes) \
S(msync, NeedsBigProcessLock::Yes) \
S(msyscall, NeedsBigProcessLock::Yes) \
S(munmap, NeedsBigProcessLock::Yes) \
S(open, NeedsBigProcessLock::Yes) \