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.
This commit is contained in:
Brian Gianforcaro 2021-12-29 00:10:17 -08:00 committed by Andreas Kling
parent c4f60844c5
commit bad6d50b86
Notes: sideshowbarker 2024-07-17 21:58:41 +09:00
61 changed files with 133 additions and 132 deletions

View file

@ -29,8 +29,8 @@ NonnullRefPtr<FramebufferDevice> FramebufferDevice::create(const GenericGraphics
ErrorOr<Memory::Region*> FramebufferDevice::mmap(Process& process, OpenFileDescription&, Memory::VirtualRange const& range, u64 offset, int prot, bool shared)
{
process.require_promise(Pledge::video);
SpinlockLocker lock(m_activation_lock);
REQUIRE_PROMISE(video);
if (!shared)
return ENODEV;
if (offset != 0)