diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-12-29 00:10:17 -0800 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-12-29 18:08:15 +0100 |
commit | bad6d50b86ae1e0a46219baf149fa0a3574af9ce (patch) | |
tree | 83d0da5a800509416d70555b751cd01244cbe98c /Kernel/Syscalls/read.cpp | |
parent | c4f60844c5d2bd51e70a621753208fe0c9392339 (diff) | |
download | serenity-bad6d50b86ae1e0a46219baf149fa0a3574af9ce.zip |
Kernel: Use Process::require_promise() instead of REQUIRE_PROMISE()
This change lays the foundation for making the require_promise return
an error hand handling the process abort outside of the syscall
implementations, to avoid cases where we would leak resources.
It also has the advantage that it makes removes a gs pointer read
to look up the current thread, then process for every syscall. We
can instead go through the Process this pointer in most cases.
Diffstat (limited to 'Kernel/Syscalls/read.cpp')
-rw-r--r-- | Kernel/Syscalls/read.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Syscalls/read.cpp b/Kernel/Syscalls/read.cpp index cd70a06e10..e481c21ff5 100644 --- a/Kernel/Syscalls/read.cpp +++ b/Kernel/Syscalls/read.cpp @@ -40,7 +40,7 @@ static ErrorOr<void> check_blocked_read(OpenFileDescription* description) ErrorOr<FlatPtr> Process::sys$readv(int fd, Userspace<const struct iovec*> iov, int iov_count) { VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this) - REQUIRE_PROMISE(stdio); + require_promise(Pledge::stdio); if (iov_count < 0) return EINVAL; @@ -74,7 +74,7 @@ ErrorOr<FlatPtr> Process::sys$readv(int fd, Userspace<const struct iovec*> iov, ErrorOr<FlatPtr> Process::sys$read(int fd, Userspace<u8*> buffer, size_t size) { VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this) - REQUIRE_PROMISE(stdio); + require_promise(Pledge::stdio); if (size == 0) return 0; if (size > NumericLimits<ssize_t>::max()) @@ -91,7 +91,7 @@ ErrorOr<FlatPtr> Process::sys$read(int fd, Userspace<u8*> buffer, size_t size) ErrorOr<FlatPtr> Process::sys$pread(int fd, Userspace<u8*> buffer, size_t size, Userspace<off_t const*> userspace_offset) { VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this) - REQUIRE_PROMISE(stdio); + require_promise(Pledge::stdio); if (size == 0) return 0; if (size > NumericLimits<ssize_t>::max()) |