summaryrefslogtreecommitdiff
path: root/LibC/stdlib.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-11 15:36:40 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-11 15:38:07 +0100
commitd5d45d1088d28b7640bcc3013810b38c702c3933 (patch)
tree2e9ae7ce429b12cf993dd9adb26965e9d46d305d /LibC/stdlib.cpp
parent9b70808ab562415e1ce1510fc27c003cc193213e (diff)
downloadserenity-d5d45d1088d28b7640bcc3013810b38c702c3933.zip
Rage hacking to get bash to run. It finally runs. So cool! :^)
Diffstat (limited to 'LibC/stdlib.cpp')
-rw-r--r--LibC/stdlib.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/LibC/stdlib.cpp b/LibC/stdlib.cpp
index 7f323c204d..195a787e14 100644
--- a/LibC/stdlib.cpp
+++ b/LibC/stdlib.cpp
@@ -1,9 +1,10 @@
#include <stdlib.h>
-#include <mman.h>
+#include <sys/mman.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <alloca.h>
+#include <assert.h>
#include <Kernel/Syscall.h>
#include <AK/Assertions.h>
@@ -54,11 +55,12 @@ void* calloc(size_t nmemb, size_t)
return nullptr;
}
-void* realloc(void *ptr, size_t)
+void* realloc(void *ptr, size_t size)
{
- (void) ptr;
- ASSERT_NOT_REACHED();
- return nullptr;
+ // FIXME: This is broken as shit.
+ auto* new_ptr = malloc(size);
+ memcpy(new_ptr, ptr, size);
+ return new_ptr;
}
void exit(int status)
@@ -116,4 +118,13 @@ long atol(const char* str)
return atoi(str);
}
+void __qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *))
+{
+ (void) base;
+ (void) nmemb;
+ (void) size;
+ (void) compar;
+ assert(false);
+}
+
}