summaryrefslogtreecommitdiff
path: root/Libraries/LibC/mman.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2020-01-06 12:04:55 +0100
committerAndreas Kling <awesomekling@gmail.com>2020-01-06 12:04:55 +0100
commita47f0c93defc8352cb5e589c9cc347a05f67b8bd (patch)
tree644720ea70e69c274d872c1d97f64093c955f959 /Libraries/LibC/mman.cpp
parent33025a8049e49d4e5f1bc5cbba73465c8b285d25 (diff)
downloadserenity-a47f0c93defc8352cb5e589c9cc347a05f67b8bd.zip
Kernel: Pass name+length to mmap() and remove SmapDisabler
Diffstat (limited to 'Libraries/LibC/mman.cpp')
-rw-r--r--Libraries/LibC/mman.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/Libraries/LibC/mman.cpp b/Libraries/LibC/mman.cpp
index 777af713b1..7bad81dd70 100644
--- a/Libraries/LibC/mman.cpp
+++ b/Libraries/LibC/mman.cpp
@@ -8,22 +8,16 @@ extern "C" {
void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset)
{
- Syscall::SC_mmap_params params { (u32)addr, size, prot, flags, fd, offset, nullptr };
- int rc = syscall(SC_mmap, &params);
- if (rc < 0 && -rc < EMAXERRNO) {
- errno = -rc;
- return (void*)-1;
- }
- return (void*)rc;
+ return mmap_with_name(addr, size, prot, flags, fd, offset, nullptr);
}
void* mmap_with_name(void* addr, size_t size, int prot, int flags, int fd, off_t offset, const char* name)
{
- Syscall::SC_mmap_params params { (u32)addr, size, prot, flags, fd, offset, name };
+ Syscall::SC_mmap_params params { (u32)addr, size, prot, flags, fd, offset, name, name ? strlen(name) : 0 };
int rc = syscall(SC_mmap, &params);
if (rc < 0 && -rc < EMAXERRNO) {
errno = -rc;
- return (void*)-1;
+ return MAP_FAILED;
}
return (void*)rc;
}