mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
Implement errno in LibC.
This also meant I had to implement BSS (SHT_NOBITS) sections in ELFLoader. I also added an strerror() so we can print out what the errors are.
This commit is contained in:
parent
434b6a8688
commit
260b14e505
Notes:
sideshowbarker
2024-07-19 18:38:59 +09:00
Author: https://github.com/awesomekling
Commit: 260b14e505
14 changed files with 209 additions and 27 deletions
|
@ -1,16 +1,19 @@
|
|||
#include "mman.h"
|
||||
#include "errno.h"
|
||||
#include <Kernel/Syscall.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
void* mmap(void* addr, size_t size)
|
||||
{
|
||||
return (void*)Syscall::invoke(Syscall::PosixMmap, (dword)addr, (dword)size);
|
||||
int rc = Syscall::invoke(Syscall::PosixMmap, (dword)addr, (dword)size);
|
||||
__RETURN_WITH_ERRNO(rc, (void*)rc, (void*)-1);
|
||||
}
|
||||
|
||||
int munmap(void* addr, size_t size)
|
||||
{
|
||||
return Syscall::invoke(Syscall::PosixMunmap, (dword)addr, (dword)size);
|
||||
int rc = Syscall::invoke(Syscall::PosixMunmap, (dword)addr, (dword)size);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue