summaryrefslogtreecommitdiff
path: root/userland/libc/malloc
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-10-03 15:08:45 +0200
committerAnton Kling <anton@kling.gg>2024-10-03 15:08:45 +0200
commit226d861c9ebb7f09f95665d07d9ab5c6b7ed7d6f (patch)
treed900c3437d3d65ee7bd88474586dc6dd947b14ce /userland/libc/malloc
parent64b0b49a1f23da9faa680f8158cb8a12cd4d118c (diff)
libc: small changes
Diffstat (limited to 'userland/libc/malloc')
-rw-r--r--userland/libc/malloc/malloc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/userland/libc/malloc/malloc.c b/userland/libc/malloc/malloc.c
index e368edd..bb7361d 100644
--- a/userland/libc/malloc/malloc.c
+++ b/userland/libc/malloc/malloc.c
@@ -1,4 +1,5 @@
#include <assert.h>
+#include <fcntl.h>
#include <math.h>
#include <stdarg.h>
#include <stddef.h>
@@ -8,7 +9,7 @@
#include <sys/random.h>
#include <typedefs.h>
#include <unistd.h>
-#define NEW_ALLOC_SIZE 0x5000
+#define NEW_ALLOC_SIZE 0x20000
#define IS_FREE (1 << 0)
#define IS_FINAL (1 << 1)
@@ -37,6 +38,12 @@ int debug_vprintf(const char *fmt, va_list ap) {
return -1;
}
write(1, buffer, rc);
+
+ static int serial_fd = -1;
+ if (-1 == serial_fd) {
+ serial_fd = open("/dev/serial", O_RDWR);
+ }
+ write(serial_fd, buffer, rc);
return rc;
}
@@ -259,6 +266,8 @@ void free(void *p) {
assert(h->magic == 0xdde51ab9410268b1);
assert(!(h->flags & IS_FREE));
+ randomfill(p, h->size);
+
h->flags |= IS_FREE;
merge_headers(h);
}