1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:57:44 +00:00

Kernel: Implement flock downgrading

This commit makes it possible for a process to downgrade a file lock it
holds from a write (exclusive) lock to a read (shared) lock. For this,
the process must point to the exact range of the flock, and must be the
owner of the lock.
This commit is contained in:
sin-ack 2022-10-01 19:28:30 +00:00 committed by Andrew Kaster
parent 9b425b860c
commit 3275015786
2 changed files with 39 additions and 19 deletions

View file

@ -104,7 +104,7 @@ public:
ErrorOr<NonnullLockRefPtr<FIFO>> fifo();
bool can_apply_flock(flock const&) const;
bool can_apply_flock(flock const&, Optional<OpenFileDescription const&> = {}) const;
ErrorOr<void> apply_flock(Process const&, OpenFileDescription const&, Userspace<flock const*>, ShouldBlock);
ErrorOr<void> get_flock(OpenFileDescription const&, Userspace<flock*>) const;
void remove_flocks_for_description(OpenFileDescription const&);