mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 10:48:41 +00:00
Kernel+LibC: Turn errno codes into a strongly typed enum
..and allow implicit creation of KResult and KResultOr from ErrnoCode. This means that kernel functions that return those types can finally do "return EINVAL;" and it will just work. There's a handful of functions that still deal with signed integers that should be converted to return KResults.
This commit is contained in:
@@ -42,10 +42,10 @@ AnonymousFile::~AnonymousFile()
|
||||
KResultOr<Region*> AnonymousFile::mmap(Process& process, FileDescription&, VirtualAddress preferred_vaddr, size_t offset, size_t size, int prot, bool shared)
|
||||
{
|
||||
if (offset != 0)
|
||||
return KResult(-EINVAL);
|
||||
return EINVAL;
|
||||
|
||||
if (size != m_vmobject->size())
|
||||
return KResult(-EINVAL);
|
||||
return EINVAL;
|
||||
|
||||
return process.allocate_region_with_vmobject(preferred_vaddr, size, m_vmobject, offset, {}, prot, shared);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user