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

Kernel: Convert process file descriptor table to a SpinlockProtected

Instead of manually locking in the various member functions of
Process::OpenFileDescriptions, simply wrap it in a SpinlockProtected.
This commit is contained in:
Andreas Kling 2022-01-29 01:22:28 +01:00
parent 93e90e16c3
commit 8ebec2938c
30 changed files with 257 additions and 190 deletions

View file

@ -22,7 +22,7 @@ ErrorOr<FlatPtr> Process::sys$chmod(Userspace<Syscall::SC_chmod_params const*> u
if (params.dirfd == AT_FDCWD) {
base = current_directory();
} else {
auto base_description = TRY(fds().open_file_description(params.dirfd));
auto base_description = TRY(open_file_description(params.dirfd));
if (!base_description->custody())
return EINVAL;
base = base_description->custody();
@ -36,7 +36,7 @@ ErrorOr<FlatPtr> Process::sys$fchmod(int fd, mode_t mode)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
TRY(require_promise(Pledge::fattr));
auto description = TRY(fds().open_file_description(fd));
auto description = TRY(open_file_description(fd));
TRY(description->chmod(mode));
return 0;
}