1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:27:34 +00:00

Kernel: Factor out range allocation from Process::allocate_region*().

These functions were doing exactly the same thing for range allocation, so
share that code in an allocate_range() helper.

Region allocation will now also fail if range allocation fails, which means
that mmap() can actually fail without falling apart. Exciting times!
This commit is contained in:
Andreas Kling 2019-05-17 04:39:22 +02:00
parent 87b54a82c7
commit 6957825444
3 changed files with 20 additions and 24 deletions

View file

@ -258,6 +258,8 @@ private:
Process(String&& name, uid_t, gid_t, pid_t ppid, RingLevel, RetainPtr<Inode>&& cwd = nullptr, RetainPtr<Inode>&& executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
Range allocate_range(LinearAddress, size_t);
int do_exec(String path, Vector<String> arguments, Vector<String> environment);
ssize_t do_write(FileDescriptor&, const byte*, int data_size);